@brytdesigns/shopify-ajax-cart-api 1.0.3 → 1.0.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.
@@ -152,14 +152,18 @@ export declare const add: (input?: ({
152
152
  readonly sections_url?: string | undefined;
153
153
  }) | undefined) => import("effect/Effect").Effect<AjaxClientResponse<undefined> | AjaxClientResponse<{
154
154
  readonly items: readonly {
155
+ readonly key: string;
155
156
  readonly title: string;
156
157
  readonly url: string;
157
158
  readonly price: number;
158
159
  readonly id: string | number;
159
- readonly key: string;
160
160
  readonly properties: {
161
161
  readonly [x: string]: string | number | boolean | null;
162
162
  } | null;
163
+ readonly properties_array: readonly {
164
+ readonly key: string;
165
+ readonly value: string | number | boolean | null;
166
+ }[] | null;
163
167
  readonly quantity: number;
164
168
  readonly variant_id: string | number;
165
169
  readonly original_price: number;
@@ -202,12 +206,12 @@ export declare const add: (input?: ({
202
206
  readonly line_level_discount_allocations: readonly {
203
207
  readonly amount: number;
204
208
  readonly discount_application: {
209
+ readonly value: number;
205
210
  readonly target_selection: "all" | "entitled" | "explicit";
206
211
  readonly target_type: "line_item" | "shipping_line";
207
212
  readonly title: string;
208
213
  readonly total_allocated_amount: number;
209
214
  readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
210
- readonly value: number;
211
215
  readonly value_type: "fixed_amount" | "percentage";
212
216
  readonly description: string | null;
213
217
  };
@@ -261,14 +265,18 @@ export declare const add: (input?: ({
261
265
  };
262
266
  }> | AjaxClientResponse<{
263
267
  readonly items: readonly {
268
+ readonly key: string;
264
269
  readonly title: string;
265
270
  readonly url: string;
266
271
  readonly price: number;
267
272
  readonly id: string | number;
268
- readonly key: string;
269
273
  readonly properties: {
270
274
  readonly [x: string]: string | number | boolean | null;
271
275
  } | null;
276
+ readonly properties_array: readonly {
277
+ readonly key: string;
278
+ readonly value: string | number | boolean | null;
279
+ }[] | null;
272
280
  readonly quantity: number;
273
281
  readonly variant_id: string | number;
274
282
  readonly original_price: number;
@@ -311,12 +319,12 @@ export declare const add: (input?: ({
311
319
  readonly line_level_discount_allocations: readonly {
312
320
  readonly amount: number;
313
321
  readonly discount_application: {
322
+ readonly value: number;
314
323
  readonly target_selection: "all" | "entitled" | "explicit";
315
324
  readonly target_type: "line_item" | "shipping_line";
316
325
  readonly title: string;
317
326
  readonly total_allocated_amount: number;
318
327
  readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
319
- readonly value: number;
320
328
  readonly value_type: "fixed_amount" | "percentage";
321
329
  readonly description: string | null;
322
330
  };
@@ -404,6 +412,10 @@ export declare const change: (input?: ({
404
412
  readonly attributes: {
405
413
  readonly [x: string]: string | number | boolean | null;
406
414
  };
415
+ readonly attributes_array: readonly {
416
+ readonly key: string;
417
+ readonly value: string | number | boolean | null;
418
+ }[];
407
419
  readonly discount_codes: readonly {
408
420
  readonly code: string;
409
421
  readonly applicable: boolean;
@@ -413,14 +425,18 @@ export declare const change: (input?: ({
413
425
  readonly total_weight: number;
414
426
  readonly item_count: number;
415
427
  readonly items: readonly {
428
+ readonly key: string;
416
429
  readonly title: string;
417
430
  readonly url: string;
418
431
  readonly price: number;
419
432
  readonly id: string | number;
420
- readonly key: string;
421
433
  readonly properties: {
422
434
  readonly [x: string]: string | number | boolean | null;
423
435
  } | null;
436
+ readonly properties_array: readonly {
437
+ readonly key: string;
438
+ readonly value: string | number | boolean | null;
439
+ }[] | null;
424
440
  readonly quantity: number;
425
441
  readonly variant_id: string | number;
426
442
  readonly original_price: number;
@@ -463,12 +479,12 @@ export declare const change: (input?: ({
463
479
  readonly line_level_discount_allocations: readonly {
464
480
  readonly amount: number;
465
481
  readonly discount_application: {
482
+ readonly value: number;
466
483
  readonly target_selection: "all" | "entitled" | "explicit";
467
484
  readonly target_type: "line_item" | "shipping_line";
468
485
  readonly title: string;
469
486
  readonly total_allocated_amount: number;
470
487
  readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
471
- readonly value: number;
472
488
  readonly value_type: "fixed_amount" | "percentage";
473
489
  readonly description: string | null;
474
490
  };
@@ -519,12 +535,12 @@ export declare const change: (input?: ({
519
535
  readonly currency: string;
520
536
  readonly items_subtotal_price: number;
521
537
  readonly cart_level_discount_applications: readonly {
538
+ readonly value: number;
522
539
  readonly target_selection: "all" | "entitled" | "explicit";
523
540
  readonly target_type: "line_item" | "shipping_line";
524
541
  readonly title: string;
525
542
  readonly total_allocated_amount: number;
526
543
  readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
527
- readonly value: number;
528
544
  readonly value_type: "fixed_amount" | "percentage";
529
545
  readonly description: string | null;
530
546
  }[];
@@ -582,6 +598,10 @@ export declare const change: (input?: ({
582
598
  readonly attributes: {
583
599
  readonly [x: string]: string | number | boolean | null;
584
600
  };
601
+ readonly attributes_array: readonly {
602
+ readonly key: string;
603
+ readonly value: string | number | boolean | null;
604
+ }[];
585
605
  readonly discount_codes: readonly {
586
606
  readonly code: string;
587
607
  readonly applicable: boolean;
@@ -591,14 +611,18 @@ export declare const change: (input?: ({
591
611
  readonly total_weight: number;
592
612
  readonly item_count: number;
593
613
  readonly items: readonly {
614
+ readonly key: string;
594
615
  readonly title: string;
595
616
  readonly url: string;
596
617
  readonly price: number;
597
618
  readonly id: string | number;
598
- readonly key: string;
599
619
  readonly properties: {
600
620
  readonly [x: string]: string | number | boolean | null;
601
621
  } | null;
622
+ readonly properties_array: readonly {
623
+ readonly key: string;
624
+ readonly value: string | number | boolean | null;
625
+ }[] | null;
602
626
  readonly quantity: number;
603
627
  readonly variant_id: string | number;
604
628
  readonly original_price: number;
@@ -641,12 +665,12 @@ export declare const change: (input?: ({
641
665
  readonly line_level_discount_allocations: readonly {
642
666
  readonly amount: number;
643
667
  readonly discount_application: {
668
+ readonly value: number;
644
669
  readonly target_selection: "all" | "entitled" | "explicit";
645
670
  readonly target_type: "line_item" | "shipping_line";
646
671
  readonly title: string;
647
672
  readonly total_allocated_amount: number;
648
673
  readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
649
- readonly value: number;
650
674
  readonly value_type: "fixed_amount" | "percentage";
651
675
  readonly description: string | null;
652
676
  };
@@ -697,12 +721,12 @@ export declare const change: (input?: ({
697
721
  readonly currency: string;
698
722
  readonly items_subtotal_price: number;
699
723
  readonly cart_level_discount_applications: readonly {
724
+ readonly value: number;
700
725
  readonly target_selection: "all" | "entitled" | "explicit";
701
726
  readonly target_type: "line_item" | "shipping_line";
702
727
  readonly title: string;
703
728
  readonly total_allocated_amount: number;
704
729
  readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
705
- readonly value: number;
706
730
  readonly value_type: "fixed_amount" | "percentage";
707
731
  readonly description: string | null;
708
732
  }[];
@@ -765,6 +789,10 @@ export declare const clear: (input?: {
765
789
  readonly attributes: {
766
790
  readonly [x: string]: string | number | boolean | null;
767
791
  };
792
+ readonly attributes_array: readonly {
793
+ readonly key: string;
794
+ readonly value: string | number | boolean | null;
795
+ }[];
768
796
  readonly discount_codes: readonly {
769
797
  readonly code: string;
770
798
  readonly applicable: boolean;
@@ -774,14 +802,18 @@ export declare const clear: (input?: {
774
802
  readonly total_weight: number;
775
803
  readonly item_count: number;
776
804
  readonly items: readonly {
805
+ readonly key: string;
777
806
  readonly title: string;
778
807
  readonly url: string;
779
808
  readonly price: number;
780
809
  readonly id: string | number;
781
- readonly key: string;
782
810
  readonly properties: {
783
811
  readonly [x: string]: string | number | boolean | null;
784
812
  } | null;
813
+ readonly properties_array: readonly {
814
+ readonly key: string;
815
+ readonly value: string | number | boolean | null;
816
+ }[] | null;
785
817
  readonly quantity: number;
786
818
  readonly variant_id: string | number;
787
819
  readonly original_price: number;
@@ -824,12 +856,12 @@ export declare const clear: (input?: {
824
856
  readonly line_level_discount_allocations: readonly {
825
857
  readonly amount: number;
826
858
  readonly discount_application: {
859
+ readonly value: number;
827
860
  readonly target_selection: "all" | "entitled" | "explicit";
828
861
  readonly target_type: "line_item" | "shipping_line";
829
862
  readonly title: string;
830
863
  readonly total_allocated_amount: number;
831
864
  readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
832
- readonly value: number;
833
865
  readonly value_type: "fixed_amount" | "percentage";
834
866
  readonly description: string | null;
835
867
  };
@@ -880,12 +912,12 @@ export declare const clear: (input?: {
880
912
  readonly currency: string;
881
913
  readonly items_subtotal_price: number;
882
914
  readonly cart_level_discount_applications: readonly {
915
+ readonly value: number;
883
916
  readonly target_selection: "all" | "entitled" | "explicit";
884
917
  readonly target_type: "line_item" | "shipping_line";
885
918
  readonly title: string;
886
919
  readonly total_allocated_amount: number;
887
920
  readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
888
- readonly value: number;
889
921
  readonly value_type: "fixed_amount" | "percentage";
890
922
  readonly description: string | null;
891
923
  }[];
@@ -905,6 +937,10 @@ export declare const clear: (input?: {
905
937
  readonly attributes: {
906
938
  readonly [x: string]: string | number | boolean | null;
907
939
  };
940
+ readonly attributes_array: readonly {
941
+ readonly key: string;
942
+ readonly value: string | number | boolean | null;
943
+ }[];
908
944
  readonly discount_codes: readonly {
909
945
  readonly code: string;
910
946
  readonly applicable: boolean;
@@ -914,14 +950,18 @@ export declare const clear: (input?: {
914
950
  readonly total_weight: number;
915
951
  readonly item_count: number;
916
952
  readonly items: readonly {
953
+ readonly key: string;
917
954
  readonly title: string;
918
955
  readonly url: string;
919
956
  readonly price: number;
920
957
  readonly id: string | number;
921
- readonly key: string;
922
958
  readonly properties: {
923
959
  readonly [x: string]: string | number | boolean | null;
924
960
  } | null;
961
+ readonly properties_array: readonly {
962
+ readonly key: string;
963
+ readonly value: string | number | boolean | null;
964
+ }[] | null;
925
965
  readonly quantity: number;
926
966
  readonly variant_id: string | number;
927
967
  readonly original_price: number;
@@ -964,12 +1004,12 @@ export declare const clear: (input?: {
964
1004
  readonly line_level_discount_allocations: readonly {
965
1005
  readonly amount: number;
966
1006
  readonly discount_application: {
1007
+ readonly value: number;
967
1008
  readonly target_selection: "all" | "entitled" | "explicit";
968
1009
  readonly target_type: "line_item" | "shipping_line";
969
1010
  readonly title: string;
970
1011
  readonly total_allocated_amount: number;
971
1012
  readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
972
- readonly value: number;
973
1013
  readonly value_type: "fixed_amount" | "percentage";
974
1014
  readonly description: string | null;
975
1015
  };
@@ -1020,12 +1060,12 @@ export declare const clear: (input?: {
1020
1060
  readonly currency: string;
1021
1061
  readonly items_subtotal_price: number;
1022
1062
  readonly cart_level_discount_applications: readonly {
1063
+ readonly value: number;
1023
1064
  readonly target_selection: "all" | "entitled" | "explicit";
1024
1065
  readonly target_type: "line_item" | "shipping_line";
1025
1066
  readonly title: string;
1026
1067
  readonly total_allocated_amount: number;
1027
1068
  readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
1028
- readonly value: number;
1029
1069
  readonly value_type: "fixed_amount" | "percentage";
1030
1070
  readonly description: string | null;
1031
1071
  }[];
@@ -1050,6 +1090,10 @@ export declare const get: (input?: {
1050
1090
  readonly attributes: {
1051
1091
  readonly [x: string]: string | number | boolean | null;
1052
1092
  };
1093
+ readonly attributes_array: readonly {
1094
+ readonly key: string;
1095
+ readonly value: string | number | boolean | null;
1096
+ }[];
1053
1097
  readonly discount_codes: readonly {
1054
1098
  readonly code: string;
1055
1099
  readonly applicable: boolean;
@@ -1059,14 +1103,18 @@ export declare const get: (input?: {
1059
1103
  readonly total_weight: number;
1060
1104
  readonly item_count: number;
1061
1105
  readonly items: readonly {
1106
+ readonly key: string;
1062
1107
  readonly title: string;
1063
1108
  readonly url: string;
1064
1109
  readonly price: number;
1065
1110
  readonly id: string | number;
1066
- readonly key: string;
1067
1111
  readonly properties: {
1068
1112
  readonly [x: string]: string | number | boolean | null;
1069
1113
  } | null;
1114
+ readonly properties_array: readonly {
1115
+ readonly key: string;
1116
+ readonly value: string | number | boolean | null;
1117
+ }[] | null;
1070
1118
  readonly quantity: number;
1071
1119
  readonly variant_id: string | number;
1072
1120
  readonly original_price: number;
@@ -1109,12 +1157,12 @@ export declare const get: (input?: {
1109
1157
  readonly line_level_discount_allocations: readonly {
1110
1158
  readonly amount: number;
1111
1159
  readonly discount_application: {
1160
+ readonly value: number;
1112
1161
  readonly target_selection: "all" | "entitled" | "explicit";
1113
1162
  readonly target_type: "line_item" | "shipping_line";
1114
1163
  readonly title: string;
1115
1164
  readonly total_allocated_amount: number;
1116
1165
  readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
1117
- readonly value: number;
1118
1166
  readonly value_type: "fixed_amount" | "percentage";
1119
1167
  readonly description: string | null;
1120
1168
  };
@@ -1165,12 +1213,12 @@ export declare const get: (input?: {
1165
1213
  readonly currency: string;
1166
1214
  readonly items_subtotal_price: number;
1167
1215
  readonly cart_level_discount_applications: readonly {
1216
+ readonly value: number;
1168
1217
  readonly target_selection: "all" | "entitled" | "explicit";
1169
1218
  readonly target_type: "line_item" | "shipping_line";
1170
1219
  readonly title: string;
1171
1220
  readonly total_allocated_amount: number;
1172
1221
  readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
1173
- readonly value: number;
1174
1222
  readonly value_type: "fixed_amount" | "percentage";
1175
1223
  readonly description: string | null;
1176
1224
  }[];
@@ -1190,6 +1238,10 @@ export declare const get: (input?: {
1190
1238
  readonly attributes: {
1191
1239
  readonly [x: string]: string | number | boolean | null;
1192
1240
  };
1241
+ readonly attributes_array: readonly {
1242
+ readonly key: string;
1243
+ readonly value: string | number | boolean | null;
1244
+ }[];
1193
1245
  readonly discount_codes: readonly {
1194
1246
  readonly code: string;
1195
1247
  readonly applicable: boolean;
@@ -1199,14 +1251,18 @@ export declare const get: (input?: {
1199
1251
  readonly total_weight: number;
1200
1252
  readonly item_count: number;
1201
1253
  readonly items: readonly {
1254
+ readonly key: string;
1202
1255
  readonly title: string;
1203
1256
  readonly url: string;
1204
1257
  readonly price: number;
1205
1258
  readonly id: string | number;
1206
- readonly key: string;
1207
1259
  readonly properties: {
1208
1260
  readonly [x: string]: string | number | boolean | null;
1209
1261
  } | null;
1262
+ readonly properties_array: readonly {
1263
+ readonly key: string;
1264
+ readonly value: string | number | boolean | null;
1265
+ }[] | null;
1210
1266
  readonly quantity: number;
1211
1267
  readonly variant_id: string | number;
1212
1268
  readonly original_price: number;
@@ -1249,12 +1305,12 @@ export declare const get: (input?: {
1249
1305
  readonly line_level_discount_allocations: readonly {
1250
1306
  readonly amount: number;
1251
1307
  readonly discount_application: {
1308
+ readonly value: number;
1252
1309
  readonly target_selection: "all" | "entitled" | "explicit";
1253
1310
  readonly target_type: "line_item" | "shipping_line";
1254
1311
  readonly title: string;
1255
1312
  readonly total_allocated_amount: number;
1256
1313
  readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
1257
- readonly value: number;
1258
1314
  readonly value_type: "fixed_amount" | "percentage";
1259
1315
  readonly description: string | null;
1260
1316
  };
@@ -1305,12 +1361,12 @@ export declare const get: (input?: {
1305
1361
  readonly currency: string;
1306
1362
  readonly items_subtotal_price: number;
1307
1363
  readonly cart_level_discount_applications: readonly {
1364
+ readonly value: number;
1308
1365
  readonly target_selection: "all" | "entitled" | "explicit";
1309
1366
  readonly target_type: "line_item" | "shipping_line";
1310
1367
  readonly title: string;
1311
1368
  readonly total_allocated_amount: number;
1312
1369
  readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
1313
- readonly value: number;
1314
1370
  readonly value_type: "fixed_amount" | "percentage";
1315
1371
  readonly description: string | null;
1316
1372
  }[];
@@ -1344,6 +1400,10 @@ export declare const update: (input?: ({
1344
1400
  readonly attributes: {
1345
1401
  readonly [x: string]: string | number | boolean | null;
1346
1402
  };
1403
+ readonly attributes_array: readonly {
1404
+ readonly key: string;
1405
+ readonly value: string | number | boolean | null;
1406
+ }[];
1347
1407
  readonly discount_codes: readonly {
1348
1408
  readonly code: string;
1349
1409
  readonly applicable: boolean;
@@ -1353,14 +1413,18 @@ export declare const update: (input?: ({
1353
1413
  readonly total_weight: number;
1354
1414
  readonly item_count: number;
1355
1415
  readonly items: readonly {
1416
+ readonly key: string;
1356
1417
  readonly title: string;
1357
1418
  readonly url: string;
1358
1419
  readonly price: number;
1359
1420
  readonly id: string | number;
1360
- readonly key: string;
1361
1421
  readonly properties: {
1362
1422
  readonly [x: string]: string | number | boolean | null;
1363
1423
  } | null;
1424
+ readonly properties_array: readonly {
1425
+ readonly key: string;
1426
+ readonly value: string | number | boolean | null;
1427
+ }[] | null;
1364
1428
  readonly quantity: number;
1365
1429
  readonly variant_id: string | number;
1366
1430
  readonly original_price: number;
@@ -1403,12 +1467,12 @@ export declare const update: (input?: ({
1403
1467
  readonly line_level_discount_allocations: readonly {
1404
1468
  readonly amount: number;
1405
1469
  readonly discount_application: {
1470
+ readonly value: number;
1406
1471
  readonly target_selection: "all" | "entitled" | "explicit";
1407
1472
  readonly target_type: "line_item" | "shipping_line";
1408
1473
  readonly title: string;
1409
1474
  readonly total_allocated_amount: number;
1410
1475
  readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
1411
- readonly value: number;
1412
1476
  readonly value_type: "fixed_amount" | "percentage";
1413
1477
  readonly description: string | null;
1414
1478
  };
@@ -1459,12 +1523,12 @@ export declare const update: (input?: ({
1459
1523
  readonly currency: string;
1460
1524
  readonly items_subtotal_price: number;
1461
1525
  readonly cart_level_discount_applications: readonly {
1526
+ readonly value: number;
1462
1527
  readonly target_selection: "all" | "entitled" | "explicit";
1463
1528
  readonly target_type: "line_item" | "shipping_line";
1464
1529
  readonly title: string;
1465
1530
  readonly total_allocated_amount: number;
1466
1531
  readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
1467
- readonly value: number;
1468
1532
  readonly value_type: "fixed_amount" | "percentage";
1469
1533
  readonly description: string | null;
1470
1534
  }[];
@@ -1490,6 +1554,10 @@ export declare const update: (input?: ({
1490
1554
  readonly attributes: {
1491
1555
  readonly [x: string]: string | number | boolean | null;
1492
1556
  };
1557
+ readonly attributes_array: readonly {
1558
+ readonly key: string;
1559
+ readonly value: string | number | boolean | null;
1560
+ }[];
1493
1561
  readonly discount_codes: readonly {
1494
1562
  readonly code: string;
1495
1563
  readonly applicable: boolean;
@@ -1499,14 +1567,18 @@ export declare const update: (input?: ({
1499
1567
  readonly total_weight: number;
1500
1568
  readonly item_count: number;
1501
1569
  readonly items: readonly {
1570
+ readonly key: string;
1502
1571
  readonly title: string;
1503
1572
  readonly url: string;
1504
1573
  readonly price: number;
1505
1574
  readonly id: string | number;
1506
- readonly key: string;
1507
1575
  readonly properties: {
1508
1576
  readonly [x: string]: string | number | boolean | null;
1509
1577
  } | null;
1578
+ readonly properties_array: readonly {
1579
+ readonly key: string;
1580
+ readonly value: string | number | boolean | null;
1581
+ }[] | null;
1510
1582
  readonly quantity: number;
1511
1583
  readonly variant_id: string | number;
1512
1584
  readonly original_price: number;
@@ -1549,12 +1621,12 @@ export declare const update: (input?: ({
1549
1621
  readonly line_level_discount_allocations: readonly {
1550
1622
  readonly amount: number;
1551
1623
  readonly discount_application: {
1624
+ readonly value: number;
1552
1625
  readonly target_selection: "all" | "entitled" | "explicit";
1553
1626
  readonly target_type: "line_item" | "shipping_line";
1554
1627
  readonly title: string;
1555
1628
  readonly total_allocated_amount: number;
1556
1629
  readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
1557
- readonly value: number;
1558
1630
  readonly value_type: "fixed_amount" | "percentage";
1559
1631
  readonly description: string | null;
1560
1632
  };
@@ -1605,12 +1677,12 @@ export declare const update: (input?: ({
1605
1677
  readonly currency: string;
1606
1678
  readonly items_subtotal_price: number;
1607
1679
  readonly cart_level_discount_applications: readonly {
1680
+ readonly value: number;
1608
1681
  readonly target_selection: "all" | "entitled" | "explicit";
1609
1682
  readonly target_type: "line_item" | "shipping_line";
1610
1683
  readonly title: string;
1611
1684
  readonly total_allocated_amount: number;
1612
1685
  readonly type: "" | "automatic" | "discount_code" | "manual" | "script";
1613
- readonly value: number;
1614
1686
  readonly value_type: "fixed_amount" | "percentage";
1615
1687
  readonly description: string | null;
1616
1688
  }[];
@@ -1,16 +1,36 @@
1
1
  import * as Schema from 'effect/Schema';
2
2
  import { Resource, Ajax } from '@brytdesigns/shopify-utils/effect';
3
3
 
4
+ const BaseAttributeValue = Schema.Union(
5
+ Schema.Null,
6
+ Schema.String,
7
+ Schema.Boolean,
8
+ Schema.Number
9
+ );
4
10
  const BaseAttributes = Schema.Record({
5
11
  key: Schema.String,
6
- value: Schema.Union(
7
- Schema.Null,
8
- Schema.String,
9
- Schema.Boolean,
10
- Schema.Number
11
- )
12
+ value: BaseAttributeValue
12
13
  });
13
14
  const Attributes = BaseAttributes;
15
+ const AttributesArray = Schema.transform(
16
+ Attributes,
17
+ Schema.Array(
18
+ Schema.Struct({ key: Schema.String, value: BaseAttributeValue })
19
+ ),
20
+ {
21
+ decode: (record) => Object.keys(record).map((key) => ({
22
+ key,
23
+ value: record[key]
24
+ })),
25
+ encode: (array) => array.reduce(
26
+ (result, { key, value }) => ({
27
+ ...result,
28
+ [key]: value
29
+ }),
30
+ {}
31
+ )
32
+ }
33
+ );
14
34
  const DiscountApplication = Schema.Struct({
15
35
  target_selection: Schema.Literal("all", "entitled", "explicit"),
16
36
  target_type: Schema.Literal("line_item", "shipping_line"),
@@ -110,6 +130,9 @@ const LineItem = Schema.Struct({
110
130
  properties: Schema.optionalWith(Schema.NullOr(Attributes), {
111
131
  default: () => ({})
112
132
  }),
133
+ properties_array: Schema.optionalWith(Schema.NullOr(AttributesArray), {
134
+ default: () => []
135
+ }),
113
136
  quantity: Schema.Number,
114
137
  variant_id: Resource.ID,
115
138
  key: Schema.String,
@@ -158,6 +181,7 @@ const Cart = Schema.Struct({
158
181
  attributes: Schema.optionalWith(Attributes, {
159
182
  default: () => ({})
160
183
  }),
184
+ attributes_array: Schema.optionalWith(AttributesArray, { default: () => [] }),
161
185
  discounts: Schema.optionalWith(Schema.Array(Discount), { default: () => [] }),
162
186
  discount_codes: Schema.optionalWith(
163
187
  Schema.Array(