@ikas/storefront 1.0.3-beta.1 → 1.0.3-beta.2

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/build/index.es.js CHANGED
@@ -22884,6 +22884,9 @@ var IkasProductOption = /** @class */ (function () {
22884
22884
  : true));
22885
22885
  };
22886
22886
  this.isValidChoiceOptionValue = function () {
22887
+ if (!_this.values.length) {
22888
+ return !!_this.isOptional;
22889
+ }
22887
22890
  return (!!_this.selectSettings &&
22888
22891
  (_this.selectSettings.minSelect !== null
22889
22892
  ? _this.values.length >= _this.selectSettings.minSelect
@@ -22931,6 +22934,9 @@ var IkasProductOption = /** @class */ (function () {
22931
22934
  });
22932
22935
  }
22933
22936
  else {
22937
+ if (_this.type === IkasProductOptionType.CHECKBOX) {
22938
+ return !!_this.values.length && _this.values[0] === "true";
22939
+ }
22934
22940
  return !!_this.values.length;
22935
22941
  }
22936
22942
  }), "order");
@@ -70847,6 +70853,7 @@ var IkasCartStore = /** @class */ (function () {
70847
70853
  }); };
70848
70854
  this.findExistingItem = function (variant, product) {
70849
70855
  var _a, _b, _c, _d, _e;
70856
+ debugger;
70850
70857
  if (!product.productOptionSetId) {
70851
70858
  return (_a = _this.cart) === null || _a === void 0 ? void 0 : _a.items.find(function (item) { return item.variant.id === variant.id; });
70852
70859
  }
@@ -70860,7 +70867,7 @@ var IkasCartStore = /** @class */ (function () {
70860
70867
  var productOptionValues = (_e = (_d = (_c = product.productOptionSet) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.find(function (o) { return o.id === option.productOptionId; })) === null || _e === void 0 ? void 0 : _e.values;
70861
70868
  hasSameOptionValues =
70862
70869
  hasSameOptionValues &&
70863
- existingOptionValues.length === (productOptionValues === null || productOptionValues === void 0 ? void 0 : productOptionValues.values.length) &&
70870
+ existingOptionValues.length === (productOptionValues === null || productOptionValues === void 0 ? void 0 : productOptionValues.length) &&
70864
70871
  existingOptionValues.every(function (val) { return productOptionValues === null || productOptionValues === void 0 ? void 0 : productOptionValues.includes(val); });
70865
70872
  if (!hasSameOptionValues)
70866
70873
  return "break";
package/build/index.js CHANGED
@@ -22879,6 +22879,9 @@ var IkasProductOption = /** @class */ (function () {
22879
22879
  : true));
22880
22880
  };
22881
22881
  this.isValidChoiceOptionValue = function () {
22882
+ if (!_this.values.length) {
22883
+ return !!_this.isOptional;
22884
+ }
22882
22885
  return (!!_this.selectSettings &&
22883
22886
  (_this.selectSettings.minSelect !== null
22884
22887
  ? _this.values.length >= _this.selectSettings.minSelect
@@ -22926,6 +22929,9 @@ var IkasProductOption = /** @class */ (function () {
22926
22929
  });
22927
22930
  }
22928
22931
  else {
22932
+ if (_this.type === exports.IkasProductOptionType.CHECKBOX) {
22933
+ return !!_this.values.length && _this.values[0] === "true";
22934
+ }
22929
22935
  return !!_this.values.length;
22930
22936
  }
22931
22937
  }), "order");
@@ -70824,6 +70830,7 @@ var IkasCartStore = /** @class */ (function () {
70824
70830
  }); };
70825
70831
  this.findExistingItem = function (variant, product) {
70826
70832
  var _a, _b, _c, _d, _e;
70833
+ debugger;
70827
70834
  if (!product.productOptionSetId) {
70828
70835
  return (_a = _this.cart) === null || _a === void 0 ? void 0 : _a.items.find(function (item) { return item.variant.id === variant.id; });
70829
70836
  }
@@ -70837,7 +70844,7 @@ var IkasCartStore = /** @class */ (function () {
70837
70844
  var productOptionValues = (_e = (_d = (_c = product.productOptionSet) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.find(function (o) { return o.id === option.productOptionId; })) === null || _e === void 0 ? void 0 : _e.values;
70838
70845
  hasSameOptionValues =
70839
70846
  hasSameOptionValues &&
70840
- existingOptionValues.length === (productOptionValues === null || productOptionValues === void 0 ? void 0 : productOptionValues.values.length) &&
70847
+ existingOptionValues.length === (productOptionValues === null || productOptionValues === void 0 ? void 0 : productOptionValues.length) &&
70841
70848
  existingOptionValues.every(function (val) { return productOptionValues === null || productOptionValues === void 0 ? void 0 : productOptionValues.includes(val); });
70842
70849
  if (!hasSameOptionValues)
70843
70850
  return "break";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "1.0.3-beta.1",
3
+ "version": "1.0.3-beta.2",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",