@betterstore/react 0.1.9 → 0.1.10

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,11 @@
1
1
  # @betterstore/sdk
2
2
 
3
+ ## 0.1.10
4
+
5
+ ### Patch Changes
6
+
7
+ - usecart bug fix
8
+
3
9
  ## 0.1.9
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs.js CHANGED
@@ -207,7 +207,13 @@ const useCart = zustand.create()(persist((set, get) => ({
207
207
  addItem: (product, additionalParams) => set((state) => {
208
208
  var _a, _b;
209
209
  const productId = typeof product === "string" ? product : product === null || product === void 0 ? void 0 : product.id;
210
- const formattedNewItem = Object.assign(Object.assign({ productId: productId }, (typeof product !== "string" && Object.assign({}, product))), { quantity: (_a = additionalParams === null || additionalParams === void 0 ? void 0 : additionalParams.quantity) !== null && _a !== void 0 ? _a : 1, variantOptions: (_b = additionalParams === null || additionalParams === void 0 ? void 0 : additionalParams.variantOptions) !== null && _b !== void 0 ? _b : [], metadata: additionalParams === null || additionalParams === void 0 ? void 0 : additionalParams.metadata });
210
+ const formattedNewItem = {
211
+ productId: productId,
212
+ product: typeof product !== "string" ? product : undefined,
213
+ quantity: (_a = additionalParams === null || additionalParams === void 0 ? void 0 : additionalParams.quantity) !== null && _a !== void 0 ? _a : 1,
214
+ variantOptions: (_b = additionalParams === null || additionalParams === void 0 ? void 0 : additionalParams.variantOptions) !== null && _b !== void 0 ? _b : [],
215
+ metadata: additionalParams === null || additionalParams === void 0 ? void 0 : additionalParams.metadata,
216
+ };
211
217
  const id = generateLineItemId(formattedNewItem);
212
218
  const existingItemIndex = state.lineItems.findIndex((item) => item.id === id);
213
219
  if (existingItemIndex !== -1) {
package/dist/index.mjs CHANGED
@@ -205,7 +205,13 @@ const useCart = create()(persist((set, get) => ({
205
205
  addItem: (product, additionalParams) => set((state) => {
206
206
  var _a, _b;
207
207
  const productId = typeof product === "string" ? product : product === null || product === void 0 ? void 0 : product.id;
208
- const formattedNewItem = Object.assign(Object.assign({ productId: productId }, (typeof product !== "string" && Object.assign({}, product))), { quantity: (_a = additionalParams === null || additionalParams === void 0 ? void 0 : additionalParams.quantity) !== null && _a !== void 0 ? _a : 1, variantOptions: (_b = additionalParams === null || additionalParams === void 0 ? void 0 : additionalParams.variantOptions) !== null && _b !== void 0 ? _b : [], metadata: additionalParams === null || additionalParams === void 0 ? void 0 : additionalParams.metadata });
208
+ const formattedNewItem = {
209
+ productId: productId,
210
+ product: typeof product !== "string" ? product : undefined,
211
+ quantity: (_a = additionalParams === null || additionalParams === void 0 ? void 0 : additionalParams.quantity) !== null && _a !== void 0 ? _a : 1,
212
+ variantOptions: (_b = additionalParams === null || additionalParams === void 0 ? void 0 : additionalParams.variantOptions) !== null && _b !== void 0 ? _b : [],
213
+ metadata: additionalParams === null || additionalParams === void 0 ? void 0 : additionalParams.metadata,
214
+ };
209
215
  const id = generateLineItemId(formattedNewItem);
210
216
  const existingItemIndex = state.lineItems.findIndex((item) => item.id === id);
211
217
  if (existingItemIndex !== -1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/react",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "E-commerce for Developers",
5
5
  "private": false,
6
6
  "publishConfig": {