@ikas/storefront 0.0.154 → 0.0.155
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
|
@@ -17881,7 +17881,13 @@ var IkasOrder = /** @class */ (function () {
|
|
|
17881
17881
|
}
|
|
17882
17882
|
Object.defineProperty(IkasOrder.prototype, "refundableItems", {
|
|
17883
17883
|
get: function () {
|
|
17884
|
-
return this.orderLineItems.filter(function (item) {
|
|
17884
|
+
return this.orderLineItems.filter(function (item) {
|
|
17885
|
+
return [
|
|
17886
|
+
OrderLineItemStatusEnum$1.FULFILLED,
|
|
17887
|
+
OrderLineItemStatusEnum$1.UNFULFILLED,
|
|
17888
|
+
OrderLineItemStatusEnum$1.DELIVERED,
|
|
17889
|
+
].includes(item.status);
|
|
17890
|
+
});
|
|
17885
17891
|
},
|
|
17886
17892
|
enumerable: false,
|
|
17887
17893
|
configurable: true
|
|
@@ -18125,6 +18131,7 @@ var IkasProductVariant = /** @class */ (function () {
|
|
|
18125
18131
|
? new IkasProductPrice(data.price)
|
|
18126
18132
|
: new IkasProductPrice();
|
|
18127
18133
|
this.stock = data.stock || 0;
|
|
18134
|
+
this.isActive = data.isActive !== undefined ? data.isActive : true;
|
|
18128
18135
|
makeAutoObservable(this);
|
|
18129
18136
|
}
|
|
18130
18137
|
Object.defineProperty(IkasProductVariant.prototype, "mainImage", {
|
|
@@ -19953,6 +19960,47 @@ var IkasProductDetail = /** @class */ (function () {
|
|
|
19953
19960
|
enumerable: false,
|
|
19954
19961
|
configurable: true
|
|
19955
19962
|
});
|
|
19963
|
+
Object.defineProperty(IkasProductDetail.prototype, "displayedVariantTypes", {
|
|
19964
|
+
get: function () {
|
|
19965
|
+
var _this = this;
|
|
19966
|
+
var displayedVariantTypes = this.product.variantTypes.map(function (productVariantType) {
|
|
19967
|
+
var variantType = productVariantType.variantType;
|
|
19968
|
+
var displayedVariantValues = [];
|
|
19969
|
+
variantType.values.forEach(function (variantValue) {
|
|
19970
|
+
var otherSelectedVariantValues = _this.selectedVariantValues.filter(function (vv) { return vv.variantTypeId !== variantType.id; });
|
|
19971
|
+
var allVariantValues = otherSelectedVariantValues.concat(variantValue);
|
|
19972
|
+
var variant = _this.product.variants.find(function (v) {
|
|
19973
|
+
return v.variantValues.every(function (vv) {
|
|
19974
|
+
return allVariantValues.some(function (avv) { return avv.id === vv.id; });
|
|
19975
|
+
});
|
|
19976
|
+
});
|
|
19977
|
+
var isSelected = _this.selectedVariant.variantValues.some(function (vv) { return vv.id === variantValue.id; });
|
|
19978
|
+
var hasStock = variant
|
|
19979
|
+
? variant.stock > 0 && variant.isActive
|
|
19980
|
+
: true;
|
|
19981
|
+
if (variant) {
|
|
19982
|
+
displayedVariantValues.push({
|
|
19983
|
+
variant: variant,
|
|
19984
|
+
variantValue: variantValue,
|
|
19985
|
+
hasStock: hasStock,
|
|
19986
|
+
isSelected: isSelected,
|
|
19987
|
+
});
|
|
19988
|
+
}
|
|
19989
|
+
});
|
|
19990
|
+
return {
|
|
19991
|
+
variantType: variantType,
|
|
19992
|
+
displayedVariantValues: displayedVariantValues,
|
|
19993
|
+
};
|
|
19994
|
+
});
|
|
19995
|
+
// Filter inactive variantValues if there is only a single variant type
|
|
19996
|
+
if (displayedVariantTypes.length === 1) {
|
|
19997
|
+
displayedVariantTypes[0].displayedVariantValues = displayedVariantTypes[0].displayedVariantValues.filter(function (dvv) { return dvv.variant.isActive; });
|
|
19998
|
+
}
|
|
19999
|
+
return displayedVariantTypes;
|
|
20000
|
+
},
|
|
20001
|
+
enumerable: false,
|
|
20002
|
+
configurable: true
|
|
20003
|
+
});
|
|
19956
20004
|
IkasProductDetail.prototype.selectVariantValue = function (variantValue) {
|
|
19957
20005
|
var _a;
|
|
19958
20006
|
var metaData = this.product.metaData;
|
|
@@ -27923,6 +27971,7 @@ function simpleToProduct(simple) {
|
|
|
27923
27971
|
variantTypeId: pvt === null || pvt === void 0 ? void 0 : pvt.variantType.id,
|
|
27924
27972
|
});
|
|
27925
27973
|
}),
|
|
27974
|
+
isActive: v.isActive,
|
|
27926
27975
|
});
|
|
27927
27976
|
}),
|
|
27928
27977
|
});
|
package/build/index.js
CHANGED
|
@@ -17887,7 +17887,13 @@ var IkasOrder = /** @class */ (function () {
|
|
|
17887
17887
|
}
|
|
17888
17888
|
Object.defineProperty(IkasOrder.prototype, "refundableItems", {
|
|
17889
17889
|
get: function () {
|
|
17890
|
-
return this.orderLineItems.filter(function (item) {
|
|
17890
|
+
return this.orderLineItems.filter(function (item) {
|
|
17891
|
+
return [
|
|
17892
|
+
exports.OrderLineItemStatusEnum.FULFILLED,
|
|
17893
|
+
exports.OrderLineItemStatusEnum.UNFULFILLED,
|
|
17894
|
+
exports.OrderLineItemStatusEnum.DELIVERED,
|
|
17895
|
+
].includes(item.status);
|
|
17896
|
+
});
|
|
17891
17897
|
},
|
|
17892
17898
|
enumerable: false,
|
|
17893
17899
|
configurable: true
|
|
@@ -18123,6 +18129,7 @@ var IkasProductVariant = /** @class */ (function () {
|
|
|
18123
18129
|
? new IkasProductPrice(data.price)
|
|
18124
18130
|
: new IkasProductPrice();
|
|
18125
18131
|
this.stock = data.stock || 0;
|
|
18132
|
+
this.isActive = data.isActive !== undefined ? data.isActive : true;
|
|
18126
18133
|
mobx.makeAutoObservable(this);
|
|
18127
18134
|
}
|
|
18128
18135
|
Object.defineProperty(IkasProductVariant.prototype, "mainImage", {
|
|
@@ -19936,6 +19943,47 @@ var IkasProductDetail = /** @class */ (function () {
|
|
|
19936
19943
|
enumerable: false,
|
|
19937
19944
|
configurable: true
|
|
19938
19945
|
});
|
|
19946
|
+
Object.defineProperty(IkasProductDetail.prototype, "displayedVariantTypes", {
|
|
19947
|
+
get: function () {
|
|
19948
|
+
var _this = this;
|
|
19949
|
+
var displayedVariantTypes = this.product.variantTypes.map(function (productVariantType) {
|
|
19950
|
+
var variantType = productVariantType.variantType;
|
|
19951
|
+
var displayedVariantValues = [];
|
|
19952
|
+
variantType.values.forEach(function (variantValue) {
|
|
19953
|
+
var otherSelectedVariantValues = _this.selectedVariantValues.filter(function (vv) { return vv.variantTypeId !== variantType.id; });
|
|
19954
|
+
var allVariantValues = otherSelectedVariantValues.concat(variantValue);
|
|
19955
|
+
var variant = _this.product.variants.find(function (v) {
|
|
19956
|
+
return v.variantValues.every(function (vv) {
|
|
19957
|
+
return allVariantValues.some(function (avv) { return avv.id === vv.id; });
|
|
19958
|
+
});
|
|
19959
|
+
});
|
|
19960
|
+
var isSelected = _this.selectedVariant.variantValues.some(function (vv) { return vv.id === variantValue.id; });
|
|
19961
|
+
var hasStock = variant
|
|
19962
|
+
? variant.stock > 0 && variant.isActive
|
|
19963
|
+
: true;
|
|
19964
|
+
if (variant) {
|
|
19965
|
+
displayedVariantValues.push({
|
|
19966
|
+
variant: variant,
|
|
19967
|
+
variantValue: variantValue,
|
|
19968
|
+
hasStock: hasStock,
|
|
19969
|
+
isSelected: isSelected,
|
|
19970
|
+
});
|
|
19971
|
+
}
|
|
19972
|
+
});
|
|
19973
|
+
return {
|
|
19974
|
+
variantType: variantType,
|
|
19975
|
+
displayedVariantValues: displayedVariantValues,
|
|
19976
|
+
};
|
|
19977
|
+
});
|
|
19978
|
+
// Filter inactive variantValues if there is only a single variant type
|
|
19979
|
+
if (displayedVariantTypes.length === 1) {
|
|
19980
|
+
displayedVariantTypes[0].displayedVariantValues = displayedVariantTypes[0].displayedVariantValues.filter(function (dvv) { return dvv.variant.isActive; });
|
|
19981
|
+
}
|
|
19982
|
+
return displayedVariantTypes;
|
|
19983
|
+
},
|
|
19984
|
+
enumerable: false,
|
|
19985
|
+
configurable: true
|
|
19986
|
+
});
|
|
19939
19987
|
IkasProductDetail.prototype.selectVariantValue = function (variantValue) {
|
|
19940
19988
|
var _a;
|
|
19941
19989
|
var metaData = this.product.metaData;
|
|
@@ -27902,6 +27950,7 @@ function simpleToProduct(simple) {
|
|
|
27902
27950
|
variantTypeId: pvt === null || pvt === void 0 ? void 0 : pvt.variantType.id,
|
|
27903
27951
|
});
|
|
27904
27952
|
}),
|
|
27953
|
+
isActive: v.isActive,
|
|
27905
27954
|
});
|
|
27906
27955
|
}),
|
|
27907
27956
|
});
|
|
@@ -3,7 +3,7 @@ export { IkasBrandList, IkasBrandListType, IkasBrandListSortType, } from "./bran
|
|
|
3
3
|
export { IkasCategoryList, IkasCategoryListType, IkasCategoryListSortType, } from "./category-list/index";
|
|
4
4
|
export type { IkasBrandListParams } from "./brand-list/index";
|
|
5
5
|
export { IkasNavigationLink } from "./navigation-link/index";
|
|
6
|
-
export { IkasProductDetail } from "./product-detail/index";
|
|
6
|
+
export { IkasProductDetail, IkasDisplayedVariantType, IkasDisplayedVariantValue, } from "./product-detail/index";
|
|
7
7
|
export { IkasProductList, IkasProductListType, IkasProductListSortType, } from "./product-list/index";
|
|
8
8
|
export { Validator, ValidationStatus } from "./validator/index";
|
|
9
9
|
export * from "./validator/rules/index";
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import { IkasProduct, IkasVariantValue } from "../../index";
|
|
2
2
|
import { NextRouter } from "next/router";
|
|
3
|
+
import { IkasProductVariant, IkasVariantType } from "../../data/index";
|
|
3
4
|
export declare class IkasProductDetail {
|
|
4
5
|
product: IkasProduct;
|
|
5
6
|
selectedVariantValues: IkasVariantValue[];
|
|
6
7
|
private router?;
|
|
7
8
|
constructor(product: IkasProduct, selectedVariantValues: IkasVariantValue[], router?: NextRouter);
|
|
8
9
|
get mainVariantValue(): IkasVariantValue | undefined;
|
|
9
|
-
get selectedVariant():
|
|
10
|
+
get selectedVariant(): IkasProductVariant;
|
|
10
11
|
get href(): string;
|
|
12
|
+
get displayedVariantTypes(): IkasDisplayedVariantType[];
|
|
11
13
|
selectVariantValue(variantValue: IkasVariantValue): void;
|
|
12
14
|
}
|
|
15
|
+
export declare type IkasDisplayedVariantValue = {
|
|
16
|
+
variant: IkasProductVariant;
|
|
17
|
+
variantValue: IkasVariantValue;
|
|
18
|
+
hasStock: boolean;
|
|
19
|
+
isSelected: boolean;
|
|
20
|
+
};
|
|
21
|
+
export declare type IkasDisplayedVariantType = {
|
|
22
|
+
variantType: IkasVariantType;
|
|
23
|
+
displayedVariantValues: IkasDisplayedVariantValue[];
|
|
24
|
+
};
|