@ikas/storefront 1.0.2 → 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.es.js CHANGED
@@ -19867,6 +19867,28 @@ var moment = createCommonjsModule(function (module, exports) {
19867
19867
  })));
19868
19868
  });
19869
19869
 
19870
+ var ProductOptionTypeEnum;
19871
+ (function (ProductOptionTypeEnum) {
19872
+ ProductOptionTypeEnum["CHECKBOX"] = "CHECKBOX";
19873
+ ProductOptionTypeEnum["CHOICE"] = "CHOICE";
19874
+ ProductOptionTypeEnum["COLOR_PICKER"] = "COLOR_PICKER";
19875
+ ProductOptionTypeEnum["DATE_PICKER"] = "DATE_PICKER";
19876
+ ProductOptionTypeEnum["FILE"] = "FILE";
19877
+ ProductOptionTypeEnum["IMAGE"] = "IMAGE";
19878
+ ProductOptionTypeEnum["TEXT"] = "TEXT";
19879
+ ProductOptionTypeEnum["TEXT_AREA"] = "TEXT_AREA";
19880
+ })(ProductOptionTypeEnum || (ProductOptionTypeEnum = {}));
19881
+ var IkasOrderLineOptions = /** @class */ (function () {
19882
+ function IkasOrderLineOptions(data) {
19883
+ this.name = data.name;
19884
+ this.productOptionId = data.productOptionId;
19885
+ this.productOptionsSetId = data.productOptionsSetId;
19886
+ this.type = data.type;
19887
+ this.values = data.values;
19888
+ }
19889
+ return IkasOrderLineOptions;
19890
+ }());
19891
+
19870
19892
  var IkasOrderLineItem = /** @class */ (function () {
19871
19893
  function IkasOrderLineItem(data) {
19872
19894
  this.discount = null;
@@ -19894,6 +19916,9 @@ var IkasOrderLineItem = /** @class */ (function () {
19894
19916
  ? new IkasOrderLineVariant(data.variant)
19895
19917
  : new IkasOrderLineVariant();
19896
19918
  this.status = data.status || OrderLineItemStatusEnum.FULFILLED;
19919
+ this.options = data.options
19920
+ ? data.options.map(function (oP) { return new IkasOrderLineOptions(oP); })
19921
+ : null;
19897
19922
  makeAutoObservable(this);
19898
19923
  }
19899
19924
  Object.defineProperty(IkasOrderLineItem.prototype, "orderedAtDays", {
@@ -21095,79 +21120,6 @@ var IkasProductTag = /** @class */ (function () {
21095
21120
  return IkasProductTag;
21096
21121
  }());
21097
21122
 
21098
- var IkasProduct = /** @class */ (function () {
21099
- function IkasProduct(data) {
21100
- if (data === void 0) { data = {}; }
21101
- this.id = data.id || Date.now() + "";
21102
- this.name = data.name || "";
21103
- this.type = data.type || IkasProductType.PHYSICAL;
21104
- this.description = data.description || "";
21105
- this.shortDescription = data.shortDescription || "";
21106
- this.metaData = data.metaData
21107
- ? new IkasHTMLMetaData(data.metaData)
21108
- : undefined;
21109
- this.brand = data.brand ? new IkasBrand(data.brand) : null;
21110
- this.categories = data.categories
21111
- ? data.categories.map(function (c) { return new IkasCategory(c); })
21112
- : [];
21113
- this.tags = data.tags
21114
- ? data.tags.map(function (tag) { return new IkasProductTag(tag); })
21115
- : [];
21116
- this.variants = data.variants
21117
- ? data.variants.map(function (v) { return new IkasProductVariant(v); })
21118
- : [];
21119
- this.attributes = data.attributes
21120
- ? data.attributes.map(function (a) { return new IkasProductAttributeValue(a); })
21121
- : [];
21122
- this.variantTypes = data.variantTypes
21123
- ? data.variantTypes.map(function (v) { return new IkasProductVariantType(v); })
21124
- : [];
21125
- this.productOptionSetId = data.productOptionSetId || null;
21126
- this.productOptionSet = data.productOptionSet || null;
21127
- makeAutoObservable(this);
21128
- }
21129
- Object.defineProperty(IkasProduct.prototype, "hasVariant", {
21130
- get: function () {
21131
- return !!this.variantTypes.length;
21132
- },
21133
- enumerable: false,
21134
- configurable: true
21135
- });
21136
- Object.defineProperty(IkasProduct.prototype, "hasStock", {
21137
- get: function () {
21138
- return this.variants.some(function (v) { return v.stock > 0; });
21139
- },
21140
- enumerable: false,
21141
- configurable: true
21142
- });
21143
- Object.defineProperty(IkasProduct.prototype, "mainVariantType", {
21144
- get: function () {
21145
- if (!this.hasVariant)
21146
- return;
21147
- return this.variantTypes[0].variantType;
21148
- },
21149
- enumerable: false,
21150
- configurable: true
21151
- });
21152
- Object.defineProperty(IkasProduct.prototype, "href", {
21153
- get: function () {
21154
- var _a;
21155
- if (!((_a = this.metaData) === null || _a === void 0 ? void 0 : _a.slug))
21156
- return "";
21157
- return "/" + this.metaData.slug;
21158
- },
21159
- enumerable: false,
21160
- configurable: true
21161
- });
21162
- return IkasProduct;
21163
- }());
21164
- var IkasProductType;
21165
- (function (IkasProductType) {
21166
- IkasProductType["PHYSICAL"] = "PHYSICAL";
21167
- IkasProductType["DIGITAL"] = "DIGITAL";
21168
- IkasProductType["MEMBERSHIP"] = "MEMBERSHIP";
21169
- })(IkasProductType || (IkasProductType = {}));
21170
-
21171
21123
  /**
21172
21124
  * Appends the elements of `values` to `array`.
21173
21125
  *
@@ -22791,6 +22743,399 @@ var sortBy = _baseRest(function(collection, iteratees) {
22791
22743
 
22792
22744
  var sortBy_1 = sortBy;
22793
22745
 
22746
+ var IkasProductOptionType;
22747
+ (function (IkasProductOptionType) {
22748
+ IkasProductOptionType["CHOICE"] = "CHOICE";
22749
+ IkasProductOptionType["TEXT"] = "TEXT";
22750
+ IkasProductOptionType["TEXT_AREA"] = "TEXT_AREA";
22751
+ // IMAGE = "IMAGE",
22752
+ // FILE = "FILE",
22753
+ IkasProductOptionType["COLOR_PICKER"] = "COLOR_PICKER";
22754
+ // DATE_PICKER = "DATE_PICKER",
22755
+ IkasProductOptionType["CHECKBOX"] = "CHECKBOX";
22756
+ })(IkasProductOptionType || (IkasProductOptionType = {}));
22757
+ var IkasProductOptionSelectType;
22758
+ (function (IkasProductOptionSelectType) {
22759
+ IkasProductOptionSelectType["SELECT"] = "SELECT";
22760
+ IkasProductOptionSelectType["BOX"] = "BOX";
22761
+ IkasProductOptionSelectType["SWATCH"] = "SWATCH";
22762
+ })(IkasProductOptionSelectType || (IkasProductOptionSelectType = {}));
22763
+ var IkasProductOptionSelectValueTranslations = /** @class */ (function () {
22764
+ function IkasProductOptionSelectValueTranslations(data) {
22765
+ this.id = data.id || "";
22766
+ this.value = data.value || null;
22767
+ makeAutoObservable(this);
22768
+ }
22769
+ return IkasProductOptionSelectValueTranslations;
22770
+ }());
22771
+ var IkasProductOptionTranslations = /** @class */ (function () {
22772
+ function IkasProductOptionTranslations(data) {
22773
+ var _a;
22774
+ this.id = data.id || "";
22775
+ this.name = data.name || null;
22776
+ this.optionalText = data.optionalText || null;
22777
+ this.values =
22778
+ ((_a = data.values) === null || _a === void 0 ? void 0 : _a.map(function (o) { return new IkasProductOptionSelectValueTranslations(o); })) || [];
22779
+ makeAutoObservable(this);
22780
+ }
22781
+ return IkasProductOptionTranslations;
22782
+ }());
22783
+ var IkasProductOptionSetTranslations = /** @class */ (function () {
22784
+ function IkasProductOptionSetTranslations(data) {
22785
+ var _a;
22786
+ this.locale = data.locale || "";
22787
+ this.options =
22788
+ ((_a = data.options) === null || _a === void 0 ? void 0 : _a.map(function (o) { return new IkasProductOptionTranslations(o); })) || [];
22789
+ makeAutoObservable(this);
22790
+ }
22791
+ return IkasProductOptionSetTranslations;
22792
+ }());
22793
+ var IkasProductOptionSelectValue = /** @class */ (function () {
22794
+ function IkasProductOptionSelectValue(data) {
22795
+ if (data === void 0) { data = {}; }
22796
+ this.thumbnailImage = null;
22797
+ this.id = data.id || "";
22798
+ this.order = data.order || 0;
22799
+ this.value = data.value || "";
22800
+ this.price = data.price || null;
22801
+ this.thumbnailImageId = data.thumbnailImageId || null;
22802
+ this.colorCode = data.colorCode || null;
22803
+ this.thumbnailImage = this.thumbnailImageId
22804
+ ? new IkasImage(this.thumbnailImageId)
22805
+ : null;
22806
+ makeAutoObservable(this);
22807
+ }
22808
+ return IkasProductOptionSelectValue;
22809
+ }());
22810
+ var IkasProductOptionSelectSettings = /** @class */ (function () {
22811
+ function IkasProductOptionSelectSettings(data) {
22812
+ if (data === void 0) { data = {}; }
22813
+ var _a;
22814
+ this.type = data.type || IkasProductOptionSelectType.BOX;
22815
+ this.minSelect =
22816
+ data.minSelect !== null && data.minSelect !== undefined
22817
+ ? data.minSelect
22818
+ : null;
22819
+ this.maxSelect =
22820
+ data.maxSelect !== null && data.maxSelect !== undefined
22821
+ ? data.maxSelect
22822
+ : null;
22823
+ this.values = sortBy_1(((_a = data.values) === null || _a === void 0 ? void 0 : _a.map(function (o) { return new IkasProductOptionSelectValue(o); })) || [], "order");
22824
+ makeAutoObservable(this);
22825
+ }
22826
+ return IkasProductOptionSelectSettings;
22827
+ }());
22828
+ var IkasProductOptionDateSettings = /** @class */ (function () {
22829
+ function IkasProductOptionDateSettings(data) {
22830
+ this.min = data.min || null;
22831
+ this.max = data.max || null;
22832
+ makeAutoObservable(this);
22833
+ }
22834
+ return IkasProductOptionDateSettings;
22835
+ }());
22836
+ var IkasProductOptionTextSettings = /** @class */ (function () {
22837
+ function IkasProductOptionTextSettings(data) {
22838
+ if (data === void 0) { data = {}; }
22839
+ this.min = data.min !== null && data.min !== undefined ? data.min : null;
22840
+ this.max = data.max !== null && data.max !== undefined ? data.max : null;
22841
+ makeAutoObservable(this);
22842
+ }
22843
+ return IkasProductOptionTextSettings;
22844
+ }());
22845
+ var IkasProductOptionFileSettings = /** @class */ (function () {
22846
+ function IkasProductOptionFileSettings(data) {
22847
+ this.allowedExtensions = data.allowedExtensions || null;
22848
+ this.minQuantity =
22849
+ data.minQuantity !== null && data.minQuantity !== undefined
22850
+ ? data.minQuantity
22851
+ : null;
22852
+ this.maxQuantity =
22853
+ data.maxQuantity !== null && data.maxQuantity !== undefined
22854
+ ? data.maxQuantity
22855
+ : null;
22856
+ makeAutoObservable(this);
22857
+ }
22858
+ return IkasProductOptionFileSettings;
22859
+ }());
22860
+ var IkasProductOption = /** @class */ (function () {
22861
+ function IkasProductOption(data) {
22862
+ var _this = this;
22863
+ this._values = [];
22864
+ this.childOptions = [];
22865
+ this.initValues = function () {
22866
+ if (!_this.isOptional) {
22867
+ _this.values = [];
22868
+ if (_this.childOptions) {
22869
+ _this.childOptions.forEach(function (co) { return co.initValues(); });
22870
+ }
22871
+ }
22872
+ };
22873
+ this.isValidTextOptionValue = function () {
22874
+ var value = _this.values[0];
22875
+ if (!value) {
22876
+ return !!_this.isOptional;
22877
+ }
22878
+ return (!!_this.textSettings &&
22879
+ (_this.textSettings.min !== null
22880
+ ? value.length >= _this.textSettings.min
22881
+ : true) &&
22882
+ (_this.textSettings.max !== null
22883
+ ? value.length <= _this.textSettings.max
22884
+ : true));
22885
+ };
22886
+ this.isValidChoiceOptionValue = function () {
22887
+ return (!!_this.selectSettings &&
22888
+ (_this.selectSettings.minSelect !== null
22889
+ ? _this.values.length >= _this.selectSettings.minSelect
22890
+ : true) &&
22891
+ (_this.selectSettings.maxSelect !== null
22892
+ ? _this.values.length <= _this.selectSettings.maxSelect
22893
+ : true));
22894
+ };
22895
+ this.id = data.id || "";
22896
+ this.productOptionSetId = data.productOptionSetId || "";
22897
+ this.name = data.name || "";
22898
+ this.order = data.order || 0;
22899
+ this.type = data.type || IkasProductOptionType.CHOICE;
22900
+ this.selectSettings = data.selectSettings
22901
+ ? new IkasProductOptionSelectSettings(data.selectSettings || {})
22902
+ : null;
22903
+ this.textSettings = data.textSettings
22904
+ ? new IkasProductOptionTextSettings(data.textSettings || {})
22905
+ : null;
22906
+ this.fileSettings = data.fileSettings
22907
+ ? new IkasProductOptionFileSettings(data.fileSettings || {})
22908
+ : null;
22909
+ this.dateSettings = data.dateSettings
22910
+ ? new IkasProductOptionDateSettings(data.dateSettings || {})
22911
+ : null;
22912
+ this.price = data.price || null;
22913
+ this.isOptional = data.isOptional || false;
22914
+ this.optionalText = data.optionalText || null;
22915
+ this.requiredOptionId = data.requiredOptionId || null;
22916
+ this.requiredOptionValueIds = data.requiredOptionValueIds || null;
22917
+ this.values = data.values || [];
22918
+ //@ts-ignore
22919
+ this.childOptions = data.childOptions || [];
22920
+ makeAutoObservable(this);
22921
+ }
22922
+ Object.defineProperty(IkasProductOption.prototype, "displayedChildOptions", {
22923
+ get: function () {
22924
+ var _this = this;
22925
+ return sortBy_1(this.childOptions.filter(function (co) {
22926
+ var _a;
22927
+ // Check if all required options are selected
22928
+ if ((_a = co.requiredOptionValueIds) === null || _a === void 0 ? void 0 : _a.length) {
22929
+ return co.requiredOptionValueIds.every(function (rovId) {
22930
+ return _this.values.some(function (v) { return v === rovId; });
22931
+ });
22932
+ }
22933
+ else {
22934
+ return !!_this.values.length;
22935
+ }
22936
+ }), "order");
22937
+ },
22938
+ enumerable: false,
22939
+ configurable: true
22940
+ });
22941
+ Object.defineProperty(IkasProductOption.prototype, "hasValidValues", {
22942
+ get: function () {
22943
+ if (!this.values.length && !this.isOptional) {
22944
+ return false;
22945
+ }
22946
+ var hasValidValues = false;
22947
+ switch (this.type) {
22948
+ case IkasProductOptionType.TEXT:
22949
+ case IkasProductOptionType.TEXT_AREA:
22950
+ hasValidValues = this.isValidTextOptionValue();
22951
+ break;
22952
+ case IkasProductOptionType.CHECKBOX:
22953
+ case IkasProductOptionType.COLOR_PICKER:
22954
+ hasValidValues = true;
22955
+ break;
22956
+ case IkasProductOptionType.CHOICE:
22957
+ hasValidValues = this.isValidChoiceOptionValue();
22958
+ break;
22959
+ }
22960
+ return (hasValidValues &&
22961
+ this.displayedChildOptions.every(function (co) { return co.hasValidValues; }));
22962
+ },
22963
+ enumerable: false,
22964
+ configurable: true
22965
+ });
22966
+ Object.defineProperty(IkasProductOption.prototype, "values", {
22967
+ get: function () {
22968
+ return this._values;
22969
+ },
22970
+ set: function (values) {
22971
+ this._values = values;
22972
+ if (!values.length) {
22973
+ this.childOptions.forEach(function (co) { return (co.values = []); });
22974
+ }
22975
+ },
22976
+ enumerable: false,
22977
+ configurable: true
22978
+ });
22979
+ return IkasProductOption;
22980
+ }());
22981
+ var IkasProductOptionSet = /** @class */ (function () {
22982
+ function IkasProductOptionSet(data) {
22983
+ var _this = this;
22984
+ var _a, _b;
22985
+ this.initOptionValues = function () { return __awaiter(_this, void 0, void 0, function () {
22986
+ return __generator(this, function (_a) {
22987
+ this.options.forEach(function (o) { return o.initValues(); });
22988
+ return [2 /*return*/];
22989
+ });
22990
+ }); };
22991
+ this.id = data.id || "";
22992
+ this.name = data.name || "";
22993
+ this.options =
22994
+ ((_a = data.options) === null || _a === void 0 ? void 0 : _a.map(function (o) {
22995
+ return new IkasProductOption(__assign(__assign({}, o), { productOptionSetId: _this.id }));
22996
+ })) || [];
22997
+ this.translations = data.translations
22998
+ ? (_b = data.translations) === null || _b === void 0 ? void 0 : _b.map(function (o) { return new IkasProductOptionSetTranslations(o); }) : null;
22999
+ this.setChildOptions();
23000
+ this.setTranslations();
23001
+ this.initOptionValues();
23002
+ makeAutoObservable(this);
23003
+ }
23004
+ Object.defineProperty(IkasProductOptionSet.prototype, "displayedOptions", {
23005
+ get: function () {
23006
+ return sortBy_1(this.options.filter(function (o) { return !o.requiredOptionId; }), "order");
23007
+ },
23008
+ enumerable: false,
23009
+ configurable: true
23010
+ });
23011
+ IkasProductOptionSet.prototype.setTranslations = function () {
23012
+ var _this = this;
23013
+ var _a;
23014
+ var locale = IkasStorefrontConfig.getCurrentLocale();
23015
+ if (this.translations &&
23016
+ this.translations.some(function (t) { return t.locale === locale; })) {
23017
+ var localeTranslations = this.translations.find(function (t) { return t.locale === locale; });
23018
+ (_a = localeTranslations === null || localeTranslations === void 0 ? void 0 : localeTranslations.options) === null || _a === void 0 ? void 0 : _a.forEach(function (translatedOption) {
23019
+ var _a;
23020
+ var option = _this.options.find(function (o) { return o.id === translatedOption.id; });
23021
+ if (option) {
23022
+ option.name = translatedOption.name || option.name;
23023
+ option.optionalText =
23024
+ translatedOption.optionalText || option.optionalText;
23025
+ if (option.type === IkasProductOptionType.CHOICE) {
23026
+ (_a = translatedOption.values) === null || _a === void 0 ? void 0 : _a.forEach(function (translatedValue) {
23027
+ var _a;
23028
+ var selectValue = (_a = option.selectSettings) === null || _a === void 0 ? void 0 : _a.values.find(function (sv) { return sv.id === translatedValue.id; });
23029
+ if (selectValue) {
23030
+ selectValue.value = translatedValue.value || selectValue.value;
23031
+ }
23032
+ });
23033
+ }
23034
+ }
23035
+ });
23036
+ }
23037
+ };
23038
+ IkasProductOptionSet.prototype.setChildOptions = function () {
23039
+ var _this = this;
23040
+ this.options.forEach(function (option) {
23041
+ var childOptions = _this.options.filter(function (o) { return o.requiredOptionId === option.id; });
23042
+ if (childOptions.length) {
23043
+ //@ts-ignore
23044
+ option.childOptions = childOptions;
23045
+ }
23046
+ });
23047
+ };
23048
+ return IkasProductOptionSet;
23049
+ }());
23050
+
23051
+ var IkasProduct = /** @class */ (function () {
23052
+ function IkasProduct(data) {
23053
+ if (data === void 0) { data = {}; }
23054
+ this.id = data.id || Date.now() + "";
23055
+ this.name = data.name || "";
23056
+ this.type = data.type || IkasProductType.PHYSICAL;
23057
+ this.description = data.description || "";
23058
+ this.shortDescription = data.shortDescription || "";
23059
+ this.metaData = data.metaData
23060
+ ? new IkasHTMLMetaData(data.metaData)
23061
+ : undefined;
23062
+ this.brand = data.brand ? new IkasBrand(data.brand) : null;
23063
+ this.categories = data.categories
23064
+ ? data.categories.map(function (c) { return new IkasCategory(c); })
23065
+ : [];
23066
+ this.tags = data.tags
23067
+ ? data.tags.map(function (tag) { return new IkasProductTag(tag); })
23068
+ : [];
23069
+ this.variants = data.variants
23070
+ ? data.variants.map(function (v) { return new IkasProductVariant(v); })
23071
+ : [];
23072
+ this.attributes = data.attributes
23073
+ ? data.attributes.map(function (a) { return new IkasProductAttributeValue(a); })
23074
+ : [];
23075
+ this.variantTypes = data.variantTypes
23076
+ ? data.variantTypes.map(function (v) { return new IkasProductVariantType(v); })
23077
+ : [];
23078
+ this.productOptionSetId = data.productOptionSetId || null;
23079
+ this.productOptionSet = data.productOptionSet
23080
+ ? new IkasProductOptionSet(data.productOptionSet)
23081
+ : null;
23082
+ makeAutoObservable(this);
23083
+ }
23084
+ Object.defineProperty(IkasProduct.prototype, "hasVariant", {
23085
+ get: function () {
23086
+ return !!this.variantTypes.length;
23087
+ },
23088
+ enumerable: false,
23089
+ configurable: true
23090
+ });
23091
+ Object.defineProperty(IkasProduct.prototype, "hasStock", {
23092
+ get: function () {
23093
+ return this.variants.some(function (v) { return v.stock > 0; });
23094
+ },
23095
+ enumerable: false,
23096
+ configurable: true
23097
+ });
23098
+ Object.defineProperty(IkasProduct.prototype, "mainVariantType", {
23099
+ get: function () {
23100
+ if (!this.hasVariant)
23101
+ return;
23102
+ return this.variantTypes[0].variantType;
23103
+ },
23104
+ enumerable: false,
23105
+ configurable: true
23106
+ });
23107
+ Object.defineProperty(IkasProduct.prototype, "href", {
23108
+ get: function () {
23109
+ var _a;
23110
+ if (!((_a = this.metaData) === null || _a === void 0 ? void 0 : _a.slug))
23111
+ return "";
23112
+ return "/" + this.metaData.slug;
23113
+ },
23114
+ enumerable: false,
23115
+ configurable: true
23116
+ });
23117
+ Object.defineProperty(IkasProduct.prototype, "canAddToCart", {
23118
+ get: function () {
23119
+ if (this.productOptionSetId) {
23120
+ return (!!this.productOptionSet &&
23121
+ this.productOptionSet.displayedOptions.every(function (o) { return o.hasValidValues; }));
23122
+ }
23123
+ else {
23124
+ return true;
23125
+ }
23126
+ },
23127
+ enumerable: false,
23128
+ configurable: true
23129
+ });
23130
+ return IkasProduct;
23131
+ }());
23132
+ var IkasProductType;
23133
+ (function (IkasProductType) {
23134
+ IkasProductType["PHYSICAL"] = "PHYSICAL";
23135
+ IkasProductType["DIGITAL"] = "DIGITAL";
23136
+ IkasProductType["MEMBERSHIP"] = "MEMBERSHIP";
23137
+ })(IkasProductType || (IkasProductType = {}));
23138
+
22794
23139
  /**
22795
23140
  * The base implementation of `assignValue` and `assignMergeValue` without
22796
23141
  * value checks.
@@ -24010,147 +24355,6 @@ var IkasTransactionTypeEnum;
24010
24355
  IkasTransactionTypeEnum["VOID"] = "VOID";
24011
24356
  })(IkasTransactionTypeEnum || (IkasTransactionTypeEnum = {}));
24012
24357
 
24013
- var IkasProductOptionType;
24014
- (function (IkasProductOptionType) {
24015
- IkasProductOptionType["CHOICE"] = "CHOICE";
24016
- IkasProductOptionType["TEXT"] = "TEXT";
24017
- IkasProductOptionType["TEXT_AREA"] = "TEXT_AREA";
24018
- IkasProductOptionType["IMAGE"] = "IMAGE";
24019
- IkasProductOptionType["FILE"] = "FILE";
24020
- IkasProductOptionType["COLOR_PICKER"] = "COLOR_PICKER";
24021
- // DATE_PICKER = "DATE_PICKER",
24022
- IkasProductOptionType["CHECKBOX"] = "CHECKBOX";
24023
- })(IkasProductOptionType || (IkasProductOptionType = {}));
24024
- var IkasProductOptionSelectType;
24025
- (function (IkasProductOptionSelectType) {
24026
- IkasProductOptionSelectType["SELECT"] = "SELECT";
24027
- IkasProductOptionSelectType["BOX"] = "BOX";
24028
- IkasProductOptionSelectType["SWATCH"] = "SWATCH";
24029
- })(IkasProductOptionSelectType || (IkasProductOptionSelectType = {}));
24030
- var IkasProductOptionSelectValueTranslations = /** @class */ (function () {
24031
- function IkasProductOptionSelectValueTranslations(data) {
24032
- this.id = data.id || "";
24033
- this.value = data.value || null;
24034
- makeAutoObservable(this);
24035
- }
24036
- return IkasProductOptionSelectValueTranslations;
24037
- }());
24038
- var IkasProductOptionTranslations = /** @class */ (function () {
24039
- function IkasProductOptionTranslations(data) {
24040
- var _a;
24041
- this.id = data.id || "";
24042
- this.name = data.name || null;
24043
- this.optionalText = data.optionalText || null;
24044
- this.values =
24045
- ((_a = data.values) === null || _a === void 0 ? void 0 : _a.map(function (o) { return new IkasProductOptionSelectValueTranslations(o); })) || [];
24046
- makeAutoObservable(this);
24047
- }
24048
- return IkasProductOptionTranslations;
24049
- }());
24050
- var IkasProductOptionSetTranslations = /** @class */ (function () {
24051
- function IkasProductOptionSetTranslations(data) {
24052
- var _a;
24053
- this.locale = data.locale || "";
24054
- this.options =
24055
- ((_a = data.options) === null || _a === void 0 ? void 0 : _a.map(function (o) { return new IkasProductOptionTranslations(o); })) || [];
24056
- makeAutoObservable(this);
24057
- }
24058
- return IkasProductOptionSetTranslations;
24059
- }());
24060
- var IkasProductOptionSelectValue = /** @class */ (function () {
24061
- function IkasProductOptionSelectValue(data) {
24062
- if (data === void 0) { data = {}; }
24063
- this.order = data.order || 0;
24064
- this.value = data.value || "";
24065
- this.price = data.price || null;
24066
- this.thumbnailImageId = data.thumbnailImageId || null;
24067
- this.colorCode = data.colorCode || null;
24068
- this.thumbnailImage =
24069
- data.thumbnailImage ||
24070
- (this.thumbnailImageId
24071
- ? new IkasImage(this.thumbnailImageId)
24072
- : undefined);
24073
- makeAutoObservable(this);
24074
- }
24075
- return IkasProductOptionSelectValue;
24076
- }());
24077
- var IkasProductOptionSelectSettings = /** @class */ (function () {
24078
- function IkasProductOptionSelectSettings(data) {
24079
- if (data === void 0) { data = {}; }
24080
- var _a;
24081
- this.type = data.type || IkasProductOptionSelectType.BOX;
24082
- this.minSelect = data.minSelect || null;
24083
- this.maxSelect = data.maxSelect || null;
24084
- this.values =
24085
- ((_a = data.values) === null || _a === void 0 ? void 0 : _a.map(function (o) { return new IkasProductOptionSelectValue(o); })) || [];
24086
- makeAutoObservable(this);
24087
- }
24088
- return IkasProductOptionSelectSettings;
24089
- }());
24090
- var IkasProductOptionDateSettings = /** @class */ (function () {
24091
- function IkasProductOptionDateSettings(data) {
24092
- this.min = data.min || null;
24093
- this.max = data.max || null;
24094
- makeAutoObservable(this);
24095
- }
24096
- return IkasProductOptionDateSettings;
24097
- }());
24098
- var IkasProductOptionTextSettings = /** @class */ (function () {
24099
- function IkasProductOptionTextSettings(data) {
24100
- if (data === void 0) { data = {}; }
24101
- this.min = data.min || null;
24102
- this.max = data.max || null;
24103
- makeAutoObservable(this);
24104
- }
24105
- return IkasProductOptionTextSettings;
24106
- }());
24107
- var IkasProductOptionFileSettings = /** @class */ (function () {
24108
- function IkasProductOptionFileSettings(data) {
24109
- this.allowedExtensions = data.allowedExtensions || null;
24110
- this.minQuantity = data.minQuantity || null;
24111
- this.maxQuantity = data.maxQuantity || null;
24112
- makeAutoObservable(this);
24113
- }
24114
- return IkasProductOptionFileSettings;
24115
- }());
24116
- var IkasProductOption = /** @class */ (function () {
24117
- function IkasProductOption(data) {
24118
- this.name = data.name || "";
24119
- this.order = data.order || 0;
24120
- this.type = data.type || IkasProductOptionType.CHOICE;
24121
- this.selectSettings = data.selectSettings
24122
- ? new IkasProductOptionSelectSettings(data.selectSettings || {})
24123
- : null;
24124
- this.textSettings = data.textSettings
24125
- ? new IkasProductOptionTextSettings(data.textSettings || {})
24126
- : null;
24127
- this.fileSettings = data.fileSettings
24128
- ? new IkasProductOptionFileSettings(data.fileSettings || {})
24129
- : null;
24130
- this.dateSettings = data.dateSettings
24131
- ? new IkasProductOptionDateSettings(data.dateSettings || {})
24132
- : null;
24133
- this.price = data.price || null;
24134
- this.isOptional = data.isOptional || null;
24135
- this.optionalText = data.optionalText || null;
24136
- this.requiredOptionId = data.requiredOptionId || null;
24137
- this.requiredOptionValueIds = data.requiredOptionValueIds || null;
24138
- makeAutoObservable(this);
24139
- }
24140
- return IkasProductOption;
24141
- }());
24142
- var IkasProductOptionSet = /** @class */ (function () {
24143
- function IkasProductOptionSet(data) {
24144
- var _a, _b;
24145
- this.name = data.name || "";
24146
- this.options = ((_a = data.options) === null || _a === void 0 ? void 0 : _a.map(function (o) { return new IkasProductOption(o); })) || [];
24147
- this.translations = data.translations
24148
- ? (_b = data.translations) === null || _b === void 0 ? void 0 : _b.map(function (o) { return new IkasProductOptionSetTranslations(o); }) : null;
24149
- makeAutoObservable(this);
24150
- }
24151
- return IkasProductOptionSet;
24152
- }());
24153
-
24154
24358
  var IkasThemeComponentProp = /** @class */ (function () {
24155
24359
  function IkasThemeComponentProp(data) {
24156
24360
  this.id = data.id || Date.now() + "";
@@ -37765,7 +37969,7 @@ var ProductOptionSelectTypeEnum;
37765
37969
  ProductOptionSelectTypeEnum["SELECT"] = "SELECT";
37766
37970
  ProductOptionSelectTypeEnum["SWATCH"] = "SWATCH";
37767
37971
  })(ProductOptionSelectTypeEnum || (ProductOptionSelectTypeEnum = {}));
37768
- var ProductOptionTypeEnum;
37972
+ var ProductOptionTypeEnum$1;
37769
37973
  (function (ProductOptionTypeEnum) {
37770
37974
  ProductOptionTypeEnum["CHECKBOX"] = "CHECKBOX";
37771
37975
  ProductOptionTypeEnum["CHOICE"] = "CHOICE";
@@ -37775,7 +37979,7 @@ var ProductOptionTypeEnum;
37775
37979
  ProductOptionTypeEnum["IMAGE"] = "IMAGE";
37776
37980
  ProductOptionTypeEnum["TEXT"] = "TEXT";
37777
37981
  ProductOptionTypeEnum["TEXT_AREA"] = "TEXT_AREA";
37778
- })(ProductOptionTypeEnum || (ProductOptionTypeEnum = {}));
37982
+ })(ProductOptionTypeEnum$1 || (ProductOptionTypeEnum$1 = {}));
37779
37983
  var ProductSearchShowStockOptionEnum;
37780
37984
  (function (ProductSearchShowStockOptionEnum) {
37781
37985
  ProductSearchShowStockOptionEnum["HIDE_OUT_OF_STOCK"] = "HIDE_OUT_OF_STOCK";
@@ -41293,7 +41497,7 @@ var IkasCartAPI = /** @class */ (function () {
41293
41497
  return __generator(this, function (_b) {
41294
41498
  switch (_b.label) {
41295
41499
  case 0:
41296
- 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 "])));
41500
+ 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 "])));
41297
41501
  _b.label = 1;
41298
41502
  case 1:
41299
41503
  _b.trys.push([1, 3, , 4]);
@@ -41328,7 +41532,7 @@ var IkasCartAPI = /** @class */ (function () {
41328
41532
  return __generator(this, function (_b) {
41329
41533
  switch (_b.label) {
41330
41534
  case 0:
41331
- 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 "])));
41535
+ 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 "])));
41332
41536
  _b.label = 1;
41333
41537
  case 1:
41334
41538
  _b.trys.push([1, 3, , 4]);
@@ -43444,7 +43648,9 @@ var IkasProductOptionSetAPI = /** @class */ (function () {
43444
43648
  return [2 /*return*/];
43445
43649
  }
43446
43650
  return [2 /*return*/, {
43447
- data: data.listProductOptionSet.map(function (c) { return new IkasProductOptionSet(c); }),
43651
+ data: data.listProductOptionSet.map(function (c) {
43652
+ return new IkasProductOptionSet(c);
43653
+ }),
43448
43654
  }];
43449
43655
  case 2:
43450
43656
  err_1 = _b.sent();
@@ -70539,6 +70745,17 @@ var Note = observer(function (_a) {
70539
70745
  isSuccessStep ? (createElement("div", { className: styles$g.CheckoutNoteDisplay }, vm.checkout.note)) : (createElement(FormItem, { style: { width: "100%" }, type: FormItemType.TEXT_AREA, disableResize: true, label: "", value: vm.checkout.note || "", onChange: onCheckoutNoteChange }))))));
70540
70746
  });
70541
70747
 
70748
+ var IkasProductCartLineOption = /** @class */ (function () {
70749
+ function IkasProductCartLineOption(data) {
70750
+ if (data === void 0) { data = {}; }
70751
+ this.productOptionId = data.productOptionId || "";
70752
+ this.productOptionsSetId = data.productOptionsSetId || "";
70753
+ this.values = data.values || [];
70754
+ makeAutoObservable(this);
70755
+ }
70756
+ return IkasProductCartLineOption;
70757
+ }());
70758
+
70542
70759
  var CART_LS_KEY = "cartId";
70543
70760
  var CHECKOUT_LS_KEY = "checkoutId";
70544
70761
  var IkasCartStore = /** @class */ (function () {
@@ -70564,9 +70781,7 @@ var IkasCartStore = /** @class */ (function () {
70564
70781
  cartId = ((_b = this.cart) === null || _b === void 0 ? void 0 : _b.id) || localStorage.getItem(CART_LS_KEY);
70565
70782
  if (!cartId && !customerId)
70566
70783
  return [2 /*return*/];
70567
- return [4 /*yield*/, IkasCartAPI.getCart(cartId || undefined
70568
- // customerId || undefined // TODO reopen this when we have a way of telling backend that we cleared a cart
70569
- )];
70784
+ return [4 /*yield*/, IkasCartAPI.getCart(cartId || undefined)];
70570
70785
  case 2:
70571
70786
  cart = _c.sent();
70572
70787
  if (!cart) return [3 /*break*/, 4];
@@ -70630,28 +70845,89 @@ var IkasCartStore = /** @class */ (function () {
70630
70845
  }
70631
70846
  });
70632
70847
  }); };
70848
+ this.findExistingItem = function (variant, product) {
70849
+ var _a, _b, _c, _d, _e;
70850
+ if (!product.productOptionSetId) {
70851
+ return (_a = _this.cart) === null || _a === void 0 ? void 0 : _a.items.find(function (item) { return item.variant.id === variant.id; });
70852
+ }
70853
+ var existingItems = ((_b = _this.cart) === null || _b === void 0 ? void 0 : _b.items.filter(function (item) { return item.variant.id === variant.id; })) || [];
70854
+ for (var _i = 0, existingItems_1 = existingItems; _i < existingItems_1.length; _i++) {
70855
+ var item = existingItems_1[_i];
70856
+ if (item.options) {
70857
+ var hasSameOptionValues = true;
70858
+ var _loop_1 = function (option) {
70859
+ var existingOptionValues = option.values.map(function (v) { return v.value; });
70860
+ 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
+ hasSameOptionValues =
70862
+ hasSameOptionValues &&
70863
+ existingOptionValues.length === (productOptionValues === null || productOptionValues === void 0 ? void 0 : productOptionValues.values.length) &&
70864
+ existingOptionValues.every(function (val) { return productOptionValues === null || productOptionValues === void 0 ? void 0 : productOptionValues.includes(val); });
70865
+ if (!hasSameOptionValues)
70866
+ return "break";
70867
+ };
70868
+ for (var _f = 0, _g = item.options; _f < _g.length; _f++) {
70869
+ var option = _g[_f];
70870
+ var state_1 = _loop_1(option);
70871
+ if (state_1 === "break")
70872
+ break;
70873
+ }
70874
+ if (hasSameOptionValues)
70875
+ return item;
70876
+ }
70877
+ }
70878
+ };
70879
+ this.createCartLineOptions = function (item) {
70880
+ if (item && item.options) {
70881
+ var options = [];
70882
+ for (var _i = 0, _a = item.options; _i < _a.length; _i++) {
70883
+ var option = _a[_i];
70884
+ var data = new IkasProductCartLineOption({});
70885
+ data.productOptionId = option.productOptionId;
70886
+ data.productOptionsSetId = option.productOptionsSetId;
70887
+ data.values = option.values.map(function (val) { return val.value; });
70888
+ options.push(data);
70889
+ }
70890
+ return options;
70891
+ }
70892
+ else {
70893
+ return null;
70894
+ }
70895
+ };
70633
70896
  this.addItem = function (variant, product, initialQuantity) {
70634
70897
  if (initialQuantity === void 0) { initialQuantity = 1; }
70635
70898
  return __awaiter(_this, void 0, void 0, function () {
70636
- var existingItem, cartId, input, cart, eventId, item, err_2;
70637
- var _a, _b, _c;
70638
- return __generator(this, function (_d) {
70639
- switch (_d.label) {
70899
+ var existingItem, optionValues_1, cartId, input, cart, eventId, item, err_2;
70900
+ var _a, _b, _c, _d, _e;
70901
+ return __generator(this, function (_f) {
70902
+ switch (_f.label) {
70640
70903
  case 0:
70641
- _d.trys.push([0, 5, , 6]);
70904
+ _f.trys.push([0, 5, , 6]);
70905
+ if (!product.canAddToCart)
70906
+ return [2 /*return*/, false];
70642
70907
  return [4 /*yield*/, this.beforeCartOperationCheck()];
70643
70908
  case 1:
70644
- _d.sent();
70909
+ _f.sent();
70645
70910
  if (this.cart) {
70646
- existingItem = this.cart.items.find(function (item) { return item.variant.id === variant.id; });
70911
+ existingItem = this.findExistingItem(variant, product);
70647
70912
  if (existingItem) {
70913
+ (_a = product.productOptionSet) === null || _a === void 0 ? void 0 : _a.initOptionValues();
70648
70914
  return [2 /*return*/, this.changeItemQuantity(existingItem, existingItem.quantity + 1)];
70649
70915
  }
70650
70916
  }
70651
- cartId = ((_a = this.cart) === null || _a === void 0 ? void 0 : _a.id) || localStorage.getItem(CART_LS_KEY);
70917
+ optionValues_1 = [];
70918
+ (_b = product.productOptionSet) === null || _b === void 0 ? void 0 : _b.options.forEach(function (o) {
70919
+ if (o.values.length) {
70920
+ optionValues_1.push(new IkasProductCartLineOption({
70921
+ productOptionId: o.id,
70922
+ productOptionsSetId: o.productOptionSetId,
70923
+ values: o.values,
70924
+ }));
70925
+ }
70926
+ });
70927
+ cartId = ((_c = this.cart) === null || _c === void 0 ? void 0 : _c.id) || localStorage.getItem(CART_LS_KEY);
70652
70928
  input = {
70653
70929
  cartId: cartId,
70654
- 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) ||
70930
+ 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) ||
70655
70931
  null,
70656
70932
  item: {
70657
70933
  id: null,
@@ -70661,6 +70937,7 @@ var IkasCartStore = /** @class */ (function () {
70661
70937
  name: product.name,
70662
70938
  },
70663
70939
  },
70940
+ options: optionValues_1.length ? optionValues_1 : null,
70664
70941
  priceListId: IkasStorefrontConfig.priceListId || null,
70665
70942
  salesChannelId: IkasStorefrontConfig.salesChannelId,
70666
70943
  storefrontId: IkasStorefrontConfig.storefrontId,
@@ -70669,12 +70946,12 @@ var IkasCartStore = /** @class */ (function () {
70669
70946
  };
70670
70947
  return [4 /*yield*/, IkasCartAPI.saveItemToCart(input)];
70671
70948
  case 2:
70672
- cart = _d.sent();
70949
+ cart = _f.sent();
70673
70950
  if (!cart) return [3 /*break*/, 4];
70674
70951
  return [4 /*yield*/, this.setCart(cart)];
70675
70952
  case 3:
70676
- _d.sent();
70677
- _d.label = 4;
70953
+ _f.sent();
70954
+ _f.label = 4;
70678
70955
  case 4:
70679
70956
  if (this.cart) {
70680
70957
  eventId = this.cart.id + "-" + this.cart.updatedAt;
@@ -70683,11 +70960,11 @@ var IkasCartStore = /** @class */ (function () {
70683
70960
  Analytics.addToCart(item, initialQuantity, eventId, this.cart);
70684
70961
  }
70685
70962
  }
70686
- return [3 /*break*/, 6];
70963
+ return [2 /*return*/, true];
70687
70964
  case 5:
70688
- err_2 = _d.sent();
70965
+ err_2 = _f.sent();
70689
70966
  console.log(err_2);
70690
- return [3 /*break*/, 6];
70967
+ return [2 /*return*/, false];
70691
70968
  case 6: return [2 /*return*/];
70692
70969
  }
70693
70970
  });
@@ -70715,6 +70992,7 @@ var IkasCartStore = /** @class */ (function () {
70715
70992
  name: item.variant.name,
70716
70993
  },
70717
70994
  },
70995
+ options: this.createCartLineOptions(item),
70718
70996
  priceListId: IkasStorefrontConfig.priceListId || null,
70719
70997
  salesChannelId: IkasStorefrontConfig.salesChannelId,
70720
70998
  storefrontId: IkasStorefrontConfig.storefrontId,
@@ -70741,11 +71019,11 @@ var IkasCartStore = /** @class */ (function () {
70741
71019
  Analytics.addToCart(item, quantity - oldQuantity, eventId, this.cart);
70742
71020
  }
70743
71021
  }
70744
- return [3 /*break*/, 6];
71022
+ return [2 /*return*/, true];
70745
71023
  case 5:
70746
71024
  err_3 = _d.sent();
70747
71025
  console.log(err_3);
70748
- return [3 /*break*/, 6];
71026
+ return [2 /*return*/, false];
70749
71027
  case 6: return [2 /*return*/];
70750
71028
  }
70751
71029
  });
@@ -70824,7 +71102,7 @@ var IkasCartStore = /** @class */ (function () {
70824
71102
  return IkasCartStore;
70825
71103
  }());
70826
71104
 
70827
- var styles$h = {"StepSuccess":"style-module_StepSuccess__36Zg4","SuccessTitleContainer":"style-module_SuccessTitleContainer__3fT9P","SuccessTitle":"style-module_SuccessTitle__2cVxj","SuccessSubTitle":"style-module_SuccessSubTitle__2UvWI","InfoGrid":"style-module_InfoGrid__2VYXk","InfoTitle":"style-module_InfoTitle__2Whku","InfoText":"style-module_InfoText__1LHFw","InfoTextBold":"style-module_InfoTextBold__21977","WithBorder":"style-module_WithBorder__1aBHw","CardLogoContainer":"style-module_CardLogoContainer__3tymO","Actions":"style-module_Actions__3ZXaJ","HelpText":"style-module_HelpText__39LA1","Cta":"style-module_Cta__3sxNK","OrderStatus":"style-module_OrderStatus__CPd7s","Yellow":"style-module_Yellow__1mZZm","Green":"style-module_Green__2qwNg","Red":"style-module_Red__TKRy8"};
71105
+ var styles$h = {"StepSuccess":"style-module_StepSuccess__36Zg4","SuccessTitleContainer":"style-module_SuccessTitleContainer__3fT9P","SuccessTitle":"style-module_SuccessTitle__2cVxj","SuccessSubTitle":"style-module_SuccessSubTitle__2UvWI","InfoGrid":"style-module_InfoGrid__2VYXk","InfoTitle":"style-module_InfoTitle__2Whku","InfoText":"style-module_InfoText__1LHFw","InfoTextBold":"style-module_InfoTextBold__21977","WithBorder":"style-module_WithBorder__1aBHw","CardLogoContainer":"style-module_CardLogoContainer__3tymO","PaymentLogoContainer":"style-module_PaymentLogoContainer__AN08p","Actions":"style-module_Actions__3ZXaJ","HelpText":"style-module_HelpText__39LA1","Cta":"style-module_Cta__3sxNK","OrderStatus":"style-module_OrderStatus__CPd7s","Yellow":"style-module_Yellow__1mZZm","Green":"style-module_Green__2qwNg","Red":"style-module_Red__TKRy8"};
70828
71106
 
70829
71107
  var SVGSuccessCircle = function (_a) {
70830
71108
  var className = _a.className;
@@ -70911,12 +71189,18 @@ var StepSuccess = observer(function (_a) {
70911
71189
  };
70912
71190
  var paymentMethodDetail = (_d = vm.successTransaction) === null || _d === void 0 ? void 0 : _d.paymentMethodDetail;
70913
71191
  var paymentInfoGrid = useMemo(function () {
70914
- var _a, _b, _c;
71192
+ var _a, _b, _c, _d;
70915
71193
  return (createElement("div", { className: [styles$h.InfoGrid].join(" ") },
70916
71194
  createElement("div", null,
70917
71195
  createElement("div", { className: styles$h.InfoTitle }, t("checkout-page:paymentMethod")),
70918
71196
  paymentGateway && (createElement(Fragment$1, null,
70919
- createElement("div", { className: styles$h.InfoText }, paymentGateway.name),
71197
+ !!paymentGateway.logoUrl && (createElement("div", { className: styles$h.PaymentLogoContainer },
71198
+ createElement("img", { src: paymentGateway.logoUrl }))),
71199
+ !paymentGateway.logoUrl && (createElement("div", { className: styles$h.InfoText }, paymentGateway.paymentMethodType ===
71200
+ IkasPaymentMethodType.CREDIT_CARD &&
71201
+ paymentGateway.type === IkasPaymentGatewayType.INTERNAL
71202
+ ? t("checkout-page:creditCard")
71203
+ : paymentGateway.name)),
70920
71204
  !!paymentGateway.description &&
70921
71205
  paymentGateway.type !== IkasPaymentGatewayType.EXTERNAL && (createElement("div", { className: styles$h.InfoText },
70922
71206
  createElement("div", { dangerouslySetInnerHTML: {
@@ -70926,14 +71210,15 @@ var StepSuccess = observer(function (_a) {
70926
71210
  createElement("div", { className: styles$h.InfoText },
70927
71211
  createElement("div", { className: styles$h.CardLogoContainer }, getCardLogo()),
70928
71212
  createElement("span", null, "**** " + ((paymentMethodDetail === null || paymentMethodDetail === void 0 ? void 0 : paymentMethodDetail.lastFourDigits) || ""))),
70929
- paymentMethodDetail &&
71213
+ ((_b = paymentMethodDetail === null || paymentMethodDetail === void 0 ? void 0 : paymentMethodDetail.installment) === null || _b === void 0 ? void 0 : _b.installmentCount) &&
70930
71214
  paymentMethodDetail.installment.installmentCount > 1 && (createElement(Fragment$1, null,
70931
71215
  createElement("div", { className: styles$h.InfoText }, paymentMethodDetail.installment.installmentCount + " " + t("checkout-page:installments")),
70932
- createElement("div", { className: styles$h.InfoText }, paymentMethodDetail.installment.installmentCount + " x " + formatMoney(paymentMethodDetail.installment.installmentPrice, vm.checkout.cart.currencyCode))))))),
71216
+ paymentMethodDetail.installment.installmentPrice !==
71217
+ null && (createElement("div", { className: styles$h.InfoText }, paymentMethodDetail.installment.installmentCount + " x " + formatMoney(paymentMethodDetail.installment.installmentPrice, vm.checkout.cart.currencyCode)))))))),
70933
71218
  createElement("div", null,
70934
71219
  createElement("div", { className: styles$h.InfoTitle }, t("checkout-page:billingAddress")),
70935
- !!((_b = vm.checkout.billingAddress) === null || _b === void 0 ? void 0 : _b.company) && (createElement("div", { className: [styles$h.InfoText, styles$h.InfoTextBold].join(" ") }, vm.checkout.billingAddress.company)),
70936
- createElement("div", { className: styles$h.InfoText }, (_c = vm.checkout.billingAddress) === null || _c === void 0 ? void 0 : _c.addressText))));
71220
+ !!((_c = vm.checkout.billingAddress) === null || _c === void 0 ? void 0 : _c.company) && (createElement("div", { className: [styles$h.InfoText, styles$h.InfoTextBold].join(" ") }, vm.checkout.billingAddress.company)),
71221
+ createElement("div", { className: styles$h.InfoText }, (_d = vm.checkout.billingAddress) === null || _d === void 0 ? void 0 : _d.addressText))));
70937
71222
  }, []);
70938
71223
  var contactInfoGrid = useMemo(function () {
70939
71224
  var _a, _b, _c, _d, _e;