@ikas/storefront 0.0.52 → 0.0.53

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.
@@ -80,9 +80,14 @@ export declare enum OrderLineItemStatusEnum {
80
80
  * Order Package Fulfill Status Enum
81
81
  */
82
82
  export declare enum OrderPackageFulfillStatusEnum {
83
+ CANCELLED = "CANCELLED",
84
+ CANCEL_REJECTED = "CANCEL_REJECTED",
85
+ CANCEL_REQUESTED = "CANCEL_REQUESTED",
83
86
  DELIVERED = "DELIVERED",
84
87
  FULFILLED = "FULFILLED",
85
- SHIPPED = "SHIPPED"
88
+ REFUNDED = "REFUNDED",
89
+ REFUND_REJECTED = "REFUND_REJECTED",
90
+ REFUND_REQUESTED = "REFUND_REQUESTED"
86
91
  }
87
92
  /**
88
93
  * Order Package Status Enum
@@ -140,8 +145,8 @@ export declare enum ProductFilterDisplayTypeEnum {
140
145
  BOX = "BOX",
141
146
  DATE_RANGE = "DATE_RANGE",
142
147
  LIST = "LIST",
143
- NUMBER_LIST = "NUMBER_LIST",
144
148
  NUMBER_RANGE = "NUMBER_RANGE",
149
+ NUMBER_RANGE_LIST = "NUMBER_RANGE_LIST",
145
150
  SWATCH = "SWATCH"
146
151
  }
147
152
  /**
package/build/index.es.js CHANGED
@@ -12438,7 +12438,7 @@ var IkasCategory = /** @class */ (function () {
12438
12438
  ? new IkasHTMLMetaData(data.metaData)
12439
12439
  : undefined;
12440
12440
  this.image = data.image ? new IkasImage(data.image.id) : null;
12441
- this.path = data.path || [];
12441
+ this.path = data.path ? data.path.map(function (p) { return new IkasCategoryPath(p); }) : [];
12442
12442
  makeAutoObservable(this);
12443
12443
  }
12444
12444
  Object.defineProperty(IkasCategory.prototype, "href", {
@@ -12452,6 +12452,24 @@ var IkasCategory = /** @class */ (function () {
12452
12452
  configurable: true
12453
12453
  });
12454
12454
  return IkasCategory;
12455
+ }());
12456
+ var IkasCategoryPath = /** @class */ (function () {
12457
+ function IkasCategoryPath(data) {
12458
+ this.id = data.id || "";
12459
+ this.name = data.name || "";
12460
+ this.slug = data.slug || "";
12461
+ makeAutoObservable(this);
12462
+ }
12463
+ Object.defineProperty(IkasCategoryPath.prototype, "href", {
12464
+ get: function () {
12465
+ if (!this.slug)
12466
+ return "";
12467
+ return "/" + this.slug;
12468
+ },
12469
+ enumerable: false,
12470
+ configurable: true
12471
+ });
12472
+ return IkasCategoryPath;
12455
12473
  }());
12456
12474
 
12457
12475
  var IkasOrderAddress = /** @class */ (function () {
@@ -13396,6 +13414,14 @@ var IkasProductFilter = /** @class */ (function () {
13396
13414
  enumerable: false,
13397
13415
  configurable: true
13398
13416
  });
13417
+ Object.defineProperty(IkasProductFilter.prototype, "displayedValues", {
13418
+ get: function () {
13419
+ var _a;
13420
+ return (_a = this.values) === null || _a === void 0 ? void 0 : _a.filter(function (v) { return (!v.resultCount ? v.isSelected : true); });
13421
+ },
13422
+ enumerable: false,
13423
+ configurable: true
13424
+ });
13399
13425
  IkasProductFilter.prototype.clear = function () {
13400
13426
  var _a, _b;
13401
13427
  this.numberRange = null;
@@ -13420,6 +13446,7 @@ var IkasApplicableProductFilterValue = /** @class */ (function () {
13420
13446
  this.colorCode = null;
13421
13447
  this.thumbnailImageId = null;
13422
13448
  this.thumbnailImage = null;
13449
+ this.resultCount = null;
13423
13450
  // Extra
13424
13451
  this._isSelected = false;
13425
13452
  this.id = data.id || "";
@@ -13430,6 +13457,7 @@ var IkasApplicableProductFilterValue = /** @class */ (function () {
13430
13457
  if (this.thumbnailImageId)
13431
13458
  this.thumbnailImage = new IkasImage(this.thumbnailImageId);
13432
13459
  this._isSelected = data.isSelected || false;
13460
+ this.resultCount = data.resultCount || null;
13433
13461
  makeAutoObservable(this);
13434
13462
  }
13435
13463
  Object.defineProperty(IkasApplicableProductFilterValue.prototype, "isSelected", {
@@ -15098,6 +15126,7 @@ var IkasProductList = /** @class */ (function () {
15098
15126
  return new IkasProductDetail(product, product.variants[0].variantValues);
15099
15127
  });
15100
15128
  }
15129
+ this.applyFacets(response_1.facets);
15101
15130
  this.data = data;
15102
15131
  this._count = response_1.count;
15103
15132
  this._initialized = true;
@@ -15437,7 +15466,6 @@ var IkasProductList = /** @class */ (function () {
15437
15466
  return [4 /*yield*/, IkasProductSearchAPI.getProductFilterData()];
15438
15467
  case 1:
15439
15468
  _a.filters = _b.sent();
15440
- // this._filterCategoryId ? [this._filterCategoryId] : undefined
15441
15469
  if (this.filters)
15442
15470
  this.filters.sort(function (f1, f2) { return (f1.order > f2.order ? 1 : -1); });
15443
15471
  return [2 /*return*/];
@@ -15476,6 +15504,29 @@ var IkasProductList = /** @class */ (function () {
15476
15504
  console.log(err);
15477
15505
  }
15478
15506
  };
15507
+ IkasProductList.prototype.applyFacets = function (facets) {
15508
+ var _a;
15509
+ (_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (filter) {
15510
+ var _a;
15511
+ var facet = facets === null || facets === void 0 ? void 0 : facets.find(function (f) { return f.id === filter.id; });
15512
+ if (facet) {
15513
+ facet.values.forEach(function (facetValue) {
15514
+ var _a;
15515
+ try {
15516
+ var filterValue = (_a = filter.values) === null || _a === void 0 ? void 0 : _a.find(function (fv) { return fv.id === facetValue.id; });
15517
+ if (filterValue)
15518
+ filterValue.resultCount = facetValue.count;
15519
+ }
15520
+ catch (err) {
15521
+ console.log(err);
15522
+ }
15523
+ });
15524
+ }
15525
+ else {
15526
+ (_a = filter.values) === null || _a === void 0 ? void 0 : _a.forEach(function (v) { return (v.resultCount = null); });
15527
+ }
15528
+ });
15529
+ };
15479
15530
  IkasProductList.prototype.toJSON = function () {
15480
15531
  return {
15481
15532
  data: this.data,
@@ -15487,8 +15538,8 @@ var IkasProductList = /** @class */ (function () {
15487
15538
  searchKeyword: this._searchKeyword,
15488
15539
  initialized: this._initialized,
15489
15540
  minPage: this._minPage,
15490
- pageBrandId: this._filterBrandId,
15491
- pageCategoryId: this._filterCategoryId,
15541
+ filterBrandId: this._filterBrandId,
15542
+ filterCategoryId: this._filterCategoryId,
15492
15543
  filters: this.filters,
15493
15544
  recommendFor: this._recommendFor,
15494
15545
  productListPropValue: this._productListPropValue,
@@ -23116,7 +23167,7 @@ function simpleToProduct(simple) {
23116
23167
  return new IkasCategory({
23117
23168
  id: c.id,
23118
23169
  name: c.name,
23119
- path: c.path,
23170
+ path: c.path.map(function (p) { return new IkasCategoryPath(p); }),
23120
23171
  metaData: new IkasHTMLMetaData({
23121
23172
  slug: c.slug || "",
23122
23173
  }),
@@ -23173,59 +23224,21 @@ function simpleToProduct(simple) {
23173
23224
  price: new IkasProductPrice((_c = v.prices) === null || _c === void 0 ? void 0 : _c.find(function (p) { return p.priceListId === null; })),
23174
23225
  stock: v.stocks.length ? v.stocks[0].stockCount : 0,
23175
23226
  variantValues: (_d = v.variantValues) === null || _d === void 0 ? void 0 : _d.map(function (vv) {
23176
- var _a;
23177
- var variantValue = (_a = simple.productVariantTypes
23178
- .find(function (pvt) { return pvt.variantType.id === vv.variantTypeId; })) === null || _a === void 0 ? void 0 : _a.variantType.values.find(function (_vv) { return _vv.id === vv.variantValueId; });
23227
+ var pvt = simple.productVariantTypes.find(function (pvt) { return pvt.variantType.id === vv.variantTypeId; });
23228
+ var variantValue = pvt === null || pvt === void 0 ? void 0 : pvt.variantType.values.find(function (_vv) { return _vv.id === vv.variantValueId; });
23179
23229
  return new IkasVariantValue({
23180
23230
  id: vv.variantValueId,
23181
23231
  name: variantValue === null || variantValue === void 0 ? void 0 : variantValue.name,
23182
23232
  colorCode: variantValue === null || variantValue === void 0 ? void 0 : variantValue.colorCode,
23183
23233
  thumbnailImageId: variantValue === null || variantValue === void 0 ? void 0 : variantValue.thumbnailImageId,
23234
+ variantTypeId: pvt === null || pvt === void 0 ? void 0 : pvt.variantType.id,
23184
23235
  });
23185
23236
  }),
23186
23237
  });
23187
23238
  }),
23188
23239
  });
23189
23240
  }
23190
- var templateObject_1$e, templateObject_2$4;
23191
- // type SearchInput = {
23192
- // categoryIdList: string[] | null;
23193
- // filterList: SearchInputFilter[] | null;
23194
- // order: SearchInputOrder[] | null;
23195
- // page: number | null;
23196
- // perPage: number | null;
23197
- // priceListId: string | null;
23198
- // productId: string | null;
23199
- // query: string | null;
23200
- // slug: string | null;
23201
- // };
23202
- // type SearchInputFilter = {
23203
- // id: string;
23204
- // type: ProductFilterType;
23205
- // valueList: string[];
23206
- // };
23207
- // export type SearchInputOrder = {
23208
- // direction: SortByDirection;
23209
- // type: SortByType;
23210
- // };
23211
- // enum SortByDirection {
23212
- // ASC = "ASC",
23213
- // DESC = "DESC",
23214
- // }
23215
- // enum SortByType {
23216
- // CREATED_AT = "CREATED_AT",
23217
- // DISCOUNT_RATIO = "DISCOUNT_RATIO",
23218
- // PRICE = "PRICE",
23219
- // }
23220
- // export enum ProductFilterType {
23221
- // ATTRIBUTE = "ATTRIBUTE",
23222
- // BRAND = "BRAND",
23223
- // DISCOUNT_RATIO = "DISCOUNT_RATIO",
23224
- // PRICE = "PRICE",
23225
- // STOCK_STATUS = "STOCK_STATUS",
23226
- // TAG = "TAG",
23227
- // VARIANT_TYPE = "VARIANT_TYPE",
23228
- // }
23241
+ var templateObject_1$e, templateObject_2$4;
23229
23242
 
23230
23243
  var IkasProductAttributeAPI = /** @class */ (function () {
23231
23244
  function IkasProductAttributeAPI() {
package/build/index.js CHANGED
@@ -12449,7 +12449,7 @@ var IkasCategory = /** @class */ (function () {
12449
12449
  ? new IkasHTMLMetaData(data.metaData)
12450
12450
  : undefined;
12451
12451
  this.image = data.image ? new IkasImage(data.image.id) : null;
12452
- this.path = data.path || [];
12452
+ this.path = data.path ? data.path.map(function (p) { return new IkasCategoryPath(p); }) : [];
12453
12453
  mobx.makeAutoObservable(this);
12454
12454
  }
12455
12455
  Object.defineProperty(IkasCategory.prototype, "href", {
@@ -12463,6 +12463,24 @@ var IkasCategory = /** @class */ (function () {
12463
12463
  configurable: true
12464
12464
  });
12465
12465
  return IkasCategory;
12466
+ }());
12467
+ var IkasCategoryPath = /** @class */ (function () {
12468
+ function IkasCategoryPath(data) {
12469
+ this.id = data.id || "";
12470
+ this.name = data.name || "";
12471
+ this.slug = data.slug || "";
12472
+ mobx.makeAutoObservable(this);
12473
+ }
12474
+ Object.defineProperty(IkasCategoryPath.prototype, "href", {
12475
+ get: function () {
12476
+ if (!this.slug)
12477
+ return "";
12478
+ return "/" + this.slug;
12479
+ },
12480
+ enumerable: false,
12481
+ configurable: true
12482
+ });
12483
+ return IkasCategoryPath;
12466
12484
  }());
12467
12485
 
12468
12486
  var IkasOrderAddress = /** @class */ (function () {
@@ -13390,6 +13408,14 @@ var IkasProductFilter = /** @class */ (function () {
13390
13408
  enumerable: false,
13391
13409
  configurable: true
13392
13410
  });
13411
+ Object.defineProperty(IkasProductFilter.prototype, "displayedValues", {
13412
+ get: function () {
13413
+ var _a;
13414
+ return (_a = this.values) === null || _a === void 0 ? void 0 : _a.filter(function (v) { return (!v.resultCount ? v.isSelected : true); });
13415
+ },
13416
+ enumerable: false,
13417
+ configurable: true
13418
+ });
13393
13419
  IkasProductFilter.prototype.clear = function () {
13394
13420
  var _a, _b;
13395
13421
  this.numberRange = null;
@@ -13414,6 +13440,7 @@ var IkasApplicableProductFilterValue = /** @class */ (function () {
13414
13440
  this.colorCode = null;
13415
13441
  this.thumbnailImageId = null;
13416
13442
  this.thumbnailImage = null;
13443
+ this.resultCount = null;
13417
13444
  // Extra
13418
13445
  this._isSelected = false;
13419
13446
  this.id = data.id || "";
@@ -13424,6 +13451,7 @@ var IkasApplicableProductFilterValue = /** @class */ (function () {
13424
13451
  if (this.thumbnailImageId)
13425
13452
  this.thumbnailImage = new IkasImage(this.thumbnailImageId);
13426
13453
  this._isSelected = data.isSelected || false;
13454
+ this.resultCount = data.resultCount || null;
13427
13455
  mobx.makeAutoObservable(this);
13428
13456
  }
13429
13457
  Object.defineProperty(IkasApplicableProductFilterValue.prototype, "isSelected", {
@@ -15080,6 +15108,7 @@ var IkasProductList = /** @class */ (function () {
15080
15108
  return new IkasProductDetail(product, product.variants[0].variantValues);
15081
15109
  });
15082
15110
  }
15111
+ this.applyFacets(response_1.facets);
15083
15112
  this.data = data;
15084
15113
  this._count = response_1.count;
15085
15114
  this._initialized = true;
@@ -15419,7 +15448,6 @@ var IkasProductList = /** @class */ (function () {
15419
15448
  return [4 /*yield*/, IkasProductSearchAPI.getProductFilterData()];
15420
15449
  case 1:
15421
15450
  _a.filters = _b.sent();
15422
- // this._filterCategoryId ? [this._filterCategoryId] : undefined
15423
15451
  if (this.filters)
15424
15452
  this.filters.sort(function (f1, f2) { return (f1.order > f2.order ? 1 : -1); });
15425
15453
  return [2 /*return*/];
@@ -15458,6 +15486,29 @@ var IkasProductList = /** @class */ (function () {
15458
15486
  console.log(err);
15459
15487
  }
15460
15488
  };
15489
+ IkasProductList.prototype.applyFacets = function (facets) {
15490
+ var _a;
15491
+ (_a = this.filters) === null || _a === void 0 ? void 0 : _a.forEach(function (filter) {
15492
+ var _a;
15493
+ var facet = facets === null || facets === void 0 ? void 0 : facets.find(function (f) { return f.id === filter.id; });
15494
+ if (facet) {
15495
+ facet.values.forEach(function (facetValue) {
15496
+ var _a;
15497
+ try {
15498
+ var filterValue = (_a = filter.values) === null || _a === void 0 ? void 0 : _a.find(function (fv) { return fv.id === facetValue.id; });
15499
+ if (filterValue)
15500
+ filterValue.resultCount = facetValue.count;
15501
+ }
15502
+ catch (err) {
15503
+ console.log(err);
15504
+ }
15505
+ });
15506
+ }
15507
+ else {
15508
+ (_a = filter.values) === null || _a === void 0 ? void 0 : _a.forEach(function (v) { return (v.resultCount = null); });
15509
+ }
15510
+ });
15511
+ };
15461
15512
  IkasProductList.prototype.toJSON = function () {
15462
15513
  return {
15463
15514
  data: this.data,
@@ -15469,8 +15520,8 @@ var IkasProductList = /** @class */ (function () {
15469
15520
  searchKeyword: this._searchKeyword,
15470
15521
  initialized: this._initialized,
15471
15522
  minPage: this._minPage,
15472
- pageBrandId: this._filterBrandId,
15473
- pageCategoryId: this._filterCategoryId,
15523
+ filterBrandId: this._filterBrandId,
15524
+ filterCategoryId: this._filterCategoryId,
15474
15525
  filters: this.filters,
15475
15526
  recommendFor: this._recommendFor,
15476
15527
  productListPropValue: this._productListPropValue,
@@ -23095,7 +23146,7 @@ function simpleToProduct(simple) {
23095
23146
  return new IkasCategory({
23096
23147
  id: c.id,
23097
23148
  name: c.name,
23098
- path: c.path,
23149
+ path: c.path.map(function (p) { return new IkasCategoryPath(p); }),
23099
23150
  metaData: new IkasHTMLMetaData({
23100
23151
  slug: c.slug || "",
23101
23152
  }),
@@ -23152,59 +23203,21 @@ function simpleToProduct(simple) {
23152
23203
  price: new IkasProductPrice((_c = v.prices) === null || _c === void 0 ? void 0 : _c.find(function (p) { return p.priceListId === null; })),
23153
23204
  stock: v.stocks.length ? v.stocks[0].stockCount : 0,
23154
23205
  variantValues: (_d = v.variantValues) === null || _d === void 0 ? void 0 : _d.map(function (vv) {
23155
- var _a;
23156
- var variantValue = (_a = simple.productVariantTypes
23157
- .find(function (pvt) { return pvt.variantType.id === vv.variantTypeId; })) === null || _a === void 0 ? void 0 : _a.variantType.values.find(function (_vv) { return _vv.id === vv.variantValueId; });
23206
+ var pvt = simple.productVariantTypes.find(function (pvt) { return pvt.variantType.id === vv.variantTypeId; });
23207
+ var variantValue = pvt === null || pvt === void 0 ? void 0 : pvt.variantType.values.find(function (_vv) { return _vv.id === vv.variantValueId; });
23158
23208
  return new IkasVariantValue({
23159
23209
  id: vv.variantValueId,
23160
23210
  name: variantValue === null || variantValue === void 0 ? void 0 : variantValue.name,
23161
23211
  colorCode: variantValue === null || variantValue === void 0 ? void 0 : variantValue.colorCode,
23162
23212
  thumbnailImageId: variantValue === null || variantValue === void 0 ? void 0 : variantValue.thumbnailImageId,
23213
+ variantTypeId: pvt === null || pvt === void 0 ? void 0 : pvt.variantType.id,
23163
23214
  });
23164
23215
  }),
23165
23216
  });
23166
23217
  }),
23167
23218
  });
23168
23219
  }
23169
- var templateObject_1$e, templateObject_2$4;
23170
- // type SearchInput = {
23171
- // categoryIdList: string[] | null;
23172
- // filterList: SearchInputFilter[] | null;
23173
- // order: SearchInputOrder[] | null;
23174
- // page: number | null;
23175
- // perPage: number | null;
23176
- // priceListId: string | null;
23177
- // productId: string | null;
23178
- // query: string | null;
23179
- // slug: string | null;
23180
- // };
23181
- // type SearchInputFilter = {
23182
- // id: string;
23183
- // type: ProductFilterType;
23184
- // valueList: string[];
23185
- // };
23186
- // export type SearchInputOrder = {
23187
- // direction: SortByDirection;
23188
- // type: SortByType;
23189
- // };
23190
- // enum SortByDirection {
23191
- // ASC = "ASC",
23192
- // DESC = "DESC",
23193
- // }
23194
- // enum SortByType {
23195
- // CREATED_AT = "CREATED_AT",
23196
- // DISCOUNT_RATIO = "DISCOUNT_RATIO",
23197
- // PRICE = "PRICE",
23198
- // }
23199
- // export enum ProductFilterType {
23200
- // ATTRIBUTE = "ATTRIBUTE",
23201
- // BRAND = "BRAND",
23202
- // DISCOUNT_RATIO = "DISCOUNT_RATIO",
23203
- // PRICE = "PRICE",
23204
- // STOCK_STATUS = "STOCK_STATUS",
23205
- // TAG = "TAG",
23206
- // VARIANT_TYPE = "VARIANT_TYPE",
23207
- // }
23220
+ var templateObject_1$e, templateObject_2$4;
23208
23221
 
23209
23222
  var IkasProductAttributeAPI = /** @class */ (function () {
23210
23223
  function IkasProductAttributeAPI() {
@@ -1,13 +1,19 @@
1
1
  import { IkasImage } from "../image/index";
2
2
  import { IkasHTMLMetaData } from "../html-meta-data/index";
3
- import { ISimpleCategoryPath } from "../simple-product/index";
4
3
  export declare class IkasCategory {
5
4
  id: string;
6
5
  name: string;
7
6
  parentId: string | null;
8
7
  metaData?: IkasHTMLMetaData | null;
9
8
  image?: IkasImage | null;
10
- path: ISimpleCategoryPath[];
9
+ path: IkasCategoryPath[];
11
10
  constructor(data: Partial<IkasCategory>);
12
11
  get href(): string;
13
12
  }
13
+ export declare class IkasCategoryPath {
14
+ id: string;
15
+ name: string;
16
+ slug?: string | null;
17
+ constructor(data: Partial<IkasCategoryPath>);
18
+ get href(): string;
19
+ }
@@ -17,6 +17,7 @@ export declare class IkasProductFilter {
17
17
  get isCustomValueFilter(): boolean;
18
18
  get valueList(): string[];
19
19
  get keyList(): string[];
20
+ get displayedValues(): IkasApplicableProductFilterValue[] | undefined;
20
21
  clear(): void;
21
22
  toInput(): SearchInputFilterListInput;
22
23
  private rangeToId;
@@ -28,6 +29,7 @@ export declare class IkasApplicableProductFilterValue {
28
29
  colorCode?: string | null;
29
30
  thumbnailImageId?: string | null;
30
31
  thumbnailImage?: IkasImage | null;
32
+ resultCount?: number | null;
31
33
  private _isSelected?;
32
34
  constructor(data?: Partial<IkasApplicableProductFilterValue>);
33
35
  get isSelected(): boolean | undefined;
@@ -41,6 +41,7 @@ export declare class IkasProductList {
41
41
  clear(): void;
42
42
  private getFilters;
43
43
  private applyQueryParamFilters;
44
+ private applyFacets;
44
45
  applyFilters: () => Promise<void>;
45
46
  getInitial: (queryParams?: URLSearchParams | undefined) => Promise<void>;
46
47
  getPrev: () => Promise<void>;
@@ -56,8 +57,8 @@ export declare class IkasProductList {
56
57
  searchKeyword: string;
57
58
  initialized: boolean;
58
59
  minPage: number | null | undefined;
59
- pageBrandId: string | null | undefined;
60
- pageCategoryId: string | null | undefined;
60
+ filterBrandId: string | null | undefined;
61
+ filterCategoryId: string | null | undefined;
61
62
  filters: IkasProductFilter[] | null | undefined;
62
63
  recommendFor: string | null | undefined;
63
64
  productListPropValue: IkasProductListPropValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.52",
3
+ "version": "0.0.53",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",