@shophost/client 2.0.51 → 2.0.53

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shophost/client",
3
- "version": "2.0.51",
3
+ "version": "2.0.53",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./src/index.d.ts",
@@ -959,6 +959,10 @@ export type Product = {
959
959
  * Stock Keeping Unit identifier
960
960
  */
961
961
  sku?: string;
962
+ /**
963
+ * Available stock quantity. Null means unlimited inventory.
964
+ */
965
+ availableQuantity?: string | number | null;
962
966
  basePrice: number;
963
967
  discountedBasePrice?: string | number | null;
964
968
  /**
@@ -1051,6 +1055,10 @@ export type CreateProduct = {
1051
1055
  * Stock Keeping Unit identifier
1052
1056
  */
1053
1057
  sku?: string;
1058
+ /**
1059
+ * Available stock quantity. Null means unlimited inventory.
1060
+ */
1061
+ availableQuantity?: string | number | null;
1054
1062
  basePrice: number;
1055
1063
  discountedBasePrice?: string | number | null;
1056
1064
  /**
@@ -1133,6 +1141,10 @@ export type LocalizedProduct = {
1133
1141
  * Stock Keeping Unit identifier
1134
1142
  */
1135
1143
  sku?: string;
1144
+ /**
1145
+ * Available stock quantity. Null means unlimited inventory.
1146
+ */
1147
+ availableQuantity?: string | number | null;
1136
1148
  basePrice: number;
1137
1149
  discountedBasePrice?: string | number | null;
1138
1150
  /**
@@ -1188,6 +1200,10 @@ export type UpdateProduct = {
1188
1200
  * Stock Keeping Unit identifier
1189
1201
  */
1190
1202
  sku?: string;
1203
+ /**
1204
+ * Available stock quantity. Null means unlimited inventory.
1205
+ */
1206
+ availableQuantity?: string | number | null;
1191
1207
  basePrice?: number;
1192
1208
  discountedBasePrice?: string | number | null;
1193
1209
  /**
@@ -1555,6 +1571,18 @@ export type Order = {
1555
1571
  * Date when the order was cancelled
1556
1572
  */
1557
1573
  cancelledAt?: string | null;
1574
+ /**
1575
+ * Date when the paid order inventory was deducted
1576
+ */
1577
+ inventoryDeductedAt?: string | null;
1578
+ /**
1579
+ * Date when the paid order was flagged for manual inventory review
1580
+ */
1581
+ inventoryConflictAt?: string | null;
1582
+ /**
1583
+ * List of line items that could not be deducted after payment
1584
+ */
1585
+ inventoryConflictItems?: Array<InventoryConflictItem> | null;
1558
1586
  shippingAddress?: Address & ({
1559
1587
  [key: string]: unknown;
1560
1588
  } | null);
@@ -1652,6 +1680,56 @@ export type CartItem = {
1652
1680
  }>;
1653
1681
  }>;
1654
1682
  };
1683
+ export type InventoryConflictItem = {
1684
+ productId: string;
1685
+ title: string;
1686
+ requestedQuantity: number;
1687
+ availableQuantity: number;
1688
+ };
1689
+ export type CartConflict = {
1690
+ invalidProductIds: Array<string>;
1691
+ normalizedItems: Array<CartItem>;
1692
+ adjustments: Array<CartAdjustment>;
1693
+ products: {
1694
+ [key: string]: LocalizedProduct;
1695
+ };
1696
+ shipping?: number;
1697
+ subtotal: number;
1698
+ total: number;
1699
+ message: string;
1700
+ };
1701
+ export type CartAdjustment = {
1702
+ /**
1703
+ * ID of the affected product
1704
+ */
1705
+ productId: string;
1706
+ modifierGroups?: Array<{
1707
+ /**
1708
+ * ID of the modifier group
1709
+ */
1710
+ id: string;
1711
+ modifiers: Array<{
1712
+ /**
1713
+ * ID of the selected modifier
1714
+ */
1715
+ id: string;
1716
+ /**
1717
+ * Quantity of this modifier
1718
+ */
1719
+ quantity?: number;
1720
+ }>;
1721
+ }>;
1722
+ reason: CartAdjustmentReason;
1723
+ /**
1724
+ * Quantity requested by the customer
1725
+ */
1726
+ requestedQuantity: number;
1727
+ /**
1728
+ * Quantity accepted after stock normalization
1729
+ */
1730
+ resolvedQuantity: number;
1731
+ };
1732
+ export type CartAdjustmentReason = 'invalid_product' | 'out_of_stock' | 'insufficient_stock';
1655
1733
  export type CreateOrder = {
1656
1734
  items: Array<CartItem>;
1657
1735
  shippingMethodId?: string;
@@ -4987,6 +5065,10 @@ export type CreateOrderErrors = {
4987
5065
  */
4988
5066
  message: string;
4989
5067
  };
5068
+ /**
5069
+ * Conflict
5070
+ */
5071
+ 409: CartConflict;
4990
5072
  };
4991
5073
  export type CreateOrderError = CreateOrderErrors[keyof CreateOrderErrors];
4992
5074
  export type CreateOrderResponses = {
@@ -5357,6 +5439,8 @@ export type GetCartDataResponses = {
5357
5439
  */
5358
5440
  200: {
5359
5441
  invalidProductIds: Array<string>;
5442
+ normalizedItems: Array<CartItem>;
5443
+ adjustments: Array<CartAdjustment>;
5360
5444
  products: {
5361
5445
  [key: string]: LocalizedProduct;
5362
5446
  };