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

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.js CHANGED
@@ -19882,6 +19882,28 @@ var moment = createCommonjsModule(function (module, exports) {
19882
19882
  })));
19883
19883
  });
19884
19884
 
19885
+ var ProductOptionTypeEnum;
19886
+ (function (ProductOptionTypeEnum) {
19887
+ ProductOptionTypeEnum["CHECKBOX"] = "CHECKBOX";
19888
+ ProductOptionTypeEnum["CHOICE"] = "CHOICE";
19889
+ ProductOptionTypeEnum["COLOR_PICKER"] = "COLOR_PICKER";
19890
+ ProductOptionTypeEnum["DATE_PICKER"] = "DATE_PICKER";
19891
+ ProductOptionTypeEnum["FILE"] = "FILE";
19892
+ ProductOptionTypeEnum["IMAGE"] = "IMAGE";
19893
+ ProductOptionTypeEnum["TEXT"] = "TEXT";
19894
+ ProductOptionTypeEnum["TEXT_AREA"] = "TEXT_AREA";
19895
+ })(ProductOptionTypeEnum || (ProductOptionTypeEnum = {}));
19896
+ var IkasOrderLineOptions = /** @class */ (function () {
19897
+ function IkasOrderLineOptions(data) {
19898
+ this.name = data.name;
19899
+ this.productOptionId = data.productOptionId;
19900
+ this.productOptionsSetId = data.productOptionsSetId;
19901
+ this.type = data.type;
19902
+ this.values = data.values;
19903
+ }
19904
+ return IkasOrderLineOptions;
19905
+ }());
19906
+
19885
19907
  var IkasOrderLineItem = /** @class */ (function () {
19886
19908
  function IkasOrderLineItem(data) {
19887
19909
  this.discount = null;
@@ -19909,6 +19931,9 @@ var IkasOrderLineItem = /** @class */ (function () {
19909
19931
  ? new IkasOrderLineVariant(data.variant)
19910
19932
  : new IkasOrderLineVariant();
19911
19933
  this.status = data.status || OrderLineItemStatusEnum.FULFILLED;
19934
+ this.options = data.options
19935
+ ? data.options.map(function (oP) { return new IkasOrderLineOptions(oP); })
19936
+ : null;
19912
19937
  mobx.makeAutoObservable(this);
19913
19938
  }
19914
19939
  Object.defineProperty(IkasOrderLineItem.prototype, "orderedAtDays", {
@@ -21092,78 +21117,6 @@ var IkasProductTag = /** @class */ (function () {
21092
21117
  return IkasProductTag;
21093
21118
  }());
21094
21119
 
21095
- var IkasProduct = /** @class */ (function () {
21096
- function IkasProduct(data) {
21097
- if (data === void 0) { data = {}; }
21098
- this.id = data.id || Date.now() + "";
21099
- this.name = data.name || "";
21100
- this.type = data.type || exports.IkasProductType.PHYSICAL;
21101
- this.description = data.description || "";
21102
- this.shortDescription = data.shortDescription || "";
21103
- this.metaData = data.metaData
21104
- ? new IkasHTMLMetaData(data.metaData)
21105
- : undefined;
21106
- this.brand = data.brand ? new IkasBrand(data.brand) : null;
21107
- this.categories = data.categories
21108
- ? data.categories.map(function (c) { return new IkasCategory(c); })
21109
- : [];
21110
- this.tags = data.tags
21111
- ? data.tags.map(function (tag) { return new IkasProductTag(tag); })
21112
- : [];
21113
- this.variants = data.variants
21114
- ? data.variants.map(function (v) { return new IkasProductVariant(v); })
21115
- : [];
21116
- this.attributes = data.attributes
21117
- ? data.attributes.map(function (a) { return new IkasProductAttributeValue(a); })
21118
- : [];
21119
- this.variantTypes = data.variantTypes
21120
- ? data.variantTypes.map(function (v) { return new IkasProductVariantType(v); })
21121
- : [];
21122
- this.productOptionSetId = data.productOptionSetId || null;
21123
- this.productOptionSet = data.productOptionSet || null;
21124
- mobx.makeAutoObservable(this);
21125
- }
21126
- Object.defineProperty(IkasProduct.prototype, "hasVariant", {
21127
- get: function () {
21128
- return !!this.variantTypes.length;
21129
- },
21130
- enumerable: false,
21131
- configurable: true
21132
- });
21133
- Object.defineProperty(IkasProduct.prototype, "hasStock", {
21134
- get: function () {
21135
- return this.variants.some(function (v) { return v.stock > 0; });
21136
- },
21137
- enumerable: false,
21138
- configurable: true
21139
- });
21140
- Object.defineProperty(IkasProduct.prototype, "mainVariantType", {
21141
- get: function () {
21142
- if (!this.hasVariant)
21143
- return;
21144
- return this.variantTypes[0].variantType;
21145
- },
21146
- enumerable: false,
21147
- configurable: true
21148
- });
21149
- Object.defineProperty(IkasProduct.prototype, "href", {
21150
- get: function () {
21151
- var _a;
21152
- if (!((_a = this.metaData) === null || _a === void 0 ? void 0 : _a.slug))
21153
- return "";
21154
- return "/" + this.metaData.slug;
21155
- },
21156
- enumerable: false,
21157
- configurable: true
21158
- });
21159
- return IkasProduct;
21160
- }());
21161
- (function (IkasProductType) {
21162
- IkasProductType["PHYSICAL"] = "PHYSICAL";
21163
- IkasProductType["DIGITAL"] = "DIGITAL";
21164
- IkasProductType["MEMBERSHIP"] = "MEMBERSHIP";
21165
- })(exports.IkasProductType || (exports.IkasProductType = {}));
21166
-
21167
21120
  /**
21168
21121
  * Appends the elements of `values` to `array`.
21169
21122
  *
@@ -22787,6 +22740,396 @@ var sortBy = _baseRest(function(collection, iteratees) {
22787
22740
 
22788
22741
  var sortBy_1 = sortBy;
22789
22742
 
22743
+ (function (IkasProductOptionType) {
22744
+ IkasProductOptionType["CHOICE"] = "CHOICE";
22745
+ IkasProductOptionType["TEXT"] = "TEXT";
22746
+ IkasProductOptionType["TEXT_AREA"] = "TEXT_AREA";
22747
+ // IMAGE = "IMAGE",
22748
+ // FILE = "FILE",
22749
+ IkasProductOptionType["COLOR_PICKER"] = "COLOR_PICKER";
22750
+ // DATE_PICKER = "DATE_PICKER",
22751
+ IkasProductOptionType["CHECKBOX"] = "CHECKBOX";
22752
+ })(exports.IkasProductOptionType || (exports.IkasProductOptionType = {}));
22753
+ (function (IkasProductOptionSelectType) {
22754
+ IkasProductOptionSelectType["SELECT"] = "SELECT";
22755
+ IkasProductOptionSelectType["BOX"] = "BOX";
22756
+ IkasProductOptionSelectType["SWATCH"] = "SWATCH";
22757
+ })(exports.IkasProductOptionSelectType || (exports.IkasProductOptionSelectType = {}));
22758
+ var IkasProductOptionSelectValueTranslations = /** @class */ (function () {
22759
+ function IkasProductOptionSelectValueTranslations(data) {
22760
+ this.id = data.id || "";
22761
+ this.value = data.value || null;
22762
+ mobx.makeAutoObservable(this);
22763
+ }
22764
+ return IkasProductOptionSelectValueTranslations;
22765
+ }());
22766
+ var IkasProductOptionTranslations = /** @class */ (function () {
22767
+ function IkasProductOptionTranslations(data) {
22768
+ var _a;
22769
+ this.id = data.id || "";
22770
+ this.name = data.name || null;
22771
+ this.optionalText = data.optionalText || null;
22772
+ this.values =
22773
+ ((_a = data.values) === null || _a === void 0 ? void 0 : _a.map(function (o) { return new IkasProductOptionSelectValueTranslations(o); })) || [];
22774
+ mobx.makeAutoObservable(this);
22775
+ }
22776
+ return IkasProductOptionTranslations;
22777
+ }());
22778
+ var IkasProductOptionSetTranslations = /** @class */ (function () {
22779
+ function IkasProductOptionSetTranslations(data) {
22780
+ var _a;
22781
+ this.locale = data.locale || "";
22782
+ this.options =
22783
+ ((_a = data.options) === null || _a === void 0 ? void 0 : _a.map(function (o) { return new IkasProductOptionTranslations(o); })) || [];
22784
+ mobx.makeAutoObservable(this);
22785
+ }
22786
+ return IkasProductOptionSetTranslations;
22787
+ }());
22788
+ var IkasProductOptionSelectValue = /** @class */ (function () {
22789
+ function IkasProductOptionSelectValue(data) {
22790
+ if (data === void 0) { data = {}; }
22791
+ this.thumbnailImage = null;
22792
+ this.id = data.id || "";
22793
+ this.order = data.order || 0;
22794
+ this.value = data.value || "";
22795
+ this.price = data.price || null;
22796
+ this.thumbnailImageId = data.thumbnailImageId || null;
22797
+ this.colorCode = data.colorCode || null;
22798
+ this.thumbnailImage = this.thumbnailImageId
22799
+ ? new IkasImage(this.thumbnailImageId)
22800
+ : null;
22801
+ mobx.makeAutoObservable(this);
22802
+ }
22803
+ return IkasProductOptionSelectValue;
22804
+ }());
22805
+ var IkasProductOptionSelectSettings = /** @class */ (function () {
22806
+ function IkasProductOptionSelectSettings(data) {
22807
+ if (data === void 0) { data = {}; }
22808
+ var _a;
22809
+ this.type = data.type || exports.IkasProductOptionSelectType.BOX;
22810
+ this.minSelect =
22811
+ data.minSelect !== null && data.minSelect !== undefined
22812
+ ? data.minSelect
22813
+ : null;
22814
+ this.maxSelect =
22815
+ data.maxSelect !== null && data.maxSelect !== undefined
22816
+ ? data.maxSelect
22817
+ : null;
22818
+ this.values = sortBy_1(((_a = data.values) === null || _a === void 0 ? void 0 : _a.map(function (o) { return new IkasProductOptionSelectValue(o); })) || [], "order");
22819
+ mobx.makeAutoObservable(this);
22820
+ }
22821
+ return IkasProductOptionSelectSettings;
22822
+ }());
22823
+ var IkasProductOptionDateSettings = /** @class */ (function () {
22824
+ function IkasProductOptionDateSettings(data) {
22825
+ this.min = data.min || null;
22826
+ this.max = data.max || null;
22827
+ mobx.makeAutoObservable(this);
22828
+ }
22829
+ return IkasProductOptionDateSettings;
22830
+ }());
22831
+ var IkasProductOptionTextSettings = /** @class */ (function () {
22832
+ function IkasProductOptionTextSettings(data) {
22833
+ if (data === void 0) { data = {}; }
22834
+ this.min = data.min !== null && data.min !== undefined ? data.min : null;
22835
+ this.max = data.max !== null && data.max !== undefined ? data.max : null;
22836
+ mobx.makeAutoObservable(this);
22837
+ }
22838
+ return IkasProductOptionTextSettings;
22839
+ }());
22840
+ var IkasProductOptionFileSettings = /** @class */ (function () {
22841
+ function IkasProductOptionFileSettings(data) {
22842
+ this.allowedExtensions = data.allowedExtensions || null;
22843
+ this.minQuantity =
22844
+ data.minQuantity !== null && data.minQuantity !== undefined
22845
+ ? data.minQuantity
22846
+ : null;
22847
+ this.maxQuantity =
22848
+ data.maxQuantity !== null && data.maxQuantity !== undefined
22849
+ ? data.maxQuantity
22850
+ : null;
22851
+ mobx.makeAutoObservable(this);
22852
+ }
22853
+ return IkasProductOptionFileSettings;
22854
+ }());
22855
+ var IkasProductOption = /** @class */ (function () {
22856
+ function IkasProductOption(data) {
22857
+ var _this = this;
22858
+ this._values = [];
22859
+ this.childOptions = [];
22860
+ this.initValues = function () {
22861
+ if (!_this.isOptional) {
22862
+ _this.values = [];
22863
+ if (_this.childOptions) {
22864
+ _this.childOptions.forEach(function (co) { return co.initValues(); });
22865
+ }
22866
+ }
22867
+ };
22868
+ this.isValidTextOptionValue = function () {
22869
+ var value = _this.values[0];
22870
+ if (!value) {
22871
+ return !!_this.isOptional;
22872
+ }
22873
+ return (!!_this.textSettings &&
22874
+ (_this.textSettings.min !== null
22875
+ ? value.length >= _this.textSettings.min
22876
+ : true) &&
22877
+ (_this.textSettings.max !== null
22878
+ ? value.length <= _this.textSettings.max
22879
+ : true));
22880
+ };
22881
+ this.isValidChoiceOptionValue = function () {
22882
+ return (!!_this.selectSettings &&
22883
+ (_this.selectSettings.minSelect !== null
22884
+ ? _this.values.length >= _this.selectSettings.minSelect
22885
+ : true) &&
22886
+ (_this.selectSettings.maxSelect !== null
22887
+ ? _this.values.length <= _this.selectSettings.maxSelect
22888
+ : true));
22889
+ };
22890
+ this.id = data.id || "";
22891
+ this.productOptionSetId = data.productOptionSetId || "";
22892
+ this.name = data.name || "";
22893
+ this.order = data.order || 0;
22894
+ this.type = data.type || exports.IkasProductOptionType.CHOICE;
22895
+ this.selectSettings = data.selectSettings
22896
+ ? new IkasProductOptionSelectSettings(data.selectSettings || {})
22897
+ : null;
22898
+ this.textSettings = data.textSettings
22899
+ ? new IkasProductOptionTextSettings(data.textSettings || {})
22900
+ : null;
22901
+ this.fileSettings = data.fileSettings
22902
+ ? new IkasProductOptionFileSettings(data.fileSettings || {})
22903
+ : null;
22904
+ this.dateSettings = data.dateSettings
22905
+ ? new IkasProductOptionDateSettings(data.dateSettings || {})
22906
+ : null;
22907
+ this.price = data.price || null;
22908
+ this.isOptional = data.isOptional || false;
22909
+ this.optionalText = data.optionalText || null;
22910
+ this.requiredOptionId = data.requiredOptionId || null;
22911
+ this.requiredOptionValueIds = data.requiredOptionValueIds || null;
22912
+ this.values = data.values || [];
22913
+ //@ts-ignore
22914
+ this.childOptions = data.childOptions || [];
22915
+ mobx.makeAutoObservable(this);
22916
+ }
22917
+ Object.defineProperty(IkasProductOption.prototype, "displayedChildOptions", {
22918
+ get: function () {
22919
+ var _this = this;
22920
+ return sortBy_1(this.childOptions.filter(function (co) {
22921
+ var _a;
22922
+ // Check if all required options are selected
22923
+ if ((_a = co.requiredOptionValueIds) === null || _a === void 0 ? void 0 : _a.length) {
22924
+ return co.requiredOptionValueIds.every(function (rovId) {
22925
+ return _this.values.some(function (v) { return v === rovId; });
22926
+ });
22927
+ }
22928
+ else {
22929
+ return !!_this.values.length;
22930
+ }
22931
+ }), "order");
22932
+ },
22933
+ enumerable: false,
22934
+ configurable: true
22935
+ });
22936
+ Object.defineProperty(IkasProductOption.prototype, "hasValidValues", {
22937
+ get: function () {
22938
+ if (!this.values.length && !this.isOptional) {
22939
+ return false;
22940
+ }
22941
+ var hasValidValues = false;
22942
+ switch (this.type) {
22943
+ case exports.IkasProductOptionType.TEXT:
22944
+ case exports.IkasProductOptionType.TEXT_AREA:
22945
+ hasValidValues = this.isValidTextOptionValue();
22946
+ break;
22947
+ case exports.IkasProductOptionType.CHECKBOX:
22948
+ case exports.IkasProductOptionType.COLOR_PICKER:
22949
+ hasValidValues = true;
22950
+ break;
22951
+ case exports.IkasProductOptionType.CHOICE:
22952
+ hasValidValues = this.isValidChoiceOptionValue();
22953
+ break;
22954
+ }
22955
+ return (hasValidValues &&
22956
+ this.displayedChildOptions.every(function (co) { return co.hasValidValues; }));
22957
+ },
22958
+ enumerable: false,
22959
+ configurable: true
22960
+ });
22961
+ Object.defineProperty(IkasProductOption.prototype, "values", {
22962
+ get: function () {
22963
+ return this._values;
22964
+ },
22965
+ set: function (values) {
22966
+ this._values = values;
22967
+ if (!values.length) {
22968
+ this.childOptions.forEach(function (co) { return (co.values = []); });
22969
+ }
22970
+ },
22971
+ enumerable: false,
22972
+ configurable: true
22973
+ });
22974
+ return IkasProductOption;
22975
+ }());
22976
+ var IkasProductOptionSet = /** @class */ (function () {
22977
+ function IkasProductOptionSet(data) {
22978
+ var _this = this;
22979
+ var _a, _b;
22980
+ this.initOptionValues = function () { return __awaiter(_this, void 0, void 0, function () {
22981
+ return __generator(this, function (_a) {
22982
+ this.options.forEach(function (o) { return o.initValues(); });
22983
+ return [2 /*return*/];
22984
+ });
22985
+ }); };
22986
+ this.id = data.id || "";
22987
+ this.name = data.name || "";
22988
+ this.options =
22989
+ ((_a = data.options) === null || _a === void 0 ? void 0 : _a.map(function (o) {
22990
+ return new IkasProductOption(__assign(__assign({}, o), { productOptionSetId: _this.id }));
22991
+ })) || [];
22992
+ this.translations = data.translations
22993
+ ? (_b = data.translations) === null || _b === void 0 ? void 0 : _b.map(function (o) { return new IkasProductOptionSetTranslations(o); }) : null;
22994
+ this.setChildOptions();
22995
+ this.setTranslations();
22996
+ this.initOptionValues();
22997
+ mobx.makeAutoObservable(this);
22998
+ }
22999
+ Object.defineProperty(IkasProductOptionSet.prototype, "displayedOptions", {
23000
+ get: function () {
23001
+ return sortBy_1(this.options.filter(function (o) { return !o.requiredOptionId; }), "order");
23002
+ },
23003
+ enumerable: false,
23004
+ configurable: true
23005
+ });
23006
+ IkasProductOptionSet.prototype.setTranslations = function () {
23007
+ var _this = this;
23008
+ var _a;
23009
+ var locale = IkasStorefrontConfig.getCurrentLocale();
23010
+ if (this.translations &&
23011
+ this.translations.some(function (t) { return t.locale === locale; })) {
23012
+ var localeTranslations = this.translations.find(function (t) { return t.locale === locale; });
23013
+ (_a = localeTranslations === null || localeTranslations === void 0 ? void 0 : localeTranslations.options) === null || _a === void 0 ? void 0 : _a.forEach(function (translatedOption) {
23014
+ var _a;
23015
+ var option = _this.options.find(function (o) { return o.id === translatedOption.id; });
23016
+ if (option) {
23017
+ option.name = translatedOption.name || option.name;
23018
+ option.optionalText =
23019
+ translatedOption.optionalText || option.optionalText;
23020
+ if (option.type === exports.IkasProductOptionType.CHOICE) {
23021
+ (_a = translatedOption.values) === null || _a === void 0 ? void 0 : _a.forEach(function (translatedValue) {
23022
+ var _a;
23023
+ var selectValue = (_a = option.selectSettings) === null || _a === void 0 ? void 0 : _a.values.find(function (sv) { return sv.id === translatedValue.id; });
23024
+ if (selectValue) {
23025
+ selectValue.value = translatedValue.value || selectValue.value;
23026
+ }
23027
+ });
23028
+ }
23029
+ }
23030
+ });
23031
+ }
23032
+ };
23033
+ IkasProductOptionSet.prototype.setChildOptions = function () {
23034
+ var _this = this;
23035
+ this.options.forEach(function (option) {
23036
+ var childOptions = _this.options.filter(function (o) { return o.requiredOptionId === option.id; });
23037
+ if (childOptions.length) {
23038
+ //@ts-ignore
23039
+ option.childOptions = childOptions;
23040
+ }
23041
+ });
23042
+ };
23043
+ return IkasProductOptionSet;
23044
+ }());
23045
+
23046
+ var IkasProduct = /** @class */ (function () {
23047
+ function IkasProduct(data) {
23048
+ if (data === void 0) { data = {}; }
23049
+ this.id = data.id || Date.now() + "";
23050
+ this.name = data.name || "";
23051
+ this.type = data.type || exports.IkasProductType.PHYSICAL;
23052
+ this.description = data.description || "";
23053
+ this.shortDescription = data.shortDescription || "";
23054
+ this.metaData = data.metaData
23055
+ ? new IkasHTMLMetaData(data.metaData)
23056
+ : undefined;
23057
+ this.brand = data.brand ? new IkasBrand(data.brand) : null;
23058
+ this.categories = data.categories
23059
+ ? data.categories.map(function (c) { return new IkasCategory(c); })
23060
+ : [];
23061
+ this.tags = data.tags
23062
+ ? data.tags.map(function (tag) { return new IkasProductTag(tag); })
23063
+ : [];
23064
+ this.variants = data.variants
23065
+ ? data.variants.map(function (v) { return new IkasProductVariant(v); })
23066
+ : [];
23067
+ this.attributes = data.attributes
23068
+ ? data.attributes.map(function (a) { return new IkasProductAttributeValue(a); })
23069
+ : [];
23070
+ this.variantTypes = data.variantTypes
23071
+ ? data.variantTypes.map(function (v) { return new IkasProductVariantType(v); })
23072
+ : [];
23073
+ this.productOptionSetId = data.productOptionSetId || null;
23074
+ this.productOptionSet = data.productOptionSet
23075
+ ? new IkasProductOptionSet(data.productOptionSet)
23076
+ : null;
23077
+ mobx.makeAutoObservable(this);
23078
+ }
23079
+ Object.defineProperty(IkasProduct.prototype, "hasVariant", {
23080
+ get: function () {
23081
+ return !!this.variantTypes.length;
23082
+ },
23083
+ enumerable: false,
23084
+ configurable: true
23085
+ });
23086
+ Object.defineProperty(IkasProduct.prototype, "hasStock", {
23087
+ get: function () {
23088
+ return this.variants.some(function (v) { return v.stock > 0; });
23089
+ },
23090
+ enumerable: false,
23091
+ configurable: true
23092
+ });
23093
+ Object.defineProperty(IkasProduct.prototype, "mainVariantType", {
23094
+ get: function () {
23095
+ if (!this.hasVariant)
23096
+ return;
23097
+ return this.variantTypes[0].variantType;
23098
+ },
23099
+ enumerable: false,
23100
+ configurable: true
23101
+ });
23102
+ Object.defineProperty(IkasProduct.prototype, "href", {
23103
+ get: function () {
23104
+ var _a;
23105
+ if (!((_a = this.metaData) === null || _a === void 0 ? void 0 : _a.slug))
23106
+ return "";
23107
+ return "/" + this.metaData.slug;
23108
+ },
23109
+ enumerable: false,
23110
+ configurable: true
23111
+ });
23112
+ Object.defineProperty(IkasProduct.prototype, "canAddToCart", {
23113
+ get: function () {
23114
+ if (this.productOptionSetId) {
23115
+ return (!!this.productOptionSet &&
23116
+ this.productOptionSet.displayedOptions.every(function (o) { return o.hasValidValues; }));
23117
+ }
23118
+ else {
23119
+ return true;
23120
+ }
23121
+ },
23122
+ enumerable: false,
23123
+ configurable: true
23124
+ });
23125
+ return IkasProduct;
23126
+ }());
23127
+ (function (IkasProductType) {
23128
+ IkasProductType["PHYSICAL"] = "PHYSICAL";
23129
+ IkasProductType["DIGITAL"] = "DIGITAL";
23130
+ IkasProductType["MEMBERSHIP"] = "MEMBERSHIP";
23131
+ })(exports.IkasProductType || (exports.IkasProductType = {}));
23132
+
22790
23133
  /**
22791
23134
  * The base implementation of `assignValue` and `assignMergeValue` without
22792
23135
  * value checks.
@@ -24001,145 +24344,6 @@ var IkasTransactionCardTypeEnum;
24001
24344
  IkasTransactionTypeEnum["VOID"] = "VOID";
24002
24345
  })(exports.IkasTransactionTypeEnum || (exports.IkasTransactionTypeEnum = {}));
24003
24346
 
24004
- (function (IkasProductOptionType) {
24005
- IkasProductOptionType["CHOICE"] = "CHOICE";
24006
- IkasProductOptionType["TEXT"] = "TEXT";
24007
- IkasProductOptionType["TEXT_AREA"] = "TEXT_AREA";
24008
- IkasProductOptionType["IMAGE"] = "IMAGE";
24009
- IkasProductOptionType["FILE"] = "FILE";
24010
- IkasProductOptionType["COLOR_PICKER"] = "COLOR_PICKER";
24011
- // DATE_PICKER = "DATE_PICKER",
24012
- IkasProductOptionType["CHECKBOX"] = "CHECKBOX";
24013
- })(exports.IkasProductOptionType || (exports.IkasProductOptionType = {}));
24014
- (function (IkasProductOptionSelectType) {
24015
- IkasProductOptionSelectType["SELECT"] = "SELECT";
24016
- IkasProductOptionSelectType["BOX"] = "BOX";
24017
- IkasProductOptionSelectType["SWATCH"] = "SWATCH";
24018
- })(exports.IkasProductOptionSelectType || (exports.IkasProductOptionSelectType = {}));
24019
- var IkasProductOptionSelectValueTranslations = /** @class */ (function () {
24020
- function IkasProductOptionSelectValueTranslations(data) {
24021
- this.id = data.id || "";
24022
- this.value = data.value || null;
24023
- mobx.makeAutoObservable(this);
24024
- }
24025
- return IkasProductOptionSelectValueTranslations;
24026
- }());
24027
- var IkasProductOptionTranslations = /** @class */ (function () {
24028
- function IkasProductOptionTranslations(data) {
24029
- var _a;
24030
- this.id = data.id || "";
24031
- this.name = data.name || null;
24032
- this.optionalText = data.optionalText || null;
24033
- this.values =
24034
- ((_a = data.values) === null || _a === void 0 ? void 0 : _a.map(function (o) { return new IkasProductOptionSelectValueTranslations(o); })) || [];
24035
- mobx.makeAutoObservable(this);
24036
- }
24037
- return IkasProductOptionTranslations;
24038
- }());
24039
- var IkasProductOptionSetTranslations = /** @class */ (function () {
24040
- function IkasProductOptionSetTranslations(data) {
24041
- var _a;
24042
- this.locale = data.locale || "";
24043
- this.options =
24044
- ((_a = data.options) === null || _a === void 0 ? void 0 : _a.map(function (o) { return new IkasProductOptionTranslations(o); })) || [];
24045
- mobx.makeAutoObservable(this);
24046
- }
24047
- return IkasProductOptionSetTranslations;
24048
- }());
24049
- var IkasProductOptionSelectValue = /** @class */ (function () {
24050
- function IkasProductOptionSelectValue(data) {
24051
- if (data === void 0) { data = {}; }
24052
- this.order = data.order || 0;
24053
- this.value = data.value || "";
24054
- this.price = data.price || null;
24055
- this.thumbnailImageId = data.thumbnailImageId || null;
24056
- this.colorCode = data.colorCode || null;
24057
- this.thumbnailImage =
24058
- data.thumbnailImage ||
24059
- (this.thumbnailImageId
24060
- ? new IkasImage(this.thumbnailImageId)
24061
- : undefined);
24062
- mobx.makeAutoObservable(this);
24063
- }
24064
- return IkasProductOptionSelectValue;
24065
- }());
24066
- var IkasProductOptionSelectSettings = /** @class */ (function () {
24067
- function IkasProductOptionSelectSettings(data) {
24068
- if (data === void 0) { data = {}; }
24069
- var _a;
24070
- this.type = data.type || exports.IkasProductOptionSelectType.BOX;
24071
- this.minSelect = data.minSelect || null;
24072
- this.maxSelect = data.maxSelect || null;
24073
- this.values =
24074
- ((_a = data.values) === null || _a === void 0 ? void 0 : _a.map(function (o) { return new IkasProductOptionSelectValue(o); })) || [];
24075
- mobx.makeAutoObservable(this);
24076
- }
24077
- return IkasProductOptionSelectSettings;
24078
- }());
24079
- var IkasProductOptionDateSettings = /** @class */ (function () {
24080
- function IkasProductOptionDateSettings(data) {
24081
- this.min = data.min || null;
24082
- this.max = data.max || null;
24083
- mobx.makeAutoObservable(this);
24084
- }
24085
- return IkasProductOptionDateSettings;
24086
- }());
24087
- var IkasProductOptionTextSettings = /** @class */ (function () {
24088
- function IkasProductOptionTextSettings(data) {
24089
- if (data === void 0) { data = {}; }
24090
- this.min = data.min || null;
24091
- this.max = data.max || null;
24092
- mobx.makeAutoObservable(this);
24093
- }
24094
- return IkasProductOptionTextSettings;
24095
- }());
24096
- var IkasProductOptionFileSettings = /** @class */ (function () {
24097
- function IkasProductOptionFileSettings(data) {
24098
- this.allowedExtensions = data.allowedExtensions || null;
24099
- this.minQuantity = data.minQuantity || null;
24100
- this.maxQuantity = data.maxQuantity || null;
24101
- mobx.makeAutoObservable(this);
24102
- }
24103
- return IkasProductOptionFileSettings;
24104
- }());
24105
- var IkasProductOption = /** @class */ (function () {
24106
- function IkasProductOption(data) {
24107
- this.name = data.name || "";
24108
- this.order = data.order || 0;
24109
- this.type = data.type || exports.IkasProductOptionType.CHOICE;
24110
- this.selectSettings = data.selectSettings
24111
- ? new IkasProductOptionSelectSettings(data.selectSettings || {})
24112
- : null;
24113
- this.textSettings = data.textSettings
24114
- ? new IkasProductOptionTextSettings(data.textSettings || {})
24115
- : null;
24116
- this.fileSettings = data.fileSettings
24117
- ? new IkasProductOptionFileSettings(data.fileSettings || {})
24118
- : null;
24119
- this.dateSettings = data.dateSettings
24120
- ? new IkasProductOptionDateSettings(data.dateSettings || {})
24121
- : null;
24122
- this.price = data.price || null;
24123
- this.isOptional = data.isOptional || null;
24124
- this.optionalText = data.optionalText || null;
24125
- this.requiredOptionId = data.requiredOptionId || null;
24126
- this.requiredOptionValueIds = data.requiredOptionValueIds || null;
24127
- mobx.makeAutoObservable(this);
24128
- }
24129
- return IkasProductOption;
24130
- }());
24131
- var IkasProductOptionSet = /** @class */ (function () {
24132
- function IkasProductOptionSet(data) {
24133
- var _a, _b;
24134
- this.name = data.name || "";
24135
- this.options = ((_a = data.options) === null || _a === void 0 ? void 0 : _a.map(function (o) { return new IkasProductOption(o); })) || [];
24136
- this.translations = data.translations
24137
- ? (_b = data.translations) === null || _b === void 0 ? void 0 : _b.map(function (o) { return new IkasProductOptionSetTranslations(o); }) : null;
24138
- mobx.makeAutoObservable(this);
24139
- }
24140
- return IkasProductOptionSet;
24141
- }());
24142
-
24143
24347
  var IkasThemeComponentProp = /** @class */ (function () {
24144
24348
  function IkasThemeComponentProp(data) {
24145
24349
  this.id = data.id || Date.now() + "";
@@ -37745,7 +37949,7 @@ var ProductOptionSelectTypeEnum;
37745
37949
  ProductOptionSelectTypeEnum["SELECT"] = "SELECT";
37746
37950
  ProductOptionSelectTypeEnum["SWATCH"] = "SWATCH";
37747
37951
  })(ProductOptionSelectTypeEnum || (ProductOptionSelectTypeEnum = {}));
37748
- var ProductOptionTypeEnum;
37952
+ var ProductOptionTypeEnum$1;
37749
37953
  (function (ProductOptionTypeEnum) {
37750
37954
  ProductOptionTypeEnum["CHECKBOX"] = "CHECKBOX";
37751
37955
  ProductOptionTypeEnum["CHOICE"] = "CHOICE";
@@ -37755,7 +37959,7 @@ var ProductOptionTypeEnum;
37755
37959
  ProductOptionTypeEnum["IMAGE"] = "IMAGE";
37756
37960
  ProductOptionTypeEnum["TEXT"] = "TEXT";
37757
37961
  ProductOptionTypeEnum["TEXT_AREA"] = "TEXT_AREA";
37758
- })(ProductOptionTypeEnum || (ProductOptionTypeEnum = {}));
37962
+ })(ProductOptionTypeEnum$1 || (ProductOptionTypeEnum$1 = {}));
37759
37963
  var ProductSearchShowStockOptionEnum;
37760
37964
  (function (ProductSearchShowStockOptionEnum) {
37761
37965
  ProductSearchShowStockOptionEnum["HIDE_OUT_OF_STOCK"] = "HIDE_OUT_OF_STOCK";
@@ -41270,7 +41474,7 @@ var IkasCartAPI = /** @class */ (function () {
41270
41474
  return __generator(this, function (_b) {
41271
41475
  switch (_b.label) {
41272
41476
  case 0:
41273
- MUTATION = src(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n mutation saveItemToCart($input: SaveItemToCartInput!) {\n saveItemToCart(input: $input) {\n id\n createdAt\n updatedAt\n dueDate\n currencyCode\n customerId\n merchantId\n itemCount\n totalPrice\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n taxLines {\n price\n rate\n }\n items {\n createdAt\n currencyCode\n deleted\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n id\n name\n sku\n slug\n barcodeList\n mainImageId\n productId\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n }\n }\n "], ["\n mutation saveItemToCart($input: SaveItemToCartInput!) {\n saveItemToCart(input: $input) {\n id\n createdAt\n updatedAt\n dueDate\n currencyCode\n customerId\n merchantId\n itemCount\n totalPrice\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n taxLines {\n price\n rate\n }\n items {\n createdAt\n currencyCode\n deleted\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n id\n name\n sku\n slug\n barcodeList\n mainImageId\n productId\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n }\n }\n "])));
41477
+ MUTATION = src(templateObject_1$2 || (templateObject_1$2 = __makeTemplateObject(["\n mutation saveItemToCart($input: SaveItemToCartInput!) {\n saveItemToCart(input: $input) {\n id\n createdAt\n updatedAt\n dueDate\n currencyCode\n customerId\n merchantId\n itemCount\n totalPrice\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n taxLines {\n price\n rate\n }\n items {\n createdAt\n currencyCode\n deleted\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n options {\n name\n productOptionsSetId\n productOptionId\n type\n values {\n name\n price\n value\n }\n }\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n id\n name\n sku\n slug\n barcodeList\n mainImageId\n productId\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n }\n }\n "], ["\n mutation saveItemToCart($input: SaveItemToCartInput!) {\n saveItemToCart(input: $input) {\n id\n createdAt\n updatedAt\n dueDate\n currencyCode\n customerId\n merchantId\n itemCount\n totalPrice\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n taxLines {\n price\n rate\n }\n items {\n createdAt\n currencyCode\n deleted\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n options {\n name\n productOptionsSetId\n productOptionId\n type\n values {\n name\n price\n value\n }\n }\n originalOrderLineItemId\n price\n quantity\n status\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n id\n name\n sku\n slug\n barcodeList\n mainImageId\n productId\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n }\n }\n "])));
41274
41478
  _b.label = 1;
41275
41479
  case 1:
41276
41480
  _b.trys.push([1, 3, , 4]);
@@ -41305,7 +41509,7 @@ var IkasCartAPI = /** @class */ (function () {
41305
41509
  return __generator(this, function (_b) {
41306
41510
  switch (_b.label) {
41307
41511
  case 0:
41308
- QUERY = src(templateObject_2$1 || (templateObject_2$1 = __makeTemplateObject(["\n query getCart(\n $cartId: String\n $customerId: String\n $storefrontRoutingId: String\n ) {\n getCart(\n id: $cartId\n customerId: $customerId\n storefrontRoutingId: $storefrontRoutingId\n ) {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n items {\n createdAt\n currencyCode\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n deleted\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n slug\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n merchantId\n status\n totalPrice\n updatedAt\n }\n }\n "], ["\n query getCart(\n $cartId: String\n $customerId: String\n $storefrontRoutingId: String\n ) {\n getCart(\n id: $cartId\n customerId: $customerId\n storefrontRoutingId: $storefrontRoutingId\n ) {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n items {\n createdAt\n currencyCode\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n originalOrderLineItemId\n price\n quantity\n status\n deleted\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n slug\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n merchantId\n status\n totalPrice\n updatedAt\n }\n }\n "])));
41512
+ QUERY = src(templateObject_2$1 || (templateObject_2$1 = __makeTemplateObject(["\n query getCart(\n $cartId: String\n $customerId: String\n $storefrontRoutingId: String\n ) {\n getCart(\n id: $cartId\n customerId: $customerId\n storefrontRoutingId: $storefrontRoutingId\n ) {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n items {\n createdAt\n currencyCode\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n options {\n name\n productOptionId\n productOptionsSetId\n type\n values {\n name\n price\n value\n }\n }\n originalOrderLineItemId\n price\n quantity\n status\n deleted\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n slug\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n merchantId\n status\n totalPrice\n updatedAt\n }\n }\n "], ["\n query getCart(\n $cartId: String\n $customerId: String\n $storefrontRoutingId: String\n ) {\n getCart(\n id: $cartId\n customerId: $customerId\n storefrontRoutingId: $storefrontRoutingId\n ) {\n createdAt\n currencyCode\n customerId\n dueDate\n id\n itemCount\n salesChannelId\n storefrontId\n storefrontRoutingId\n storefrontThemeId\n items {\n createdAt\n currencyCode\n discount {\n amount\n amountType\n reason\n }\n discountPrice\n finalPrice\n id\n options {\n name\n productOptionId\n productOptionsSetId\n type\n values {\n name\n price\n value\n }\n }\n originalOrderLineItemId\n price\n quantity\n status\n deleted\n statusUpdatedAt\n stockLocationId\n taxValue\n updatedAt\n variant {\n slug\n barcodeList\n id\n mainImageId\n name\n productId\n sku\n variantValues {\n order\n variantTypeId\n variantTypeName\n variantValueId\n variantValueName\n }\n }\n }\n merchantId\n status\n totalPrice\n updatedAt\n }\n }\n "])));
41309
41513
  _b.label = 1;
41310
41514
  case 1:
41311
41515
  _b.trys.push([1, 3, , 4]);
@@ -43421,7 +43625,9 @@ var IkasProductOptionSetAPI = /** @class */ (function () {
43421
43625
  return [2 /*return*/];
43422
43626
  }
43423
43627
  return [2 /*return*/, {
43424
- data: data.listProductOptionSet.map(function (c) { return new IkasProductOptionSet(c); }),
43628
+ data: data.listProductOptionSet.map(function (c) {
43629
+ return new IkasProductOptionSet(c);
43630
+ }),
43425
43631
  }];
43426
43632
  case 2:
43427
43633
  err_1 = _b.sent();
@@ -70516,6 +70722,17 @@ var Note = mobxReactLite.observer(function (_a) {
70516
70722
  isSuccessStep ? (React.createElement("div", { className: styles$g.CheckoutNoteDisplay }, vm.checkout.note)) : (React.createElement(FormItem, { style: { width: "100%" }, type: FormItemType.TEXT_AREA, disableResize: true, label: "", value: vm.checkout.note || "", onChange: onCheckoutNoteChange }))))));
70517
70723
  });
70518
70724
 
70725
+ var IkasProductCartLineOption = /** @class */ (function () {
70726
+ function IkasProductCartLineOption(data) {
70727
+ if (data === void 0) { data = {}; }
70728
+ this.productOptionId = data.productOptionId || "";
70729
+ this.productOptionsSetId = data.productOptionsSetId || "";
70730
+ this.values = data.values || [];
70731
+ mobx.makeAutoObservable(this);
70732
+ }
70733
+ return IkasProductCartLineOption;
70734
+ }());
70735
+
70519
70736
  var CART_LS_KEY = "cartId";
70520
70737
  var CHECKOUT_LS_KEY = "checkoutId";
70521
70738
  var IkasCartStore = /** @class */ (function () {
@@ -70541,9 +70758,7 @@ var IkasCartStore = /** @class */ (function () {
70541
70758
  cartId = ((_b = this.cart) === null || _b === void 0 ? void 0 : _b.id) || localStorage.getItem(CART_LS_KEY);
70542
70759
  if (!cartId && !customerId)
70543
70760
  return [2 /*return*/];
70544
- return [4 /*yield*/, IkasCartAPI.getCart(cartId || undefined
70545
- // customerId || undefined // TODO reopen this when we have a way of telling backend that we cleared a cart
70546
- )];
70761
+ return [4 /*yield*/, IkasCartAPI.getCart(cartId || undefined)];
70547
70762
  case 2:
70548
70763
  cart = _c.sent();
70549
70764
  if (!cart) return [3 /*break*/, 4];
@@ -70607,28 +70822,89 @@ var IkasCartStore = /** @class */ (function () {
70607
70822
  }
70608
70823
  });
70609
70824
  }); };
70825
+ this.findExistingItem = function (variant, product) {
70826
+ var _a, _b, _c, _d, _e;
70827
+ if (!product.productOptionSetId) {
70828
+ return (_a = _this.cart) === null || _a === void 0 ? void 0 : _a.items.find(function (item) { return item.variant.id === variant.id; });
70829
+ }
70830
+ var existingItems = ((_b = _this.cart) === null || _b === void 0 ? void 0 : _b.items.filter(function (item) { return item.variant.id === variant.id; })) || [];
70831
+ for (var _i = 0, existingItems_1 = existingItems; _i < existingItems_1.length; _i++) {
70832
+ var item = existingItems_1[_i];
70833
+ if (item.options) {
70834
+ var hasSameOptionValues = true;
70835
+ var _loop_1 = function (option) {
70836
+ var existingOptionValues = option.values.map(function (v) { return v.value; });
70837
+ 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
+ hasSameOptionValues =
70839
+ hasSameOptionValues &&
70840
+ existingOptionValues.length === (productOptionValues === null || productOptionValues === void 0 ? void 0 : productOptionValues.values.length) &&
70841
+ existingOptionValues.every(function (val) { return productOptionValues === null || productOptionValues === void 0 ? void 0 : productOptionValues.includes(val); });
70842
+ if (!hasSameOptionValues)
70843
+ return "break";
70844
+ };
70845
+ for (var _f = 0, _g = item.options; _f < _g.length; _f++) {
70846
+ var option = _g[_f];
70847
+ var state_1 = _loop_1(option);
70848
+ if (state_1 === "break")
70849
+ break;
70850
+ }
70851
+ if (hasSameOptionValues)
70852
+ return item;
70853
+ }
70854
+ }
70855
+ };
70856
+ this.createCartLineOptions = function (item) {
70857
+ if (item && item.options) {
70858
+ var options = [];
70859
+ for (var _i = 0, _a = item.options; _i < _a.length; _i++) {
70860
+ var option = _a[_i];
70861
+ var data = new IkasProductCartLineOption({});
70862
+ data.productOptionId = option.productOptionId;
70863
+ data.productOptionsSetId = option.productOptionsSetId;
70864
+ data.values = option.values.map(function (val) { return val.value; });
70865
+ options.push(data);
70866
+ }
70867
+ return options;
70868
+ }
70869
+ else {
70870
+ return null;
70871
+ }
70872
+ };
70610
70873
  this.addItem = function (variant, product, initialQuantity) {
70611
70874
  if (initialQuantity === void 0) { initialQuantity = 1; }
70612
70875
  return __awaiter(_this, void 0, void 0, function () {
70613
- var existingItem, cartId, input, cart, eventId, item, err_2;
70614
- var _a, _b, _c;
70615
- return __generator(this, function (_d) {
70616
- switch (_d.label) {
70876
+ var existingItem, optionValues_1, cartId, input, cart, eventId, item, err_2;
70877
+ var _a, _b, _c, _d, _e;
70878
+ return __generator(this, function (_f) {
70879
+ switch (_f.label) {
70617
70880
  case 0:
70618
- _d.trys.push([0, 5, , 6]);
70881
+ _f.trys.push([0, 5, , 6]);
70882
+ if (!product.canAddToCart)
70883
+ return [2 /*return*/, false];
70619
70884
  return [4 /*yield*/, this.beforeCartOperationCheck()];
70620
70885
  case 1:
70621
- _d.sent();
70886
+ _f.sent();
70622
70887
  if (this.cart) {
70623
- existingItem = this.cart.items.find(function (item) { return item.variant.id === variant.id; });
70888
+ existingItem = this.findExistingItem(variant, product);
70624
70889
  if (existingItem) {
70890
+ (_a = product.productOptionSet) === null || _a === void 0 ? void 0 : _a.initOptionValues();
70625
70891
  return [2 /*return*/, this.changeItemQuantity(existingItem, existingItem.quantity + 1)];
70626
70892
  }
70627
70893
  }
70628
- cartId = ((_a = this.cart) === null || _a === void 0 ? void 0 : _a.id) || localStorage.getItem(CART_LS_KEY);
70894
+ optionValues_1 = [];
70895
+ (_b = product.productOptionSet) === null || _b === void 0 ? void 0 : _b.options.forEach(function (o) {
70896
+ if (o.values.length) {
70897
+ optionValues_1.push(new IkasProductCartLineOption({
70898
+ productOptionId: o.id,
70899
+ productOptionsSetId: o.productOptionSetId,
70900
+ values: o.values,
70901
+ }));
70902
+ }
70903
+ });
70904
+ cartId = ((_c = this.cart) === null || _c === void 0 ? void 0 : _c.id) || localStorage.getItem(CART_LS_KEY);
70629
70905
  input = {
70630
70906
  cartId: cartId,
70631
- customerId: ((_b = this.cart) === null || _b === void 0 ? void 0 : _b.customerId) || ((_c = this.baseStore.customerStore.customer) === null || _c === void 0 ? void 0 : _c.id) ||
70907
+ customerId: ((_d = this.cart) === null || _d === void 0 ? void 0 : _d.customerId) || ((_e = this.baseStore.customerStore.customer) === null || _e === void 0 ? void 0 : _e.id) ||
70632
70908
  null,
70633
70909
  item: {
70634
70910
  id: null,
@@ -70638,6 +70914,7 @@ var IkasCartStore = /** @class */ (function () {
70638
70914
  name: product.name,
70639
70915
  },
70640
70916
  },
70917
+ options: optionValues_1.length ? optionValues_1 : null,
70641
70918
  priceListId: IkasStorefrontConfig.priceListId || null,
70642
70919
  salesChannelId: IkasStorefrontConfig.salesChannelId,
70643
70920
  storefrontId: IkasStorefrontConfig.storefrontId,
@@ -70646,12 +70923,12 @@ var IkasCartStore = /** @class */ (function () {
70646
70923
  };
70647
70924
  return [4 /*yield*/, IkasCartAPI.saveItemToCart(input)];
70648
70925
  case 2:
70649
- cart = _d.sent();
70926
+ cart = _f.sent();
70650
70927
  if (!cart) return [3 /*break*/, 4];
70651
70928
  return [4 /*yield*/, this.setCart(cart)];
70652
70929
  case 3:
70653
- _d.sent();
70654
- _d.label = 4;
70930
+ _f.sent();
70931
+ _f.label = 4;
70655
70932
  case 4:
70656
70933
  if (this.cart) {
70657
70934
  eventId = this.cart.id + "-" + this.cart.updatedAt;
@@ -70660,11 +70937,11 @@ var IkasCartStore = /** @class */ (function () {
70660
70937
  Analytics.addToCart(item, initialQuantity, eventId, this.cart);
70661
70938
  }
70662
70939
  }
70663
- return [3 /*break*/, 6];
70940
+ return [2 /*return*/, true];
70664
70941
  case 5:
70665
- err_2 = _d.sent();
70942
+ err_2 = _f.sent();
70666
70943
  console.log(err_2);
70667
- return [3 /*break*/, 6];
70944
+ return [2 /*return*/, false];
70668
70945
  case 6: return [2 /*return*/];
70669
70946
  }
70670
70947
  });
@@ -70692,6 +70969,7 @@ var IkasCartStore = /** @class */ (function () {
70692
70969
  name: item.variant.name,
70693
70970
  },
70694
70971
  },
70972
+ options: this.createCartLineOptions(item),
70695
70973
  priceListId: IkasStorefrontConfig.priceListId || null,
70696
70974
  salesChannelId: IkasStorefrontConfig.salesChannelId,
70697
70975
  storefrontId: IkasStorefrontConfig.storefrontId,
@@ -70718,11 +70996,11 @@ var IkasCartStore = /** @class */ (function () {
70718
70996
  Analytics.addToCart(item, quantity - oldQuantity, eventId, this.cart);
70719
70997
  }
70720
70998
  }
70721
- return [3 /*break*/, 6];
70999
+ return [2 /*return*/, true];
70722
71000
  case 5:
70723
71001
  err_3 = _d.sent();
70724
71002
  console.log(err_3);
70725
- return [3 /*break*/, 6];
71003
+ return [2 /*return*/, false];
70726
71004
  case 6: return [2 /*return*/];
70727
71005
  }
70728
71006
  });