@firfi/voila-sdk 0.1.3 → 0.1.4
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/dist/src/domain/schemas/discount.d.ts +439 -0
- package/dist/src/domain/schemas/discount.d.ts.map +1 -0
- package/dist/src/domain/schemas/discount.js +59 -0
- package/dist/src/domain/schemas/discount.js.map +1 -0
- package/dist/src/domain/schemas/index.d.ts +1 -0
- package/dist/src/domain/schemas/index.d.ts.map +1 -1
- package/dist/src/domain/schemas/index.js +1 -0
- package/dist/src/domain/schemas/index.js.map +1 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/voila/browser-login-adapter.d.ts +2 -2
- package/dist/src/voila/discount-urls.d.ts +13 -0
- package/dist/src/voila/discount-urls.d.ts.map +1 -0
- package/dist/src/voila/discount-urls.js +33 -0
- package/dist/src/voila/discount-urls.js.map +1 -0
- package/dist/src/voila/discounted-products.d.ts +53 -0
- package/dist/src/voila/discounted-products.d.ts.map +1 -0
- package/dist/src/voila/discounted-products.js +195 -0
- package/dist/src/voila/discounted-products.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export declare const MIN_DISCOUNT_PAGE_SIZE = 1;
|
|
3
|
+
export declare const MAX_DISCOUNT_PAGE_SIZE = 24;
|
|
4
|
+
export declare const DEFAULT_DISCOUNT_PAGE_SIZE = 12;
|
|
5
|
+
export declare const DEFAULT_MIN_SAVINGS_AMOUNT = 0.5;
|
|
6
|
+
export declare const DEFAULT_MIN_SAVINGS_PERCENT = 10;
|
|
7
|
+
export declare const MAX_DISCOUNT_QUERY_SCAN_PAGES = 5;
|
|
8
|
+
export declare const DiscountSortSchema: Schema.Literal<["best-percent", "best-amount", "price-asc"]>;
|
|
9
|
+
export type DiscountSort = Schema.Schema.Type<typeof DiscountSortSchema>;
|
|
10
|
+
export declare const DiscountedProductsInputSchema: Schema.Struct<{
|
|
11
|
+
categoryId: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.String>>, {
|
|
12
|
+
exact: true;
|
|
13
|
+
}>;
|
|
14
|
+
minSavingsAmount: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
|
|
15
|
+
exact: true;
|
|
16
|
+
}>;
|
|
17
|
+
minSavingsPercent: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.Number>>, {
|
|
18
|
+
exact: true;
|
|
19
|
+
}>;
|
|
20
|
+
pageSize: Schema.optionalWith<Schema.filter<Schema.filter<Schema.filter<Schema.filter<typeof Schema.Number>>>>, {
|
|
21
|
+
default: () => number;
|
|
22
|
+
}>;
|
|
23
|
+
pageToken: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.String>>, {
|
|
24
|
+
exact: true;
|
|
25
|
+
}>;
|
|
26
|
+
query: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.String>>, {
|
|
27
|
+
exact: true;
|
|
28
|
+
}>;
|
|
29
|
+
retailerCategoryId: Schema.optionalWith<Schema.filter<Schema.filter<typeof Schema.String>>, {
|
|
30
|
+
exact: true;
|
|
31
|
+
}>;
|
|
32
|
+
sort: Schema.optionalWith<Schema.Literal<["best-percent", "best-amount", "price-asc"]>, {
|
|
33
|
+
exact: true;
|
|
34
|
+
}>;
|
|
35
|
+
}>;
|
|
36
|
+
export type DiscountedProductsInput = Schema.Schema.Type<typeof DiscountedProductsInputSchema>;
|
|
37
|
+
export declare const RawPromotionMetadataSchema: Schema.extend<Schema.Struct<{
|
|
38
|
+
description: Schema.optionalWith<typeof Schema.String, {
|
|
39
|
+
exact: true;
|
|
40
|
+
}>;
|
|
41
|
+
id: Schema.optionalWith<typeof Schema.String, {
|
|
42
|
+
exact: true;
|
|
43
|
+
}>;
|
|
44
|
+
label: Schema.optionalWith<typeof Schema.String, {
|
|
45
|
+
exact: true;
|
|
46
|
+
}>;
|
|
47
|
+
name: Schema.optionalWith<typeof Schema.String, {
|
|
48
|
+
exact: true;
|
|
49
|
+
}>;
|
|
50
|
+
promotionId: Schema.optionalWith<typeof Schema.String, {
|
|
51
|
+
exact: true;
|
|
52
|
+
}>;
|
|
53
|
+
type: Schema.optionalWith<typeof Schema.String, {
|
|
54
|
+
exact: true;
|
|
55
|
+
}>;
|
|
56
|
+
}>, Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
|
|
57
|
+
export type RawPromotionMetadata = Schema.Schema.Type<typeof RawPromotionMetadataSchema>;
|
|
58
|
+
export declare const RawPromotionProductSchema: Schema.extend<Schema.Struct<{
|
|
59
|
+
available: typeof Schema.Boolean;
|
|
60
|
+
brand: Schema.optionalWith<typeof Schema.String, {
|
|
61
|
+
exact: true;
|
|
62
|
+
}>;
|
|
63
|
+
maxQuantityReached: typeof Schema.Boolean;
|
|
64
|
+
name: typeof Schema.String;
|
|
65
|
+
packSizeDescription: Schema.optionalWith<typeof Schema.String, {
|
|
66
|
+
exact: true;
|
|
67
|
+
}>;
|
|
68
|
+
price: Schema.Struct<{
|
|
69
|
+
amount: typeof Schema.String;
|
|
70
|
+
currency: typeof Schema.String;
|
|
71
|
+
}>;
|
|
72
|
+
productId: typeof Schema.String;
|
|
73
|
+
promoPrice: Schema.optionalWith<Schema.Struct<{
|
|
74
|
+
amount: typeof Schema.String;
|
|
75
|
+
currency: typeof Schema.String;
|
|
76
|
+
}>, {
|
|
77
|
+
exact: true;
|
|
78
|
+
}>;
|
|
79
|
+
promoUnitPrice: Schema.optionalWith<Schema.Struct<{
|
|
80
|
+
price: Schema.Struct<{
|
|
81
|
+
amount: typeof Schema.String;
|
|
82
|
+
currency: typeof Schema.String;
|
|
83
|
+
}>;
|
|
84
|
+
unit: typeof Schema.String;
|
|
85
|
+
unitName: Schema.optionalWith<typeof Schema.String, {
|
|
86
|
+
exact: true;
|
|
87
|
+
}>;
|
|
88
|
+
}>, {
|
|
89
|
+
exact: true;
|
|
90
|
+
}>;
|
|
91
|
+
promotions: Schema.optionalWith<Schema.Array$<Schema.extend<Schema.Struct<{
|
|
92
|
+
description: Schema.optionalWith<typeof Schema.String, {
|
|
93
|
+
exact: true;
|
|
94
|
+
}>;
|
|
95
|
+
id: Schema.optionalWith<typeof Schema.String, {
|
|
96
|
+
exact: true;
|
|
97
|
+
}>;
|
|
98
|
+
label: Schema.optionalWith<typeof Schema.String, {
|
|
99
|
+
exact: true;
|
|
100
|
+
}>;
|
|
101
|
+
name: Schema.optionalWith<typeof Schema.String, {
|
|
102
|
+
exact: true;
|
|
103
|
+
}>;
|
|
104
|
+
promotionId: Schema.optionalWith<typeof Schema.String, {
|
|
105
|
+
exact: true;
|
|
106
|
+
}>;
|
|
107
|
+
type: Schema.optionalWith<typeof Schema.String, {
|
|
108
|
+
exact: true;
|
|
109
|
+
}>;
|
|
110
|
+
}>, Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>>, {
|
|
111
|
+
exact: true;
|
|
112
|
+
}>;
|
|
113
|
+
quantityInBasket: typeof Schema.Number;
|
|
114
|
+
retailerProductId: typeof Schema.String;
|
|
115
|
+
unitPrice: Schema.optionalWith<Schema.Struct<{
|
|
116
|
+
price: Schema.Struct<{
|
|
117
|
+
amount: typeof Schema.String;
|
|
118
|
+
currency: typeof Schema.String;
|
|
119
|
+
}>;
|
|
120
|
+
unit: typeof Schema.String;
|
|
121
|
+
unitName: Schema.optionalWith<typeof Schema.String, {
|
|
122
|
+
exact: true;
|
|
123
|
+
}>;
|
|
124
|
+
}>, {
|
|
125
|
+
exact: true;
|
|
126
|
+
}>;
|
|
127
|
+
}>, Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
|
|
128
|
+
export type RawPromotionProduct = Schema.Schema.Type<typeof RawPromotionProductSchema>;
|
|
129
|
+
export declare const RawPromotionProductGroupSchema: Schema.extend<Schema.Struct<{
|
|
130
|
+
decoratedProducts: Schema.optionalWith<Schema.Array$<Schema.extend<Schema.Struct<{
|
|
131
|
+
available: typeof Schema.Boolean;
|
|
132
|
+
brand: Schema.optionalWith<typeof Schema.String, {
|
|
133
|
+
exact: true;
|
|
134
|
+
}>;
|
|
135
|
+
maxQuantityReached: typeof Schema.Boolean;
|
|
136
|
+
name: typeof Schema.String;
|
|
137
|
+
packSizeDescription: Schema.optionalWith<typeof Schema.String, {
|
|
138
|
+
exact: true;
|
|
139
|
+
}>;
|
|
140
|
+
price: Schema.Struct<{
|
|
141
|
+
amount: typeof Schema.String;
|
|
142
|
+
currency: typeof Schema.String;
|
|
143
|
+
}>;
|
|
144
|
+
productId: typeof Schema.String;
|
|
145
|
+
promoPrice: Schema.optionalWith<Schema.Struct<{
|
|
146
|
+
amount: typeof Schema.String;
|
|
147
|
+
currency: typeof Schema.String;
|
|
148
|
+
}>, {
|
|
149
|
+
exact: true;
|
|
150
|
+
}>;
|
|
151
|
+
promoUnitPrice: Schema.optionalWith<Schema.Struct<{
|
|
152
|
+
price: Schema.Struct<{
|
|
153
|
+
amount: typeof Schema.String;
|
|
154
|
+
currency: typeof Schema.String;
|
|
155
|
+
}>;
|
|
156
|
+
unit: typeof Schema.String;
|
|
157
|
+
unitName: Schema.optionalWith<typeof Schema.String, {
|
|
158
|
+
exact: true;
|
|
159
|
+
}>;
|
|
160
|
+
}>, {
|
|
161
|
+
exact: true;
|
|
162
|
+
}>;
|
|
163
|
+
promotions: Schema.optionalWith<Schema.Array$<Schema.extend<Schema.Struct<{
|
|
164
|
+
description: Schema.optionalWith<typeof Schema.String, {
|
|
165
|
+
exact: true;
|
|
166
|
+
}>;
|
|
167
|
+
id: Schema.optionalWith<typeof Schema.String, {
|
|
168
|
+
exact: true;
|
|
169
|
+
}>;
|
|
170
|
+
label: Schema.optionalWith<typeof Schema.String, {
|
|
171
|
+
exact: true;
|
|
172
|
+
}>;
|
|
173
|
+
name: Schema.optionalWith<typeof Schema.String, {
|
|
174
|
+
exact: true;
|
|
175
|
+
}>;
|
|
176
|
+
promotionId: Schema.optionalWith<typeof Schema.String, {
|
|
177
|
+
exact: true;
|
|
178
|
+
}>;
|
|
179
|
+
type: Schema.optionalWith<typeof Schema.String, {
|
|
180
|
+
exact: true;
|
|
181
|
+
}>;
|
|
182
|
+
}>, Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>>, {
|
|
183
|
+
exact: true;
|
|
184
|
+
}>;
|
|
185
|
+
quantityInBasket: typeof Schema.Number;
|
|
186
|
+
retailerProductId: typeof Schema.String;
|
|
187
|
+
unitPrice: Schema.optionalWith<Schema.Struct<{
|
|
188
|
+
price: Schema.Struct<{
|
|
189
|
+
amount: typeof Schema.String;
|
|
190
|
+
currency: typeof Schema.String;
|
|
191
|
+
}>;
|
|
192
|
+
unit: typeof Schema.String;
|
|
193
|
+
unitName: Schema.optionalWith<typeof Schema.String, {
|
|
194
|
+
exact: true;
|
|
195
|
+
}>;
|
|
196
|
+
}>, {
|
|
197
|
+
exact: true;
|
|
198
|
+
}>;
|
|
199
|
+
}>, Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>>, {
|
|
200
|
+
exact: true;
|
|
201
|
+
}>;
|
|
202
|
+
name: Schema.optionalWith<typeof Schema.String, {
|
|
203
|
+
exact: true;
|
|
204
|
+
}>;
|
|
205
|
+
products: Schema.optionalWith<Schema.Array$<Schema.extend<Schema.Struct<{
|
|
206
|
+
available: typeof Schema.Boolean;
|
|
207
|
+
brand: Schema.optionalWith<typeof Schema.String, {
|
|
208
|
+
exact: true;
|
|
209
|
+
}>;
|
|
210
|
+
maxQuantityReached: typeof Schema.Boolean;
|
|
211
|
+
name: typeof Schema.String;
|
|
212
|
+
packSizeDescription: Schema.optionalWith<typeof Schema.String, {
|
|
213
|
+
exact: true;
|
|
214
|
+
}>;
|
|
215
|
+
price: Schema.Struct<{
|
|
216
|
+
amount: typeof Schema.String;
|
|
217
|
+
currency: typeof Schema.String;
|
|
218
|
+
}>;
|
|
219
|
+
productId: typeof Schema.String;
|
|
220
|
+
promoPrice: Schema.optionalWith<Schema.Struct<{
|
|
221
|
+
amount: typeof Schema.String;
|
|
222
|
+
currency: typeof Schema.String;
|
|
223
|
+
}>, {
|
|
224
|
+
exact: true;
|
|
225
|
+
}>;
|
|
226
|
+
promoUnitPrice: Schema.optionalWith<Schema.Struct<{
|
|
227
|
+
price: Schema.Struct<{
|
|
228
|
+
amount: typeof Schema.String;
|
|
229
|
+
currency: typeof Schema.String;
|
|
230
|
+
}>;
|
|
231
|
+
unit: typeof Schema.String;
|
|
232
|
+
unitName: Schema.optionalWith<typeof Schema.String, {
|
|
233
|
+
exact: true;
|
|
234
|
+
}>;
|
|
235
|
+
}>, {
|
|
236
|
+
exact: true;
|
|
237
|
+
}>;
|
|
238
|
+
promotions: Schema.optionalWith<Schema.Array$<Schema.extend<Schema.Struct<{
|
|
239
|
+
description: Schema.optionalWith<typeof Schema.String, {
|
|
240
|
+
exact: true;
|
|
241
|
+
}>;
|
|
242
|
+
id: Schema.optionalWith<typeof Schema.String, {
|
|
243
|
+
exact: true;
|
|
244
|
+
}>;
|
|
245
|
+
label: Schema.optionalWith<typeof Schema.String, {
|
|
246
|
+
exact: true;
|
|
247
|
+
}>;
|
|
248
|
+
name: Schema.optionalWith<typeof Schema.String, {
|
|
249
|
+
exact: true;
|
|
250
|
+
}>;
|
|
251
|
+
promotionId: Schema.optionalWith<typeof Schema.String, {
|
|
252
|
+
exact: true;
|
|
253
|
+
}>;
|
|
254
|
+
type: Schema.optionalWith<typeof Schema.String, {
|
|
255
|
+
exact: true;
|
|
256
|
+
}>;
|
|
257
|
+
}>, Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>>, {
|
|
258
|
+
exact: true;
|
|
259
|
+
}>;
|
|
260
|
+
quantityInBasket: typeof Schema.Number;
|
|
261
|
+
retailerProductId: typeof Schema.String;
|
|
262
|
+
unitPrice: Schema.optionalWith<Schema.Struct<{
|
|
263
|
+
price: Schema.Struct<{
|
|
264
|
+
amount: typeof Schema.String;
|
|
265
|
+
currency: typeof Schema.String;
|
|
266
|
+
}>;
|
|
267
|
+
unit: typeof Schema.String;
|
|
268
|
+
unitName: Schema.optionalWith<typeof Schema.String, {
|
|
269
|
+
exact: true;
|
|
270
|
+
}>;
|
|
271
|
+
}>, {
|
|
272
|
+
exact: true;
|
|
273
|
+
}>;
|
|
274
|
+
}>, Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>>, {
|
|
275
|
+
exact: true;
|
|
276
|
+
}>;
|
|
277
|
+
type: typeof Schema.String;
|
|
278
|
+
}>, Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
|
|
279
|
+
export type RawPromotionProductGroup = Schema.Schema.Type<typeof RawPromotionProductGroupSchema>;
|
|
280
|
+
export declare const PromotionProductsResponseSchema: Schema.extend<Schema.Struct<{
|
|
281
|
+
nextPageToken: Schema.optionalWith<typeof Schema.String, {
|
|
282
|
+
exact: true;
|
|
283
|
+
}>;
|
|
284
|
+
productGroups: Schema.Array$<Schema.extend<Schema.Struct<{
|
|
285
|
+
decoratedProducts: Schema.optionalWith<Schema.Array$<Schema.extend<Schema.Struct<{
|
|
286
|
+
available: typeof Schema.Boolean;
|
|
287
|
+
brand: Schema.optionalWith<typeof Schema.String, {
|
|
288
|
+
exact: true;
|
|
289
|
+
}>;
|
|
290
|
+
maxQuantityReached: typeof Schema.Boolean;
|
|
291
|
+
name: typeof Schema.String;
|
|
292
|
+
packSizeDescription: Schema.optionalWith<typeof Schema.String, {
|
|
293
|
+
exact: true;
|
|
294
|
+
}>;
|
|
295
|
+
price: Schema.Struct<{
|
|
296
|
+
amount: typeof Schema.String;
|
|
297
|
+
currency: typeof Schema.String;
|
|
298
|
+
}>;
|
|
299
|
+
productId: typeof Schema.String;
|
|
300
|
+
promoPrice: Schema.optionalWith<Schema.Struct<{
|
|
301
|
+
amount: typeof Schema.String;
|
|
302
|
+
currency: typeof Schema.String;
|
|
303
|
+
}>, {
|
|
304
|
+
exact: true;
|
|
305
|
+
}>;
|
|
306
|
+
promoUnitPrice: Schema.optionalWith<Schema.Struct<{
|
|
307
|
+
price: Schema.Struct<{
|
|
308
|
+
amount: typeof Schema.String;
|
|
309
|
+
currency: typeof Schema.String;
|
|
310
|
+
}>;
|
|
311
|
+
unit: typeof Schema.String;
|
|
312
|
+
unitName: Schema.optionalWith<typeof Schema.String, {
|
|
313
|
+
exact: true;
|
|
314
|
+
}>;
|
|
315
|
+
}>, {
|
|
316
|
+
exact: true;
|
|
317
|
+
}>;
|
|
318
|
+
promotions: Schema.optionalWith<Schema.Array$<Schema.extend<Schema.Struct<{
|
|
319
|
+
description: Schema.optionalWith<typeof Schema.String, {
|
|
320
|
+
exact: true;
|
|
321
|
+
}>;
|
|
322
|
+
id: Schema.optionalWith<typeof Schema.String, {
|
|
323
|
+
exact: true;
|
|
324
|
+
}>;
|
|
325
|
+
label: Schema.optionalWith<typeof Schema.String, {
|
|
326
|
+
exact: true;
|
|
327
|
+
}>;
|
|
328
|
+
name: Schema.optionalWith<typeof Schema.String, {
|
|
329
|
+
exact: true;
|
|
330
|
+
}>;
|
|
331
|
+
promotionId: Schema.optionalWith<typeof Schema.String, {
|
|
332
|
+
exact: true;
|
|
333
|
+
}>;
|
|
334
|
+
type: Schema.optionalWith<typeof Schema.String, {
|
|
335
|
+
exact: true;
|
|
336
|
+
}>;
|
|
337
|
+
}>, Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>>, {
|
|
338
|
+
exact: true;
|
|
339
|
+
}>;
|
|
340
|
+
quantityInBasket: typeof Schema.Number;
|
|
341
|
+
retailerProductId: typeof Schema.String;
|
|
342
|
+
unitPrice: Schema.optionalWith<Schema.Struct<{
|
|
343
|
+
price: Schema.Struct<{
|
|
344
|
+
amount: typeof Schema.String;
|
|
345
|
+
currency: typeof Schema.String;
|
|
346
|
+
}>;
|
|
347
|
+
unit: typeof Schema.String;
|
|
348
|
+
unitName: Schema.optionalWith<typeof Schema.String, {
|
|
349
|
+
exact: true;
|
|
350
|
+
}>;
|
|
351
|
+
}>, {
|
|
352
|
+
exact: true;
|
|
353
|
+
}>;
|
|
354
|
+
}>, Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>>, {
|
|
355
|
+
exact: true;
|
|
356
|
+
}>;
|
|
357
|
+
name: Schema.optionalWith<typeof Schema.String, {
|
|
358
|
+
exact: true;
|
|
359
|
+
}>;
|
|
360
|
+
products: Schema.optionalWith<Schema.Array$<Schema.extend<Schema.Struct<{
|
|
361
|
+
available: typeof Schema.Boolean;
|
|
362
|
+
brand: Schema.optionalWith<typeof Schema.String, {
|
|
363
|
+
exact: true;
|
|
364
|
+
}>;
|
|
365
|
+
maxQuantityReached: typeof Schema.Boolean;
|
|
366
|
+
name: typeof Schema.String;
|
|
367
|
+
packSizeDescription: Schema.optionalWith<typeof Schema.String, {
|
|
368
|
+
exact: true;
|
|
369
|
+
}>;
|
|
370
|
+
price: Schema.Struct<{
|
|
371
|
+
amount: typeof Schema.String;
|
|
372
|
+
currency: typeof Schema.String;
|
|
373
|
+
}>;
|
|
374
|
+
productId: typeof Schema.String;
|
|
375
|
+
promoPrice: Schema.optionalWith<Schema.Struct<{
|
|
376
|
+
amount: typeof Schema.String;
|
|
377
|
+
currency: typeof Schema.String;
|
|
378
|
+
}>, {
|
|
379
|
+
exact: true;
|
|
380
|
+
}>;
|
|
381
|
+
promoUnitPrice: Schema.optionalWith<Schema.Struct<{
|
|
382
|
+
price: Schema.Struct<{
|
|
383
|
+
amount: typeof Schema.String;
|
|
384
|
+
currency: typeof Schema.String;
|
|
385
|
+
}>;
|
|
386
|
+
unit: typeof Schema.String;
|
|
387
|
+
unitName: Schema.optionalWith<typeof Schema.String, {
|
|
388
|
+
exact: true;
|
|
389
|
+
}>;
|
|
390
|
+
}>, {
|
|
391
|
+
exact: true;
|
|
392
|
+
}>;
|
|
393
|
+
promotions: Schema.optionalWith<Schema.Array$<Schema.extend<Schema.Struct<{
|
|
394
|
+
description: Schema.optionalWith<typeof Schema.String, {
|
|
395
|
+
exact: true;
|
|
396
|
+
}>;
|
|
397
|
+
id: Schema.optionalWith<typeof Schema.String, {
|
|
398
|
+
exact: true;
|
|
399
|
+
}>;
|
|
400
|
+
label: Schema.optionalWith<typeof Schema.String, {
|
|
401
|
+
exact: true;
|
|
402
|
+
}>;
|
|
403
|
+
name: Schema.optionalWith<typeof Schema.String, {
|
|
404
|
+
exact: true;
|
|
405
|
+
}>;
|
|
406
|
+
promotionId: Schema.optionalWith<typeof Schema.String, {
|
|
407
|
+
exact: true;
|
|
408
|
+
}>;
|
|
409
|
+
type: Schema.optionalWith<typeof Schema.String, {
|
|
410
|
+
exact: true;
|
|
411
|
+
}>;
|
|
412
|
+
}>, Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>>, {
|
|
413
|
+
exact: true;
|
|
414
|
+
}>;
|
|
415
|
+
quantityInBasket: typeof Schema.Number;
|
|
416
|
+
retailerProductId: typeof Schema.String;
|
|
417
|
+
unitPrice: Schema.optionalWith<Schema.Struct<{
|
|
418
|
+
price: Schema.Struct<{
|
|
419
|
+
amount: typeof Schema.String;
|
|
420
|
+
currency: typeof Schema.String;
|
|
421
|
+
}>;
|
|
422
|
+
unit: typeof Schema.String;
|
|
423
|
+
unitName: Schema.optionalWith<typeof Schema.String, {
|
|
424
|
+
exact: true;
|
|
425
|
+
}>;
|
|
426
|
+
}>, {
|
|
427
|
+
exact: true;
|
|
428
|
+
}>;
|
|
429
|
+
}>, Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>>, {
|
|
430
|
+
exact: true;
|
|
431
|
+
}>;
|
|
432
|
+
type: typeof Schema.String;
|
|
433
|
+
}>, Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>>;
|
|
434
|
+
totalProducts: Schema.optionalWith<Schema.filter<Schema.filter<Schema.filter<typeof Schema.Number>>>, {
|
|
435
|
+
exact: true;
|
|
436
|
+
}>;
|
|
437
|
+
}>, Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
|
|
438
|
+
export type PromotionProductsResponse = Schema.Schema.Type<typeof PromotionProductsResponseSchema>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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gEAKM,CAAA;AAEjD,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,8BAA8B,CAAC,CAAA;AAQhG,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gEAIK,CAAA;AAEjD,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,+BAA+B,CAAC,CAAA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import { MoneySchema, UnitPriceSchema } from "./money.js";
|
|
3
|
+
export const MIN_DISCOUNT_PAGE_SIZE = 1;
|
|
4
|
+
export const MAX_DISCOUNT_PAGE_SIZE = 24;
|
|
5
|
+
export const DEFAULT_DISCOUNT_PAGE_SIZE = 12;
|
|
6
|
+
export const DEFAULT_MIN_SAVINGS_AMOUNT = 0.5;
|
|
7
|
+
export const DEFAULT_MIN_SAVINGS_PERCENT = 10;
|
|
8
|
+
export const MAX_DISCOUNT_QUERY_SCAN_PAGES = 5;
|
|
9
|
+
const UnknownStringRecordSchema = Schema.Record({ key: Schema.String, value: Schema.Unknown });
|
|
10
|
+
const NonEmptyTrimmedStringSchema = Schema.String.pipe(Schema.trimmed(), Schema.minLength(1));
|
|
11
|
+
const DiscountPageSizeSchema = Schema.Number.pipe(Schema.finite(), Schema.int(), Schema.greaterThanOrEqualTo(MIN_DISCOUNT_PAGE_SIZE), Schema.lessThanOrEqualTo(MAX_DISCOUNT_PAGE_SIZE));
|
|
12
|
+
const NonNegativeNumberSchema = Schema.Number.pipe(Schema.finite(), Schema.nonNegative());
|
|
13
|
+
export const DiscountSortSchema = Schema.Literal("best-percent", "best-amount", "price-asc");
|
|
14
|
+
export const DiscountedProductsInputSchema = Schema.Struct({
|
|
15
|
+
categoryId: Schema.optionalWith(NonEmptyTrimmedStringSchema, { exact: true }),
|
|
16
|
+
minSavingsAmount: Schema.optionalWith(NonNegativeNumberSchema, { exact: true }),
|
|
17
|
+
minSavingsPercent: Schema.optionalWith(NonNegativeNumberSchema, { exact: true }),
|
|
18
|
+
pageSize: Schema.optionalWith(DiscountPageSizeSchema, { default: () => DEFAULT_DISCOUNT_PAGE_SIZE }),
|
|
19
|
+
pageToken: Schema.optionalWith(NonEmptyTrimmedStringSchema, { exact: true }),
|
|
20
|
+
query: Schema.optionalWith(NonEmptyTrimmedStringSchema, { exact: true }),
|
|
21
|
+
retailerCategoryId: Schema.optionalWith(NonEmptyTrimmedStringSchema, { exact: true }),
|
|
22
|
+
sort: Schema.optionalWith(DiscountSortSchema, { exact: true })
|
|
23
|
+
});
|
|
24
|
+
export const RawPromotionMetadataSchema = Schema.Struct({
|
|
25
|
+
description: Schema.optionalWith(Schema.String, { exact: true }),
|
|
26
|
+
id: Schema.optionalWith(Schema.String, { exact: true }),
|
|
27
|
+
label: Schema.optionalWith(Schema.String, { exact: true }),
|
|
28
|
+
name: Schema.optionalWith(Schema.String, { exact: true }),
|
|
29
|
+
promotionId: Schema.optionalWith(Schema.String, { exact: true }),
|
|
30
|
+
type: Schema.optionalWith(Schema.String, { exact: true })
|
|
31
|
+
}).pipe(Schema.extend(UnknownStringRecordSchema));
|
|
32
|
+
export const RawPromotionProductSchema = Schema.Struct({
|
|
33
|
+
available: Schema.Boolean,
|
|
34
|
+
brand: Schema.optionalWith(Schema.String, { exact: true }),
|
|
35
|
+
maxQuantityReached: Schema.Boolean,
|
|
36
|
+
name: Schema.String,
|
|
37
|
+
packSizeDescription: Schema.optionalWith(Schema.String, { exact: true }),
|
|
38
|
+
price: MoneySchema,
|
|
39
|
+
productId: Schema.String,
|
|
40
|
+
promoPrice: Schema.optionalWith(MoneySchema, { exact: true }),
|
|
41
|
+
promoUnitPrice: Schema.optionalWith(UnitPriceSchema, { exact: true }),
|
|
42
|
+
promotions: Schema.optionalWith(Schema.Array(RawPromotionMetadataSchema), { exact: true }),
|
|
43
|
+
quantityInBasket: Schema.Number,
|
|
44
|
+
retailerProductId: Schema.String,
|
|
45
|
+
unitPrice: Schema.optionalWith(UnitPriceSchema, { exact: true })
|
|
46
|
+
}).pipe(Schema.extend(UnknownStringRecordSchema));
|
|
47
|
+
export const RawPromotionProductGroupSchema = Schema.Struct({
|
|
48
|
+
decoratedProducts: Schema.optionalWith(Schema.Array(RawPromotionProductSchema), { exact: true }),
|
|
49
|
+
name: Schema.optionalWith(Schema.String, { exact: true }),
|
|
50
|
+
products: Schema.optionalWith(Schema.Array(RawPromotionProductSchema), { exact: true }),
|
|
51
|
+
type: Schema.String
|
|
52
|
+
}).pipe(Schema.extend(UnknownStringRecordSchema));
|
|
53
|
+
const NonNegativeIntegerSchema = Schema.Number.pipe(Schema.finite(), Schema.int(), Schema.nonNegative());
|
|
54
|
+
export const PromotionProductsResponseSchema = Schema.Struct({
|
|
55
|
+
nextPageToken: Schema.optionalWith(Schema.String, { exact: true }),
|
|
56
|
+
productGroups: Schema.Array(RawPromotionProductGroupSchema),
|
|
57
|
+
totalProducts: Schema.optionalWith(NonNegativeIntegerSchema, { exact: true })
|
|
58
|
+
}).pipe(Schema.extend(UnknownStringRecordSchema));
|
|
59
|
+
//# sourceMappingURL=discount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discount.js","sourceRoot":"","sources":["../../../../src/domain/schemas/discount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEzD,MAAM,CAAC,MAAM,sBAAsB,GAAG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,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,yBAAyB,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAChG,IAAI,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzD,QAAQ,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,yBAAyB,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACvF,IAAI,EAAE,MAAM,CAAC,MAAM;CACpB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC,CAAA;AAIjD,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CACjD,MAAM,CAAC,MAAM,EAAE,EACf,MAAM,CAAC,GAAG,EAAE,EACZ,MAAM,CAAC,WAAW,EAAE,CACrB,CAAA;AAED,MAAM,CAAC,MAAM,+BAA+B,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3D,aAAa,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAClE,aAAa,EAAE,MAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC;IAC3D,aAAa,EAAE,MAAM,CAAC,YAAY,CAAC,wBAAwB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;CAC9E,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC,CAAA"}
|
|
@@ -4,6 +4,7 @@ export * from "./category-page.js";
|
|
|
4
4
|
export * from "./category.js";
|
|
5
5
|
export * from "./checkout-summary.js";
|
|
6
6
|
export * from "./delivery-destination.js";
|
|
7
|
+
export * from "./discount.js";
|
|
7
8
|
export * from "./money.js";
|
|
8
9
|
export * from "./order-details.js";
|
|
9
10
|
export * from "./order-history.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/domain/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/domain/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA"}
|
|
@@ -4,6 +4,7 @@ export * from "./category-page.js";
|
|
|
4
4
|
export * from "./category.js";
|
|
5
5
|
export * from "./checkout-summary.js";
|
|
6
6
|
export * from "./delivery-destination.js";
|
|
7
|
+
export * from "./discount.js";
|
|
7
8
|
export * from "./money.js";
|
|
8
9
|
export * from "./order-details.js";
|
|
9
10
|
export * from "./order-history.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/domain/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/domain/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,eAAe,CAAA;AAC7B,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export * from "./voila/category-products.js";
|
|
|
12
12
|
export * from "./voila/checkout-summary.js";
|
|
13
13
|
export * from "./voila/checkout-urls.js";
|
|
14
14
|
export * from "./voila/delivery-destinations.js";
|
|
15
|
+
export * from "./voila/discount-urls.js";
|
|
16
|
+
export * from "./voila/discounted-products.js";
|
|
15
17
|
export * from "./voila/guest-bootstrap.js";
|
|
16
18
|
export * from "./voila/headers.js";
|
|
17
19
|
export * from "./voila/http-client.js";
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,mBAAmB,CAAA;AACjC,cAAc,2BAA2B,CAAA;AACzC,cAAc,kCAAkC,CAAA;AAChD,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,0BAA0B,CAAA;AACxC,cAAc,kCAAkC,CAAA;AAChD,cAAc,4BAA4B,CAAA;AAC1C,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,mBAAmB,CAAA;AACjC,cAAc,2BAA2B,CAAA;AACzC,cAAc,kCAAkC,CAAA;AAChD,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,0BAA0B,CAAA;AACxC,cAAc,kCAAkC,CAAA;AAChD,cAAc,0BAA0B,CAAA;AACxC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,2BAA2B,CAAA;AACzC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA"}
|
package/dist/src/index.js
CHANGED
|
@@ -12,6 +12,8 @@ export * from "./voila/category-products.js";
|
|
|
12
12
|
export * from "./voila/checkout-summary.js";
|
|
13
13
|
export * from "./voila/checkout-urls.js";
|
|
14
14
|
export * from "./voila/delivery-destinations.js";
|
|
15
|
+
export * from "./voila/discount-urls.js";
|
|
16
|
+
export * from "./voila/discounted-products.js";
|
|
15
17
|
export * from "./voila/guest-bootstrap.js";
|
|
16
18
|
export * from "./voila/headers.js";
|
|
17
19
|
export * from "./voila/http-client.js";
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,mBAAmB,CAAA;AACjC,cAAc,2BAA2B,CAAA;AACzC,cAAc,kCAAkC,CAAA;AAChD,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc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B,CAAA;AAC3C,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA"}
|
|
@@ -57,10 +57,10 @@ export declare const createInteractiveBrowserLoginPort: (driver: InteractiveBrow
|
|
|
57
57
|
readonly token: string;
|
|
58
58
|
};
|
|
59
59
|
readonly metadata: {
|
|
60
|
-
readonly regionId: string;
|
|
61
60
|
readonly assetVersion: string;
|
|
62
61
|
readonly clientRouteId: string;
|
|
63
62
|
readonly pageViewId: string;
|
|
63
|
+
readonly regionId: string;
|
|
64
64
|
};
|
|
65
65
|
};
|
|
66
66
|
}> | Either.Right<{
|
|
@@ -97,10 +97,10 @@ export declare const createInteractiveBrowserLoginPort: (driver: InteractiveBrow
|
|
|
97
97
|
readonly token: string;
|
|
98
98
|
};
|
|
99
99
|
readonly metadata: {
|
|
100
|
-
readonly regionId: string;
|
|
101
100
|
readonly assetVersion: string;
|
|
102
101
|
readonly clientRouteId: string;
|
|
103
102
|
readonly pageViewId: string;
|
|
103
|
+
readonly regionId: string;
|
|
104
104
|
};
|
|
105
105
|
};
|
|
106
106
|
}>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Either } from "effect";
|
|
2
|
+
import { type DiscountedProductsInput } from "../domain/schemas/index.js";
|
|
3
|
+
export interface DiscountedProductsRequest {
|
|
4
|
+
readonly method: "GET";
|
|
5
|
+
readonly url: URL;
|
|
6
|
+
}
|
|
7
|
+
export type DiscountedProductsRequestError = {
|
|
8
|
+
readonly _tag: "DiscountedProductsInputInvalid";
|
|
9
|
+
readonly message: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const makeDiscountedProductsRequest: (input: unknown) => Either.Either<DiscountedProductsRequest, DiscountedProductsRequestError>;
|
|
12
|
+
export declare const makeDiscountedProductsRequestFromInput: (input: DiscountedProductsInput) => DiscountedProductsRequest;
|
|
13
|
+
//# sourceMappingURL=discount-urls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discount-urls.d.ts","sourceRoot":"","sources":["../../../src/voila/discount-urls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAG/B,OAAO,EAAE,KAAK,uBAAuB,EAAiC,MAAM,4BAA4B,CAAA;AAMxG,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAA;IACtB,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAA;CAClB;AAED,MAAM,MAAM,8BAA8B,GAAG;IAC3C,QAAQ,CAAC,IAAI,EAAE,gCAAgC,CAAA;IAC/C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB,CAAA;AA6BD,eAAO,MAAM,6BAA6B,GACxC,OAAO,OAAO,KACb,MAAM,CAAC,MAAM,CAAC,yBAAyB,EAAE,8BAA8B,CAIvE,CAAA;AAEH,eAAO,MAAM,sCAAsC,GACjD,OAAO,uBAAuB,KAC7B,yBAGD,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Either } from "effect";
|
|
2
|
+
import { parseUnknown } from "../domain/parse.js";
|
|
3
|
+
import { DiscountedProductsInputSchema } from "../domain/schemas/index.js";
|
|
4
|
+
import { VOILA_BASE_URL } from "./urls.js";
|
|
5
|
+
const PROMOTIONS_PATH = "/api/product-listing-pages/v1/pages/promotions";
|
|
6
|
+
const TAG_WEB = "web";
|
|
7
|
+
const discountedProductsInputInvalid = () => ({
|
|
8
|
+
_tag: "DiscountedProductsInputInvalid",
|
|
9
|
+
message: "Discounted products input does not match the SDK schema"
|
|
10
|
+
});
|
|
11
|
+
const buildDiscountedProductsUrl = (input) => {
|
|
12
|
+
const url = new URL(PROMOTIONS_PATH, VOILA_BASE_URL);
|
|
13
|
+
url.searchParams.set("tag", TAG_WEB);
|
|
14
|
+
url.searchParams.set("includeAdditionalPageInfo", "true");
|
|
15
|
+
url.searchParams.set("maxProductsToDecorate", String(input.pageSize));
|
|
16
|
+
url.searchParams.set("maxPageSize", String(input.pageSize));
|
|
17
|
+
if (input.pageToken !== undefined) {
|
|
18
|
+
url.searchParams.set("pageToken", input.pageToken);
|
|
19
|
+
}
|
|
20
|
+
if (input.categoryId !== undefined) {
|
|
21
|
+
url.searchParams.set("categoryId", input.categoryId);
|
|
22
|
+
}
|
|
23
|
+
if (input.retailerCategoryId !== undefined) {
|
|
24
|
+
url.searchParams.set("retailerCategoryId", input.retailerCategoryId);
|
|
25
|
+
}
|
|
26
|
+
return url;
|
|
27
|
+
};
|
|
28
|
+
export const makeDiscountedProductsRequest = (input) => Either.map(Either.mapLeft(parseUnknown(DiscountedProductsInputSchema, input), discountedProductsInputInvalid), makeDiscountedProductsRequestFromInput);
|
|
29
|
+
export const makeDiscountedProductsRequestFromInput = (input) => ({
|
|
30
|
+
method: "GET",
|
|
31
|
+
url: buildDiscountedProductsUrl(input)
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=discount-urls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discount-urls.js","sourceRoot":"","sources":["../../../src/voila/discount-urls.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAgC,6BAA6B,EAAE,MAAM,4BAA4B,CAAA;AACxG,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE1C,MAAM,eAAe,GAAG,gDAAgD,CAAA;AACxE,MAAM,OAAO,GAAG,KAAK,CAAA;AAYrB,MAAM,8BAA8B,GAAG,GAAmC,EAAE,CAAC,CAAC;IAC5E,IAAI,EAAE,gCAAgC;IACtC,OAAO,EAAE,yDAAyD;CACnE,CAAC,CAAA;AAEF,MAAM,0BAA0B,GAAG,CAAC,KAA8B,EAAO,EAAE;IACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,eAAe,EAAE,cAAc,C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
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Either } from "effect";
|
|
2
|
+
import { type DiscountedProductsInput, type Money, type PromotionProductsResponse, type RawPromotionMetadata, type SessionSnapshot, type UnitPrice } from "../domain/schemas/index.js";
|
|
3
|
+
import { type DiscountedProductsRequestError } from "./discount-urls.js";
|
|
4
|
+
import type { VoilaJsonResult, VoilaSdkError, VoilaTransport } from "./http-client.js";
|
|
5
|
+
import type { CookieJarPort } from "./session-snapshot.js";
|
|
6
|
+
export interface NormalizedDiscountProduct {
|
|
7
|
+
readonly available: boolean;
|
|
8
|
+
readonly brand?: string;
|
|
9
|
+
readonly discountPrice: Money;
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly packSizeDescription?: string;
|
|
12
|
+
readonly productId: string;
|
|
13
|
+
readonly promoUnitPrice?: UnitPrice;
|
|
14
|
+
readonly promotionSummary?: string;
|
|
15
|
+
readonly promotions: ReadonlyArray<RawPromotionMetadata>;
|
|
16
|
+
readonly regularPrice: Money;
|
|
17
|
+
readonly retailerProductId: string;
|
|
18
|
+
readonly savingsAmount: number;
|
|
19
|
+
readonly savingsPercent: number;
|
|
20
|
+
readonly savingsPrice: Money;
|
|
21
|
+
readonly sourceGroupName?: string;
|
|
22
|
+
readonly sourceGroupType: string;
|
|
23
|
+
readonly unitPrice?: UnitPrice;
|
|
24
|
+
}
|
|
25
|
+
export interface DiscountScanMetadata {
|
|
26
|
+
readonly exhausted: boolean;
|
|
27
|
+
readonly matchedProducts: number;
|
|
28
|
+
readonly maxPages: number;
|
|
29
|
+
readonly nextPageToken?: string;
|
|
30
|
+
readonly pagesScanned: number;
|
|
31
|
+
readonly requestedPageSize: number;
|
|
32
|
+
readonly returnedProducts: number;
|
|
33
|
+
readonly startedPageToken?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface DiscountedProductsPagination {
|
|
36
|
+
readonly nextPageToken?: string;
|
|
37
|
+
readonly totalProducts?: number;
|
|
38
|
+
}
|
|
39
|
+
export interface NormalizedDiscountedProductsResult {
|
|
40
|
+
readonly pagination: DiscountedProductsPagination;
|
|
41
|
+
readonly products: ReadonlyArray<NormalizedDiscountProduct>;
|
|
42
|
+
readonly scan: DiscountScanMetadata;
|
|
43
|
+
}
|
|
44
|
+
export type DiscountedProductsResponseNormalizationError = {
|
|
45
|
+
readonly _tag: "DiscountedProductsResponseSchemaMismatch";
|
|
46
|
+
readonly message: string;
|
|
47
|
+
};
|
|
48
|
+
export type GetDiscountedProductsError = DiscountedProductsRequestError | VoilaSdkError;
|
|
49
|
+
export type GetDiscountedProductsResult = VoilaJsonResult<NormalizedDiscountedProductsResult>;
|
|
50
|
+
export declare const normalizeDiscountedProductsResponse: (response: PromotionProductsResponse, input: DiscountedProductsInput, scan: DiscountScanMetadata) => NormalizedDiscountedProductsResult;
|
|
51
|
+
export declare const parseDiscountedProductsResponse: (input: unknown, requestInput: DiscountedProductsInput) => Either.Either<NormalizedDiscountedProductsResult, DiscountedProductsResponseNormalizationError>;
|
|
52
|
+
export declare const getDiscountedProducts: (session: SessionSnapshot, input: unknown, transport: VoilaTransport, cookieJarPort?: CookieJarPort) => Promise<Either.Either<GetDiscountedProductsResult, GetDiscountedProductsError>>;
|
|
53
|
+
//# sourceMappingURL=discounted-products.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discounted-products.d.ts","sourceRoot":"","sources":["../../../src/voila/discounted-products.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAG/B,OAAO,EAGL,KAAK,uBAAuB,EAI5B,KAAK,KAAK,EACV,KAAK,yBAAyB,EAE9B,KAAK,oBAAoB,EAEzB,KAAK,eAAe,EACpB,KAAK,SAAS,EACf,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,KAAK,8BAA8B,EAA0C,MAAM,oBAAoB,CAAA;AAChH,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAA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_MIN_SAVINGS_PERCENT, DiscountedProductsInputSchema, MAX_DISCOUNT_QUERY_SCAN_PAGES, PromotionProductsResponseSchema } from "../domain/schemas/index.js";
|
|
4
|
+
import { makeDiscountedProductsRequestFromInput } from "./discount-urls.js";
|
|
5
|
+
import { requestVoilaJson } from "./http-client.js";
|
|
6
|
+
const centsPerDollar = 100;
|
|
7
|
+
const percentMultiplier = 100;
|
|
8
|
+
const noPagesScanned = 0;
|
|
9
|
+
const defaultDiscountSort = "best-percent";
|
|
10
|
+
const discountedProductsResponseSchemaMismatch = () => ({
|
|
11
|
+
_tag: "DiscountedProductsResponseSchemaMismatch",
|
|
12
|
+
message: "Voila discounted products response does not match the SDK schema"
|
|
13
|
+
});
|
|
14
|
+
const moneyAmount = (money) => {
|
|
15
|
+
const amount = Number(money.amount);
|
|
16
|
+
return Number.isFinite(amount) ? amount : undefined;
|
|
17
|
+
};
|
|
18
|
+
const roundCurrency = (amount) => Math.round(amount * centsPerDollar) / centsPerDollar;
|
|
19
|
+
const roundPercent = (amount) => Math.round(amount * percentMultiplier) / percentMultiplier;
|
|
20
|
+
const moneyFromAmount = (amount, currency) => ({
|
|
21
|
+
amount: roundCurrency(amount).toFixed(2),
|
|
22
|
+
currency
|
|
23
|
+
});
|
|
24
|
+
const firstPromotionSummary = (promotions) => {
|
|
25
|
+
for (const promotion of promotions) {
|
|
26
|
+
const summaries = [
|
|
27
|
+
promotion.label,
|
|
28
|
+
promotion.name,
|
|
29
|
+
promotion.description,
|
|
30
|
+
promotion.type
|
|
31
|
+
];
|
|
32
|
+
for (const summary of summaries) {
|
|
33
|
+
if (summary !== undefined && summary.trim().length > 0) {
|
|
34
|
+
return summary;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
39
|
+
};
|
|
40
|
+
const matchesQuery = (product, query) => {
|
|
41
|
+
if (query === undefined) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
const normalizedQuery = query.toLocaleLowerCase();
|
|
45
|
+
const searchable = [
|
|
46
|
+
product.name,
|
|
47
|
+
product.brand ?? "",
|
|
48
|
+
product.retailerProductId,
|
|
49
|
+
product.packSizeDescription ?? "",
|
|
50
|
+
...((product.promotions ?? []).map((promotion) => `${promotion.label ?? ""} ${promotion.name ?? ""} ${promotion.description ?? ""}`))
|
|
51
|
+
].join(" ").toLocaleLowerCase();
|
|
52
|
+
return searchable.includes(normalizedQuery);
|
|
53
|
+
};
|
|
54
|
+
const passesThreshold = (savingsAmount, savingsPercent, input) => savingsAmount >= (input.minSavingsAmount ?? DEFAULT_MIN_SAVINGS_AMOUNT)
|
|
55
|
+
|| savingsPercent >= (input.minSavingsPercent ?? DEFAULT_MIN_SAVINGS_PERCENT);
|
|
56
|
+
const normalizeProduct = (product, sourceGroup, input) => {
|
|
57
|
+
if (product.promoPrice === undefined) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
const regularAmount = moneyAmount(product.price);
|
|
61
|
+
const discountAmount = moneyAmount(product.promoPrice);
|
|
62
|
+
if (regularAmount === undefined || discountAmount === undefined || regularAmount <= discountAmount) {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
const savingsAmount = roundCurrency(regularAmount - discountAmount);
|
|
66
|
+
const savingsPercent = roundPercent((savingsAmount / regularAmount) * percentMultiplier);
|
|
67
|
+
if (!passesThreshold(savingsAmount, savingsPercent, input) || !matchesQuery(product, input.query)) {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
const promotions = product.promotions ?? [];
|
|
71
|
+
const promotionSummary = firstPromotionSummary(promotions);
|
|
72
|
+
return {
|
|
73
|
+
available: product.available,
|
|
74
|
+
...(product.brand === undefined ? {} : { brand: product.brand }),
|
|
75
|
+
discountPrice: product.promoPrice,
|
|
76
|
+
name: product.name,
|
|
77
|
+
...(product.packSizeDescription === undefined ? {} : { packSizeDescription: product.packSizeDescription }),
|
|
78
|
+
productId: product.productId,
|
|
79
|
+
...(product.promoUnitPrice === undefined ? {} : { promoUnitPrice: product.promoUnitPrice }),
|
|
80
|
+
...(promotionSummary === undefined ? {} : { promotionSummary }),
|
|
81
|
+
promotions,
|
|
82
|
+
regularPrice: product.price,
|
|
83
|
+
retailerProductId: product.retailerProductId,
|
|
84
|
+
savingsAmount,
|
|
85
|
+
savingsPercent,
|
|
86
|
+
savingsPrice: moneyFromAmount(savingsAmount, product.price.currency),
|
|
87
|
+
...(sourceGroup.name === undefined ? {} : { sourceGroupName: sourceGroup.name }),
|
|
88
|
+
sourceGroupType: sourceGroup.type,
|
|
89
|
+
...(product.unitPrice === undefined ? {} : { unitPrice: product.unitPrice })
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
const normalizeResponseProducts = (response, input) => response.productGroups.flatMap((group) => [
|
|
93
|
+
...(group.decoratedProducts ?? []),
|
|
94
|
+
...(group.products ?? [])
|
|
95
|
+
].flatMap((product) => {
|
|
96
|
+
const normalized = normalizeProduct(product, group, input);
|
|
97
|
+
return normalized === undefined ? [] : [normalized];
|
|
98
|
+
}));
|
|
99
|
+
const compareDiscountProducts = (sort, left, right) => {
|
|
100
|
+
switch (sort) {
|
|
101
|
+
case "best-amount":
|
|
102
|
+
return right.savingsAmount - left.savingsAmount;
|
|
103
|
+
case "best-percent":
|
|
104
|
+
return right.savingsPercent - left.savingsPercent;
|
|
105
|
+
case "price-asc":
|
|
106
|
+
return Number(left.discountPrice.amount) - Number(right.discountPrice.amount);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
const sortDiscountProducts = (products, sort) => [...products].sort((left, right) => compareDiscountProducts(sort, left, right));
|
|
110
|
+
export const normalizeDiscountedProductsResponse = (response, input, scan) => {
|
|
111
|
+
const sorted = sortDiscountProducts(normalizeResponseProducts(response, input), input.sort ?? defaultDiscountSort);
|
|
112
|
+
const products = input.query !== undefined && sorted.length > input.pageSize
|
|
113
|
+
? sorted
|
|
114
|
+
: sorted.slice(0, input.pageSize);
|
|
115
|
+
return {
|
|
116
|
+
pagination: {
|
|
117
|
+
...(scan.nextPageToken === undefined ? {} : { nextPageToken: scan.nextPageToken }),
|
|
118
|
+
...(response.totalProducts === undefined ? {} : { totalProducts: response.totalProducts })
|
|
119
|
+
},
|
|
120
|
+
products,
|
|
121
|
+
scan: {
|
|
122
|
+
...scan,
|
|
123
|
+
matchedProducts: sorted.length,
|
|
124
|
+
returnedProducts: products.length
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
export const parseDiscountedProductsResponse = (input, requestInput) => Either.map(Either.mapLeft(parseUnknown(PromotionProductsResponseSchema, input), discountedProductsResponseSchemaMismatch), (response) => normalizeDiscountedProductsResponse(response, requestInput, {
|
|
129
|
+
exhausted: response.nextPageToken === undefined,
|
|
130
|
+
matchedProducts: noPagesScanned,
|
|
131
|
+
maxPages: 1,
|
|
132
|
+
...(response.nextPageToken === undefined ? {} : { nextPageToken: response.nextPageToken }),
|
|
133
|
+
pagesScanned: 1,
|
|
134
|
+
requestedPageSize: requestInput.pageSize,
|
|
135
|
+
returnedProducts: noPagesScanned,
|
|
136
|
+
...(requestInput.pageToken === undefined ? {} : { startedPageToken: requestInput.pageToken })
|
|
137
|
+
}));
|
|
138
|
+
const makePageInput = (input, pageToken) => ({
|
|
139
|
+
...input,
|
|
140
|
+
...(pageToken === undefined ? {} : { pageToken })
|
|
141
|
+
});
|
|
142
|
+
const makeScanMetadata = (input, pagesScanned, maxPages, nextPageToken) => ({
|
|
143
|
+
exhausted: nextPageToken === undefined,
|
|
144
|
+
matchedProducts: noPagesScanned,
|
|
145
|
+
maxPages,
|
|
146
|
+
...(nextPageToken === undefined ? {} : { nextPageToken }),
|
|
147
|
+
pagesScanned,
|
|
148
|
+
requestedPageSize: input.pageSize,
|
|
149
|
+
returnedProducts: noPagesScanned,
|
|
150
|
+
...(input.pageToken === undefined ? {} : { startedPageToken: input.pageToken })
|
|
151
|
+
});
|
|
152
|
+
export const getDiscountedProducts = async (session, input, transport, cookieJarPort) => {
|
|
153
|
+
const parsed = Either.mapLeft(parseUnknown(DiscountedProductsInputSchema, input), () => ({
|
|
154
|
+
_tag: "DiscountedProductsInputInvalid",
|
|
155
|
+
message: "Discounted products input does not match the SDK schema"
|
|
156
|
+
}));
|
|
157
|
+
if (Either.isLeft(parsed)) {
|
|
158
|
+
return Either.left(parsed.left);
|
|
159
|
+
}
|
|
160
|
+
const maxPages = parsed.right.query === undefined ? 1 : MAX_DISCOUNT_QUERY_SCAN_PAGES;
|
|
161
|
+
let currentSession = session;
|
|
162
|
+
let pageToken = parsed.right.pageToken;
|
|
163
|
+
let response = {
|
|
164
|
+
productGroups: []
|
|
165
|
+
};
|
|
166
|
+
let pagesScanned = noPagesScanned;
|
|
167
|
+
while (pagesScanned < maxPages) {
|
|
168
|
+
const pageInput = makePageInput(parsed.right, pageToken);
|
|
169
|
+
const request = makeDiscountedProductsRequestFromInput(pageInput);
|
|
170
|
+
const page = await requestVoilaJson(PromotionProductsResponseSchema, currentSession, request, transport, cookieJarPort);
|
|
171
|
+
if (Either.isLeft(page)) {
|
|
172
|
+
return Either.left(page.left);
|
|
173
|
+
}
|
|
174
|
+
pagesScanned += 1;
|
|
175
|
+
currentSession = page.right.session;
|
|
176
|
+
response = {
|
|
177
|
+
...page.right.value,
|
|
178
|
+
productGroups: [
|
|
179
|
+
...response.productGroups,
|
|
180
|
+
...page.right.value.productGroups
|
|
181
|
+
]
|
|
182
|
+
};
|
|
183
|
+
pageToken = page.right.value.nextPageToken;
|
|
184
|
+
const matchedProducts = normalizeResponseProducts(response, parsed.right).length;
|
|
185
|
+
if (pageToken === undefined || matchedProducts >= parsed.right.pageSize) {
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
const scan = makeScanMetadata(parsed.right, pagesScanned, maxPages, pageToken);
|
|
190
|
+
return Either.right({
|
|
191
|
+
session: currentSession,
|
|
192
|
+
value: normalizeDiscountedProductsResponse(response, parsed.right, scan)
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
//# sourceMappingURL=discounted-products.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discounted-products.js","sourceRoot":"","sources":["../../../src/voila/discounted-products.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,EAE3B,6BAA6B,EAE7B,6BAA6B,EAG7B,+BAA+B,EAKhC,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAuC,sCAAsC,EAAE,MAAM,oBAAoB,CAAA;AAEhH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAsDnD,MAAM,cAAc,GAAG,GAAG,CAAA;AAC1B,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAC7B,MAAM,cAAc,GAAG,CAAC,CAAA;AACxB,MAAM,mBAAmB,GAAiB,cAAc,CAAA;AAExD,MAAM,wCAAwC,GAAG,GAAiD,EAAE,CAAC,CAAC;IACpG,IAAI,EAAE,0CAA0C;IAChD,OAAO,EAAE,kEAAkE;CAC5E,CAAC,CAAA;AAEF,MAAM,WAAW,GAAG,CAAC,KAAY,EAAsB,EAAE;IACvD,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAEnC,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;AACrD,CAAC,CAAA;AAED,MAAM,aAAa,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,cAAc,CAAC,GAAG,cAAc,CAAA;AAEtG,MAAM,YAAY,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,iBAAiB,CAA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