@brytdesigns/shopify-ajax-cart-api 1.0.37 → 1.0.39
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/effect/api/CartAdd.js.map +1 -1
- package/dist/effect/api/CartChange.js.map +1 -1
- package/dist/effect/api/CartClear.js.map +1 -1
- package/dist/effect/api/CartGet.js.map +1 -1
- package/dist/effect/api/CartUpdate.js.map +1 -1
- package/dist/effect/index.d.ts +247 -247
- package/dist/effect/schema.js +612 -19
- package/dist/effect/schema.js.map +1 -1
- package/dist/esm/index.js +1312 -515
- package/dist/esm/index.js.map +1 -1
- package/dist/main/effect/api/CartAdd.js.map +1 -1
- package/dist/main/effect/api/CartChange.js.map +1 -1
- package/dist/main/effect/api/CartClear.js.map +1 -1
- package/dist/main/effect/api/CartGet.js.map +1 -1
- package/dist/main/effect/api/CartUpdate.js.map +1 -1
- package/dist/main/effect/schema.js +612 -19
- package/dist/main/effect/schema.js.map +1 -1
- package/dist/main/index.d.ts +743 -547
- package/dist/main/index.js +137 -0
- package/dist/main/index.js.map +1 -1
- package/package.json +5 -5
package/dist/main/index.d.ts
CHANGED
|
@@ -122,11 +122,52 @@ declare const add: (input?: ({
|
|
|
122
122
|
} | {
|
|
123
123
|
readonly data?: {
|
|
124
124
|
readonly items: readonly ({
|
|
125
|
-
readonly key: string;
|
|
126
125
|
readonly title: string;
|
|
126
|
+
readonly key: string;
|
|
127
127
|
readonly url: string;
|
|
128
|
+
readonly image: string | null;
|
|
129
|
+
readonly quantity_rule?: {
|
|
130
|
+
readonly min: number;
|
|
131
|
+
readonly max: number | null;
|
|
132
|
+
readonly increment: number;
|
|
133
|
+
} | undefined;
|
|
128
134
|
readonly price: number;
|
|
129
135
|
readonly id: string | number;
|
|
136
|
+
readonly selling_plan_allocation: {
|
|
137
|
+
readonly price: number;
|
|
138
|
+
readonly price_adjustments: readonly {
|
|
139
|
+
readonly position: number;
|
|
140
|
+
readonly price: number;
|
|
141
|
+
}[];
|
|
142
|
+
readonly selling_plan: {
|
|
143
|
+
readonly description: string | null;
|
|
144
|
+
readonly name: string;
|
|
145
|
+
readonly id: string | number;
|
|
146
|
+
readonly options: readonly {
|
|
147
|
+
readonly value: string;
|
|
148
|
+
readonly name: string;
|
|
149
|
+
readonly position: number;
|
|
150
|
+
}[];
|
|
151
|
+
readonly recurring_deliveries: boolean;
|
|
152
|
+
readonly fixed_selling_plan: boolean;
|
|
153
|
+
readonly price_adjustments: readonly {
|
|
154
|
+
readonly value: string | number;
|
|
155
|
+
readonly value_type: "fixed_amount" | "percentage" | "price";
|
|
156
|
+
readonly position: number;
|
|
157
|
+
readonly order_count: number | null;
|
|
158
|
+
}[];
|
|
159
|
+
};
|
|
160
|
+
readonly compare_at_price: number;
|
|
161
|
+
readonly per_delivery_price: number;
|
|
162
|
+
} | null;
|
|
163
|
+
readonly unit_price_measurement?: {
|
|
164
|
+
readonly measured_type: "volume" | "weight" | "dimension";
|
|
165
|
+
readonly quantity_unit: string;
|
|
166
|
+
readonly quantity_value: number;
|
|
167
|
+
readonly reference_unit: string;
|
|
168
|
+
readonly reference_value: number;
|
|
169
|
+
} | undefined;
|
|
170
|
+
readonly variant_options: readonly string[];
|
|
130
171
|
readonly properties: {
|
|
131
172
|
readonly [x: string]: string | number | boolean | null;
|
|
132
173
|
};
|
|
@@ -157,73 +198,32 @@ declare const add: (input?: ({
|
|
|
157
198
|
readonly url: string | null;
|
|
158
199
|
readonly width: number | null;
|
|
159
200
|
};
|
|
160
|
-
readonly image: string | null;
|
|
161
201
|
readonly handle: string;
|
|
162
202
|
readonly requires_shipping: boolean;
|
|
163
203
|
readonly product_type: string | null;
|
|
164
204
|
readonly product_title: string;
|
|
165
205
|
readonly product_description: string | null;
|
|
166
206
|
readonly variant_title: string | null;
|
|
167
|
-
readonly variant_options: readonly string[];
|
|
168
207
|
readonly options_with_values: readonly {
|
|
169
208
|
readonly value: string;
|
|
170
209
|
readonly name: string;
|
|
171
210
|
}[];
|
|
172
211
|
readonly line_level_discount_allocations: readonly {
|
|
173
|
-
readonly amount: number;
|
|
174
212
|
readonly discount_application: {
|
|
213
|
+
readonly title: string;
|
|
214
|
+
readonly description: string | null;
|
|
175
215
|
readonly value: number;
|
|
176
216
|
readonly target_selection: "all" | "entitled" | "explicit";
|
|
177
217
|
readonly target_type: "line_item" | "shipping_line";
|
|
178
|
-
readonly title: string;
|
|
179
218
|
readonly total_allocated_amount: number;
|
|
180
219
|
readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
|
|
181
220
|
readonly value_type: "fixed_amount" | "percentage";
|
|
182
|
-
readonly description: string | null;
|
|
183
221
|
};
|
|
222
|
+
readonly amount: number;
|
|
184
223
|
}[];
|
|
185
224
|
readonly line_level_total_discount: number;
|
|
186
|
-
readonly quantity_rule?: {
|
|
187
|
-
readonly min: number;
|
|
188
|
-
readonly max: number | null;
|
|
189
|
-
readonly increment: number;
|
|
190
|
-
} | undefined;
|
|
191
225
|
readonly has_components: boolean;
|
|
192
226
|
readonly unit_price?: number | undefined;
|
|
193
|
-
readonly unit_price_measurement?: {
|
|
194
|
-
readonly measured_type: "volume" | "weight" | "dimension";
|
|
195
|
-
readonly quantity_unit: string;
|
|
196
|
-
readonly quantity_value: number;
|
|
197
|
-
readonly reference_unit: string;
|
|
198
|
-
readonly reference_value: number;
|
|
199
|
-
} | undefined;
|
|
200
|
-
readonly selling_plan_allocation: {
|
|
201
|
-
readonly price: number;
|
|
202
|
-
readonly price_adjustments: readonly {
|
|
203
|
-
readonly position: number;
|
|
204
|
-
readonly price: number;
|
|
205
|
-
}[];
|
|
206
|
-
readonly compare_at_price: number;
|
|
207
|
-
readonly per_delivery_price: number;
|
|
208
|
-
readonly selling_plan: {
|
|
209
|
-
readonly description: string | null;
|
|
210
|
-
readonly name: string;
|
|
211
|
-
readonly id: string | number;
|
|
212
|
-
readonly options: readonly {
|
|
213
|
-
readonly value: string;
|
|
214
|
-
readonly name: string;
|
|
215
|
-
readonly position: number;
|
|
216
|
-
}[];
|
|
217
|
-
readonly recurring_deliveries: boolean;
|
|
218
|
-
readonly fixed_selling_plan: boolean;
|
|
219
|
-
readonly price_adjustments: readonly {
|
|
220
|
-
readonly value: string | number;
|
|
221
|
-
readonly value_type: "fixed_amount" | "percentage" | "price";
|
|
222
|
-
readonly position: number;
|
|
223
|
-
readonly order_count: number | null;
|
|
224
|
-
}[];
|
|
225
|
-
};
|
|
226
|
-
} | null;
|
|
227
227
|
} & {
|
|
228
228
|
readonly properties_array: readonly {
|
|
229
229
|
readonly key: string;
|
|
@@ -287,6 +287,9 @@ declare const change: (input?: ({
|
|
|
287
287
|
} | undefined;
|
|
288
288
|
} | {
|
|
289
289
|
readonly data?: ({
|
|
290
|
+
readonly attributes: {
|
|
291
|
+
readonly [x: string]: string | number | boolean | null;
|
|
292
|
+
};
|
|
290
293
|
readonly total_discount: number;
|
|
291
294
|
readonly discounts: readonly {
|
|
292
295
|
readonly title: string;
|
|
@@ -295,9 +298,6 @@ declare const change: (input?: ({
|
|
|
295
298
|
readonly requires_shipping: boolean;
|
|
296
299
|
readonly token: string;
|
|
297
300
|
readonly note: string | null;
|
|
298
|
-
readonly attributes: {
|
|
299
|
-
readonly [x: string]: string | number | boolean | null;
|
|
300
|
-
};
|
|
301
301
|
readonly discount_codes: readonly {
|
|
302
302
|
readonly code: string;
|
|
303
303
|
readonly applicable: boolean;
|
|
@@ -307,11 +307,52 @@ declare const change: (input?: ({
|
|
|
307
307
|
readonly total_weight: number;
|
|
308
308
|
readonly item_count: number;
|
|
309
309
|
readonly items: readonly ({
|
|
310
|
-
readonly key: string;
|
|
311
310
|
readonly title: string;
|
|
311
|
+
readonly key: string;
|
|
312
312
|
readonly url: string;
|
|
313
|
+
readonly image: string | null;
|
|
314
|
+
readonly quantity_rule?: {
|
|
315
|
+
readonly min: number;
|
|
316
|
+
readonly max: number | null;
|
|
317
|
+
readonly increment: number;
|
|
318
|
+
} | undefined;
|
|
313
319
|
readonly price: number;
|
|
314
320
|
readonly id: string | number;
|
|
321
|
+
readonly selling_plan_allocation: {
|
|
322
|
+
readonly price: number;
|
|
323
|
+
readonly price_adjustments: readonly {
|
|
324
|
+
readonly position: number;
|
|
325
|
+
readonly price: number;
|
|
326
|
+
}[];
|
|
327
|
+
readonly selling_plan: {
|
|
328
|
+
readonly description: string | null;
|
|
329
|
+
readonly name: string;
|
|
330
|
+
readonly id: string | number;
|
|
331
|
+
readonly options: readonly {
|
|
332
|
+
readonly value: string;
|
|
333
|
+
readonly name: string;
|
|
334
|
+
readonly position: number;
|
|
335
|
+
}[];
|
|
336
|
+
readonly recurring_deliveries: boolean;
|
|
337
|
+
readonly fixed_selling_plan: boolean;
|
|
338
|
+
readonly price_adjustments: readonly {
|
|
339
|
+
readonly value: string | number;
|
|
340
|
+
readonly value_type: "fixed_amount" | "percentage" | "price";
|
|
341
|
+
readonly position: number;
|
|
342
|
+
readonly order_count: number | null;
|
|
343
|
+
}[];
|
|
344
|
+
};
|
|
345
|
+
readonly compare_at_price: number;
|
|
346
|
+
readonly per_delivery_price: number;
|
|
347
|
+
} | null;
|
|
348
|
+
readonly unit_price_measurement?: {
|
|
349
|
+
readonly measured_type: "volume" | "weight" | "dimension";
|
|
350
|
+
readonly quantity_unit: string;
|
|
351
|
+
readonly quantity_value: number;
|
|
352
|
+
readonly reference_unit: string;
|
|
353
|
+
readonly reference_value: number;
|
|
354
|
+
} | undefined;
|
|
355
|
+
readonly variant_options: readonly string[];
|
|
315
356
|
readonly properties: {
|
|
316
357
|
readonly [x: string]: string | number | boolean | null;
|
|
317
358
|
};
|
|
@@ -342,73 +383,32 @@ declare const change: (input?: ({
|
|
|
342
383
|
readonly url: string | null;
|
|
343
384
|
readonly width: number | null;
|
|
344
385
|
};
|
|
345
|
-
readonly image: string | null;
|
|
346
386
|
readonly handle: string;
|
|
347
387
|
readonly requires_shipping: boolean;
|
|
348
388
|
readonly product_type: string | null;
|
|
349
389
|
readonly product_title: string;
|
|
350
390
|
readonly product_description: string | null;
|
|
351
391
|
readonly variant_title: string | null;
|
|
352
|
-
readonly variant_options: readonly string[];
|
|
353
392
|
readonly options_with_values: readonly {
|
|
354
393
|
readonly value: string;
|
|
355
394
|
readonly name: string;
|
|
356
395
|
}[];
|
|
357
396
|
readonly line_level_discount_allocations: readonly {
|
|
358
|
-
readonly amount: number;
|
|
359
397
|
readonly discount_application: {
|
|
398
|
+
readonly title: string;
|
|
399
|
+
readonly description: string | null;
|
|
360
400
|
readonly value: number;
|
|
361
401
|
readonly target_selection: "all" | "entitled" | "explicit";
|
|
362
402
|
readonly target_type: "line_item" | "shipping_line";
|
|
363
|
-
readonly title: string;
|
|
364
403
|
readonly total_allocated_amount: number;
|
|
365
404
|
readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
|
|
366
405
|
readonly value_type: "fixed_amount" | "percentage";
|
|
367
|
-
readonly description: string | null;
|
|
368
406
|
};
|
|
407
|
+
readonly amount: number;
|
|
369
408
|
}[];
|
|
370
409
|
readonly line_level_total_discount: number;
|
|
371
|
-
readonly quantity_rule?: {
|
|
372
|
-
readonly min: number;
|
|
373
|
-
readonly max: number | null;
|
|
374
|
-
readonly increment: number;
|
|
375
|
-
} | undefined;
|
|
376
410
|
readonly has_components: boolean;
|
|
377
411
|
readonly unit_price?: number | undefined;
|
|
378
|
-
readonly unit_price_measurement?: {
|
|
379
|
-
readonly measured_type: "volume" | "weight" | "dimension";
|
|
380
|
-
readonly quantity_unit: string;
|
|
381
|
-
readonly quantity_value: number;
|
|
382
|
-
readonly reference_unit: string;
|
|
383
|
-
readonly reference_value: number;
|
|
384
|
-
} | undefined;
|
|
385
|
-
readonly selling_plan_allocation: {
|
|
386
|
-
readonly price: number;
|
|
387
|
-
readonly price_adjustments: readonly {
|
|
388
|
-
readonly position: number;
|
|
389
|
-
readonly price: number;
|
|
390
|
-
}[];
|
|
391
|
-
readonly compare_at_price: number;
|
|
392
|
-
readonly per_delivery_price: number;
|
|
393
|
-
readonly selling_plan: {
|
|
394
|
-
readonly description: string | null;
|
|
395
|
-
readonly name: string;
|
|
396
|
-
readonly id: string | number;
|
|
397
|
-
readonly options: readonly {
|
|
398
|
-
readonly value: string;
|
|
399
|
-
readonly name: string;
|
|
400
|
-
readonly position: number;
|
|
401
|
-
}[];
|
|
402
|
-
readonly recurring_deliveries: boolean;
|
|
403
|
-
readonly fixed_selling_plan: boolean;
|
|
404
|
-
readonly price_adjustments: readonly {
|
|
405
|
-
readonly value: string | number;
|
|
406
|
-
readonly value_type: "fixed_amount" | "percentage" | "price";
|
|
407
|
-
readonly position: number;
|
|
408
|
-
readonly order_count: number | null;
|
|
409
|
-
}[];
|
|
410
|
-
};
|
|
411
|
-
} | null;
|
|
412
412
|
} & {
|
|
413
413
|
readonly properties_array: readonly {
|
|
414
414
|
readonly key: string;
|
|
@@ -432,14 +432,14 @@ declare const change: (input?: ({
|
|
|
432
432
|
readonly currency: string;
|
|
433
433
|
readonly items_subtotal_price: number;
|
|
434
434
|
readonly cart_level_discount_applications: readonly {
|
|
435
|
+
readonly title: string;
|
|
436
|
+
readonly description: string | null;
|
|
435
437
|
readonly value: number;
|
|
436
438
|
readonly target_selection: "all" | "entitled" | "explicit";
|
|
437
439
|
readonly target_type: "line_item" | "shipping_line";
|
|
438
|
-
readonly title: string;
|
|
439
440
|
readonly total_allocated_amount: number;
|
|
440
441
|
readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
|
|
441
442
|
readonly value_type: "fixed_amount" | "percentage";
|
|
442
|
-
readonly description: string | null;
|
|
443
443
|
}[];
|
|
444
444
|
} & {
|
|
445
445
|
readonly attributes_array: readonly {
|
|
@@ -484,6 +484,9 @@ declare const clear: (input?: {
|
|
|
484
484
|
} | undefined;
|
|
485
485
|
} | {
|
|
486
486
|
readonly data?: ({
|
|
487
|
+
readonly attributes: {
|
|
488
|
+
readonly [x: string]: string | number | boolean | null;
|
|
489
|
+
};
|
|
487
490
|
readonly total_discount: number;
|
|
488
491
|
readonly discounts: readonly {
|
|
489
492
|
readonly title: string;
|
|
@@ -492,9 +495,6 @@ declare const clear: (input?: {
|
|
|
492
495
|
readonly requires_shipping: boolean;
|
|
493
496
|
readonly token: string;
|
|
494
497
|
readonly note: string | null;
|
|
495
|
-
readonly attributes: {
|
|
496
|
-
readonly [x: string]: string | number | boolean | null;
|
|
497
|
-
};
|
|
498
498
|
readonly discount_codes: readonly {
|
|
499
499
|
readonly code: string;
|
|
500
500
|
readonly applicable: boolean;
|
|
@@ -504,11 +504,52 @@ declare const clear: (input?: {
|
|
|
504
504
|
readonly total_weight: number;
|
|
505
505
|
readonly item_count: number;
|
|
506
506
|
readonly items: readonly ({
|
|
507
|
-
readonly key: string;
|
|
508
507
|
readonly title: string;
|
|
508
|
+
readonly key: string;
|
|
509
509
|
readonly url: string;
|
|
510
|
+
readonly image: string | null;
|
|
511
|
+
readonly quantity_rule?: {
|
|
512
|
+
readonly min: number;
|
|
513
|
+
readonly max: number | null;
|
|
514
|
+
readonly increment: number;
|
|
515
|
+
} | undefined;
|
|
510
516
|
readonly price: number;
|
|
511
517
|
readonly id: string | number;
|
|
518
|
+
readonly selling_plan_allocation: {
|
|
519
|
+
readonly price: number;
|
|
520
|
+
readonly price_adjustments: readonly {
|
|
521
|
+
readonly position: number;
|
|
522
|
+
readonly price: number;
|
|
523
|
+
}[];
|
|
524
|
+
readonly selling_plan: {
|
|
525
|
+
readonly description: string | null;
|
|
526
|
+
readonly name: string;
|
|
527
|
+
readonly id: string | number;
|
|
528
|
+
readonly options: readonly {
|
|
529
|
+
readonly value: string;
|
|
530
|
+
readonly name: string;
|
|
531
|
+
readonly position: number;
|
|
532
|
+
}[];
|
|
533
|
+
readonly recurring_deliveries: boolean;
|
|
534
|
+
readonly fixed_selling_plan: boolean;
|
|
535
|
+
readonly price_adjustments: readonly {
|
|
536
|
+
readonly value: string | number;
|
|
537
|
+
readonly value_type: "fixed_amount" | "percentage" | "price";
|
|
538
|
+
readonly position: number;
|
|
539
|
+
readonly order_count: number | null;
|
|
540
|
+
}[];
|
|
541
|
+
};
|
|
542
|
+
readonly compare_at_price: number;
|
|
543
|
+
readonly per_delivery_price: number;
|
|
544
|
+
} | null;
|
|
545
|
+
readonly unit_price_measurement?: {
|
|
546
|
+
readonly measured_type: "volume" | "weight" | "dimension";
|
|
547
|
+
readonly quantity_unit: string;
|
|
548
|
+
readonly quantity_value: number;
|
|
549
|
+
readonly reference_unit: string;
|
|
550
|
+
readonly reference_value: number;
|
|
551
|
+
} | undefined;
|
|
552
|
+
readonly variant_options: readonly string[];
|
|
512
553
|
readonly properties: {
|
|
513
554
|
readonly [x: string]: string | number | boolean | null;
|
|
514
555
|
};
|
|
@@ -539,73 +580,32 @@ declare const clear: (input?: {
|
|
|
539
580
|
readonly url: string | null;
|
|
540
581
|
readonly width: number | null;
|
|
541
582
|
};
|
|
542
|
-
readonly image: string | null;
|
|
543
583
|
readonly handle: string;
|
|
544
584
|
readonly requires_shipping: boolean;
|
|
545
585
|
readonly product_type: string | null;
|
|
546
586
|
readonly product_title: string;
|
|
547
587
|
readonly product_description: string | null;
|
|
548
588
|
readonly variant_title: string | null;
|
|
549
|
-
readonly variant_options: readonly string[];
|
|
550
589
|
readonly options_with_values: readonly {
|
|
551
590
|
readonly value: string;
|
|
552
591
|
readonly name: string;
|
|
553
592
|
}[];
|
|
554
593
|
readonly line_level_discount_allocations: readonly {
|
|
555
|
-
readonly amount: number;
|
|
556
594
|
readonly discount_application: {
|
|
595
|
+
readonly title: string;
|
|
596
|
+
readonly description: string | null;
|
|
557
597
|
readonly value: number;
|
|
558
598
|
readonly target_selection: "all" | "entitled" | "explicit";
|
|
559
599
|
readonly target_type: "line_item" | "shipping_line";
|
|
560
|
-
readonly title: string;
|
|
561
600
|
readonly total_allocated_amount: number;
|
|
562
601
|
readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
|
|
563
602
|
readonly value_type: "fixed_amount" | "percentage";
|
|
564
|
-
readonly description: string | null;
|
|
565
603
|
};
|
|
604
|
+
readonly amount: number;
|
|
566
605
|
}[];
|
|
567
606
|
readonly line_level_total_discount: number;
|
|
568
|
-
readonly quantity_rule?: {
|
|
569
|
-
readonly min: number;
|
|
570
|
-
readonly max: number | null;
|
|
571
|
-
readonly increment: number;
|
|
572
|
-
} | undefined;
|
|
573
607
|
readonly has_components: boolean;
|
|
574
608
|
readonly unit_price?: number | undefined;
|
|
575
|
-
readonly unit_price_measurement?: {
|
|
576
|
-
readonly measured_type: "volume" | "weight" | "dimension";
|
|
577
|
-
readonly quantity_unit: string;
|
|
578
|
-
readonly quantity_value: number;
|
|
579
|
-
readonly reference_unit: string;
|
|
580
|
-
readonly reference_value: number;
|
|
581
|
-
} | undefined;
|
|
582
|
-
readonly selling_plan_allocation: {
|
|
583
|
-
readonly price: number;
|
|
584
|
-
readonly price_adjustments: readonly {
|
|
585
|
-
readonly position: number;
|
|
586
|
-
readonly price: number;
|
|
587
|
-
}[];
|
|
588
|
-
readonly compare_at_price: number;
|
|
589
|
-
readonly per_delivery_price: number;
|
|
590
|
-
readonly selling_plan: {
|
|
591
|
-
readonly description: string | null;
|
|
592
|
-
readonly name: string;
|
|
593
|
-
readonly id: string | number;
|
|
594
|
-
readonly options: readonly {
|
|
595
|
-
readonly value: string;
|
|
596
|
-
readonly name: string;
|
|
597
|
-
readonly position: number;
|
|
598
|
-
}[];
|
|
599
|
-
readonly recurring_deliveries: boolean;
|
|
600
|
-
readonly fixed_selling_plan: boolean;
|
|
601
|
-
readonly price_adjustments: readonly {
|
|
602
|
-
readonly value: string | number;
|
|
603
|
-
readonly value_type: "fixed_amount" | "percentage" | "price";
|
|
604
|
-
readonly position: number;
|
|
605
|
-
readonly order_count: number | null;
|
|
606
|
-
}[];
|
|
607
|
-
};
|
|
608
|
-
} | null;
|
|
609
609
|
} & {
|
|
610
610
|
readonly properties_array: readonly {
|
|
611
611
|
readonly key: string;
|
|
@@ -629,14 +629,14 @@ declare const clear: (input?: {
|
|
|
629
629
|
readonly currency: string;
|
|
630
630
|
readonly items_subtotal_price: number;
|
|
631
631
|
readonly cart_level_discount_applications: readonly {
|
|
632
|
+
readonly title: string;
|
|
633
|
+
readonly description: string | null;
|
|
632
634
|
readonly value: number;
|
|
633
635
|
readonly target_selection: "all" | "entitled" | "explicit";
|
|
634
636
|
readonly target_type: "line_item" | "shipping_line";
|
|
635
|
-
readonly title: string;
|
|
636
637
|
readonly total_allocated_amount: number;
|
|
637
638
|
readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
|
|
638
639
|
readonly value_type: "fixed_amount" | "percentage";
|
|
639
|
-
readonly description: string | null;
|
|
640
640
|
}[];
|
|
641
641
|
} & {
|
|
642
642
|
readonly attributes_array: readonly {
|
|
@@ -681,6 +681,9 @@ declare const get: (input?: {
|
|
|
681
681
|
} | undefined;
|
|
682
682
|
} | {
|
|
683
683
|
readonly data?: ({
|
|
684
|
+
readonly attributes: {
|
|
685
|
+
readonly [x: string]: string | number | boolean | null;
|
|
686
|
+
};
|
|
684
687
|
readonly total_discount: number;
|
|
685
688
|
readonly discounts: readonly {
|
|
686
689
|
readonly title: string;
|
|
@@ -689,9 +692,6 @@ declare const get: (input?: {
|
|
|
689
692
|
readonly requires_shipping: boolean;
|
|
690
693
|
readonly token: string;
|
|
691
694
|
readonly note: string | null;
|
|
692
|
-
readonly attributes: {
|
|
693
|
-
readonly [x: string]: string | number | boolean | null;
|
|
694
|
-
};
|
|
695
695
|
readonly discount_codes: readonly {
|
|
696
696
|
readonly code: string;
|
|
697
697
|
readonly applicable: boolean;
|
|
@@ -701,11 +701,52 @@ declare const get: (input?: {
|
|
|
701
701
|
readonly total_weight: number;
|
|
702
702
|
readonly item_count: number;
|
|
703
703
|
readonly items: readonly ({
|
|
704
|
-
readonly key: string;
|
|
705
704
|
readonly title: string;
|
|
705
|
+
readonly key: string;
|
|
706
706
|
readonly url: string;
|
|
707
|
+
readonly image: string | null;
|
|
708
|
+
readonly quantity_rule?: {
|
|
709
|
+
readonly min: number;
|
|
710
|
+
readonly max: number | null;
|
|
711
|
+
readonly increment: number;
|
|
712
|
+
} | undefined;
|
|
707
713
|
readonly price: number;
|
|
708
714
|
readonly id: string | number;
|
|
715
|
+
readonly selling_plan_allocation: {
|
|
716
|
+
readonly price: number;
|
|
717
|
+
readonly price_adjustments: readonly {
|
|
718
|
+
readonly position: number;
|
|
719
|
+
readonly price: number;
|
|
720
|
+
}[];
|
|
721
|
+
readonly selling_plan: {
|
|
722
|
+
readonly description: string | null;
|
|
723
|
+
readonly name: string;
|
|
724
|
+
readonly id: string | number;
|
|
725
|
+
readonly options: readonly {
|
|
726
|
+
readonly value: string;
|
|
727
|
+
readonly name: string;
|
|
728
|
+
readonly position: number;
|
|
729
|
+
}[];
|
|
730
|
+
readonly recurring_deliveries: boolean;
|
|
731
|
+
readonly fixed_selling_plan: boolean;
|
|
732
|
+
readonly price_adjustments: readonly {
|
|
733
|
+
readonly value: string | number;
|
|
734
|
+
readonly value_type: "fixed_amount" | "percentage" | "price";
|
|
735
|
+
readonly position: number;
|
|
736
|
+
readonly order_count: number | null;
|
|
737
|
+
}[];
|
|
738
|
+
};
|
|
739
|
+
readonly compare_at_price: number;
|
|
740
|
+
readonly per_delivery_price: number;
|
|
741
|
+
} | null;
|
|
742
|
+
readonly unit_price_measurement?: {
|
|
743
|
+
readonly measured_type: "volume" | "weight" | "dimension";
|
|
744
|
+
readonly quantity_unit: string;
|
|
745
|
+
readonly quantity_value: number;
|
|
746
|
+
readonly reference_unit: string;
|
|
747
|
+
readonly reference_value: number;
|
|
748
|
+
} | undefined;
|
|
749
|
+
readonly variant_options: readonly string[];
|
|
709
750
|
readonly properties: {
|
|
710
751
|
readonly [x: string]: string | number | boolean | null;
|
|
711
752
|
};
|
|
@@ -736,73 +777,32 @@ declare const get: (input?: {
|
|
|
736
777
|
readonly url: string | null;
|
|
737
778
|
readonly width: number | null;
|
|
738
779
|
};
|
|
739
|
-
readonly image: string | null;
|
|
740
780
|
readonly handle: string;
|
|
741
781
|
readonly requires_shipping: boolean;
|
|
742
782
|
readonly product_type: string | null;
|
|
743
783
|
readonly product_title: string;
|
|
744
784
|
readonly product_description: string | null;
|
|
745
785
|
readonly variant_title: string | null;
|
|
746
|
-
readonly variant_options: readonly string[];
|
|
747
786
|
readonly options_with_values: readonly {
|
|
748
787
|
readonly value: string;
|
|
749
788
|
readonly name: string;
|
|
750
789
|
}[];
|
|
751
790
|
readonly line_level_discount_allocations: readonly {
|
|
752
|
-
readonly amount: number;
|
|
753
791
|
readonly discount_application: {
|
|
792
|
+
readonly title: string;
|
|
793
|
+
readonly description: string | null;
|
|
754
794
|
readonly value: number;
|
|
755
795
|
readonly target_selection: "all" | "entitled" | "explicit";
|
|
756
796
|
readonly target_type: "line_item" | "shipping_line";
|
|
757
|
-
readonly title: string;
|
|
758
797
|
readonly total_allocated_amount: number;
|
|
759
798
|
readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
|
|
760
799
|
readonly value_type: "fixed_amount" | "percentage";
|
|
761
|
-
readonly description: string | null;
|
|
762
800
|
};
|
|
801
|
+
readonly amount: number;
|
|
763
802
|
}[];
|
|
764
803
|
readonly line_level_total_discount: number;
|
|
765
|
-
readonly quantity_rule?: {
|
|
766
|
-
readonly min: number;
|
|
767
|
-
readonly max: number | null;
|
|
768
|
-
readonly increment: number;
|
|
769
|
-
} | undefined;
|
|
770
804
|
readonly has_components: boolean;
|
|
771
805
|
readonly unit_price?: number | undefined;
|
|
772
|
-
readonly unit_price_measurement?: {
|
|
773
|
-
readonly measured_type: "volume" | "weight" | "dimension";
|
|
774
|
-
readonly quantity_unit: string;
|
|
775
|
-
readonly quantity_value: number;
|
|
776
|
-
readonly reference_unit: string;
|
|
777
|
-
readonly reference_value: number;
|
|
778
|
-
} | undefined;
|
|
779
|
-
readonly selling_plan_allocation: {
|
|
780
|
-
readonly price: number;
|
|
781
|
-
readonly price_adjustments: readonly {
|
|
782
|
-
readonly position: number;
|
|
783
|
-
readonly price: number;
|
|
784
|
-
}[];
|
|
785
|
-
readonly compare_at_price: number;
|
|
786
|
-
readonly per_delivery_price: number;
|
|
787
|
-
readonly selling_plan: {
|
|
788
|
-
readonly description: string | null;
|
|
789
|
-
readonly name: string;
|
|
790
|
-
readonly id: string | number;
|
|
791
|
-
readonly options: readonly {
|
|
792
|
-
readonly value: string;
|
|
793
|
-
readonly name: string;
|
|
794
|
-
readonly position: number;
|
|
795
|
-
}[];
|
|
796
|
-
readonly recurring_deliveries: boolean;
|
|
797
|
-
readonly fixed_selling_plan: boolean;
|
|
798
|
-
readonly price_adjustments: readonly {
|
|
799
|
-
readonly value: string | number;
|
|
800
|
-
readonly value_type: "fixed_amount" | "percentage" | "price";
|
|
801
|
-
readonly position: number;
|
|
802
|
-
readonly order_count: number | null;
|
|
803
|
-
}[];
|
|
804
|
-
};
|
|
805
|
-
} | null;
|
|
806
806
|
} & {
|
|
807
807
|
readonly properties_array: readonly {
|
|
808
808
|
readonly key: string;
|
|
@@ -826,14 +826,14 @@ declare const get: (input?: {
|
|
|
826
826
|
readonly currency: string;
|
|
827
827
|
readonly items_subtotal_price: number;
|
|
828
828
|
readonly cart_level_discount_applications: readonly {
|
|
829
|
+
readonly title: string;
|
|
830
|
+
readonly description: string | null;
|
|
829
831
|
readonly value: number;
|
|
830
832
|
readonly target_selection: "all" | "entitled" | "explicit";
|
|
831
833
|
readonly target_type: "line_item" | "shipping_line";
|
|
832
|
-
readonly title: string;
|
|
833
834
|
readonly total_allocated_amount: number;
|
|
834
835
|
readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
|
|
835
836
|
readonly value_type: "fixed_amount" | "percentage";
|
|
836
|
-
readonly description: string | null;
|
|
837
837
|
}[];
|
|
838
838
|
} & {
|
|
839
839
|
readonly attributes_array: readonly {
|
|
@@ -865,14 +865,14 @@ declare namespace update {
|
|
|
865
865
|
type Input = UpdateInput;
|
|
866
866
|
}
|
|
867
867
|
declare const update: (input?: ({
|
|
868
|
-
readonly note?: string | null | undefined;
|
|
869
868
|
readonly attributes?: {
|
|
870
869
|
readonly [x: string]: string | number | boolean | null;
|
|
871
870
|
} | undefined;
|
|
871
|
+
readonly discount?: readonly string[] | undefined;
|
|
872
|
+
readonly note?: string | null | undefined;
|
|
872
873
|
readonly updates?: {
|
|
873
874
|
readonly [x: string]: number;
|
|
874
875
|
} | readonly number[] | undefined;
|
|
875
|
-
readonly discount?: readonly string[] | undefined;
|
|
876
876
|
} & {
|
|
877
877
|
readonly sections?: readonly string[] | undefined;
|
|
878
878
|
readonly sections_url?: string | undefined;
|
|
@@ -887,6 +887,9 @@ declare const update: (input?: ({
|
|
|
887
887
|
} | undefined;
|
|
888
888
|
} | {
|
|
889
889
|
readonly data?: ({
|
|
890
|
+
readonly attributes: {
|
|
891
|
+
readonly [x: string]: string | number | boolean | null;
|
|
892
|
+
};
|
|
890
893
|
readonly total_discount: number;
|
|
891
894
|
readonly discounts: readonly {
|
|
892
895
|
readonly title: string;
|
|
@@ -895,9 +898,6 @@ declare const update: (input?: ({
|
|
|
895
898
|
readonly requires_shipping: boolean;
|
|
896
899
|
readonly token: string;
|
|
897
900
|
readonly note: string | null;
|
|
898
|
-
readonly attributes: {
|
|
899
|
-
readonly [x: string]: string | number | boolean | null;
|
|
900
|
-
};
|
|
901
901
|
readonly discount_codes: readonly {
|
|
902
902
|
readonly code: string;
|
|
903
903
|
readonly applicable: boolean;
|
|
@@ -907,11 +907,52 @@ declare const update: (input?: ({
|
|
|
907
907
|
readonly total_weight: number;
|
|
908
908
|
readonly item_count: number;
|
|
909
909
|
readonly items: readonly ({
|
|
910
|
-
readonly key: string;
|
|
911
910
|
readonly title: string;
|
|
911
|
+
readonly key: string;
|
|
912
912
|
readonly url: string;
|
|
913
|
+
readonly image: string | null;
|
|
914
|
+
readonly quantity_rule?: {
|
|
915
|
+
readonly min: number;
|
|
916
|
+
readonly max: number | null;
|
|
917
|
+
readonly increment: number;
|
|
918
|
+
} | undefined;
|
|
913
919
|
readonly price: number;
|
|
914
920
|
readonly id: string | number;
|
|
921
|
+
readonly selling_plan_allocation: {
|
|
922
|
+
readonly price: number;
|
|
923
|
+
readonly price_adjustments: readonly {
|
|
924
|
+
readonly position: number;
|
|
925
|
+
readonly price: number;
|
|
926
|
+
}[];
|
|
927
|
+
readonly selling_plan: {
|
|
928
|
+
readonly description: string | null;
|
|
929
|
+
readonly name: string;
|
|
930
|
+
readonly id: string | number;
|
|
931
|
+
readonly options: readonly {
|
|
932
|
+
readonly value: string;
|
|
933
|
+
readonly name: string;
|
|
934
|
+
readonly position: number;
|
|
935
|
+
}[];
|
|
936
|
+
readonly recurring_deliveries: boolean;
|
|
937
|
+
readonly fixed_selling_plan: boolean;
|
|
938
|
+
readonly price_adjustments: readonly {
|
|
939
|
+
readonly value: string | number;
|
|
940
|
+
readonly value_type: "fixed_amount" | "percentage" | "price";
|
|
941
|
+
readonly position: number;
|
|
942
|
+
readonly order_count: number | null;
|
|
943
|
+
}[];
|
|
944
|
+
};
|
|
945
|
+
readonly compare_at_price: number;
|
|
946
|
+
readonly per_delivery_price: number;
|
|
947
|
+
} | null;
|
|
948
|
+
readonly unit_price_measurement?: {
|
|
949
|
+
readonly measured_type: "volume" | "weight" | "dimension";
|
|
950
|
+
readonly quantity_unit: string;
|
|
951
|
+
readonly quantity_value: number;
|
|
952
|
+
readonly reference_unit: string;
|
|
953
|
+
readonly reference_value: number;
|
|
954
|
+
} | undefined;
|
|
955
|
+
readonly variant_options: readonly string[];
|
|
915
956
|
readonly properties: {
|
|
916
957
|
readonly [x: string]: string | number | boolean | null;
|
|
917
958
|
};
|
|
@@ -942,73 +983,32 @@ declare const update: (input?: ({
|
|
|
942
983
|
readonly url: string | null;
|
|
943
984
|
readonly width: number | null;
|
|
944
985
|
};
|
|
945
|
-
readonly image: string | null;
|
|
946
986
|
readonly handle: string;
|
|
947
987
|
readonly requires_shipping: boolean;
|
|
948
988
|
readonly product_type: string | null;
|
|
949
989
|
readonly product_title: string;
|
|
950
990
|
readonly product_description: string | null;
|
|
951
991
|
readonly variant_title: string | null;
|
|
952
|
-
readonly variant_options: readonly string[];
|
|
953
992
|
readonly options_with_values: readonly {
|
|
954
993
|
readonly value: string;
|
|
955
994
|
readonly name: string;
|
|
956
995
|
}[];
|
|
957
996
|
readonly line_level_discount_allocations: readonly {
|
|
958
|
-
readonly amount: number;
|
|
959
997
|
readonly discount_application: {
|
|
998
|
+
readonly title: string;
|
|
999
|
+
readonly description: string | null;
|
|
960
1000
|
readonly value: number;
|
|
961
1001
|
readonly target_selection: "all" | "entitled" | "explicit";
|
|
962
1002
|
readonly target_type: "line_item" | "shipping_line";
|
|
963
|
-
readonly title: string;
|
|
964
1003
|
readonly total_allocated_amount: number;
|
|
965
1004
|
readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
|
|
966
1005
|
readonly value_type: "fixed_amount" | "percentage";
|
|
967
|
-
readonly description: string | null;
|
|
968
1006
|
};
|
|
1007
|
+
readonly amount: number;
|
|
969
1008
|
}[];
|
|
970
1009
|
readonly line_level_total_discount: number;
|
|
971
|
-
readonly quantity_rule?: {
|
|
972
|
-
readonly min: number;
|
|
973
|
-
readonly max: number | null;
|
|
974
|
-
readonly increment: number;
|
|
975
|
-
} | undefined;
|
|
976
1010
|
readonly has_components: boolean;
|
|
977
1011
|
readonly unit_price?: number | undefined;
|
|
978
|
-
readonly unit_price_measurement?: {
|
|
979
|
-
readonly measured_type: "volume" | "weight" | "dimension";
|
|
980
|
-
readonly quantity_unit: string;
|
|
981
|
-
readonly quantity_value: number;
|
|
982
|
-
readonly reference_unit: string;
|
|
983
|
-
readonly reference_value: number;
|
|
984
|
-
} | undefined;
|
|
985
|
-
readonly selling_plan_allocation: {
|
|
986
|
-
readonly price: number;
|
|
987
|
-
readonly price_adjustments: readonly {
|
|
988
|
-
readonly position: number;
|
|
989
|
-
readonly price: number;
|
|
990
|
-
}[];
|
|
991
|
-
readonly compare_at_price: number;
|
|
992
|
-
readonly per_delivery_price: number;
|
|
993
|
-
readonly selling_plan: {
|
|
994
|
-
readonly description: string | null;
|
|
995
|
-
readonly name: string;
|
|
996
|
-
readonly id: string | number;
|
|
997
|
-
readonly options: readonly {
|
|
998
|
-
readonly value: string;
|
|
999
|
-
readonly name: string;
|
|
1000
|
-
readonly position: number;
|
|
1001
|
-
}[];
|
|
1002
|
-
readonly recurring_deliveries: boolean;
|
|
1003
|
-
readonly fixed_selling_plan: boolean;
|
|
1004
|
-
readonly price_adjustments: readonly {
|
|
1005
|
-
readonly value: string | number;
|
|
1006
|
-
readonly value_type: "fixed_amount" | "percentage" | "price";
|
|
1007
|
-
readonly position: number;
|
|
1008
|
-
readonly order_count: number | null;
|
|
1009
|
-
}[];
|
|
1010
|
-
};
|
|
1011
|
-
} | null;
|
|
1012
1012
|
} & {
|
|
1013
1013
|
readonly properties_array: readonly {
|
|
1014
1014
|
readonly key: string;
|
|
@@ -1032,14 +1032,14 @@ declare const update: (input?: ({
|
|
|
1032
1032
|
readonly currency: string;
|
|
1033
1033
|
readonly items_subtotal_price: number;
|
|
1034
1034
|
readonly cart_level_discount_applications: readonly {
|
|
1035
|
+
readonly title: string;
|
|
1036
|
+
readonly description: string | null;
|
|
1035
1037
|
readonly value: number;
|
|
1036
1038
|
readonly target_selection: "all" | "entitled" | "explicit";
|
|
1037
1039
|
readonly target_type: "line_item" | "shipping_line";
|
|
1038
|
-
readonly title: string;
|
|
1039
1040
|
readonly total_allocated_amount: number;
|
|
1040
1041
|
readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
|
|
1041
1042
|
readonly value_type: "fixed_amount" | "percentage";
|
|
1042
|
-
readonly description: string | null;
|
|
1043
1043
|
}[];
|
|
1044
1044
|
} & {
|
|
1045
1045
|
readonly attributes_array: readonly {
|
|
@@ -1076,7 +1076,43 @@ export declare namespace createAjaxCartClient {
|
|
|
1076
1076
|
headers?: Record<string, string>;
|
|
1077
1077
|
};
|
|
1078
1078
|
}
|
|
1079
|
-
|
|
1079
|
+
/**
|
|
1080
|
+
* Validates the input cart object against the defined CartOutput schema.
|
|
1081
|
+
*
|
|
1082
|
+
* @remarks
|
|
1083
|
+
* This function is used to ensure that the provided cart object adheres to the expected structure.
|
|
1084
|
+
* It uses the `Effect.runSync` function to decode the unknown cart object using the `Schema.decodeUnknown` function.
|
|
1085
|
+
*
|
|
1086
|
+
* @param cart - The unknown cart object to be validated.
|
|
1087
|
+
* @returns The validated cart object if it matches the CartOutput schema, or throws an error if it doesn't.
|
|
1088
|
+
*
|
|
1089
|
+
* @example
|
|
1090
|
+
* ```typescript
|
|
1091
|
+
* const cartData = {
|
|
1092
|
+
* id: "1234567890",
|
|
1093
|
+
* items: [
|
|
1094
|
+
* {
|
|
1095
|
+
* id: "9876543210",
|
|
1096
|
+
* quantity: 2,
|
|
1097
|
+
* variantId: "variant-123",
|
|
1098
|
+
* // ... other item properties
|
|
1099
|
+
* },
|
|
1100
|
+
* // ... other cart items
|
|
1101
|
+
* ],
|
|
1102
|
+
* // ... other cart properties
|
|
1103
|
+
* };
|
|
1104
|
+
*
|
|
1105
|
+
* try {
|
|
1106
|
+
* const validatedCart = validateCart(cartData);
|
|
1107
|
+
* console.log("Cart is valid:", validatedCart);
|
|
1108
|
+
* } catch (error) {
|
|
1109
|
+
* console.error("Cart validation failed:", error);
|
|
1110
|
+
* }
|
|
1111
|
+
* ```
|
|
1112
|
+
*/ export declare const validateCart: (cart: unknown) => {
|
|
1113
|
+
readonly attributes: {
|
|
1114
|
+
readonly [x: string]: string | number | boolean | null;
|
|
1115
|
+
};
|
|
1080
1116
|
readonly total_discount: number;
|
|
1081
1117
|
readonly discounts: readonly {
|
|
1082
1118
|
readonly title: string;
|
|
@@ -1085,9 +1121,6 @@ export declare const validateCart: (cart: unknown) => {
|
|
|
1085
1121
|
readonly requires_shipping: boolean;
|
|
1086
1122
|
readonly token: string;
|
|
1087
1123
|
readonly note: string | null;
|
|
1088
|
-
readonly attributes: {
|
|
1089
|
-
readonly [x: string]: string | number | boolean | null;
|
|
1090
|
-
};
|
|
1091
1124
|
readonly discount_codes: readonly {
|
|
1092
1125
|
readonly code: string;
|
|
1093
1126
|
readonly applicable: boolean;
|
|
@@ -1097,15 +1130,56 @@ export declare const validateCart: (cart: unknown) => {
|
|
|
1097
1130
|
readonly total_weight: number;
|
|
1098
1131
|
readonly item_count: number;
|
|
1099
1132
|
readonly items: readonly ({
|
|
1100
|
-
readonly key: string;
|
|
1101
1133
|
readonly title: string;
|
|
1134
|
+
readonly key: string;
|
|
1102
1135
|
readonly url: string;
|
|
1136
|
+
readonly image: string | null;
|
|
1137
|
+
readonly quantity_rule?: {
|
|
1138
|
+
readonly min: number;
|
|
1139
|
+
readonly max: number | null;
|
|
1140
|
+
readonly increment: number;
|
|
1141
|
+
} | undefined;
|
|
1103
1142
|
readonly price: number;
|
|
1104
1143
|
readonly id: string | number;
|
|
1105
|
-
readonly
|
|
1106
|
-
readonly
|
|
1107
|
-
|
|
1108
|
-
|
|
1144
|
+
readonly selling_plan_allocation: {
|
|
1145
|
+
readonly price: number;
|
|
1146
|
+
readonly price_adjustments: readonly {
|
|
1147
|
+
readonly position: number;
|
|
1148
|
+
readonly price: number;
|
|
1149
|
+
}[];
|
|
1150
|
+
readonly selling_plan: {
|
|
1151
|
+
readonly description: string | null;
|
|
1152
|
+
readonly name: string;
|
|
1153
|
+
readonly id: string | number;
|
|
1154
|
+
readonly options: readonly {
|
|
1155
|
+
readonly value: string;
|
|
1156
|
+
readonly name: string;
|
|
1157
|
+
readonly position: number;
|
|
1158
|
+
}[];
|
|
1159
|
+
readonly recurring_deliveries: boolean;
|
|
1160
|
+
readonly fixed_selling_plan: boolean;
|
|
1161
|
+
readonly price_adjustments: readonly {
|
|
1162
|
+
readonly value: string | number;
|
|
1163
|
+
readonly value_type: "fixed_amount" | "percentage" | "price";
|
|
1164
|
+
readonly position: number;
|
|
1165
|
+
readonly order_count: number | null;
|
|
1166
|
+
}[];
|
|
1167
|
+
};
|
|
1168
|
+
readonly compare_at_price: number;
|
|
1169
|
+
readonly per_delivery_price: number;
|
|
1170
|
+
} | null;
|
|
1171
|
+
readonly unit_price_measurement?: {
|
|
1172
|
+
readonly measured_type: "volume" | "weight" | "dimension";
|
|
1173
|
+
readonly quantity_unit: string;
|
|
1174
|
+
readonly quantity_value: number;
|
|
1175
|
+
readonly reference_unit: string;
|
|
1176
|
+
readonly reference_value: number;
|
|
1177
|
+
} | undefined;
|
|
1178
|
+
readonly variant_options: readonly string[];
|
|
1179
|
+
readonly properties: {
|
|
1180
|
+
readonly [x: string]: string | number | boolean | null;
|
|
1181
|
+
};
|
|
1182
|
+
readonly quantity: number;
|
|
1109
1183
|
readonly variant_id: string | number;
|
|
1110
1184
|
readonly original_price: number;
|
|
1111
1185
|
readonly discounted_price: number;
|
|
@@ -1132,73 +1206,32 @@ export declare const validateCart: (cart: unknown) => {
|
|
|
1132
1206
|
readonly url: string | null;
|
|
1133
1207
|
readonly width: number | null;
|
|
1134
1208
|
};
|
|
1135
|
-
readonly image: string | null;
|
|
1136
1209
|
readonly handle: string;
|
|
1137
1210
|
readonly requires_shipping: boolean;
|
|
1138
1211
|
readonly product_type: string | null;
|
|
1139
1212
|
readonly product_title: string;
|
|
1140
1213
|
readonly product_description: string | null;
|
|
1141
1214
|
readonly variant_title: string | null;
|
|
1142
|
-
readonly variant_options: readonly string[];
|
|
1143
1215
|
readonly options_with_values: readonly {
|
|
1144
1216
|
readonly value: string;
|
|
1145
1217
|
readonly name: string;
|
|
1146
1218
|
}[];
|
|
1147
1219
|
readonly line_level_discount_allocations: readonly {
|
|
1148
|
-
readonly amount: number;
|
|
1149
1220
|
readonly discount_application: {
|
|
1221
|
+
readonly title: string;
|
|
1222
|
+
readonly description: string | null;
|
|
1150
1223
|
readonly value: number;
|
|
1151
1224
|
readonly target_selection: "all" | "entitled" | "explicit";
|
|
1152
1225
|
readonly target_type: "line_item" | "shipping_line";
|
|
1153
|
-
readonly title: string;
|
|
1154
1226
|
readonly total_allocated_amount: number;
|
|
1155
1227
|
readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
|
|
1156
1228
|
readonly value_type: "fixed_amount" | "percentage";
|
|
1157
|
-
readonly description: string | null;
|
|
1158
1229
|
};
|
|
1230
|
+
readonly amount: number;
|
|
1159
1231
|
}[];
|
|
1160
1232
|
readonly line_level_total_discount: number;
|
|
1161
|
-
readonly quantity_rule?: {
|
|
1162
|
-
readonly min: number;
|
|
1163
|
-
readonly max: number | null;
|
|
1164
|
-
readonly increment: number;
|
|
1165
|
-
} | undefined;
|
|
1166
1233
|
readonly has_components: boolean;
|
|
1167
1234
|
readonly unit_price?: number | undefined;
|
|
1168
|
-
readonly unit_price_measurement?: {
|
|
1169
|
-
readonly measured_type: "volume" | "weight" | "dimension";
|
|
1170
|
-
readonly quantity_unit: string;
|
|
1171
|
-
readonly quantity_value: number;
|
|
1172
|
-
readonly reference_unit: string;
|
|
1173
|
-
readonly reference_value: number;
|
|
1174
|
-
} | undefined;
|
|
1175
|
-
readonly selling_plan_allocation: {
|
|
1176
|
-
readonly price: number;
|
|
1177
|
-
readonly price_adjustments: readonly {
|
|
1178
|
-
readonly position: number;
|
|
1179
|
-
readonly price: number;
|
|
1180
|
-
}[];
|
|
1181
|
-
readonly compare_at_price: number;
|
|
1182
|
-
readonly per_delivery_price: number;
|
|
1183
|
-
readonly selling_plan: {
|
|
1184
|
-
readonly description: string | null;
|
|
1185
|
-
readonly name: string;
|
|
1186
|
-
readonly id: string | number;
|
|
1187
|
-
readonly options: readonly {
|
|
1188
|
-
readonly value: string;
|
|
1189
|
-
readonly name: string;
|
|
1190
|
-
readonly position: number;
|
|
1191
|
-
}[];
|
|
1192
|
-
readonly recurring_deliveries: boolean;
|
|
1193
|
-
readonly fixed_selling_plan: boolean;
|
|
1194
|
-
readonly price_adjustments: readonly {
|
|
1195
|
-
readonly value: string | number;
|
|
1196
|
-
readonly value_type: "fixed_amount" | "percentage" | "price";
|
|
1197
|
-
readonly position: number;
|
|
1198
|
-
readonly order_count: number | null;
|
|
1199
|
-
}[];
|
|
1200
|
-
};
|
|
1201
|
-
} | null;
|
|
1202
1235
|
} & {
|
|
1203
1236
|
readonly properties_array: readonly {
|
|
1204
1237
|
readonly key: string;
|
|
@@ -1222,14 +1255,14 @@ export declare const validateCart: (cart: unknown) => {
|
|
|
1222
1255
|
readonly currency: string;
|
|
1223
1256
|
readonly items_subtotal_price: number;
|
|
1224
1257
|
readonly cart_level_discount_applications: readonly {
|
|
1258
|
+
readonly title: string;
|
|
1259
|
+
readonly description: string | null;
|
|
1225
1260
|
readonly value: number;
|
|
1226
1261
|
readonly target_selection: "all" | "entitled" | "explicit";
|
|
1227
1262
|
readonly target_type: "line_item" | "shipping_line";
|
|
1228
|
-
readonly title: string;
|
|
1229
1263
|
readonly total_allocated_amount: number;
|
|
1230
1264
|
readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
|
|
1231
1265
|
readonly value_type: "fixed_amount" | "percentage";
|
|
1232
|
-
readonly description: string | null;
|
|
1233
1266
|
}[];
|
|
1234
1267
|
} & {
|
|
1235
1268
|
readonly attributes_array: readonly {
|
|
@@ -1251,9 +1284,58 @@ export declare const validateCart: (cart: unknown) => {
|
|
|
1251
1284
|
readonly value: string | number | boolean | null;
|
|
1252
1285
|
}[];
|
|
1253
1286
|
};
|
|
1287
|
+
/**
|
|
1288
|
+
* Creates an instance of the Ajax Cart API client with optional debugging capabilities.
|
|
1289
|
+
*
|
|
1290
|
+
* @remarks
|
|
1291
|
+
* This function initializes the Ajax Cart API client with the provided options.
|
|
1292
|
+
* It sets up the necessary layers for logging and AJAX requests based on the debug flag.
|
|
1293
|
+
*
|
|
1294
|
+
* @param options - An optional object containing debug flag.
|
|
1295
|
+
* @param options.debug - A boolean indicating whether to enable debugging. Default is false.
|
|
1296
|
+
*
|
|
1297
|
+
* @returns An object containing the Ajax Cart API methods: add, change, clear, get, and update.
|
|
1298
|
+
*
|
|
1299
|
+
* @example
|
|
1300
|
+
* ```typescript
|
|
1301
|
+
* const ajaxCartApi = createAjaxCartApi({ debug: true });
|
|
1302
|
+
*
|
|
1303
|
+
* // Use the Ajax Cart API methods
|
|
1304
|
+
* ajaxCartApi.add({ productId: "123", quantity: 2 })
|
|
1305
|
+
* .then((response) => {
|
|
1306
|
+
* console.log("Cart updated:", response);
|
|
1307
|
+
* })
|
|
1308
|
+
* .catch((error) => {
|
|
1309
|
+
* console.error("Failed to update cart:", error);
|
|
1310
|
+
* });
|
|
1311
|
+
* ```
|
|
1312
|
+
*/
|
|
1254
1313
|
export declare const createAjaxCartApi: ({ debug }: {
|
|
1255
1314
|
debug?: boolean | undefined;
|
|
1256
1315
|
}) => {
|
|
1316
|
+
/**
|
|
1317
|
+
* Adds a product to the cart.
|
|
1318
|
+
*
|
|
1319
|
+
* @param input - The input object containing the product ID and quantity to be added.
|
|
1320
|
+
* @param options - An optional object containing request options.
|
|
1321
|
+
* @param options.signal - An AbortSignal object to abort the request.
|
|
1322
|
+
* @param options.headers - Custom headers to be sent with the request.
|
|
1323
|
+
*
|
|
1324
|
+
* @returns A Promise that resolves to the updated cart object.
|
|
1325
|
+
*
|
|
1326
|
+
* @example
|
|
1327
|
+
* ```typescript
|
|
1328
|
+
* const ajaxCartApi = createAjaxCartApi({ debug: true });
|
|
1329
|
+
*
|
|
1330
|
+
* ajaxCartApi.add({ productId: "123", quantity: 2 })
|
|
1331
|
+
* .then((response) => {
|
|
1332
|
+
* console.log("Cart updated:", response);
|
|
1333
|
+
* })
|
|
1334
|
+
* .catch((error) => {
|
|
1335
|
+
* console.error("Failed to update cart:", error);
|
|
1336
|
+
* });
|
|
1337
|
+
* ```
|
|
1338
|
+
*/
|
|
1257
1339
|
add: (input: add.Input, options?: createAjaxCartClient.RequestOptions) => Promise<{
|
|
1258
1340
|
readonly data?: undefined;
|
|
1259
1341
|
readonly error?: {
|
|
@@ -1264,11 +1346,52 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1264
1346
|
} | {
|
|
1265
1347
|
readonly data?: {
|
|
1266
1348
|
readonly items: readonly ({
|
|
1267
|
-
readonly key: string;
|
|
1268
1349
|
readonly title: string;
|
|
1350
|
+
readonly key: string;
|
|
1269
1351
|
readonly url: string;
|
|
1352
|
+
readonly image: string | null;
|
|
1353
|
+
readonly quantity_rule?: {
|
|
1354
|
+
readonly min: number;
|
|
1355
|
+
readonly max: number | null;
|
|
1356
|
+
readonly increment: number;
|
|
1357
|
+
} | undefined;
|
|
1270
1358
|
readonly price: number;
|
|
1271
1359
|
readonly id: string | number;
|
|
1360
|
+
readonly selling_plan_allocation: {
|
|
1361
|
+
readonly price: number;
|
|
1362
|
+
readonly price_adjustments: readonly {
|
|
1363
|
+
readonly position: number;
|
|
1364
|
+
readonly price: number;
|
|
1365
|
+
}[];
|
|
1366
|
+
readonly selling_plan: {
|
|
1367
|
+
readonly description: string | null;
|
|
1368
|
+
readonly name: string;
|
|
1369
|
+
readonly id: string | number;
|
|
1370
|
+
readonly options: readonly {
|
|
1371
|
+
readonly value: string;
|
|
1372
|
+
readonly name: string;
|
|
1373
|
+
readonly position: number;
|
|
1374
|
+
}[];
|
|
1375
|
+
readonly recurring_deliveries: boolean;
|
|
1376
|
+
readonly fixed_selling_plan: boolean;
|
|
1377
|
+
readonly price_adjustments: readonly {
|
|
1378
|
+
readonly value: string | number;
|
|
1379
|
+
readonly value_type: "fixed_amount" | "percentage" | "price";
|
|
1380
|
+
readonly position: number;
|
|
1381
|
+
readonly order_count: number | null;
|
|
1382
|
+
}[];
|
|
1383
|
+
};
|
|
1384
|
+
readonly compare_at_price: number;
|
|
1385
|
+
readonly per_delivery_price: number;
|
|
1386
|
+
} | null;
|
|
1387
|
+
readonly unit_price_measurement?: {
|
|
1388
|
+
readonly measured_type: "volume" | "weight" | "dimension";
|
|
1389
|
+
readonly quantity_unit: string;
|
|
1390
|
+
readonly quantity_value: number;
|
|
1391
|
+
readonly reference_unit: string;
|
|
1392
|
+
readonly reference_value: number;
|
|
1393
|
+
} | undefined;
|
|
1394
|
+
readonly variant_options: readonly string[];
|
|
1272
1395
|
readonly properties: {
|
|
1273
1396
|
readonly [x: string]: string | number | boolean | null;
|
|
1274
1397
|
};
|
|
@@ -1299,73 +1422,32 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1299
1422
|
readonly url: string | null;
|
|
1300
1423
|
readonly width: number | null;
|
|
1301
1424
|
};
|
|
1302
|
-
readonly image: string | null;
|
|
1303
1425
|
readonly handle: string;
|
|
1304
1426
|
readonly requires_shipping: boolean;
|
|
1305
1427
|
readonly product_type: string | null;
|
|
1306
1428
|
readonly product_title: string;
|
|
1307
1429
|
readonly product_description: string | null;
|
|
1308
1430
|
readonly variant_title: string | null;
|
|
1309
|
-
readonly variant_options: readonly string[];
|
|
1310
1431
|
readonly options_with_values: readonly {
|
|
1311
1432
|
readonly value: string;
|
|
1312
1433
|
readonly name: string;
|
|
1313
1434
|
}[];
|
|
1314
1435
|
readonly line_level_discount_allocations: readonly {
|
|
1315
|
-
readonly amount: number;
|
|
1316
1436
|
readonly discount_application: {
|
|
1437
|
+
readonly title: string;
|
|
1438
|
+
readonly description: string | null;
|
|
1317
1439
|
readonly value: number;
|
|
1318
1440
|
readonly target_selection: "all" | "entitled" | "explicit";
|
|
1319
1441
|
readonly target_type: "line_item" | "shipping_line";
|
|
1320
|
-
readonly title: string;
|
|
1321
1442
|
readonly total_allocated_amount: number;
|
|
1322
1443
|
readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
|
|
1323
1444
|
readonly value_type: "fixed_amount" | "percentage";
|
|
1324
|
-
readonly description: string | null;
|
|
1325
1445
|
};
|
|
1446
|
+
readonly amount: number;
|
|
1326
1447
|
}[];
|
|
1327
1448
|
readonly line_level_total_discount: number;
|
|
1328
|
-
readonly quantity_rule?: {
|
|
1329
|
-
readonly min: number;
|
|
1330
|
-
readonly max: number | null;
|
|
1331
|
-
readonly increment: number;
|
|
1332
|
-
} | undefined;
|
|
1333
1449
|
readonly has_components: boolean;
|
|
1334
1450
|
readonly unit_price?: number | undefined;
|
|
1335
|
-
readonly unit_price_measurement?: {
|
|
1336
|
-
readonly measured_type: "volume" | "weight" | "dimension";
|
|
1337
|
-
readonly quantity_unit: string;
|
|
1338
|
-
readonly quantity_value: number;
|
|
1339
|
-
readonly reference_unit: string;
|
|
1340
|
-
readonly reference_value: number;
|
|
1341
|
-
} | undefined;
|
|
1342
|
-
readonly selling_plan_allocation: {
|
|
1343
|
-
readonly price: number;
|
|
1344
|
-
readonly price_adjustments: readonly {
|
|
1345
|
-
readonly position: number;
|
|
1346
|
-
readonly price: number;
|
|
1347
|
-
}[];
|
|
1348
|
-
readonly compare_at_price: number;
|
|
1349
|
-
readonly per_delivery_price: number;
|
|
1350
|
-
readonly selling_plan: {
|
|
1351
|
-
readonly description: string | null;
|
|
1352
|
-
readonly name: string;
|
|
1353
|
-
readonly id: string | number;
|
|
1354
|
-
readonly options: readonly {
|
|
1355
|
-
readonly value: string;
|
|
1356
|
-
readonly name: string;
|
|
1357
|
-
readonly position: number;
|
|
1358
|
-
}[];
|
|
1359
|
-
readonly recurring_deliveries: boolean;
|
|
1360
|
-
readonly fixed_selling_plan: boolean;
|
|
1361
|
-
readonly price_adjustments: readonly {
|
|
1362
|
-
readonly value: string | number;
|
|
1363
|
-
readonly value_type: "fixed_amount" | "percentage" | "price";
|
|
1364
|
-
readonly position: number;
|
|
1365
|
-
readonly order_count: number | null;
|
|
1366
|
-
}[];
|
|
1367
|
-
};
|
|
1368
|
-
} | null;
|
|
1369
1451
|
} & {
|
|
1370
1452
|
readonly properties_array: readonly {
|
|
1371
1453
|
readonly key: string;
|
|
@@ -1393,6 +1475,34 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1393
1475
|
description?: string;
|
|
1394
1476
|
} | undefined;
|
|
1395
1477
|
}>;
|
|
1478
|
+
/**
|
|
1479
|
+
* Updates the quantity, attributes, or selling plan of a specific item in the cart.
|
|
1480
|
+
*
|
|
1481
|
+
* @remarks
|
|
1482
|
+
* This function sends a request to update the quantity, attributes, or selling plan of a specific item in the cart.
|
|
1483
|
+
* It uses the provided input object to specify the item ID and the new quantity, attributes, or selling plan.
|
|
1484
|
+
* The function also accepts optional request options, such as an AbortSignal for cancellation.
|
|
1485
|
+
*
|
|
1486
|
+
* @param input - The input object containing the item ID and the new quantity.
|
|
1487
|
+
* @param options - An optional object containing request options.
|
|
1488
|
+
* @param options.signal - An AbortSignal object to abort the request.
|
|
1489
|
+
* @param options.headers - Custom headers to be sent with the request.
|
|
1490
|
+
*
|
|
1491
|
+
* @returns A Promise that resolves to the updated cart object.
|
|
1492
|
+
*
|
|
1493
|
+
* @example
|
|
1494
|
+
* ```typescript
|
|
1495
|
+
* const ajaxCartApi = createAjaxCartApi({ debug: true });
|
|
1496
|
+
*
|
|
1497
|
+
* ajaxCartApi.change({ itemId: "9876543210", quantity: 3 })
|
|
1498
|
+
* .then((response) => {
|
|
1499
|
+
* console.log("Cart updated:", response);
|
|
1500
|
+
* })
|
|
1501
|
+
* .catch((error) => {
|
|
1502
|
+
* console.error("Failed to update cart:", error);
|
|
1503
|
+
* });
|
|
1504
|
+
* ```
|
|
1505
|
+
*/
|
|
1396
1506
|
change: (input: change.Input, options?: createAjaxCartClient.RequestOptions) => Promise<{
|
|
1397
1507
|
readonly data?: undefined;
|
|
1398
1508
|
readonly error?: {
|
|
@@ -1402,6 +1512,9 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1402
1512
|
} | undefined;
|
|
1403
1513
|
} | {
|
|
1404
1514
|
readonly data?: ({
|
|
1515
|
+
readonly attributes: {
|
|
1516
|
+
readonly [x: string]: string | number | boolean | null;
|
|
1517
|
+
};
|
|
1405
1518
|
readonly total_discount: number;
|
|
1406
1519
|
readonly discounts: readonly {
|
|
1407
1520
|
readonly title: string;
|
|
@@ -1410,9 +1523,6 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1410
1523
|
readonly requires_shipping: boolean;
|
|
1411
1524
|
readonly token: string;
|
|
1412
1525
|
readonly note: string | null;
|
|
1413
|
-
readonly attributes: {
|
|
1414
|
-
readonly [x: string]: string | number | boolean | null;
|
|
1415
|
-
};
|
|
1416
1526
|
readonly discount_codes: readonly {
|
|
1417
1527
|
readonly code: string;
|
|
1418
1528
|
readonly applicable: boolean;
|
|
@@ -1422,11 +1532,52 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1422
1532
|
readonly total_weight: number;
|
|
1423
1533
|
readonly item_count: number;
|
|
1424
1534
|
readonly items: readonly ({
|
|
1425
|
-
readonly key: string;
|
|
1426
1535
|
readonly title: string;
|
|
1536
|
+
readonly key: string;
|
|
1427
1537
|
readonly url: string;
|
|
1538
|
+
readonly image: string | null;
|
|
1539
|
+
readonly quantity_rule?: {
|
|
1540
|
+
readonly min: number;
|
|
1541
|
+
readonly max: number | null;
|
|
1542
|
+
readonly increment: number;
|
|
1543
|
+
} | undefined;
|
|
1428
1544
|
readonly price: number;
|
|
1429
1545
|
readonly id: string | number;
|
|
1546
|
+
readonly selling_plan_allocation: {
|
|
1547
|
+
readonly price: number;
|
|
1548
|
+
readonly price_adjustments: readonly {
|
|
1549
|
+
readonly position: number;
|
|
1550
|
+
readonly price: number;
|
|
1551
|
+
}[];
|
|
1552
|
+
readonly selling_plan: {
|
|
1553
|
+
readonly description: string | null;
|
|
1554
|
+
readonly name: string;
|
|
1555
|
+
readonly id: string | number;
|
|
1556
|
+
readonly options: readonly {
|
|
1557
|
+
readonly value: string;
|
|
1558
|
+
readonly name: string;
|
|
1559
|
+
readonly position: number;
|
|
1560
|
+
}[];
|
|
1561
|
+
readonly recurring_deliveries: boolean;
|
|
1562
|
+
readonly fixed_selling_plan: boolean;
|
|
1563
|
+
readonly price_adjustments: readonly {
|
|
1564
|
+
readonly value: string | number;
|
|
1565
|
+
readonly value_type: "fixed_amount" | "percentage" | "price";
|
|
1566
|
+
readonly position: number;
|
|
1567
|
+
readonly order_count: number | null;
|
|
1568
|
+
}[];
|
|
1569
|
+
};
|
|
1570
|
+
readonly compare_at_price: number;
|
|
1571
|
+
readonly per_delivery_price: number;
|
|
1572
|
+
} | null;
|
|
1573
|
+
readonly unit_price_measurement?: {
|
|
1574
|
+
readonly measured_type: "volume" | "weight" | "dimension";
|
|
1575
|
+
readonly quantity_unit: string;
|
|
1576
|
+
readonly quantity_value: number;
|
|
1577
|
+
readonly reference_unit: string;
|
|
1578
|
+
readonly reference_value: number;
|
|
1579
|
+
} | undefined;
|
|
1580
|
+
readonly variant_options: readonly string[];
|
|
1430
1581
|
readonly properties: {
|
|
1431
1582
|
readonly [x: string]: string | number | boolean | null;
|
|
1432
1583
|
};
|
|
@@ -1457,73 +1608,32 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1457
1608
|
readonly url: string | null;
|
|
1458
1609
|
readonly width: number | null;
|
|
1459
1610
|
};
|
|
1460
|
-
readonly image: string | null;
|
|
1461
1611
|
readonly handle: string;
|
|
1462
1612
|
readonly requires_shipping: boolean;
|
|
1463
1613
|
readonly product_type: string | null;
|
|
1464
1614
|
readonly product_title: string;
|
|
1465
1615
|
readonly product_description: string | null;
|
|
1466
1616
|
readonly variant_title: string | null;
|
|
1467
|
-
readonly variant_options: readonly string[];
|
|
1468
1617
|
readonly options_with_values: readonly {
|
|
1469
1618
|
readonly value: string;
|
|
1470
1619
|
readonly name: string;
|
|
1471
1620
|
}[];
|
|
1472
1621
|
readonly line_level_discount_allocations: readonly {
|
|
1473
|
-
readonly amount: number;
|
|
1474
1622
|
readonly discount_application: {
|
|
1623
|
+
readonly title: string;
|
|
1624
|
+
readonly description: string | null;
|
|
1475
1625
|
readonly value: number;
|
|
1476
1626
|
readonly target_selection: "all" | "entitled" | "explicit";
|
|
1477
1627
|
readonly target_type: "line_item" | "shipping_line";
|
|
1478
|
-
readonly title: string;
|
|
1479
1628
|
readonly total_allocated_amount: number;
|
|
1480
1629
|
readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
|
|
1481
1630
|
readonly value_type: "fixed_amount" | "percentage";
|
|
1482
|
-
readonly description: string | null;
|
|
1483
1631
|
};
|
|
1632
|
+
readonly amount: number;
|
|
1484
1633
|
}[];
|
|
1485
1634
|
readonly line_level_total_discount: number;
|
|
1486
|
-
readonly quantity_rule?: {
|
|
1487
|
-
readonly min: number;
|
|
1488
|
-
readonly max: number | null;
|
|
1489
|
-
readonly increment: number;
|
|
1490
|
-
} | undefined;
|
|
1491
1635
|
readonly has_components: boolean;
|
|
1492
1636
|
readonly unit_price?: number | undefined;
|
|
1493
|
-
readonly unit_price_measurement?: {
|
|
1494
|
-
readonly measured_type: "volume" | "weight" | "dimension";
|
|
1495
|
-
readonly quantity_unit: string;
|
|
1496
|
-
readonly quantity_value: number;
|
|
1497
|
-
readonly reference_unit: string;
|
|
1498
|
-
readonly reference_value: number;
|
|
1499
|
-
} | undefined;
|
|
1500
|
-
readonly selling_plan_allocation: {
|
|
1501
|
-
readonly price: number;
|
|
1502
|
-
readonly price_adjustments: readonly {
|
|
1503
|
-
readonly position: number;
|
|
1504
|
-
readonly price: number;
|
|
1505
|
-
}[];
|
|
1506
|
-
readonly compare_at_price: number;
|
|
1507
|
-
readonly per_delivery_price: number;
|
|
1508
|
-
readonly selling_plan: {
|
|
1509
|
-
readonly description: string | null;
|
|
1510
|
-
readonly name: string;
|
|
1511
|
-
readonly id: string | number;
|
|
1512
|
-
readonly options: readonly {
|
|
1513
|
-
readonly value: string;
|
|
1514
|
-
readonly name: string;
|
|
1515
|
-
readonly position: number;
|
|
1516
|
-
}[];
|
|
1517
|
-
readonly recurring_deliveries: boolean;
|
|
1518
|
-
readonly fixed_selling_plan: boolean;
|
|
1519
|
-
readonly price_adjustments: readonly {
|
|
1520
|
-
readonly value: string | number;
|
|
1521
|
-
readonly value_type: "fixed_amount" | "percentage" | "price";
|
|
1522
|
-
readonly position: number;
|
|
1523
|
-
readonly order_count: number | null;
|
|
1524
|
-
}[];
|
|
1525
|
-
};
|
|
1526
|
-
} | null;
|
|
1527
1637
|
} & {
|
|
1528
1638
|
readonly properties_array: readonly {
|
|
1529
1639
|
readonly key: string;
|
|
@@ -1547,14 +1657,14 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1547
1657
|
readonly currency: string;
|
|
1548
1658
|
readonly items_subtotal_price: number;
|
|
1549
1659
|
readonly cart_level_discount_applications: readonly {
|
|
1660
|
+
readonly title: string;
|
|
1661
|
+
readonly description: string | null;
|
|
1550
1662
|
readonly value: number;
|
|
1551
1663
|
readonly target_selection: "all" | "entitled" | "explicit";
|
|
1552
1664
|
readonly target_type: "line_item" | "shipping_line";
|
|
1553
|
-
readonly title: string;
|
|
1554
1665
|
readonly total_allocated_amount: number;
|
|
1555
1666
|
readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
|
|
1556
1667
|
readonly value_type: "fixed_amount" | "percentage";
|
|
1557
|
-
readonly description: string | null;
|
|
1558
1668
|
}[];
|
|
1559
1669
|
} & {
|
|
1560
1670
|
readonly attributes_array: readonly {
|
|
@@ -1582,6 +1692,31 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1582
1692
|
description?: string;
|
|
1583
1693
|
} | undefined;
|
|
1584
1694
|
}>;
|
|
1695
|
+
/**
|
|
1696
|
+
* Clears the entire cart.
|
|
1697
|
+
*
|
|
1698
|
+
* This function sends a request to clear the entire cart. It does not require any input parameters.
|
|
1699
|
+
* The function accepts optional request options, such as an AbortSignal for cancellation.
|
|
1700
|
+
*
|
|
1701
|
+
* @param input - An optional input object containing request options.
|
|
1702
|
+
* @param input.signal - An AbortSignal object to abort the request.
|
|
1703
|
+
* @param input.headers - Custom headers to be sent with the request.
|
|
1704
|
+
*
|
|
1705
|
+
* @returns A Promise that resolves to an empty object upon successful cart clearance.
|
|
1706
|
+
*
|
|
1707
|
+
* @example
|
|
1708
|
+
* ```typescript
|
|
1709
|
+
* const ajaxCartApi = createAjaxCartApi({ debug: true });
|
|
1710
|
+
*
|
|
1711
|
+
* ajaxCartApi.clear()
|
|
1712
|
+
* .then(() => {
|
|
1713
|
+
* console.log("Cart cleared successfully");
|
|
1714
|
+
* })
|
|
1715
|
+
* .catch((error) => {
|
|
1716
|
+
* console.error("Failed to clear cart:", error);
|
|
1717
|
+
* });
|
|
1718
|
+
* ```
|
|
1719
|
+
*/
|
|
1585
1720
|
clear: (input: clear.Input, options?: createAjaxCartClient.RequestOptions) => Promise<{
|
|
1586
1721
|
readonly data?: undefined;
|
|
1587
1722
|
readonly error?: {
|
|
@@ -1591,6 +1726,9 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1591
1726
|
} | undefined;
|
|
1592
1727
|
} | {
|
|
1593
1728
|
readonly data?: ({
|
|
1729
|
+
readonly attributes: {
|
|
1730
|
+
readonly [x: string]: string | number | boolean | null;
|
|
1731
|
+
};
|
|
1594
1732
|
readonly total_discount: number;
|
|
1595
1733
|
readonly discounts: readonly {
|
|
1596
1734
|
readonly title: string;
|
|
@@ -1599,9 +1737,6 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1599
1737
|
readonly requires_shipping: boolean;
|
|
1600
1738
|
readonly token: string;
|
|
1601
1739
|
readonly note: string | null;
|
|
1602
|
-
readonly attributes: {
|
|
1603
|
-
readonly [x: string]: string | number | boolean | null;
|
|
1604
|
-
};
|
|
1605
1740
|
readonly discount_codes: readonly {
|
|
1606
1741
|
readonly code: string;
|
|
1607
1742
|
readonly applicable: boolean;
|
|
@@ -1611,11 +1746,52 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1611
1746
|
readonly total_weight: number;
|
|
1612
1747
|
readonly item_count: number;
|
|
1613
1748
|
readonly items: readonly ({
|
|
1614
|
-
readonly key: string;
|
|
1615
1749
|
readonly title: string;
|
|
1750
|
+
readonly key: string;
|
|
1616
1751
|
readonly url: string;
|
|
1752
|
+
readonly image: string | null;
|
|
1753
|
+
readonly quantity_rule?: {
|
|
1754
|
+
readonly min: number;
|
|
1755
|
+
readonly max: number | null;
|
|
1756
|
+
readonly increment: number;
|
|
1757
|
+
} | undefined;
|
|
1617
1758
|
readonly price: number;
|
|
1618
1759
|
readonly id: string | number;
|
|
1760
|
+
readonly selling_plan_allocation: {
|
|
1761
|
+
readonly price: number;
|
|
1762
|
+
readonly price_adjustments: readonly {
|
|
1763
|
+
readonly position: number;
|
|
1764
|
+
readonly price: number;
|
|
1765
|
+
}[];
|
|
1766
|
+
readonly selling_plan: {
|
|
1767
|
+
readonly description: string | null;
|
|
1768
|
+
readonly name: string;
|
|
1769
|
+
readonly id: string | number;
|
|
1770
|
+
readonly options: readonly {
|
|
1771
|
+
readonly value: string;
|
|
1772
|
+
readonly name: string;
|
|
1773
|
+
readonly position: number;
|
|
1774
|
+
}[];
|
|
1775
|
+
readonly recurring_deliveries: boolean;
|
|
1776
|
+
readonly fixed_selling_plan: boolean;
|
|
1777
|
+
readonly price_adjustments: readonly {
|
|
1778
|
+
readonly value: string | number;
|
|
1779
|
+
readonly value_type: "fixed_amount" | "percentage" | "price";
|
|
1780
|
+
readonly position: number;
|
|
1781
|
+
readonly order_count: number | null;
|
|
1782
|
+
}[];
|
|
1783
|
+
};
|
|
1784
|
+
readonly compare_at_price: number;
|
|
1785
|
+
readonly per_delivery_price: number;
|
|
1786
|
+
} | null;
|
|
1787
|
+
readonly unit_price_measurement?: {
|
|
1788
|
+
readonly measured_type: "volume" | "weight" | "dimension";
|
|
1789
|
+
readonly quantity_unit: string;
|
|
1790
|
+
readonly quantity_value: number;
|
|
1791
|
+
readonly reference_unit: string;
|
|
1792
|
+
readonly reference_value: number;
|
|
1793
|
+
} | undefined;
|
|
1794
|
+
readonly variant_options: readonly string[];
|
|
1619
1795
|
readonly properties: {
|
|
1620
1796
|
readonly [x: string]: string | number | boolean | null;
|
|
1621
1797
|
};
|
|
@@ -1646,73 +1822,32 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1646
1822
|
readonly url: string | null;
|
|
1647
1823
|
readonly width: number | null;
|
|
1648
1824
|
};
|
|
1649
|
-
readonly image: string | null;
|
|
1650
1825
|
readonly handle: string;
|
|
1651
1826
|
readonly requires_shipping: boolean;
|
|
1652
1827
|
readonly product_type: string | null;
|
|
1653
1828
|
readonly product_title: string;
|
|
1654
1829
|
readonly product_description: string | null;
|
|
1655
1830
|
readonly variant_title: string | null;
|
|
1656
|
-
readonly variant_options: readonly string[];
|
|
1657
1831
|
readonly options_with_values: readonly {
|
|
1658
1832
|
readonly value: string;
|
|
1659
1833
|
readonly name: string;
|
|
1660
1834
|
}[];
|
|
1661
1835
|
readonly line_level_discount_allocations: readonly {
|
|
1662
|
-
readonly amount: number;
|
|
1663
1836
|
readonly discount_application: {
|
|
1837
|
+
readonly title: string;
|
|
1838
|
+
readonly description: string | null;
|
|
1664
1839
|
readonly value: number;
|
|
1665
1840
|
readonly target_selection: "all" | "entitled" | "explicit";
|
|
1666
1841
|
readonly target_type: "line_item" | "shipping_line";
|
|
1667
|
-
readonly title: string;
|
|
1668
1842
|
readonly total_allocated_amount: number;
|
|
1669
1843
|
readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
|
|
1670
1844
|
readonly value_type: "fixed_amount" | "percentage";
|
|
1671
|
-
readonly description: string | null;
|
|
1672
1845
|
};
|
|
1846
|
+
readonly amount: number;
|
|
1673
1847
|
}[];
|
|
1674
1848
|
readonly line_level_total_discount: number;
|
|
1675
|
-
readonly quantity_rule?: {
|
|
1676
|
-
readonly min: number;
|
|
1677
|
-
readonly max: number | null;
|
|
1678
|
-
readonly increment: number;
|
|
1679
|
-
} | undefined;
|
|
1680
1849
|
readonly has_components: boolean;
|
|
1681
1850
|
readonly unit_price?: number | undefined;
|
|
1682
|
-
readonly unit_price_measurement?: {
|
|
1683
|
-
readonly measured_type: "volume" | "weight" | "dimension";
|
|
1684
|
-
readonly quantity_unit: string;
|
|
1685
|
-
readonly quantity_value: number;
|
|
1686
|
-
readonly reference_unit: string;
|
|
1687
|
-
readonly reference_value: number;
|
|
1688
|
-
} | undefined;
|
|
1689
|
-
readonly selling_plan_allocation: {
|
|
1690
|
-
readonly price: number;
|
|
1691
|
-
readonly price_adjustments: readonly {
|
|
1692
|
-
readonly position: number;
|
|
1693
|
-
readonly price: number;
|
|
1694
|
-
}[];
|
|
1695
|
-
readonly compare_at_price: number;
|
|
1696
|
-
readonly per_delivery_price: number;
|
|
1697
|
-
readonly selling_plan: {
|
|
1698
|
-
readonly description: string | null;
|
|
1699
|
-
readonly name: string;
|
|
1700
|
-
readonly id: string | number;
|
|
1701
|
-
readonly options: readonly {
|
|
1702
|
-
readonly value: string;
|
|
1703
|
-
readonly name: string;
|
|
1704
|
-
readonly position: number;
|
|
1705
|
-
}[];
|
|
1706
|
-
readonly recurring_deliveries: boolean;
|
|
1707
|
-
readonly fixed_selling_plan: boolean;
|
|
1708
|
-
readonly price_adjustments: readonly {
|
|
1709
|
-
readonly value: string | number;
|
|
1710
|
-
readonly value_type: "fixed_amount" | "percentage" | "price";
|
|
1711
|
-
readonly position: number;
|
|
1712
|
-
readonly order_count: number | null;
|
|
1713
|
-
}[];
|
|
1714
|
-
};
|
|
1715
|
-
} | null;
|
|
1716
1851
|
} & {
|
|
1717
1852
|
readonly properties_array: readonly {
|
|
1718
1853
|
readonly key: string;
|
|
@@ -1736,14 +1871,14 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1736
1871
|
readonly currency: string;
|
|
1737
1872
|
readonly items_subtotal_price: number;
|
|
1738
1873
|
readonly cart_level_discount_applications: readonly {
|
|
1874
|
+
readonly title: string;
|
|
1875
|
+
readonly description: string | null;
|
|
1739
1876
|
readonly value: number;
|
|
1740
1877
|
readonly target_selection: "all" | "entitled" | "explicit";
|
|
1741
1878
|
readonly target_type: "line_item" | "shipping_line";
|
|
1742
|
-
readonly title: string;
|
|
1743
1879
|
readonly total_allocated_amount: number;
|
|
1744
1880
|
readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
|
|
1745
1881
|
readonly value_type: "fixed_amount" | "percentage";
|
|
1746
|
-
readonly description: string | null;
|
|
1747
1882
|
}[];
|
|
1748
1883
|
} & {
|
|
1749
1884
|
readonly attributes_array: readonly {
|
|
@@ -1771,6 +1906,32 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1771
1906
|
description?: string;
|
|
1772
1907
|
} | undefined;
|
|
1773
1908
|
}>;
|
|
1909
|
+
/**
|
|
1910
|
+
* Retrieves the current state of the cart.
|
|
1911
|
+
*
|
|
1912
|
+
* This function sends a request to retrieve the current state of the cart.
|
|
1913
|
+
* It does not require any input parameters.
|
|
1914
|
+
* The function accepts optional request options, such as an AbortSignal for cancellation.
|
|
1915
|
+
*
|
|
1916
|
+
* @param input - An optional input object containing request options.
|
|
1917
|
+
* @param input.signal - An AbortSignal object to abort the request.
|
|
1918
|
+
* @param input.headers - Custom headers to be sent with the request.
|
|
1919
|
+
*
|
|
1920
|
+
* @returns A Promise that resolves to the current cart object.
|
|
1921
|
+
*
|
|
1922
|
+
* @example
|
|
1923
|
+
* ```typescript
|
|
1924
|
+
* const ajaxCartApi = createAjaxCartApi({ debug: true });
|
|
1925
|
+
*
|
|
1926
|
+
* ajaxCartApi.get()
|
|
1927
|
+
* .then((response) => {
|
|
1928
|
+
* console.log("Current cart:", response);
|
|
1929
|
+
* })
|
|
1930
|
+
* .catch((error) => {
|
|
1931
|
+
* console.error("Failed to retrieve cart:", error);
|
|
1932
|
+
* });
|
|
1933
|
+
* ```
|
|
1934
|
+
*/
|
|
1774
1935
|
get: (input: get.Input, options?: createAjaxCartClient.RequestOptions) => Promise<{
|
|
1775
1936
|
readonly data?: undefined;
|
|
1776
1937
|
readonly error?: {
|
|
@@ -1780,6 +1941,9 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1780
1941
|
} | undefined;
|
|
1781
1942
|
} | {
|
|
1782
1943
|
readonly data?: ({
|
|
1944
|
+
readonly attributes: {
|
|
1945
|
+
readonly [x: string]: string | number | boolean | null;
|
|
1946
|
+
};
|
|
1783
1947
|
readonly total_discount: number;
|
|
1784
1948
|
readonly discounts: readonly {
|
|
1785
1949
|
readonly title: string;
|
|
@@ -1788,9 +1952,6 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1788
1952
|
readonly requires_shipping: boolean;
|
|
1789
1953
|
readonly token: string;
|
|
1790
1954
|
readonly note: string | null;
|
|
1791
|
-
readonly attributes: {
|
|
1792
|
-
readonly [x: string]: string | number | boolean | null;
|
|
1793
|
-
};
|
|
1794
1955
|
readonly discount_codes: readonly {
|
|
1795
1956
|
readonly code: string;
|
|
1796
1957
|
readonly applicable: boolean;
|
|
@@ -1800,11 +1961,52 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1800
1961
|
readonly total_weight: number;
|
|
1801
1962
|
readonly item_count: number;
|
|
1802
1963
|
readonly items: readonly ({
|
|
1803
|
-
readonly key: string;
|
|
1804
1964
|
readonly title: string;
|
|
1965
|
+
readonly key: string;
|
|
1805
1966
|
readonly url: string;
|
|
1967
|
+
readonly image: string | null;
|
|
1968
|
+
readonly quantity_rule?: {
|
|
1969
|
+
readonly min: number;
|
|
1970
|
+
readonly max: number | null;
|
|
1971
|
+
readonly increment: number;
|
|
1972
|
+
} | undefined;
|
|
1806
1973
|
readonly price: number;
|
|
1807
1974
|
readonly id: string | number;
|
|
1975
|
+
readonly selling_plan_allocation: {
|
|
1976
|
+
readonly price: number;
|
|
1977
|
+
readonly price_adjustments: readonly {
|
|
1978
|
+
readonly position: number;
|
|
1979
|
+
readonly price: number;
|
|
1980
|
+
}[];
|
|
1981
|
+
readonly selling_plan: {
|
|
1982
|
+
readonly description: string | null;
|
|
1983
|
+
readonly name: string;
|
|
1984
|
+
readonly id: string | number;
|
|
1985
|
+
readonly options: readonly {
|
|
1986
|
+
readonly value: string;
|
|
1987
|
+
readonly name: string;
|
|
1988
|
+
readonly position: number;
|
|
1989
|
+
}[];
|
|
1990
|
+
readonly recurring_deliveries: boolean;
|
|
1991
|
+
readonly fixed_selling_plan: boolean;
|
|
1992
|
+
readonly price_adjustments: readonly {
|
|
1993
|
+
readonly value: string | number;
|
|
1994
|
+
readonly value_type: "fixed_amount" | "percentage" | "price";
|
|
1995
|
+
readonly position: number;
|
|
1996
|
+
readonly order_count: number | null;
|
|
1997
|
+
}[];
|
|
1998
|
+
};
|
|
1999
|
+
readonly compare_at_price: number;
|
|
2000
|
+
readonly per_delivery_price: number;
|
|
2001
|
+
} | null;
|
|
2002
|
+
readonly unit_price_measurement?: {
|
|
2003
|
+
readonly measured_type: "volume" | "weight" | "dimension";
|
|
2004
|
+
readonly quantity_unit: string;
|
|
2005
|
+
readonly quantity_value: number;
|
|
2006
|
+
readonly reference_unit: string;
|
|
2007
|
+
readonly reference_value: number;
|
|
2008
|
+
} | undefined;
|
|
2009
|
+
readonly variant_options: readonly string[];
|
|
1808
2010
|
readonly properties: {
|
|
1809
2011
|
readonly [x: string]: string | number | boolean | null;
|
|
1810
2012
|
};
|
|
@@ -1835,73 +2037,32 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1835
2037
|
readonly url: string | null;
|
|
1836
2038
|
readonly width: number | null;
|
|
1837
2039
|
};
|
|
1838
|
-
readonly image: string | null;
|
|
1839
2040
|
readonly handle: string;
|
|
1840
2041
|
readonly requires_shipping: boolean;
|
|
1841
2042
|
readonly product_type: string | null;
|
|
1842
2043
|
readonly product_title: string;
|
|
1843
2044
|
readonly product_description: string | null;
|
|
1844
2045
|
readonly variant_title: string | null;
|
|
1845
|
-
readonly variant_options: readonly string[];
|
|
1846
2046
|
readonly options_with_values: readonly {
|
|
1847
2047
|
readonly value: string;
|
|
1848
2048
|
readonly name: string;
|
|
1849
2049
|
}[];
|
|
1850
2050
|
readonly line_level_discount_allocations: readonly {
|
|
1851
|
-
readonly amount: number;
|
|
1852
2051
|
readonly discount_application: {
|
|
2052
|
+
readonly title: string;
|
|
2053
|
+
readonly description: string | null;
|
|
1853
2054
|
readonly value: number;
|
|
1854
2055
|
readonly target_selection: "all" | "entitled" | "explicit";
|
|
1855
2056
|
readonly target_type: "line_item" | "shipping_line";
|
|
1856
|
-
readonly title: string;
|
|
1857
2057
|
readonly total_allocated_amount: number;
|
|
1858
2058
|
readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
|
|
1859
2059
|
readonly value_type: "fixed_amount" | "percentage";
|
|
1860
|
-
readonly description: string | null;
|
|
1861
2060
|
};
|
|
2061
|
+
readonly amount: number;
|
|
1862
2062
|
}[];
|
|
1863
2063
|
readonly line_level_total_discount: number;
|
|
1864
|
-
readonly quantity_rule?: {
|
|
1865
|
-
readonly min: number;
|
|
1866
|
-
readonly max: number | null;
|
|
1867
|
-
readonly increment: number;
|
|
1868
|
-
} | undefined;
|
|
1869
2064
|
readonly has_components: boolean;
|
|
1870
2065
|
readonly unit_price?: number | undefined;
|
|
1871
|
-
readonly unit_price_measurement?: {
|
|
1872
|
-
readonly measured_type: "volume" | "weight" | "dimension";
|
|
1873
|
-
readonly quantity_unit: string;
|
|
1874
|
-
readonly quantity_value: number;
|
|
1875
|
-
readonly reference_unit: string;
|
|
1876
|
-
readonly reference_value: number;
|
|
1877
|
-
} | undefined;
|
|
1878
|
-
readonly selling_plan_allocation: {
|
|
1879
|
-
readonly price: number;
|
|
1880
|
-
readonly price_adjustments: readonly {
|
|
1881
|
-
readonly position: number;
|
|
1882
|
-
readonly price: number;
|
|
1883
|
-
}[];
|
|
1884
|
-
readonly compare_at_price: number;
|
|
1885
|
-
readonly per_delivery_price: number;
|
|
1886
|
-
readonly selling_plan: {
|
|
1887
|
-
readonly description: string | null;
|
|
1888
|
-
readonly name: string;
|
|
1889
|
-
readonly id: string | number;
|
|
1890
|
-
readonly options: readonly {
|
|
1891
|
-
readonly value: string;
|
|
1892
|
-
readonly name: string;
|
|
1893
|
-
readonly position: number;
|
|
1894
|
-
}[];
|
|
1895
|
-
readonly recurring_deliveries: boolean;
|
|
1896
|
-
readonly fixed_selling_plan: boolean;
|
|
1897
|
-
readonly price_adjustments: readonly {
|
|
1898
|
-
readonly value: string | number;
|
|
1899
|
-
readonly value_type: "fixed_amount" | "percentage" | "price";
|
|
1900
|
-
readonly position: number;
|
|
1901
|
-
readonly order_count: number | null;
|
|
1902
|
-
}[];
|
|
1903
|
-
};
|
|
1904
|
-
} | null;
|
|
1905
2066
|
} & {
|
|
1906
2067
|
readonly properties_array: readonly {
|
|
1907
2068
|
readonly key: string;
|
|
@@ -1925,14 +2086,14 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1925
2086
|
readonly currency: string;
|
|
1926
2087
|
readonly items_subtotal_price: number;
|
|
1927
2088
|
readonly cart_level_discount_applications: readonly {
|
|
2089
|
+
readonly title: string;
|
|
2090
|
+
readonly description: string | null;
|
|
1928
2091
|
readonly value: number;
|
|
1929
2092
|
readonly target_selection: "all" | "entitled" | "explicit";
|
|
1930
2093
|
readonly target_type: "line_item" | "shipping_line";
|
|
1931
|
-
readonly title: string;
|
|
1932
2094
|
readonly total_allocated_amount: number;
|
|
1933
2095
|
readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
|
|
1934
2096
|
readonly value_type: "fixed_amount" | "percentage";
|
|
1935
|
-
readonly description: string | null;
|
|
1936
2097
|
}[];
|
|
1937
2098
|
} & {
|
|
1938
2099
|
readonly attributes_array: readonly {
|
|
@@ -1960,6 +2121,41 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1960
2121
|
description?: string;
|
|
1961
2122
|
} | undefined;
|
|
1962
2123
|
}>;
|
|
2124
|
+
/**
|
|
2125
|
+
* Updates the cart with the provided input data.
|
|
2126
|
+
*
|
|
2127
|
+
* This function sends a request to update any cart level data (discount codes, notes, attributes, etc...).
|
|
2128
|
+
* It uses the provided input object to specify the changes to be made to the cart.
|
|
2129
|
+
* The function also accepts optional request options, such as an AbortSignal for cancellation.
|
|
2130
|
+
*
|
|
2131
|
+
* @param input - The input object containing the changes to be made to the cart.
|
|
2132
|
+
* @param options - An optional object containing request options.
|
|
2133
|
+
* @param options.signal - An AbortSignal object to abort the request.
|
|
2134
|
+
* @param options.headers - Custom headers to be sent with the request.
|
|
2135
|
+
*
|
|
2136
|
+
* @returns A Promise that resolves to the updated cart object.
|
|
2137
|
+
*
|
|
2138
|
+
* @example
|
|
2139
|
+
* ```typescript
|
|
2140
|
+
* const ajaxCartApi = createAjaxCartApi({ debug: true });
|
|
2141
|
+
*
|
|
2142
|
+
* ajaxCartApi.update({
|
|
2143
|
+
* updates: { 1231231: 2, 1231230: 0 },
|
|
2144
|
+
* note: "This is a note",
|
|
2145
|
+
* attributes: {
|
|
2146
|
+
* "public_key": "Public value",
|
|
2147
|
+
* "_private_key": "Private value"
|
|
2148
|
+
* },
|
|
2149
|
+
* discount: ["hello","world"]
|
|
2150
|
+
* })
|
|
2151
|
+
* .then((response) => {
|
|
2152
|
+
* console.log("Cart updated:", response);
|
|
2153
|
+
* })
|
|
2154
|
+
* .catch((error) => {
|
|
2155
|
+
* console.error("Failed to update cart:", error);
|
|
2156
|
+
* });
|
|
2157
|
+
* ```
|
|
2158
|
+
*/
|
|
1963
2159
|
update: (input: update.Input, options?: createAjaxCartClient.RequestOptions) => Promise<{
|
|
1964
2160
|
readonly data?: undefined;
|
|
1965
2161
|
readonly error?: {
|
|
@@ -1969,6 +2165,9 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1969
2165
|
} | undefined;
|
|
1970
2166
|
} | {
|
|
1971
2167
|
readonly data?: ({
|
|
2168
|
+
readonly attributes: {
|
|
2169
|
+
readonly [x: string]: string | number | boolean | null;
|
|
2170
|
+
};
|
|
1972
2171
|
readonly total_discount: number;
|
|
1973
2172
|
readonly discounts: readonly {
|
|
1974
2173
|
readonly title: string;
|
|
@@ -1977,9 +2176,6 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1977
2176
|
readonly requires_shipping: boolean;
|
|
1978
2177
|
readonly token: string;
|
|
1979
2178
|
readonly note: string | null;
|
|
1980
|
-
readonly attributes: {
|
|
1981
|
-
readonly [x: string]: string | number | boolean | null;
|
|
1982
|
-
};
|
|
1983
2179
|
readonly discount_codes: readonly {
|
|
1984
2180
|
readonly code: string;
|
|
1985
2181
|
readonly applicable: boolean;
|
|
@@ -1989,11 +2185,52 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
1989
2185
|
readonly total_weight: number;
|
|
1990
2186
|
readonly item_count: number;
|
|
1991
2187
|
readonly items: readonly ({
|
|
1992
|
-
readonly key: string;
|
|
1993
2188
|
readonly title: string;
|
|
2189
|
+
readonly key: string;
|
|
1994
2190
|
readonly url: string;
|
|
2191
|
+
readonly image: string | null;
|
|
2192
|
+
readonly quantity_rule?: {
|
|
2193
|
+
readonly min: number;
|
|
2194
|
+
readonly max: number | null;
|
|
2195
|
+
readonly increment: number;
|
|
2196
|
+
} | undefined;
|
|
1995
2197
|
readonly price: number;
|
|
1996
2198
|
readonly id: string | number;
|
|
2199
|
+
readonly selling_plan_allocation: {
|
|
2200
|
+
readonly price: number;
|
|
2201
|
+
readonly price_adjustments: readonly {
|
|
2202
|
+
readonly position: number;
|
|
2203
|
+
readonly price: number;
|
|
2204
|
+
}[];
|
|
2205
|
+
readonly selling_plan: {
|
|
2206
|
+
readonly description: string | null;
|
|
2207
|
+
readonly name: string;
|
|
2208
|
+
readonly id: string | number;
|
|
2209
|
+
readonly options: readonly {
|
|
2210
|
+
readonly value: string;
|
|
2211
|
+
readonly name: string;
|
|
2212
|
+
readonly position: number;
|
|
2213
|
+
}[];
|
|
2214
|
+
readonly recurring_deliveries: boolean;
|
|
2215
|
+
readonly fixed_selling_plan: boolean;
|
|
2216
|
+
readonly price_adjustments: readonly {
|
|
2217
|
+
readonly value: string | number;
|
|
2218
|
+
readonly value_type: "fixed_amount" | "percentage" | "price";
|
|
2219
|
+
readonly position: number;
|
|
2220
|
+
readonly order_count: number | null;
|
|
2221
|
+
}[];
|
|
2222
|
+
};
|
|
2223
|
+
readonly compare_at_price: number;
|
|
2224
|
+
readonly per_delivery_price: number;
|
|
2225
|
+
} | null;
|
|
2226
|
+
readonly unit_price_measurement?: {
|
|
2227
|
+
readonly measured_type: "volume" | "weight" | "dimension";
|
|
2228
|
+
readonly quantity_unit: string;
|
|
2229
|
+
readonly quantity_value: number;
|
|
2230
|
+
readonly reference_unit: string;
|
|
2231
|
+
readonly reference_value: number;
|
|
2232
|
+
} | undefined;
|
|
2233
|
+
readonly variant_options: readonly string[];
|
|
1997
2234
|
readonly properties: {
|
|
1998
2235
|
readonly [x: string]: string | number | boolean | null;
|
|
1999
2236
|
};
|
|
@@ -2024,73 +2261,32 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
2024
2261
|
readonly url: string | null;
|
|
2025
2262
|
readonly width: number | null;
|
|
2026
2263
|
};
|
|
2027
|
-
readonly image: string | null;
|
|
2028
2264
|
readonly handle: string;
|
|
2029
2265
|
readonly requires_shipping: boolean;
|
|
2030
2266
|
readonly product_type: string | null;
|
|
2031
2267
|
readonly product_title: string;
|
|
2032
2268
|
readonly product_description: string | null;
|
|
2033
2269
|
readonly variant_title: string | null;
|
|
2034
|
-
readonly variant_options: readonly string[];
|
|
2035
2270
|
readonly options_with_values: readonly {
|
|
2036
2271
|
readonly value: string;
|
|
2037
2272
|
readonly name: string;
|
|
2038
2273
|
}[];
|
|
2039
2274
|
readonly line_level_discount_allocations: readonly {
|
|
2040
|
-
readonly amount: number;
|
|
2041
2275
|
readonly discount_application: {
|
|
2276
|
+
readonly title: string;
|
|
2277
|
+
readonly description: string | null;
|
|
2042
2278
|
readonly value: number;
|
|
2043
2279
|
readonly target_selection: "all" | "entitled" | "explicit";
|
|
2044
2280
|
readonly target_type: "line_item" | "shipping_line";
|
|
2045
|
-
readonly title: string;
|
|
2046
2281
|
readonly total_allocated_amount: number;
|
|
2047
2282
|
readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
|
|
2048
2283
|
readonly value_type: "fixed_amount" | "percentage";
|
|
2049
|
-
readonly description: string | null;
|
|
2050
2284
|
};
|
|
2285
|
+
readonly amount: number;
|
|
2051
2286
|
}[];
|
|
2052
2287
|
readonly line_level_total_discount: number;
|
|
2053
|
-
readonly quantity_rule?: {
|
|
2054
|
-
readonly min: number;
|
|
2055
|
-
readonly max: number | null;
|
|
2056
|
-
readonly increment: number;
|
|
2057
|
-
} | undefined;
|
|
2058
2288
|
readonly has_components: boolean;
|
|
2059
2289
|
readonly unit_price?: number | undefined;
|
|
2060
|
-
readonly unit_price_measurement?: {
|
|
2061
|
-
readonly measured_type: "volume" | "weight" | "dimension";
|
|
2062
|
-
readonly quantity_unit: string;
|
|
2063
|
-
readonly quantity_value: number;
|
|
2064
|
-
readonly reference_unit: string;
|
|
2065
|
-
readonly reference_value: number;
|
|
2066
|
-
} | undefined;
|
|
2067
|
-
readonly selling_plan_allocation: {
|
|
2068
|
-
readonly price: number;
|
|
2069
|
-
readonly price_adjustments: readonly {
|
|
2070
|
-
readonly position: number;
|
|
2071
|
-
readonly price: number;
|
|
2072
|
-
}[];
|
|
2073
|
-
readonly compare_at_price: number;
|
|
2074
|
-
readonly per_delivery_price: number;
|
|
2075
|
-
readonly selling_plan: {
|
|
2076
|
-
readonly description: string | null;
|
|
2077
|
-
readonly name: string;
|
|
2078
|
-
readonly id: string | number;
|
|
2079
|
-
readonly options: readonly {
|
|
2080
|
-
readonly value: string;
|
|
2081
|
-
readonly name: string;
|
|
2082
|
-
readonly position: number;
|
|
2083
|
-
}[];
|
|
2084
|
-
readonly recurring_deliveries: boolean;
|
|
2085
|
-
readonly fixed_selling_plan: boolean;
|
|
2086
|
-
readonly price_adjustments: readonly {
|
|
2087
|
-
readonly value: string | number;
|
|
2088
|
-
readonly value_type: "fixed_amount" | "percentage" | "price";
|
|
2089
|
-
readonly position: number;
|
|
2090
|
-
readonly order_count: number | null;
|
|
2091
|
-
}[];
|
|
2092
|
-
};
|
|
2093
|
-
} | null;
|
|
2094
2290
|
} & {
|
|
2095
2291
|
readonly properties_array: readonly {
|
|
2096
2292
|
readonly key: string;
|
|
@@ -2114,14 +2310,14 @@ export declare const createAjaxCartApi: ({ debug }: {
|
|
|
2114
2310
|
readonly currency: string;
|
|
2115
2311
|
readonly items_subtotal_price: number;
|
|
2116
2312
|
readonly cart_level_discount_applications: readonly {
|
|
2313
|
+
readonly title: string;
|
|
2314
|
+
readonly description: string | null;
|
|
2117
2315
|
readonly value: number;
|
|
2118
2316
|
readonly target_selection: "all" | "entitled" | "explicit";
|
|
2119
2317
|
readonly target_type: "line_item" | "shipping_line";
|
|
2120
|
-
readonly title: string;
|
|
2121
2318
|
readonly total_allocated_amount: number;
|
|
2122
2319
|
readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
|
|
2123
2320
|
readonly value_type: "fixed_amount" | "percentage";
|
|
2124
|
-
readonly description: string | null;
|
|
2125
2321
|
}[];
|
|
2126
2322
|
} & {
|
|
2127
2323
|
readonly attributes_array: readonly {
|