@springmicro/cart 0.5.15 → 0.5.17

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@springmicro/cart",
3
3
  "private": false,
4
- "version": "0.5.15",
4
+ "version": "0.5.17",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "@nanostores/persistent": "^0.10.1",
25
25
  "@nanostores/query": "^0.3.3",
26
26
  "@nanostores/react": "^0.7.2",
27
- "@springmicro/utils": "0.5.15",
27
+ "@springmicro/utils": "0.5.17",
28
28
  "dotenv": "^16.4.5",
29
29
  "nanostores": "^0.10.3",
30
30
  "react": "^18.2.0",
@@ -49,5 +49,5 @@
49
49
  "vite-plugin-css-injected-by-js": "^3.5.1",
50
50
  "yup": "^1.4.0"
51
51
  },
52
- "gitHead": "b830a46f0cb3e6081ed9a4f31861c0d0b66a88f2"
52
+ "gitHead": "915dac621fa9bf06ffe49dadd56452f28bbd5737"
53
53
  }
@@ -22,16 +22,19 @@ export type ProductCardComponentProps = {
22
22
  pricing;
23
23
  addToCart: (price_index?: number) => void;
24
24
  removeFromCart: (price?: boolean) => void;
25
+ disabled?: boolean;
25
26
  };
26
27
 
27
28
  export default function ProductCard({
28
29
  product,
29
30
  component,
30
31
  priceTierName,
32
+ disabled,
31
33
  }: {
32
34
  product: Product;
33
35
  component?: React.FC<ProductCardComponentProps>;
34
36
  priceTierName?: string; // Might have incomplete code for cases where the tier name doesn't match.
37
+ disabled?: boolean;
35
38
  }) {
36
39
  const cart = JSON.parse(useStore(cartStore));
37
40
 
@@ -64,6 +67,7 @@ export default function ProductCard({
64
67
 
65
68
  const props: ProductCardComponentProps = {
66
69
  product,
70
+ disabled,
67
71
  foundInCart: {
68
72
  product: productFoundInCart,
69
73
  price: pi != -1 ? !!~priceInCartIndex : null,
@@ -88,6 +92,7 @@ function DefaultProductCard({
88
92
  pricing,
89
93
  addToCart,
90
94
  removeFromCart,
95
+ disabled,
91
96
  }: ProductCardComponentProps) {
92
97
  return (
93
98
  <div
@@ -112,6 +117,7 @@ function DefaultProductCard({
112
117
  onClick={() => {
113
118
  removeFromCart();
114
119
  }}
120
+ disabled={disabled}
115
121
  >
116
122
  Remove from cart
117
123
  </button>
@@ -121,6 +127,7 @@ function DefaultProductCard({
121
127
  onClick={() => {
122
128
  addToCart();
123
129
  }}
130
+ disabled={disabled}
124
131
  >
125
132
  Add {formatPricing(pricing[0])}
126
133
  </button>
@@ -140,6 +147,7 @@ function DefaultProductCard({
140
147
  onClick={() => {
141
148
  addToCart(i);
142
149
  }}
150
+ disabled={disabled}
143
151
  >
144
152
  Tier {i + 1}:
145
153
  <br />