@betterstore/react 0.1.4 → 0.1.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @betterstore/sdk
2
2
 
3
+ ## 0.1.7
4
+
5
+ ### Patch Changes
6
+
7
+ - deps fix
8
+
9
+ ## 0.1.6
10
+
11
+ ### Patch Changes
12
+
13
+ - deps fix
14
+
15
+ ## 0.1.5
16
+
17
+ ### Patch Changes
18
+
19
+ - small usecart tweak
20
+
3
21
  ## 0.1.4
4
22
 
5
23
  ### Patch Changes
@@ -19,7 +19,7 @@ type LineItemOptionalParams = {
19
19
  };
20
20
  interface Cart {
21
21
  lineItems: LineItem[];
22
- addItem: (productId: string, item: LineItemOptionalParams) => void;
22
+ addItem: (productId: string, additionalParams?: LineItemOptionalParams) => void;
23
23
  removeItem: (id: string) => void;
24
24
  updateQuantity: (id: string, quantity: number) => void;
25
25
  getProductQuantity: (productId: string) => number;
package/dist/index.cjs.js CHANGED
@@ -242,13 +242,13 @@ const generateLineItemId = (item) => {
242
242
  };
243
243
  const useCart = create()(persist((set, get) => ({
244
244
  lineItems: [],
245
- addItem: (productId, newItem) => set((state) => {
245
+ addItem: (productId, additionalParams) => set((state) => {
246
246
  var _a, _b;
247
247
  const formattedNewItem = {
248
248
  productId: productId,
249
- quantity: (_a = newItem.quantity) !== null && _a !== void 0 ? _a : 1,
250
- variantOptions: (_b = newItem.variantOptions) !== null && _b !== void 0 ? _b : [],
251
- metadata: newItem.metadata,
249
+ quantity: (_a = additionalParams === null || additionalParams === void 0 ? void 0 : additionalParams.quantity) !== null && _a !== void 0 ? _a : 1,
250
+ variantOptions: (_b = additionalParams === null || additionalParams === void 0 ? void 0 : additionalParams.variantOptions) !== null && _b !== void 0 ? _b : [],
251
+ metadata: additionalParams === null || additionalParams === void 0 ? void 0 : additionalParams.metadata,
252
252
  };
253
253
  const id = generateLineItemId(formattedNewItem);
254
254
  const existingItemIndex = state.lineItems.findIndex((item) => item.id === id);
package/dist/index.esm.js CHANGED
@@ -240,13 +240,13 @@ const generateLineItemId = (item) => {
240
240
  };
241
241
  const useCart = create()(persist((set, get) => ({
242
242
  lineItems: [],
243
- addItem: (productId, newItem) => set((state) => {
243
+ addItem: (productId, additionalParams) => set((state) => {
244
244
  var _a, _b;
245
245
  const formattedNewItem = {
246
246
  productId: productId,
247
- quantity: (_a = newItem.quantity) !== null && _a !== void 0 ? _a : 1,
248
- variantOptions: (_b = newItem.variantOptions) !== null && _b !== void 0 ? _b : [],
249
- metadata: newItem.metadata,
247
+ quantity: (_a = additionalParams === null || additionalParams === void 0 ? void 0 : additionalParams.quantity) !== null && _a !== void 0 ? _a : 1,
248
+ variantOptions: (_b = additionalParams === null || additionalParams === void 0 ? void 0 : additionalParams.variantOptions) !== null && _b !== void 0 ? _b : [],
249
+ metadata: additionalParams === null || additionalParams === void 0 ? void 0 : additionalParams.metadata,
250
250
  };
251
251
  const id = generateLineItemId(formattedNewItem);
252
252
  const existingItemIndex = state.lineItems.findIndex((item) => item.id === id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/react",
3
- "version": "0.1.4",
3
+ "version": "0.1.7",
4
4
  "description": "E-commerce for Developers",
5
5
  "private": false,
6
6
  "publishConfig": {
@@ -25,20 +25,21 @@
25
25
  "@rollup/plugin-node-resolve": "^16.0.0",
26
26
  "@rollup/plugin-typescript": "^12.1.2",
27
27
  "@tailwindcss/postcss": "^4.0.12",
28
- "@types/react": "^19.0.10",
28
+ "@types/react": "^18.0.0",
29
+ "@types/react-dom": "^18.2.0",
29
30
  "autoprefixer": "^10.4.20",
30
- "babel-preset-react": "^6.24.1",
31
- "postcss": "^8.5.3",
31
+ "babel-preset-react": "^6.23.3",
32
+ "postcss": "^8.4.31",
32
33
  "prettier": "^3.5.3",
33
34
  "rollup": "^4.34.9",
34
- "tailwindcss": "^4.0.12",
35
+ "tailwindcss": "^3.0.12",
35
36
  "tslib": "^2.8.1",
36
37
  "tsup": "^8.4.0",
37
38
  "typescript": "^5.8.2"
38
39
  },
39
40
  "peerDependencies": {
40
- "react": "^19.0.0",
41
- "react-dom": "^19.0.0"
41
+ "react": "^18.0.0",
42
+ "react-dom": "^18.0.0"
42
43
  },
43
44
  "dependencies": {
44
45
  "@betterstore/sdk": "^0.2.0",