@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.
- 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
|
@@ -1,358 +1,543 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import { Injectable } from
|
|
3
|
-
import { faker } from
|
|
4
|
-
import { DaffModelFactory } from
|
|
5
|
-
import {
|
|
6
|
-
import { DaffProductImageFactory } from
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
i0.ɵɵ
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
i0.ɵɵ
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
i0.ɵɵ
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
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
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { Injectable } from "@angular/core";
|
|
3
|
+
import { faker } from "@faker-js/faker/locale/en_US";
|
|
4
|
+
import { DaffModelFactory } from "@daffodil/core/testing";
|
|
5
|
+
import { DaffCartItemInputType, DaffCartTotalTypeEnum } from "@daffodil/cart";
|
|
6
|
+
import { DaffProductImageFactory } from "@daffodil/product/testing";
|
|
7
|
+
var MockCartShippingRate = class {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.id = faker.string.uuid();
|
|
10
|
+
this.carrier = "Birds Inc.";
|
|
11
|
+
this.carrier_title = "laden";
|
|
12
|
+
this.method_code = faker.lorem.word();
|
|
13
|
+
this.method_title = "swallow";
|
|
14
|
+
this.method_description = "efficient";
|
|
15
|
+
this.price = faker.number.int({
|
|
16
|
+
min: 1,
|
|
17
|
+
max: 1500
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var DaffCartShippingRateFactory = class DaffCartShippingRateFactory extends DaffModelFactory {
|
|
22
|
+
constructor() {
|
|
23
|
+
super(MockCartShippingRate);
|
|
24
|
+
}
|
|
25
|
+
static {
|
|
26
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
27
|
+
minVersion: "12.0.0",
|
|
28
|
+
version: "22.2.4",
|
|
29
|
+
ngImport: i0,
|
|
30
|
+
type: DaffCartShippingRateFactory,
|
|
31
|
+
deps: [],
|
|
32
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
static {
|
|
36
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
37
|
+
minVersion: "12.0.0",
|
|
38
|
+
version: "22.2.4",
|
|
39
|
+
ngImport: i0,
|
|
40
|
+
type: DaffCartShippingRateFactory,
|
|
41
|
+
providedIn: "root"
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
46
|
+
minVersion: "12.0.0",
|
|
47
|
+
version: "22.2.4",
|
|
48
|
+
ngImport: i0,
|
|
49
|
+
type: DaffCartShippingRateFactory,
|
|
50
|
+
decorators: [{
|
|
51
|
+
type: Injectable,
|
|
52
|
+
args: [{ providedIn: "root" }]
|
|
53
|
+
}],
|
|
54
|
+
ctorParameters: () => []
|
|
55
|
+
});
|
|
56
|
+
var MockDaffCartTotal = class {
|
|
57
|
+
constructor() {
|
|
58
|
+
this.name = faker.helpers.arrayElement([
|
|
59
|
+
DaffCartTotalTypeEnum.grandTotal,
|
|
60
|
+
DaffCartTotalTypeEnum.subtotalExcludingTax,
|
|
61
|
+
DaffCartTotalTypeEnum.subtotalIncludingTax,
|
|
62
|
+
DaffCartTotalTypeEnum.subtotalWithDiscountExcludingTax,
|
|
63
|
+
DaffCartTotalTypeEnum.subtotalWithDiscountIncludingTax,
|
|
64
|
+
DaffCartTotalTypeEnum.tax,
|
|
65
|
+
DaffCartTotalTypeEnum.discount,
|
|
66
|
+
DaffCartTotalTypeEnum.shipping
|
|
67
|
+
]);
|
|
68
|
+
this.value = faker.number.int({
|
|
69
|
+
min: 0,
|
|
70
|
+
max: 999999
|
|
71
|
+
});
|
|
72
|
+
this.label = faker.lorem.words();
|
|
73
|
+
this.order = faker.number.int({
|
|
74
|
+
min: 0,
|
|
75
|
+
max: 9
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
var DaffCartTotalFactory = class DaffCartTotalFactory extends DaffModelFactory {
|
|
80
|
+
constructor() {
|
|
81
|
+
super(MockDaffCartTotal);
|
|
82
|
+
}
|
|
83
|
+
createGrandTotal(partial = {}) {
|
|
84
|
+
return this.create({
|
|
85
|
+
name: DaffCartTotalTypeEnum.grandTotal,
|
|
86
|
+
label: "Grand Total"
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
createSubtotalExcludingTax(partial = {}) {
|
|
90
|
+
return this.create({
|
|
91
|
+
name: DaffCartTotalTypeEnum.subtotalExcludingTax,
|
|
92
|
+
label: "Subtotal Excluding Tax"
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
createSubtotalIncludingTax(partial = {}) {
|
|
96
|
+
return this.create({
|
|
97
|
+
name: DaffCartTotalTypeEnum.subtotalIncludingTax,
|
|
98
|
+
label: "Subtotal Including Tax"
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
createSubtotalWithDiscountExcludingTax(partial = {}) {
|
|
102
|
+
return this.create({
|
|
103
|
+
name: DaffCartTotalTypeEnum.subtotalWithDiscountExcludingTax,
|
|
104
|
+
label: "Subtotal With Discount Excluding Tax"
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
createSubtotalWithDiscountIncludingTax(partial = {}) {
|
|
108
|
+
return this.create({
|
|
109
|
+
name: DaffCartTotalTypeEnum.subtotalWithDiscountIncludingTax,
|
|
110
|
+
label: "Subtotal With Discount Including Tax"
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
createTax(partial = {}) {
|
|
114
|
+
return this.create({
|
|
115
|
+
name: DaffCartTotalTypeEnum.tax,
|
|
116
|
+
label: "Tax"
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
createDiscount(partial = {}) {
|
|
120
|
+
return this.create({
|
|
121
|
+
name: DaffCartTotalTypeEnum.discount,
|
|
122
|
+
label: "Discount"
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
createShipping(partial = {}) {
|
|
126
|
+
return this.create({
|
|
127
|
+
name: DaffCartTotalTypeEnum.shipping,
|
|
128
|
+
label: "Shipping"
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
createAllTotals() {
|
|
132
|
+
return {
|
|
133
|
+
[DaffCartTotalTypeEnum.grandTotal]: this.createGrandTotal(),
|
|
134
|
+
[DaffCartTotalTypeEnum.subtotalExcludingTax]: this.createSubtotalExcludingTax(),
|
|
135
|
+
[DaffCartTotalTypeEnum.subtotalIncludingTax]: this.createSubtotalIncludingTax(),
|
|
136
|
+
[DaffCartTotalTypeEnum.subtotalWithDiscountExcludingTax]: this.createSubtotalWithDiscountExcludingTax(),
|
|
137
|
+
[DaffCartTotalTypeEnum.subtotalWithDiscountIncludingTax]: this.createSubtotalWithDiscountIncludingTax(),
|
|
138
|
+
[DaffCartTotalTypeEnum.tax]: this.createTax(),
|
|
139
|
+
[DaffCartTotalTypeEnum.discount]: this.createDiscount(),
|
|
140
|
+
[DaffCartTotalTypeEnum.shipping]: this.createShipping()
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
static {
|
|
144
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
145
|
+
minVersion: "12.0.0",
|
|
146
|
+
version: "22.2.4",
|
|
147
|
+
ngImport: i0,
|
|
148
|
+
type: DaffCartTotalFactory,
|
|
149
|
+
deps: [],
|
|
150
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
static {
|
|
154
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
155
|
+
minVersion: "12.0.0",
|
|
156
|
+
version: "22.2.4",
|
|
157
|
+
ngImport: i0,
|
|
158
|
+
type: DaffCartTotalFactory,
|
|
159
|
+
providedIn: "root"
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
164
|
+
minVersion: "12.0.0",
|
|
165
|
+
version: "22.2.4",
|
|
166
|
+
ngImport: i0,
|
|
167
|
+
type: DaffCartTotalFactory,
|
|
168
|
+
decorators: [{
|
|
169
|
+
type: Injectable,
|
|
170
|
+
args: [{ providedIn: "root" }]
|
|
171
|
+
}],
|
|
172
|
+
ctorParameters: () => []
|
|
173
|
+
});
|
|
174
|
+
var MockCart = class {
|
|
175
|
+
constructor(totalFactory, shippingInformationFactory) {
|
|
176
|
+
this.totalFactory = totalFactory;
|
|
177
|
+
this.shippingInformationFactory = shippingInformationFactory;
|
|
178
|
+
this.id = faker.string.uuid();
|
|
179
|
+
this.coupons = [];
|
|
180
|
+
this.items = [];
|
|
181
|
+
this.billing_address = null;
|
|
182
|
+
this.shipping_address = null;
|
|
183
|
+
this.shipping_information = this.shippingInformationFactory.create();
|
|
184
|
+
this.totals = this.totalFactory.createAllTotals();
|
|
185
|
+
this.payment = null;
|
|
186
|
+
this.available_shipping_methods = [];
|
|
187
|
+
this.available_payment_methods = [];
|
|
188
|
+
this.extra_attributes = {};
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
var DaffCartFactory = class DaffCartFactory extends DaffModelFactory {
|
|
192
|
+
constructor(totalFactory, shippingInformationFactory) {
|
|
193
|
+
super(MockCart, totalFactory, shippingInformationFactory);
|
|
194
|
+
}
|
|
195
|
+
static {
|
|
196
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
197
|
+
minVersion: "12.0.0",
|
|
198
|
+
version: "22.2.4",
|
|
199
|
+
ngImport: i0,
|
|
200
|
+
type: DaffCartFactory,
|
|
201
|
+
deps: [{ token: DaffCartTotalFactory }, { token: DaffCartShippingRateFactory }],
|
|
202
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
static {
|
|
206
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
207
|
+
minVersion: "12.0.0",
|
|
208
|
+
version: "22.2.4",
|
|
209
|
+
ngImport: i0,
|
|
210
|
+
type: DaffCartFactory,
|
|
211
|
+
providedIn: "root"
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
216
|
+
minVersion: "12.0.0",
|
|
217
|
+
version: "22.2.4",
|
|
218
|
+
ngImport: i0,
|
|
219
|
+
type: DaffCartFactory,
|
|
220
|
+
decorators: [{
|
|
221
|
+
type: Injectable,
|
|
222
|
+
args: [{ providedIn: "root" }]
|
|
223
|
+
}],
|
|
224
|
+
ctorParameters: () => [{ type: DaffCartTotalFactory }, { type: DaffCartShippingRateFactory }]
|
|
225
|
+
});
|
|
226
|
+
var DaffMockCartItem = class {
|
|
227
|
+
constructor() {
|
|
228
|
+
this.id = faker.string.uuid();
|
|
229
|
+
this.type = DaffCartItemInputType.Simple;
|
|
230
|
+
this.product_id = faker.string.uuid();
|
|
231
|
+
this.parent_item_id = faker.string.uuid();
|
|
232
|
+
this.image = new DaffProductImageFactory().create();
|
|
233
|
+
this.sku = "sku";
|
|
234
|
+
this.name = "Product Name";
|
|
235
|
+
this.url = `/${faker.internet.domainWord()}.html`;
|
|
236
|
+
this.qty = faker.number.int({
|
|
237
|
+
min: 1,
|
|
238
|
+
max: 100
|
|
239
|
+
});
|
|
240
|
+
this.price = faker.number.int({
|
|
241
|
+
min: 10,
|
|
242
|
+
max: 1500
|
|
243
|
+
});
|
|
244
|
+
this.row_total = this.qty * this.price;
|
|
245
|
+
this.in_stock = true;
|
|
246
|
+
this._numberOfDiscounts = faker.number.int({
|
|
247
|
+
min: 1,
|
|
248
|
+
max: 2
|
|
249
|
+
});
|
|
250
|
+
this.discounts = this._discounts(this._numberOfDiscounts, Math.floor(this.price / this._numberOfDiscounts));
|
|
251
|
+
}
|
|
252
|
+
_discounts(count = 2, max = 100) {
|
|
253
|
+
return new Array(faker.number.int(count)).fill(null).map(() => ({
|
|
254
|
+
amount: faker.number.int({
|
|
255
|
+
min: 1,
|
|
256
|
+
max
|
|
257
|
+
}),
|
|
258
|
+
label: faker.lorem.word()
|
|
259
|
+
}));
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
var DaffCartItemFactory = class DaffCartItemFactory extends DaffModelFactory {
|
|
263
|
+
constructor() {
|
|
264
|
+
super(DaffMockCartItem);
|
|
265
|
+
}
|
|
266
|
+
fromProduct(product) {
|
|
267
|
+
return this.create({
|
|
268
|
+
product_id: product.id,
|
|
269
|
+
name: product.name,
|
|
270
|
+
url: product.url,
|
|
271
|
+
image: product.images[0],
|
|
272
|
+
sku: product.id,
|
|
273
|
+
in_stock: product.in_stock
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
static {
|
|
277
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
278
|
+
minVersion: "12.0.0",
|
|
279
|
+
version: "22.2.4",
|
|
280
|
+
ngImport: i0,
|
|
281
|
+
type: DaffCartItemFactory,
|
|
282
|
+
deps: [],
|
|
283
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
static {
|
|
287
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
288
|
+
minVersion: "12.0.0",
|
|
289
|
+
version: "22.2.4",
|
|
290
|
+
ngImport: i0,
|
|
291
|
+
type: DaffCartItemFactory,
|
|
292
|
+
providedIn: "root"
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
};
|
|
296
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
297
|
+
minVersion: "12.0.0",
|
|
298
|
+
version: "22.2.4",
|
|
299
|
+
ngImport: i0,
|
|
300
|
+
type: DaffCartItemFactory,
|
|
301
|
+
decorators: [{
|
|
302
|
+
type: Injectable,
|
|
303
|
+
args: [{ providedIn: "root" }]
|
|
304
|
+
}],
|
|
305
|
+
ctorParameters: () => []
|
|
306
|
+
});
|
|
307
|
+
var DaffMockConfigurableCartItem = class extends DaffMockCartItem {
|
|
308
|
+
constructor() {
|
|
309
|
+
super(...arguments);
|
|
310
|
+
this.type = DaffCartItemInputType.Configurable;
|
|
311
|
+
this.attributes = [{
|
|
312
|
+
attribute_label: "Color",
|
|
313
|
+
value_label: "Red"
|
|
314
|
+
}, {
|
|
315
|
+
attribute_label: "Size",
|
|
316
|
+
value_label: "M"
|
|
317
|
+
}];
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
var DaffConfigurableCartItemFactory = class DaffConfigurableCartItemFactory extends DaffModelFactory {
|
|
321
|
+
constructor() {
|
|
322
|
+
super(DaffMockConfigurableCartItem);
|
|
323
|
+
}
|
|
324
|
+
static {
|
|
325
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
326
|
+
minVersion: "12.0.0",
|
|
327
|
+
version: "22.2.4",
|
|
328
|
+
ngImport: i0,
|
|
329
|
+
type: DaffConfigurableCartItemFactory,
|
|
330
|
+
deps: [],
|
|
331
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
static {
|
|
335
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
336
|
+
minVersion: "12.0.0",
|
|
337
|
+
version: "22.2.4",
|
|
338
|
+
ngImport: i0,
|
|
339
|
+
type: DaffConfigurableCartItemFactory,
|
|
340
|
+
providedIn: "root"
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
345
|
+
minVersion: "12.0.0",
|
|
346
|
+
version: "22.2.4",
|
|
347
|
+
ngImport: i0,
|
|
348
|
+
type: DaffConfigurableCartItemFactory,
|
|
349
|
+
decorators: [{
|
|
350
|
+
type: Injectable,
|
|
351
|
+
args: [{ providedIn: "root" }]
|
|
352
|
+
}],
|
|
353
|
+
ctorParameters: () => []
|
|
354
|
+
});
|
|
355
|
+
var DaffMockCompositeCartItem = class extends DaffMockCartItem {
|
|
356
|
+
constructor() {
|
|
357
|
+
super(...arguments);
|
|
358
|
+
this.type = DaffCartItemInputType.Composite;
|
|
359
|
+
this.options = [{
|
|
360
|
+
id: faker.string.uuid(),
|
|
361
|
+
option_label: faker.lorem.word(),
|
|
362
|
+
value_label: faker.lorem.word()
|
|
363
|
+
}, {
|
|
364
|
+
id: faker.string.uuid(),
|
|
365
|
+
option_label: faker.lorem.word(),
|
|
366
|
+
value_label: faker.lorem.word()
|
|
367
|
+
}];
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
var DaffCompositeCartItemFactory = class DaffCompositeCartItemFactory extends DaffModelFactory {
|
|
371
|
+
constructor() {
|
|
372
|
+
super(DaffMockCompositeCartItem);
|
|
373
|
+
}
|
|
374
|
+
static {
|
|
375
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
376
|
+
minVersion: "12.0.0",
|
|
377
|
+
version: "22.2.4",
|
|
378
|
+
ngImport: i0,
|
|
379
|
+
type: DaffCompositeCartItemFactory,
|
|
380
|
+
deps: [],
|
|
381
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
static {
|
|
385
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
386
|
+
minVersion: "12.0.0",
|
|
387
|
+
version: "22.2.4",
|
|
388
|
+
ngImport: i0,
|
|
389
|
+
type: DaffCompositeCartItemFactory,
|
|
390
|
+
providedIn: "root"
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
};
|
|
394
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
395
|
+
minVersion: "12.0.0",
|
|
396
|
+
version: "22.2.4",
|
|
397
|
+
ngImport: i0,
|
|
398
|
+
type: DaffCompositeCartItemFactory,
|
|
399
|
+
decorators: [{
|
|
400
|
+
type: Injectable,
|
|
401
|
+
args: [{ providedIn: "root" }]
|
|
402
|
+
}],
|
|
403
|
+
ctorParameters: () => []
|
|
404
|
+
});
|
|
405
|
+
var MockCartAddress = class {
|
|
406
|
+
constructor() {
|
|
407
|
+
this.id = faker.string.uuid();
|
|
408
|
+
this.email = "email@email.com";
|
|
409
|
+
this.prefix = "prefix";
|
|
410
|
+
this.firstname = "first";
|
|
411
|
+
this.middlename = "middle";
|
|
412
|
+
this.lastname = "last";
|
|
413
|
+
this.suffix = "suffix";
|
|
414
|
+
this.company = "company";
|
|
415
|
+
this.street = "street";
|
|
416
|
+
this.city = "city";
|
|
417
|
+
this.state = "state";
|
|
418
|
+
this.region = "region";
|
|
419
|
+
this.postcode = "postcode";
|
|
420
|
+
this.country_id = "ISO";
|
|
421
|
+
this.telephone = "+1 (123)-123-1234";
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
var DaffCartAddressFactory = class DaffCartAddressFactory extends DaffModelFactory {
|
|
425
|
+
constructor() {
|
|
426
|
+
super(MockCartAddress);
|
|
427
|
+
}
|
|
428
|
+
static {
|
|
429
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
430
|
+
minVersion: "12.0.0",
|
|
431
|
+
version: "22.2.4",
|
|
432
|
+
ngImport: i0,
|
|
433
|
+
type: DaffCartAddressFactory,
|
|
434
|
+
deps: [],
|
|
435
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
static {
|
|
439
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
440
|
+
minVersion: "12.0.0",
|
|
441
|
+
version: "22.2.4",
|
|
442
|
+
ngImport: i0,
|
|
443
|
+
type: DaffCartAddressFactory,
|
|
444
|
+
providedIn: "root"
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
449
|
+
minVersion: "12.0.0",
|
|
450
|
+
version: "22.2.4",
|
|
451
|
+
ngImport: i0,
|
|
452
|
+
type: DaffCartAddressFactory,
|
|
453
|
+
decorators: [{
|
|
454
|
+
type: Injectable,
|
|
455
|
+
args: [{ providedIn: "root" }]
|
|
456
|
+
}],
|
|
457
|
+
ctorParameters: () => []
|
|
458
|
+
});
|
|
459
|
+
var MockCartPayment = class {
|
|
460
|
+
constructor() {
|
|
461
|
+
this.method = "credit-card";
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
var DaffCartPaymentFactory = class DaffCartPaymentFactory extends DaffModelFactory {
|
|
465
|
+
constructor() {
|
|
466
|
+
super(MockCartPayment);
|
|
467
|
+
}
|
|
468
|
+
static {
|
|
469
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
470
|
+
minVersion: "12.0.0",
|
|
471
|
+
version: "22.2.4",
|
|
472
|
+
ngImport: i0,
|
|
473
|
+
type: DaffCartPaymentFactory,
|
|
474
|
+
deps: [],
|
|
475
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
static {
|
|
479
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
480
|
+
minVersion: "12.0.0",
|
|
481
|
+
version: "22.2.4",
|
|
482
|
+
ngImport: i0,
|
|
483
|
+
type: DaffCartPaymentFactory,
|
|
484
|
+
providedIn: "root"
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
489
|
+
minVersion: "12.0.0",
|
|
490
|
+
version: "22.2.4",
|
|
491
|
+
ngImport: i0,
|
|
492
|
+
type: DaffCartPaymentFactory,
|
|
493
|
+
decorators: [{
|
|
494
|
+
type: Injectable,
|
|
495
|
+
args: [{ providedIn: "root" }]
|
|
496
|
+
}],
|
|
497
|
+
ctorParameters: () => []
|
|
498
|
+
});
|
|
499
|
+
var MockDaffCartCoupon = class {
|
|
500
|
+
constructor() {
|
|
501
|
+
this.id = faker.string.uuid();
|
|
502
|
+
this.code = faker.string.alphanumeric(20);
|
|
503
|
+
this.description = faker.lorem.words(5);
|
|
504
|
+
}
|
|
505
|
+
};
|
|
506
|
+
var DaffCartCouponFactory = class DaffCartCouponFactory extends DaffModelFactory {
|
|
507
|
+
constructor() {
|
|
508
|
+
super(MockDaffCartCoupon);
|
|
509
|
+
}
|
|
510
|
+
static {
|
|
511
|
+
this.ɵfac = i0.ɵɵngDeclareFactory({
|
|
512
|
+
minVersion: "12.0.0",
|
|
513
|
+
version: "22.2.4",
|
|
514
|
+
ngImport: i0,
|
|
515
|
+
type: DaffCartCouponFactory,
|
|
516
|
+
deps: [],
|
|
517
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
static {
|
|
521
|
+
this.ɵprov = i0.ɵɵngDeclareInjectable({
|
|
522
|
+
minVersion: "12.0.0",
|
|
523
|
+
version: "22.2.4",
|
|
524
|
+
ngImport: i0,
|
|
525
|
+
type: DaffCartCouponFactory,
|
|
526
|
+
providedIn: "root"
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
531
|
+
minVersion: "12.0.0",
|
|
532
|
+
version: "22.2.4",
|
|
533
|
+
ngImport: i0,
|
|
534
|
+
type: DaffCartCouponFactory,
|
|
535
|
+
decorators: [{
|
|
536
|
+
type: Injectable,
|
|
537
|
+
args: [{ providedIn: "root" }]
|
|
538
|
+
}],
|
|
539
|
+
ctorParameters: () => []
|
|
540
|
+
});
|
|
357
541
|
export { DaffCartAddressFactory, DaffCartCouponFactory, DaffCartFactory, DaffCartItemFactory, DaffCartPaymentFactory, DaffCartShippingRateFactory, DaffCartTotalFactory, DaffCompositeCartItemFactory, DaffConfigurableCartItemFactory, DaffMockCartItem, DaffMockCompositeCartItem, DaffMockConfigurableCartItem, MockCart, MockCartAddress, MockCartPayment, MockCartShippingRate, MockDaffCartCoupon, MockDaffCartTotal };
|
|
358
|
-
|
|
542
|
+
|
|
543
|
+
//# sourceMappingURL=daffodil-cart-testing.mjs.map
|