@daffodil/cart 0.94.1 → 0.95.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/daffodil-cart-driver-in-memory.mjs +1618 -1198
- package/fesm2022/daffodil-cart-driver-in-memory.mjs.map +1 -1
- package/fesm2022/daffodil-cart-driver-magento-2.4.7-testing.mjs +546 -0
- package/fesm2022/daffodil-cart-driver-magento-2.4.7-testing.mjs.map +1 -0
- package/fesm2022/daffodil-cart-driver-magento-2.4.7.mjs +2607 -0
- package/fesm2022/daffodil-cart-driver-magento-2.4.7.mjs.map +1 -0
- package/fesm2022/daffodil-cart-driver-magento-auto-testing.mjs +7 -0
- package/fesm2022/daffodil-cart-driver-magento-auto-testing.mjs.map +1 -0
- package/fesm2022/daffodil-cart-driver-magento-auto.mjs +7 -0
- package/fesm2022/daffodil-cart-driver-magento-auto.mjs.map +1 -0
- package/fesm2022/daffodil-cart-driver-testing.mjs +553 -335
- package/fesm2022/daffodil-cart-driver-testing.mjs.map +1 -1
- package/fesm2022/daffodil-cart-driver.mjs +167 -292
- package/fesm2022/daffodil-cart-driver.mjs.map +1 -1
- package/fesm2022/daffodil-cart-routing.mjs +741 -542
- package/fesm2022/daffodil-cart-routing.mjs.map +1 -1
- package/fesm2022/daffodil-cart-state-testing.mjs +288 -193
- package/fesm2022/daffodil-cart-state-testing.mjs.map +1 -1
- package/fesm2022/daffodil-cart-state.mjs +2571 -2800
- package/fesm2022/daffodil-cart-state.mjs.map +1 -1
- package/fesm2022/daffodil-cart-testing.mjs +542 -357
- package/fesm2022/daffodil-cart-testing.mjs.map +1 -1
- package/fesm2022/daffodil-cart.mjs +131 -200
- package/fesm2022/daffodil-cart.mjs.map +1 -1
- package/package.json +1 -1
- package/types/daffodil-cart-driver-in-memory.d.ts +273 -292
- package/types/daffodil-cart-driver-magento-2.4.7-testing.d.ts +176 -0
- package/types/daffodil-cart-driver-magento-2.4.7.d.ts +860 -0
- package/types/daffodil-cart-driver-magento-auto-testing.d.ts +1 -0
- package/types/daffodil-cart-driver-magento-auto.d.ts +1 -0
- package/types/daffodil-cart-driver-testing.d.ts +111 -118
- package/types/daffodil-cart-driver.d.ts +219 -262
- package/types/daffodil-cart-routing.d.ts +130 -149
- package/types/daffodil-cart-state-testing.d.ts +115 -114
- package/types/daffodil-cart-state.d.ts +1126 -1173
- package/types/daffodil-cart-testing.d.ts +146 -158
- package/types/daffodil-cart.d.ts +302 -321
- package/fesm2022/daffodil-cart-driver-magento-testing.mjs +0 -332
- package/fesm2022/daffodil-cart-driver-magento-testing.mjs.map +0 -1
- package/fesm2022/daffodil-cart-driver-magento.mjs +0 -2273
- package/fesm2022/daffodil-cart-driver-magento.mjs.map +0 -1
- package/types/daffodil-cart-driver-magento-testing.d.ts +0 -188
- package/types/daffodil-cart-driver-magento.d.ts +0 -999
package/types/daffodil-cart.d.ts
CHANGED
|
@@ -1,40 +1,36 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DaffPersonalAddress } from
|
|
3
|
-
import { DaffProduct, DaffProductImage } from
|
|
4
|
-
import * as
|
|
5
|
-
|
|
1
|
+
import { DaffError, DaffIdentifiable, DaffInheritableError, DaffLocatable, DaffPersistenceService, ID } from "@daffodil/core";
|
|
2
|
+
import { DaffPersonalAddress } from "@daffodil/geography";
|
|
3
|
+
import { DaffProduct, DaffProductImage } from "@daffodil/product";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
6
5
|
/**
|
|
7
6
|
* An enum for the cart error codes.
|
|
8
7
|
* Each error code is unique to an error class.
|
|
9
8
|
*/
|
|
10
|
-
declare enum DaffCartErrorCodes {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
export declare enum DaffCartErrorCodes {
|
|
10
|
+
CART_RESOLUTION = "DAFF_CART_RESOLUTION",
|
|
11
|
+
CART_STORAGE_RESOLUTION = "DAFF_CART_STORAGE_RESOLUTION",
|
|
12
|
+
CART_SERVER_SIDE_RESOLUTION = "DAFF_CART_SERVER_SIDE_RESOLUTION",
|
|
13
|
+
CART_NOT_FOUND_OR_CREATED_RESOLUTION = "DAFF_CART_NOT_FOUND_OR_CREATED_RESOLUTION"
|
|
15
14
|
}
|
|
16
|
-
|
|
17
15
|
/**
|
|
18
16
|
* An error thrown when the cart fails to resolve.
|
|
19
17
|
*
|
|
20
18
|
* @inheritdoc
|
|
21
19
|
*/
|
|
22
|
-
declare class DaffCartResolutionError extends DaffInheritableError implements DaffError {
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
export declare class DaffCartResolutionError extends DaffInheritableError implements DaffError {
|
|
21
|
+
readonly code: string;
|
|
22
|
+
constructor(message?: string);
|
|
25
23
|
}
|
|
26
|
-
|
|
27
24
|
/**
|
|
28
25
|
* An error thrown when the cart fails to resolve.
|
|
29
26
|
* This happens when the cart cannot be found and a new cart cannot be created.
|
|
30
27
|
*
|
|
31
28
|
* @inheritdoc
|
|
32
29
|
*/
|
|
33
|
-
declare class DaffCartNotFoundOrCreatedResolutionError extends DaffInheritableError implements DaffError {
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
export declare class DaffCartNotFoundOrCreatedResolutionError extends DaffInheritableError implements DaffError {
|
|
31
|
+
readonly code: string;
|
|
32
|
+
constructor(message?: string);
|
|
36
33
|
}
|
|
37
|
-
|
|
38
34
|
/**
|
|
39
35
|
* An error thrown when the cart fails to resolve.
|
|
40
36
|
* This happens when the app is running in a server environment.
|
|
@@ -42,241 +38,231 @@ declare class DaffCartNotFoundOrCreatedResolutionError extends DaffInheritableEr
|
|
|
42
38
|
*
|
|
43
39
|
* @inheritdoc
|
|
44
40
|
*/
|
|
45
|
-
declare class DaffCartServerSideResolutionError extends DaffInheritableError implements DaffError {
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
export declare class DaffCartServerSideResolutionError extends DaffInheritableError implements DaffError {
|
|
42
|
+
readonly code: string;
|
|
43
|
+
constructor(message?: string);
|
|
48
44
|
}
|
|
49
|
-
|
|
50
45
|
/**
|
|
51
46
|
* An error thrown when the cart fails to resolve.
|
|
52
47
|
* This happens when loading the cart ID from storage throws an exception.
|
|
53
48
|
*
|
|
54
49
|
* @inheritdoc
|
|
55
50
|
*/
|
|
56
|
-
declare class DaffCartStorageResolutionError extends DaffInheritableError implements DaffError {
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
export declare class DaffCartStorageResolutionError extends DaffInheritableError implements DaffError {
|
|
52
|
+
readonly code: string;
|
|
53
|
+
constructor(message?: string);
|
|
59
54
|
}
|
|
60
|
-
|
|
61
55
|
/**
|
|
62
56
|
* A mapping from error codes to error class constructors.
|
|
63
57
|
*/
|
|
64
|
-
declare const DaffCartErrorMap: {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
58
|
+
export declare const DaffCartErrorMap: {
|
|
59
|
+
DAFF_CART_RESOLUTION: typeof DaffCartResolutionError;
|
|
60
|
+
DAFF_CART_STORAGE_RESOLUTION: typeof DaffCartStorageResolutionError;
|
|
61
|
+
DAFF_CART_SERVER_SIDE_RESOLUTION: typeof DaffCartServerSideResolutionError;
|
|
62
|
+
DAFF_CART_NOT_FOUND_OR_CREATED_RESOLUTION: typeof DaffCartNotFoundOrCreatedResolutionError;
|
|
69
63
|
};
|
|
70
|
-
|
|
71
64
|
/**
|
|
72
65
|
* An address that is saved in the cart for checkout purposes.
|
|
73
66
|
*/
|
|
74
|
-
interface DaffCartAddress extends DaffPersonalAddress, DaffIdentifiable {
|
|
75
|
-
}
|
|
76
|
-
|
|
67
|
+
export interface DaffCartAddress extends DaffPersonalAddress, DaffIdentifiable {}
|
|
77
68
|
/**
|
|
78
69
|
* A coupon applied to the cart.
|
|
79
70
|
* Also known as a promo code.
|
|
80
71
|
*/
|
|
81
|
-
interface DaffCartCoupon extends DaffIdentifiable {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
72
|
+
export interface DaffCartCoupon extends DaffIdentifiable {
|
|
73
|
+
/**
|
|
74
|
+
* The coupon code.
|
|
75
|
+
*/
|
|
76
|
+
code: string;
|
|
77
|
+
/**
|
|
78
|
+
* An optional coupon description.
|
|
79
|
+
*/
|
|
80
|
+
description?: string;
|
|
90
81
|
}
|
|
91
|
-
|
|
92
82
|
/**
|
|
93
83
|
* An enum for the type of the cart item.
|
|
94
84
|
*/
|
|
95
|
-
declare enum DaffCartItemInputType {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
85
|
+
export declare enum DaffCartItemInputType {
|
|
86
|
+
Simple = "simple",
|
|
87
|
+
Composite = "composite",
|
|
88
|
+
Configurable = "configurable"
|
|
99
89
|
}
|
|
100
90
|
/**
|
|
101
91
|
* A set of fields specifying how to add a product to the cart.
|
|
102
92
|
*/
|
|
103
|
-
interface DaffCartItemInput {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
93
|
+
export interface DaffCartItemInput {
|
|
94
|
+
/**
|
|
95
|
+
* The type of cart item that corresponds to the product being added to the cart.
|
|
96
|
+
*/
|
|
97
|
+
type: DaffCartItemInputType;
|
|
98
|
+
/**
|
|
99
|
+
* The ID of the product to add to the cart.
|
|
100
|
+
*/
|
|
101
|
+
productId: DaffProduct['id'];
|
|
102
|
+
/**
|
|
103
|
+
* How many of the product should be added to the cart.
|
|
104
|
+
*/
|
|
105
|
+
qty: number;
|
|
116
106
|
}
|
|
117
107
|
/**
|
|
118
108
|
* A more constrained cart item input for simple products.
|
|
119
109
|
*/
|
|
120
|
-
interface DaffSimpleCartItemInput extends DaffCartItemInput {
|
|
121
|
-
|
|
110
|
+
export interface DaffSimpleCartItemInput extends DaffCartItemInput {
|
|
111
|
+
type: DaffCartItemInputType.Simple;
|
|
122
112
|
}
|
|
123
113
|
/**
|
|
124
114
|
* A cart item input for composite products.
|
|
125
115
|
*/
|
|
126
|
-
interface DaffCompositeCartItemInput extends DaffCartItemInput {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
116
|
+
export interface DaffCompositeCartItemInput extends DaffCartItemInput {
|
|
117
|
+
type: DaffCartItemInputType.Composite;
|
|
118
|
+
/**
|
|
119
|
+
* The selected options for the composite product to be added to the cart.
|
|
120
|
+
*/
|
|
121
|
+
options: DaffCompositeCartItemInputOption[];
|
|
132
122
|
}
|
|
133
123
|
/**
|
|
134
124
|
* Designates a particular option for the composite product to add to the cart.
|
|
135
125
|
*/
|
|
136
|
-
interface DaffCompositeCartItemInputOption {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
126
|
+
export interface DaffCompositeCartItemInputOption {
|
|
127
|
+
/**
|
|
128
|
+
* An identifier of the option for which a value has been chosen.
|
|
129
|
+
*/
|
|
130
|
+
code: string | number;
|
|
131
|
+
/**
|
|
132
|
+
* How many of the specified option should be added to the cart.
|
|
133
|
+
*/
|
|
134
|
+
quantity: number;
|
|
135
|
+
/**
|
|
136
|
+
* The value identifying the chosen composite product option.
|
|
137
|
+
*/
|
|
138
|
+
value: string;
|
|
149
139
|
}
|
|
150
140
|
/**
|
|
151
141
|
* Designates a particular configurable product variant to add to the cart.
|
|
152
142
|
*/
|
|
153
|
-
interface DaffConfigurableCartItemInput extends DaffCartItemInput {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
143
|
+
export interface DaffConfigurableCartItemInput extends DaffCartItemInput {
|
|
144
|
+
type: DaffCartItemInputType.Configurable;
|
|
145
|
+
/**
|
|
146
|
+
* The value identifying the particular configurable product variant.
|
|
147
|
+
*/
|
|
148
|
+
variantId: ID;
|
|
159
149
|
}
|
|
160
|
-
|
|
161
150
|
/**
|
|
162
151
|
* A discount applied to a specific cart item.
|
|
163
152
|
*/
|
|
164
|
-
interface DaffCartItemDiscount {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
153
|
+
export interface DaffCartItemDiscount {
|
|
154
|
+
/**
|
|
155
|
+
* The amount of the discount.
|
|
156
|
+
*/
|
|
157
|
+
amount: number;
|
|
158
|
+
/**
|
|
159
|
+
* A human-readable label describing the discount.
|
|
160
|
+
*/
|
|
161
|
+
label: string;
|
|
173
162
|
}
|
|
174
163
|
/**
|
|
175
164
|
* A cart item.
|
|
176
165
|
* Cart item types correspond to product types.
|
|
177
166
|
* They hold information about the product to which they correspond and how many of said product is in the cart.
|
|
178
167
|
*/
|
|
179
|
-
interface DaffCartItem extends DaffLocatable, DaffIdentifiable {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
168
|
+
export interface DaffCartItem extends DaffLocatable, DaffIdentifiable {
|
|
169
|
+
/**
|
|
170
|
+
* The type of cart item.
|
|
171
|
+
*/
|
|
172
|
+
type: DaffCartItemInputType;
|
|
173
|
+
/**
|
|
174
|
+
* The image or thumbnail of the corresponding product.
|
|
175
|
+
*/
|
|
176
|
+
image?: DaffProductImage;
|
|
177
|
+
/**
|
|
178
|
+
* The ID of the corresponding product.
|
|
179
|
+
*/
|
|
180
|
+
product_id: DaffProduct['id'];
|
|
181
|
+
parent_item_id: ID;
|
|
182
|
+
sku: string;
|
|
183
|
+
/**
|
|
184
|
+
* A human-readable label.
|
|
185
|
+
*/
|
|
186
|
+
name: string;
|
|
187
|
+
/**
|
|
188
|
+
* How many of the corresponding product is in the cart.
|
|
189
|
+
*/
|
|
190
|
+
qty: number;
|
|
191
|
+
/**
|
|
192
|
+
* The price per item, excluding cart discounts.
|
|
193
|
+
* This includes any discounts and sales that apply to the product or category.
|
|
194
|
+
*/
|
|
195
|
+
price: number;
|
|
196
|
+
/**
|
|
197
|
+
* The total for the entire row, not including cart discounts.
|
|
198
|
+
* This includes any discounts and sales that apply to the product or category.
|
|
199
|
+
*/
|
|
200
|
+
row_total: number;
|
|
201
|
+
/**
|
|
202
|
+
* Whether or not the specified quantity of the corresponding product is in stock.
|
|
203
|
+
*/
|
|
204
|
+
in_stock: boolean;
|
|
205
|
+
/**
|
|
206
|
+
* A list of discounts applied to the cart item row.
|
|
207
|
+
*/
|
|
208
|
+
discounts: DaffCartItemDiscount[];
|
|
220
209
|
}
|
|
221
|
-
|
|
222
210
|
/**
|
|
223
211
|
* The kind of payment used for the cart.
|
|
224
212
|
*/
|
|
225
|
-
interface DaffCartPaymentMethod {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
213
|
+
export interface DaffCartPaymentMethod {
|
|
214
|
+
/**
|
|
215
|
+
* Identifies the kind of payment used.
|
|
216
|
+
* e.g. "credit-card"
|
|
217
|
+
*/
|
|
218
|
+
method: string;
|
|
219
|
+
/**
|
|
220
|
+
* A very generic collection of payment info.
|
|
221
|
+
* Payment and processor specific.
|
|
222
|
+
*/
|
|
223
|
+
payment_info?: any;
|
|
236
224
|
}
|
|
237
|
-
|
|
238
225
|
/**
|
|
239
226
|
* Contains information about a particular shipping option.
|
|
240
227
|
*/
|
|
241
|
-
interface DaffCartShippingRate extends DaffIdentifiable {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
228
|
+
export interface DaffCartShippingRate extends DaffIdentifiable {
|
|
229
|
+
/**
|
|
230
|
+
* Identifies the shipping carrier.
|
|
231
|
+
*/
|
|
232
|
+
carrier: string;
|
|
233
|
+
/**
|
|
234
|
+
* A human-readable label of the shipping carrier.
|
|
235
|
+
*/
|
|
236
|
+
carrier_title: string;
|
|
237
|
+
/**
|
|
238
|
+
* Identifies the shipping method.
|
|
239
|
+
*/
|
|
240
|
+
method_code: string;
|
|
241
|
+
/**
|
|
242
|
+
* A human-readable label of the shipping method.
|
|
243
|
+
*/
|
|
244
|
+
method_title: string;
|
|
245
|
+
/**
|
|
246
|
+
* A human-readable description of the shipping method.
|
|
247
|
+
*/
|
|
248
|
+
method_description: string;
|
|
249
|
+
/**
|
|
250
|
+
* The price of the shipping option.
|
|
251
|
+
*/
|
|
252
|
+
price: number;
|
|
266
253
|
}
|
|
267
|
-
|
|
268
254
|
/**
|
|
269
255
|
* An enum for the types of totals that can appear in a cart.
|
|
270
256
|
*/
|
|
271
|
-
declare enum DaffCartTotalTypeEnum {
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
257
|
+
export declare enum DaffCartTotalTypeEnum {
|
|
258
|
+
grandTotal = "grand_total",
|
|
259
|
+
subtotalExcludingTax = "subtotal_excluding_tax",
|
|
260
|
+
subtotalIncludingTax = "subtotal_including_tax",
|
|
261
|
+
subtotalWithDiscountExcludingTax = "subtotal_with_discount_excluding_tax",
|
|
262
|
+
subtotalWithDiscountIncludingTax = "subtotal_with_discount_including_tax",
|
|
263
|
+
discount = "discount",
|
|
264
|
+
tax = "tax",
|
|
265
|
+
shipping = "shipping"
|
|
280
266
|
}
|
|
281
267
|
/**
|
|
282
268
|
* Since some cart totals might not have a value defined at all times, like shipping, the values of these totals
|
|
@@ -284,154 +270,151 @@ declare enum DaffCartTotalTypeEnum {
|
|
|
284
270
|
* shipping, this would mean the difference between a cart with no selected shipping method and a cart with a selected shipping
|
|
285
271
|
* method that costs zero.
|
|
286
272
|
*/
|
|
287
|
-
interface DaffCartTotal {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
273
|
+
export interface DaffCartTotal {
|
|
274
|
+
/**
|
|
275
|
+
* The amount of the total.
|
|
276
|
+
*/
|
|
277
|
+
value: number;
|
|
278
|
+
/**
|
|
279
|
+
* A human-readable label of the total.
|
|
280
|
+
*/
|
|
281
|
+
label: string;
|
|
282
|
+
/**
|
|
283
|
+
* The type of the total.
|
|
284
|
+
*/
|
|
285
|
+
name: DaffCartTotalTypeEnum | string;
|
|
286
|
+
/**
|
|
287
|
+
* The position in the totals list in which this total should be displayed.
|
|
288
|
+
*/
|
|
289
|
+
order: number;
|
|
304
290
|
}
|
|
305
|
-
|
|
306
291
|
/**
|
|
307
292
|
* A cart.
|
|
308
293
|
* Contains products in the form of cart items.
|
|
309
294
|
* Contains payment and shipping info used for checkout.
|
|
310
295
|
*/
|
|
311
|
-
interface DaffCart extends DaffIdentifiable {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
296
|
+
export interface DaffCart extends DaffIdentifiable {
|
|
297
|
+
/**
|
|
298
|
+
* A list of coupons applied to the cart.
|
|
299
|
+
*/
|
|
300
|
+
coupons: DaffCartCoupon[];
|
|
301
|
+
/**
|
|
302
|
+
* A list of cart items.
|
|
303
|
+
*/
|
|
304
|
+
items?: DaffCartItem[];
|
|
305
|
+
/**
|
|
306
|
+
* The billing address of the cart.
|
|
307
|
+
*/
|
|
308
|
+
billing_address: DaffCartAddress | null;
|
|
309
|
+
/**
|
|
310
|
+
* The shipping address of the cart.
|
|
311
|
+
*/
|
|
312
|
+
shipping_address: DaffCartAddress | null;
|
|
313
|
+
/**
|
|
314
|
+
* The selected payment method of the cart.
|
|
315
|
+
*/
|
|
316
|
+
payment?: DaffCartPaymentMethod;
|
|
317
|
+
/**
|
|
318
|
+
* A list of totals for the cart.
|
|
319
|
+
*/
|
|
320
|
+
totals: Record<DaffCartTotal['name'], DaffCartTotal>;
|
|
321
|
+
/**
|
|
322
|
+
* The selected shipping method.
|
|
323
|
+
*/
|
|
324
|
+
shipping_information: DaffCartShippingRate | null;
|
|
325
|
+
/**
|
|
326
|
+
* A list of available shipping methods.
|
|
327
|
+
*/
|
|
328
|
+
available_shipping_methods: DaffCartShippingRate[];
|
|
329
|
+
/**
|
|
330
|
+
* A list of available payment methods.
|
|
331
|
+
*/
|
|
332
|
+
available_payment_methods: DaffCartPaymentMethod[];
|
|
333
|
+
/**
|
|
334
|
+
* The field is set to the platform cart object returned by the most recent driver call.
|
|
335
|
+
* No fields are guaranteed here. Use this with care.
|
|
336
|
+
*/
|
|
337
|
+
extra_attributes?: any;
|
|
353
338
|
}
|
|
354
|
-
|
|
355
339
|
/**
|
|
356
340
|
* A cart item for a composite product.
|
|
357
341
|
*/
|
|
358
|
-
interface DaffCompositeCartItem extends DaffCartItem {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
342
|
+
export interface DaffCompositeCartItem extends DaffCartItem {
|
|
343
|
+
/**
|
|
344
|
+
* A list of composite cart item options.
|
|
345
|
+
*/
|
|
346
|
+
options: DaffCompositeCartItemOption[];
|
|
363
347
|
}
|
|
364
348
|
/**
|
|
365
349
|
* A composite product option in a cart item.
|
|
366
350
|
*/
|
|
367
|
-
interface DaffCompositeCartItemOption extends DaffIdentifiable {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
351
|
+
export interface DaffCompositeCartItemOption extends DaffIdentifiable {
|
|
352
|
+
/**
|
|
353
|
+
* A human-readable label for the option.
|
|
354
|
+
*/
|
|
355
|
+
option_label: string;
|
|
356
|
+
/**
|
|
357
|
+
* A human-readable label for the particular value chosen for the option.
|
|
358
|
+
*/
|
|
359
|
+
value_label: string;
|
|
376
360
|
}
|
|
377
|
-
|
|
378
361
|
/**
|
|
379
362
|
* A cart item for a configurable product.
|
|
380
363
|
*/
|
|
381
|
-
interface DaffConfigurableCartItem extends DaffCartItem {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
364
|
+
export interface DaffConfigurableCartItem extends DaffCartItem {
|
|
365
|
+
/**
|
|
366
|
+
* A list of the chosen configurable attributes.
|
|
367
|
+
*/
|
|
368
|
+
attributes: DaffConfigurableCartItemAttribute[];
|
|
386
369
|
}
|
|
387
370
|
/**
|
|
388
371
|
* Defines a selected attribute for a configurable cart item.
|
|
389
372
|
*/
|
|
390
|
-
interface DaffConfigurableCartItemAttribute {
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
373
|
+
export interface DaffConfigurableCartItemAttribute {
|
|
374
|
+
/**
|
|
375
|
+
* A human-readable label for the attribute.
|
|
376
|
+
*/
|
|
377
|
+
attribute_label: string;
|
|
378
|
+
/**
|
|
379
|
+
* A human-readable label for the particular value chosen for the attribute.
|
|
380
|
+
*/
|
|
381
|
+
value_label: string;
|
|
399
382
|
}
|
|
400
|
-
|
|
401
383
|
/**
|
|
402
384
|
* The result of placing an order for a cart.
|
|
403
385
|
* Stores a reference to a cart and order object.
|
|
386
|
+
*
|
|
387
|
+
* @deprecated Use {@link DaffCheckoutOrderResult} instead. Deprecated in version 0.95.0. Will be removed in version 0.98.0.
|
|
404
388
|
*/
|
|
405
|
-
interface DaffCartOrderResult {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
389
|
+
export interface DaffCartOrderResult {
|
|
390
|
+
/**
|
|
391
|
+
* The ID of the cart for which this order was placed.
|
|
392
|
+
*/
|
|
393
|
+
cartId: ID;
|
|
394
|
+
/**
|
|
395
|
+
* The ID of the order placed.
|
|
396
|
+
*/
|
|
397
|
+
orderId: ID;
|
|
414
398
|
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
399
|
+
declare const DaffCartPaymentMethodIdMap: import("@angular/core").InjectionToken<{
|
|
400
|
+
[key: string]: string;
|
|
401
|
+
}>, provideDaffCartPaymentMethodIdMap: <R extends {
|
|
402
|
+
[key: string]: string;
|
|
403
|
+
} = {
|
|
404
|
+
[key: string]: string;
|
|
405
|
+
}>(value: R) => import("@angular/core").ValueProvider;
|
|
420
406
|
/**
|
|
421
407
|
* Finds the IDs of any affected cart items between two carts.
|
|
422
408
|
*/
|
|
423
|
-
declare function daffCartGetAffectedItems<T extends DaffCartItem = DaffCartItem>(oldItems: Array<T>, newItems: Array<T>): Array<T['id']>;
|
|
424
|
-
|
|
409
|
+
export declare function daffCartGetAffectedItems<T extends DaffCartItem = DaffCartItem>(oldItems: Array<T>, newItems: Array<T>): Array<T['id']>;
|
|
425
410
|
/**
|
|
426
411
|
* Creates a stub cart item from the cart item input.
|
|
427
412
|
*/
|
|
428
|
-
declare const daffCartItemInputToItemTransform: (input: DaffCartItemInput) => DaffCartItem;
|
|
429
|
-
|
|
413
|
+
export declare const daffCartItemInputToItemTransform: (input: DaffCartItemInput) => DaffCartItem;
|
|
430
414
|
/**
|
|
431
415
|
* Sums the discount amounts of the cart item.
|
|
432
416
|
*/
|
|
433
|
-
declare function daffCartGetItemTotalDiscount(item: DaffCartItem): number;
|
|
434
|
-
|
|
417
|
+
export declare function daffCartGetItemTotalDiscount(item: DaffCartItem): number;
|
|
435
418
|
/**
|
|
436
419
|
* The DaffCartStorageService is responsible for storing the cart id of a customer
|
|
437
420
|
* in storage when necessary. For some ecommerce platforms, where cart information
|
|
@@ -439,25 +422,23 @@ declare function daffCartGetItemTotalDiscount(item: DaffCartItem): number;
|
|
|
439
422
|
* isn't explicitly necessary, so be sure to use this service only in the driver
|
|
440
423
|
* layer for platforms that require it.
|
|
441
424
|
*/
|
|
442
|
-
declare class DaffCartStorageService {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
425
|
+
export declare class DaffCartStorageService {
|
|
426
|
+
private storageService;
|
|
427
|
+
private readonly CART_STORAGE_ID;
|
|
428
|
+
constructor(storageService: DaffPersistenceService);
|
|
429
|
+
/**
|
|
430
|
+
* Retrieves the cart ID from storage.
|
|
431
|
+
*/
|
|
432
|
+
getCartId(): string;
|
|
433
|
+
/**
|
|
434
|
+
* Stores the cart ID in storage.
|
|
435
|
+
*/
|
|
436
|
+
setCartId(value: string): void;
|
|
437
|
+
/**
|
|
438
|
+
* Removes the cart ID from storage.
|
|
439
|
+
*/
|
|
440
|
+
removeCartId(): void;
|
|
441
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DaffCartStorageService, never>;
|
|
442
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
460
443
|
}
|
|
461
|
-
|
|
462
|
-
export { DaffCartErrorCodes, DaffCartErrorMap, DaffCartItemInputType, DaffCartNotFoundOrCreatedResolutionError, DaffCartPaymentMethodIdMap, DaffCartResolutionError, DaffCartServerSideResolutionError, DaffCartStorageResolutionError, DaffCartStorageService, DaffCartTotalTypeEnum, daffCartGetAffectedItems, daffCartGetItemTotalDiscount, daffCartItemInputToItemTransform };
|
|
463
|
-
export type { DaffCart, DaffCartAddress, DaffCartCoupon, DaffCartItem, DaffCartItemDiscount, DaffCartItemInput, DaffCartOrderResult, DaffCartPaymentMethod, DaffCartShippingRate, DaffCartTotal, DaffCompositeCartItem, DaffCompositeCartItemInput, DaffCompositeCartItemInputOption, DaffCompositeCartItemOption, DaffConfigurableCartItem, DaffConfigurableCartItemAttribute, DaffConfigurableCartItemInput, DaffSimpleCartItemInput };
|
|
444
|
+
export { DaffCartPaymentMethodIdMap };
|