@ikas/storefront 0.0.153 → 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;
|
|
@@ -19966,7 +20014,10 @@ var IkasProductDetail = /** @class */ (function () {
|
|
|
19966
20014
|
.map(function (vv) { return vv.slug; })
|
|
19967
20015
|
.join("-");
|
|
19968
20016
|
var isShallow = process.env.NODE_ENV !== "production";
|
|
19969
|
-
(_a = this.router) === null || _a === void 0 ? void 0 : _a.replace(newUrl, undefined, {
|
|
20017
|
+
(_a = this.router) === null || _a === void 0 ? void 0 : _a.replace(newUrl, undefined, {
|
|
20018
|
+
shallow: isShallow,
|
|
20019
|
+
scroll: false,
|
|
20020
|
+
});
|
|
19970
20021
|
};
|
|
19971
20022
|
return IkasProductDetail;
|
|
19972
20023
|
}());
|
|
@@ -21362,12 +21413,14 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21362
21413
|
makeAutoObservable(this);
|
|
21363
21414
|
if (this.isBrowser()) {
|
|
21364
21415
|
this.checkRestoreInfiniteScroll();
|
|
21365
|
-
|
|
21366
|
-
|
|
21367
|
-
|
|
21368
|
-
|
|
21369
|
-
|
|
21370
|
-
this.
|
|
21416
|
+
if (location.search &&
|
|
21417
|
+
(this.isFilterable || this._type === IkasProductListType.SEARCH)) {
|
|
21418
|
+
var queryParams = this.getQueryParams();
|
|
21419
|
+
this.getInitial(queryParams);
|
|
21420
|
+
}
|
|
21421
|
+
else if (this._page > 1) {
|
|
21422
|
+
this.getInitial();
|
|
21423
|
+
}
|
|
21371
21424
|
}
|
|
21372
21425
|
}
|
|
21373
21426
|
Object.defineProperty(IkasProductList.prototype, "sort", {
|
|
@@ -27918,6 +27971,7 @@ function simpleToProduct(simple) {
|
|
|
27918
27971
|
variantTypeId: pvt === null || pvt === void 0 ? void 0 : pvt.variantType.id,
|
|
27919
27972
|
});
|
|
27920
27973
|
}),
|
|
27974
|
+
isActive: v.isActive,
|
|
27921
27975
|
});
|
|
27922
27976
|
}),
|
|
27923
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;
|
|
@@ -19949,7 +19997,10 @@ var IkasProductDetail = /** @class */ (function () {
|
|
|
19949
19997
|
.map(function (vv) { return vv.slug; })
|
|
19950
19998
|
.join("-");
|
|
19951
19999
|
var isShallow = process.env.NODE_ENV !== "production";
|
|
19952
|
-
(_a = this.router) === null || _a === void 0 ? void 0 : _a.replace(newUrl, undefined, {
|
|
20000
|
+
(_a = this.router) === null || _a === void 0 ? void 0 : _a.replace(newUrl, undefined, {
|
|
20001
|
+
shallow: isShallow,
|
|
20002
|
+
scroll: false,
|
|
20003
|
+
});
|
|
19953
20004
|
};
|
|
19954
20005
|
return IkasProductDetail;
|
|
19955
20006
|
}());
|
|
@@ -21345,12 +21396,14 @@ var IkasProductList = /** @class */ (function () {
|
|
|
21345
21396
|
mobx.makeAutoObservable(this);
|
|
21346
21397
|
if (this.isBrowser()) {
|
|
21347
21398
|
this.checkRestoreInfiniteScroll();
|
|
21348
|
-
|
|
21349
|
-
|
|
21350
|
-
|
|
21351
|
-
|
|
21352
|
-
|
|
21353
|
-
this.
|
|
21399
|
+
if (location.search &&
|
|
21400
|
+
(this.isFilterable || this._type === exports.IkasProductListType.SEARCH)) {
|
|
21401
|
+
var queryParams = this.getQueryParams();
|
|
21402
|
+
this.getInitial(queryParams);
|
|
21403
|
+
}
|
|
21404
|
+
else if (this._page > 1) {
|
|
21405
|
+
this.getInitial();
|
|
21406
|
+
}
|
|
21354
21407
|
}
|
|
21355
21408
|
}
|
|
21356
21409
|
Object.defineProperty(IkasProductList.prototype, "sort", {
|
|
@@ -27897,6 +27950,7 @@ function simpleToProduct(simple) {
|
|
|
27897
27950
|
variantTypeId: pvt === null || pvt === void 0 ? void 0 : pvt.variantType.id,
|
|
27898
27951
|
});
|
|
27899
27952
|
}),
|
|
27953
|
+
isActive: v.isActive,
|
|
27900
27954
|
});
|
|
27901
27955
|
}),
|
|
27902
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
|
+
};
|