@ikas/storefront 0.0.88 → 0.0.89

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.
@@ -8,7 +8,6 @@ export { IkasCustomerAPI } from "./customer/index";
8
8
  export { IkasDistrictAPI } from "./district/index";
9
9
  export { IkasHTMLMetaDataAPI } from "./html-meta-data/index";
10
10
  export { IkasMerchantAPI } from "./merchant/index";
11
- export { IkasProductAPI } from "./product/index";
12
11
  export { IkasProductSearchAPI } from "./product-search/index";
13
12
  export { IkasProductAttributeAPI } from "./product-attribute/index";
14
13
  export { IkasFavoriteProductAPI } from "./favorite-product/index";
package/build/index.es.js CHANGED
@@ -11298,6 +11298,8 @@ var IkasCategoryPropValueProvider = /** @class */ (function () {
11298
11298
  if (this.categoryPropValue.usePageData) {
11299
11299
  return [2 /*return*/, this.pageSpecificData];
11300
11300
  }
11301
+ if (!this.categoryPropValue.categoryId)
11302
+ return [2 /*return*/, null];
11301
11303
  _a.label = 1;
11302
11304
  case 1:
11303
11305
  _a.trys.push([1, 3, , 4]);
@@ -11312,7 +11314,7 @@ var IkasCategoryPropValueProvider = /** @class */ (function () {
11312
11314
  err_1 = _a.sent();
11313
11315
  console.log(err_1);
11314
11316
  return [3 /*break*/, 4];
11315
- case 4: return [2 /*return*/, new IkasCategory({})];
11317
+ case 4: return [2 /*return*/, null];
11316
11318
  }
11317
11319
  });
11318
11320
  });
@@ -20092,12 +20094,12 @@ var IkasCustomerStore = /** @class */ (function () {
20092
20094
  favoriteProductsResult = _b.sent();
20093
20095
  if (!favoriteProductsResult.length)
20094
20096
  return [2 /*return*/, []];
20095
- return [4 /*yield*/, IkasProductAPI.listProducts({
20096
- idList: favoriteProductsResult.map(function (fP) { return fP.productId; }),
20097
+ return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
20098
+ productIdList: favoriteProductsResult.map(function (fP) { return fP.productId; }),
20097
20099
  })];
20098
20100
  case 2:
20099
20101
  productsResult = _b.sent();
20100
- return [2 /*return*/, productsResult.products];
20102
+ return [2 /*return*/, (productsResult === null || productsResult === void 0 ? void 0 : productsResult.data) || []];
20101
20103
  case 3:
20102
20104
  _b.sent();
20103
20105
  return [2 /*return*/, []];
@@ -25221,322 +25223,6 @@ var IkasMerchantAPI = /** @class */ (function () {
25221
25223
  }());
25222
25224
  var templateObject_1$9;
25223
25225
 
25224
- /**
25225
- * Flattens `array` a single level deep.
25226
- *
25227
- * @static
25228
- * @memberOf _
25229
- * @since 0.1.0
25230
- * @category Array
25231
- * @param {Array} array The array to flatten.
25232
- * @returns {Array} Returns the new flattened array.
25233
- * @example
25234
- *
25235
- * _.flatten([1, [2, [3, [4]], 5]]);
25236
- * // => [1, 2, [3, [4]], 5]
25237
- */
25238
- function flatten(array) {
25239
- var length = array == null ? 0 : array.length;
25240
- return length ? _baseFlatten(array, 1) : [];
25241
- }
25242
-
25243
- var flatten_1 = flatten;
25244
-
25245
- var IkasVariantTypeAPI = /** @class */ (function () {
25246
- function IkasVariantTypeAPI() {
25247
- }
25248
- IkasVariantTypeAPI.listVariantTypes = function (idList) {
25249
- return __awaiter(this, void 0, void 0, function () {
25250
- var LIST_VARIANT_TYPE, _a, data, errors, err_1;
25251
- return __generator(this, function (_b) {
25252
- switch (_b.label) {
25253
- case 0:
25254
- LIST_VARIANT_TYPE = src(templateObject_1$a || (templateObject_1$a = __makeTemplateObject(["\n query listVariantType($id: StringFilterInput!) {\n listVariantType(id: $id) {\n id\n createdAt\n updatedAt\n deleted\n name\n selectionType\n values {\n id\n createdAt\n updatedAt\n deleted\n name\n thumbnailImageId\n colorCode\n }\n }\n }\n "], ["\n query listVariantType($id: StringFilterInput!) {\n listVariantType(id: $id) {\n id\n createdAt\n updatedAt\n deleted\n name\n selectionType\n values {\n id\n createdAt\n updatedAt\n deleted\n name\n thumbnailImageId\n colorCode\n }\n }\n }\n "])));
25255
- _b.label = 1;
25256
- case 1:
25257
- _b.trys.push([1, 3, , 4]);
25258
- return [4 /*yield*/, apollo
25259
- .getClient()
25260
- .query({
25261
- query: LIST_VARIANT_TYPE,
25262
- variables: {
25263
- id: {
25264
- in: idList || [],
25265
- },
25266
- },
25267
- })];
25268
- case 2:
25269
- _a = _b.sent(), data = _a.data, errors = _a.errors;
25270
- if (errors && errors.length) {
25271
- return [2 /*return*/, []];
25272
- }
25273
- return [2 /*return*/, data.listVariantType.map(function (vt) {
25274
- return new IkasVariantType({
25275
- id: vt.id,
25276
- name: vt.name,
25277
- selectionType: vt.selectionType,
25278
- values: vt.values.map(function (vv) {
25279
- return new IkasVariantValue({
25280
- id: vv.id,
25281
- name: vv.name,
25282
- colorCode: vv.colorCode,
25283
- thumbnailImageId: vv.thumbnailImageId,
25284
- variantTypeId: vt.id,
25285
- });
25286
- }),
25287
- });
25288
- })];
25289
- case 3:
25290
- err_1 = _b.sent();
25291
- console.log(err_1);
25292
- return [3 /*break*/, 4];
25293
- case 4: return [2 /*return*/, []];
25294
- }
25295
- });
25296
- });
25297
- };
25298
- return IkasVariantTypeAPI;
25299
- }());
25300
- var templateObject_1$a;
25301
-
25302
- // TODO remove this api
25303
- var IkasStockLocationAPI = /** @class */ (function () {
25304
- function IkasStockLocationAPI() {
25305
- }
25306
- IkasStockLocationAPI.listStockLocation = function () {
25307
- return __awaiter(this, void 0, void 0, function () {
25308
- var QUERY, _a, data;
25309
- return __generator(this, function (_b) {
25310
- switch (_b.label) {
25311
- case 0:
25312
- QUERY = src(templateObject_1$b || (templateObject_1$b = __makeTemplateObject(["\n query listStockLocation {\n listStockLocation {\n id\n }\n }\n "], ["\n query listStockLocation {\n listStockLocation {\n id\n }\n }\n "])));
25313
- _b.label = 1;
25314
- case 1:
25315
- _b.trys.push([1, 3, , 4]);
25316
- return [4 /*yield*/, apollo
25317
- .getClient()
25318
- .query({
25319
- query: QUERY,
25320
- })];
25321
- case 2:
25322
- _a = _b.sent(), data = _a.data, _a.errors;
25323
- if (data && data.listStockLocation.length)
25324
- return [2 /*return*/, data.listStockLocation[0]];
25325
- return [3 /*break*/, 4];
25326
- case 3:
25327
- _b.sent();
25328
- return [3 /*break*/, 4];
25329
- case 4: return [2 /*return*/];
25330
- }
25331
- });
25332
- });
25333
- };
25334
- return IkasStockLocationAPI;
25335
- }());
25336
- var templateObject_1$b;
25337
-
25338
- // TODO remove this api
25339
- var IkasProductStockLocationAPI = /** @class */ (function () {
25340
- function IkasProductStockLocationAPI() {
25341
- }
25342
- IkasProductStockLocationAPI.listProductStockLocation = function (stockLocationIdList, variantIdList) {
25343
- return __awaiter(this, void 0, void 0, function () {
25344
- var QUERY, _a, data, errors, err_1;
25345
- return __generator(this, function (_b) {
25346
- switch (_b.label) {
25347
- case 0:
25348
- QUERY = src(templateObject_1$c || (templateObject_1$c = __makeTemplateObject(["\n query listProductStockLocation(\n $stockLocationIdList: [String!]!\n $variantIdList: [String!]!\n ) {\n listProductStockLocation(\n stockLocationIdList: $stockLocationIdList\n variantIdList: $variantIdList\n ) {\n variantId\n stockLocationId\n stockCount\n }\n }\n "], ["\n query listProductStockLocation(\n $stockLocationIdList: [String!]!\n $variantIdList: [String!]!\n ) {\n listProductStockLocation(\n stockLocationIdList: $stockLocationIdList\n variantIdList: $variantIdList\n ) {\n variantId\n stockLocationId\n stockCount\n }\n }\n "])));
25349
- _b.label = 1;
25350
- case 1:
25351
- _b.trys.push([1, 3, , 4]);
25352
- return [4 /*yield*/, apollo
25353
- .getClient()
25354
- .query({
25355
- query: QUERY,
25356
- variables: {
25357
- stockLocationIdList: stockLocationIdList,
25358
- variantIdList: variantIdList,
25359
- },
25360
- })];
25361
- case 2:
25362
- _a = _b.sent(), data = _a.data, errors = _a.errors;
25363
- if (data && data.listProductStockLocation)
25364
- return [2 /*return*/, data.listProductStockLocation];
25365
- console.log(errors);
25366
- return [3 /*break*/, 4];
25367
- case 3:
25368
- err_1 = _b.sent();
25369
- console.error(JSON.stringify(err_1, null, 2));
25370
- return [3 /*break*/, 4];
25371
- case 4: return [2 /*return*/];
25372
- }
25373
- });
25374
- });
25375
- };
25376
- return IkasProductStockLocationAPI;
25377
- }());
25378
- var templateObject_1$c;
25379
-
25380
- var IkasProductAPI = /** @class */ (function () {
25381
- function IkasProductAPI() {
25382
- }
25383
- IkasProductAPI.listProducts = function (params) {
25384
- return __awaiter(this, void 0, void 0, function () {
25385
- var LIST_PRODUCTS, variables, _a, data, errors, products, count, brandIds, categoryIds, variantTypeIds, stockLocation, stocks_1, variantIdList_1, productStockLocations, brandsResponse_1, categoriesResponse_1, variantTypes_1, err_1;
25386
- return __generator(this, function (_b) {
25387
- switch (_b.label) {
25388
- case 0:
25389
- LIST_PRODUCTS = src(templateObject_1$d || (templateObject_1$d = __makeTemplateObject(["\n query listProduct(\n $id: StringFilterInput\n $pagination: PaginationInput\n $search: String\n $brandId: StringFilterInput\n $categoryIds: CategoryFilterInput\n ) {\n listProduct(\n id: $id\n pagination: $pagination\n search: $search\n brandId: $brandId\n categoryIds: $categoryIds\n ) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n type\n shortDescription\n description\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\n brandId\n categoryIds\n productVariantTypes {\n order\n variantTypeId\n variantValueIds\n }\n variants {\n id\n createdAt\n updatedAt\n deleted\n sku\n barcodeList\n isActive\n variantValueIds {\n variantTypeId\n variantValueId\n }\n attributes {\n value\n productAttributeId\n productAttributeOptionId\n }\n images {\n order\n isMain\n imageId\n }\n prices {\n sellPrice\n discountPrice\n buyPrice\n currency\n }\n }\n attributes {\n value\n productAttributeId\n productAttributeOptionId\n }\n }\n count\n }\n }\n "], ["\n query listProduct(\n $id: StringFilterInput\n $pagination: PaginationInput\n $search: String\n $brandId: StringFilterInput\n $categoryIds: CategoryFilterInput\n ) {\n listProduct(\n id: $id\n pagination: $pagination\n search: $search\n brandId: $brandId\n categoryIds: $categoryIds\n ) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n type\n shortDescription\n description\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\n brandId\n categoryIds\n productVariantTypes {\n order\n variantTypeId\n variantValueIds\n }\n variants {\n id\n createdAt\n updatedAt\n deleted\n sku\n barcodeList\n isActive\n variantValueIds {\n variantTypeId\n variantValueId\n }\n attributes {\n value\n productAttributeId\n productAttributeOptionId\n }\n images {\n order\n isMain\n imageId\n }\n prices {\n sellPrice\n discountPrice\n buyPrice\n currency\n }\n }\n attributes {\n value\n productAttributeId\n productAttributeOptionId\n }\n }\n count\n }\n }\n "])));
25390
- _b.label = 1;
25391
- case 1:
25392
- _b.trys.push([1, 9, , 10]);
25393
- variables = {
25394
- search: params === null || params === void 0 ? void 0 : params.search,
25395
- };
25396
- if ((params === null || params === void 0 ? void 0 : params.idList) && params.idList.length) {
25397
- variables.id = {
25398
- in: params.idList,
25399
- };
25400
- }
25401
- if (params === null || params === void 0 ? void 0 : params.page) {
25402
- variables.pagination = {
25403
- page: params.page,
25404
- limit: params.limit || 10,
25405
- };
25406
- }
25407
- if (params === null || params === void 0 ? void 0 : params.brandId) {
25408
- variables.brandId = {
25409
- eq: params.brandId,
25410
- };
25411
- }
25412
- if ((params === null || params === void 0 ? void 0 : params.categoryIds) && params.categoryIds.length) {
25413
- variables.categoryIds = {
25414
- in: params.categoryIds,
25415
- };
25416
- }
25417
- return [4 /*yield*/, apollo
25418
- .getClient()
25419
- .query({
25420
- query: LIST_PRODUCTS,
25421
- variables: variables,
25422
- })];
25423
- case 2:
25424
- _a = _b.sent(), data = _a.data, errors = _a.errors;
25425
- if (errors && errors.length) {
25426
- console.log(errors);
25427
- return [2 /*return*/, {
25428
- products: [],
25429
- count: 0,
25430
- }];
25431
- }
25432
- products = data.listProduct.data;
25433
- count = data.listProduct.count;
25434
- brandIds = products
25435
- .map(function (p) { return p.brandId; })
25436
- .filter(function (id) { return !!id; });
25437
- categoryIds = flatten_1(products.map(function (p) { return p.categoryIds || []; }));
25438
- variantTypeIds = flatten_1(products.map(function (p) { var _a; return ((_a = p.productVariantTypes) === null || _a === void 0 ? void 0 : _a.map(function (pvt) { return pvt.variantTypeId; })) || []; }));
25439
- return [4 /*yield*/, IkasStockLocationAPI.listStockLocation()];
25440
- case 3:
25441
- stockLocation = _b.sent();
25442
- stocks_1 = {};
25443
- products.forEach(function (p) {
25444
- p.variants.forEach(function (v) {
25445
- stocks_1[v.id] = 0;
25446
- });
25447
- });
25448
- if (!stockLocation) return [3 /*break*/, 5];
25449
- variantIdList_1 = [];
25450
- products.forEach(function (p) {
25451
- return p.variants.forEach(function (v) { return variantIdList_1.push(v.id); });
25452
- });
25453
- return [4 /*yield*/, IkasProductStockLocationAPI.listProductStockLocation([stockLocation.id], variantIdList_1)];
25454
- case 4:
25455
- productStockLocations = _b.sent();
25456
- productStockLocations === null || productStockLocations === void 0 ? void 0 : productStockLocations.forEach(function (psl) {
25457
- stocks_1[psl.variantId] = psl.stockCount;
25458
- });
25459
- _b.label = 5;
25460
- case 5: return [4 /*yield*/, IkasBrandAPI.listBrands({
25461
- idList: brandIds,
25462
- page: 1,
25463
- limit: brandIds.length,
25464
- })];
25465
- case 6:
25466
- brandsResponse_1 = _b.sent();
25467
- return [4 /*yield*/, IkasCategoryAPI.listCategories({
25468
- idList: categoryIds,
25469
- page: 1,
25470
- limit: categoryIds.length,
25471
- })];
25472
- case 7:
25473
- categoriesResponse_1 = _b.sent();
25474
- return [4 /*yield*/, IkasVariantTypeAPI.listVariantTypes(variantTypeIds)];
25475
- case 8:
25476
- variantTypes_1 = _b.sent();
25477
- return [2 /*return*/, {
25478
- products: products.map(function (p) {
25479
- var _a;
25480
- return new IkasProduct({
25481
- id: p.id,
25482
- name: p.name,
25483
- type: p.type,
25484
- description: p.description || undefined,
25485
- shortDescription: p.shortDescription || undefined,
25486
- metaData: new IkasHTMLMetaData(p.metaData),
25487
- brand: p.brandId
25488
- ? brandsResponse_1.brands.find(function (b) { return b.id === p.brandId; })
25489
- : null,
25490
- categories: p.categoryIds
25491
- ? p.categoryIds.map(function (categoryId) {
25492
- return categoriesResponse_1.categories.find(function (c) { return c.id === categoryId; });
25493
- })
25494
- : [],
25495
- variants: p.variants.map(function (v, index) {
25496
- var _a;
25497
- return new IkasProductVariant({
25498
- id: v.id,
25499
- sku: v.sku,
25500
- barcodeList: v.barcodeList || [],
25501
- variantValues: v.variantValueIds
25502
- ? v.variantValueIds.map(function (vvId) {
25503
- var variantType = variantTypes_1.find(function (vt) { return vt.id === vvId.variantTypeId; });
25504
- return variantType.values.find(function (vv) { return vv.id === vvId.variantValueId; });
25505
- })
25506
- : [],
25507
- images: (_a = v.images) === null || _a === void 0 ? void 0 : _a.map(function (i) { return new IkasImage(i.imageId); }),
25508
- attributes: v.attributes || [],
25509
- price: new IkasProductPrice(v.prices[0]),
25510
- stock: stocks_1[v.id] || 0,
25511
- });
25512
- }),
25513
- attributes: p.attributes || [],
25514
- variantTypes: (_a = p.productVariantTypes) === null || _a === void 0 ? void 0 : _a.map(function (pvt) {
25515
- return new IkasProductVariantType({
25516
- variantType: variantTypes_1.find(function (vt) { return vt.id === pvt.variantTypeId; }),
25517
- variantValueIds: pvt.variantValueIds || [],
25518
- });
25519
- }),
25520
- });
25521
- }),
25522
- count: count,
25523
- }];
25524
- case 9:
25525
- err_1 = _b.sent();
25526
- console.log(err_1);
25527
- return [3 /*break*/, 10];
25528
- case 10: return [2 /*return*/, {
25529
- products: [],
25530
- count: 0,
25531
- }];
25532
- }
25533
- });
25534
- });
25535
- };
25536
- return IkasProductAPI;
25537
- }());
25538
- var templateObject_1$d;
25539
-
25540
25226
  var IkasProductSearchAPI = /** @class */ (function () {
25541
25227
  function IkasProductSearchAPI() {
25542
25228
  }
@@ -25547,7 +25233,7 @@ var IkasProductSearchAPI = /** @class */ (function () {
25547
25233
  switch (_b.label) {
25548
25234
  case 0:
25549
25235
  _b.trys.push([0, 2, , 3]);
25550
- SEARCH_PRODUCTS = src(templateObject_1$e || (templateObject_1$e = __makeTemplateObject(["\n query searchProducts($input: SearchInput!) {\n searchProducts(input: $input) {\n count\n data\n facets {\n id\n values {\n count\n id\n }\n }\n limit\n page\n totalCount\n }\n }\n "], ["\n query searchProducts($input: SearchInput!) {\n searchProducts(input: $input) {\n count\n data\n facets {\n id\n values {\n count\n id\n }\n }\n limit\n page\n totalCount\n }\n }\n "])));
25236
+ SEARCH_PRODUCTS = src(templateObject_1$a || (templateObject_1$a = __makeTemplateObject(["\n query searchProducts($input: SearchInput!) {\n searchProducts(input: $input) {\n count\n data\n facets {\n id\n values {\n count\n id\n }\n }\n limit\n page\n totalCount\n }\n }\n "], ["\n query searchProducts($input: SearchInput!) {\n searchProducts(input: $input) {\n count\n data\n facets {\n id\n values {\n count\n id\n }\n }\n limit\n page\n totalCount\n }\n }\n "])));
25551
25237
  return [4 /*yield*/, apollo
25552
25238
  .getClient()
25553
25239
  .query({
@@ -25724,7 +25410,7 @@ function simpleToProduct(simple) {
25724
25410
  }),
25725
25411
  });
25726
25412
  }
25727
- var templateObject_1$e, templateObject_2$5;
25413
+ var templateObject_1$a, templateObject_2$5;
25728
25414
 
25729
25415
  var IkasProductAttributeAPI = /** @class */ (function () {
25730
25416
  function IkasProductAttributeAPI() {
@@ -25735,7 +25421,7 @@ var IkasProductAttributeAPI = /** @class */ (function () {
25735
25421
  return __generator(this, function (_b) {
25736
25422
  switch (_b.label) {
25737
25423
  case 0:
25738
- LIST_PRODUCT_ATTRIBUTES = src(templateObject_1$f || (templateObject_1$f = __makeTemplateObject(["\n query listProductAttribute($id: StringFilterInput!) {\n listProductAttribute(id: $id) {\n id\n createdAt\n updatedAt\n deleted\n name\n description\n type\n options {\n id\n createdAt\n updatedAt\n deleted\n name\n }\n }\n }\n "], ["\n query listProductAttribute($id: StringFilterInput!) {\n listProductAttribute(id: $id) {\n id\n createdAt\n updatedAt\n deleted\n name\n description\n type\n options {\n id\n createdAt\n updatedAt\n deleted\n name\n }\n }\n }\n "])));
25424
+ LIST_PRODUCT_ATTRIBUTES = src(templateObject_1$b || (templateObject_1$b = __makeTemplateObject(["\n query listProductAttribute($id: StringFilterInput!) {\n listProductAttribute(id: $id) {\n id\n createdAt\n updatedAt\n deleted\n name\n description\n type\n options {\n id\n createdAt\n updatedAt\n deleted\n name\n }\n }\n }\n "], ["\n query listProductAttribute($id: StringFilterInput!) {\n listProductAttribute(id: $id) {\n id\n createdAt\n updatedAt\n deleted\n name\n description\n type\n options {\n id\n createdAt\n updatedAt\n deleted\n name\n }\n }\n }\n "])));
25739
25425
  _b.label = 1;
25740
25426
  case 1:
25741
25427
  _b.trys.push([1, 3, , 4]);
@@ -25768,7 +25454,7 @@ var IkasProductAttributeAPI = /** @class */ (function () {
25768
25454
  };
25769
25455
  return IkasProductAttributeAPI;
25770
25456
  }());
25771
- var templateObject_1$f;
25457
+ var templateObject_1$b;
25772
25458
 
25773
25459
  var IkasFavoriteProductAPI = /** @class */ (function () {
25774
25460
  function IkasFavoriteProductAPI() {
@@ -25779,7 +25465,7 @@ var IkasFavoriteProductAPI = /** @class */ (function () {
25779
25465
  return __generator(this, function (_b) {
25780
25466
  switch (_b.label) {
25781
25467
  case 0:
25782
- LIST_FAVORITE_PRODUCTS = src(templateObject_1$g || (templateObject_1$g = __makeTemplateObject(["\n query listFavoriteProducts {\n listFavoriteProducts {\n id\n createdAt\n updatedAt\n deleted\n productId\n customerId\n }\n }\n "], ["\n query listFavoriteProducts {\n listFavoriteProducts {\n id\n createdAt\n updatedAt\n deleted\n productId\n customerId\n }\n }\n "])));
25468
+ LIST_FAVORITE_PRODUCTS = src(templateObject_1$c || (templateObject_1$c = __makeTemplateObject(["\n query listFavoriteProducts {\n listFavoriteProducts {\n id\n createdAt\n updatedAt\n deleted\n productId\n customerId\n }\n }\n "], ["\n query listFavoriteProducts {\n listFavoriteProducts {\n id\n createdAt\n updatedAt\n deleted\n productId\n customerId\n }\n }\n "])));
25783
25469
  _b.label = 1;
25784
25470
  case 1:
25785
25471
  _b.trys.push([1, 3, , 4]);
@@ -25864,7 +25550,7 @@ var IkasFavoriteProductAPI = /** @class */ (function () {
25864
25550
  };
25865
25551
  return IkasFavoriteProductAPI;
25866
25552
  }());
25867
- var templateObject_1$g, templateObject_2$6, templateObject_3$2;
25553
+ var templateObject_1$c, templateObject_2$6, templateObject_3$2;
25868
25554
 
25869
25555
  var IkasContactFormAPI = /** @class */ (function () {
25870
25556
  function IkasContactFormAPI() {
@@ -25875,7 +25561,7 @@ var IkasContactFormAPI = /** @class */ (function () {
25875
25561
  return __generator(this, function (_b) {
25876
25562
  switch (_b.label) {
25877
25563
  case 0:
25878
- MUTATION = src(templateObject_1$h || (templateObject_1$h = __makeTemplateObject(["\n mutation sendContactFormToMerchant(\n $email: String!\n $message: String!\n $firstName: String!\n $lastName: String!\n ) {\n sendContactFormToMerchant(\n email: $email\n message: $message\n firstName: $firstName\n lastName: $lastName\n )\n }\n "], ["\n mutation sendContactFormToMerchant(\n $email: String!\n $message: String!\n $firstName: String!\n $lastName: String!\n ) {\n sendContactFormToMerchant(\n email: $email\n message: $message\n firstName: $firstName\n lastName: $lastName\n )\n }\n "])));
25564
+ MUTATION = src(templateObject_1$d || (templateObject_1$d = __makeTemplateObject(["\n mutation sendContactFormToMerchant(\n $email: String!\n $message: String!\n $firstName: String!\n $lastName: String!\n ) {\n sendContactFormToMerchant(\n email: $email\n message: $message\n firstName: $firstName\n lastName: $lastName\n )\n }\n "], ["\n mutation sendContactFormToMerchant(\n $email: String!\n $message: String!\n $firstName: String!\n $lastName: String!\n ) {\n sendContactFormToMerchant(\n email: $email\n message: $message\n firstName: $firstName\n lastName: $lastName\n )\n }\n "])));
25879
25565
  _b.label = 1;
25880
25566
  case 1:
25881
25567
  _b.trys.push([1, 3, , 4]);
@@ -25907,7 +25593,7 @@ var IkasContactFormAPI = /** @class */ (function () {
25907
25593
  };
25908
25594
  return IkasContactFormAPI;
25909
25595
  }());
25910
- var templateObject_1$h;
25596
+ var templateObject_1$d;
25911
25597
 
25912
25598
  var IkasStateAPI = /** @class */ (function () {
25913
25599
  function IkasStateAPI() {
@@ -25918,7 +25604,7 @@ var IkasStateAPI = /** @class */ (function () {
25918
25604
  return __generator(this, function (_b) {
25919
25605
  switch (_b.label) {
25920
25606
  case 0:
25921
- QUERY = src(templateObject_1$i || (templateObject_1$i = __makeTemplateObject(["\n query listState($countryId: StringFilterInput!) {\n listState(countryId: $countryId) {\n id\n name\n stateCode\n }\n }\n "], ["\n query listState($countryId: StringFilterInput!) {\n listState(countryId: $countryId) {\n id\n name\n stateCode\n }\n }\n "])));
25607
+ QUERY = src(templateObject_1$e || (templateObject_1$e = __makeTemplateObject(["\n query listState($countryId: StringFilterInput!) {\n listState(countryId: $countryId) {\n id\n name\n stateCode\n }\n }\n "], ["\n query listState($countryId: StringFilterInput!) {\n listState(countryId: $countryId) {\n id\n name\n stateCode\n }\n }\n "])));
25922
25608
  _b.label = 1;
25923
25609
  case 1:
25924
25610
  _b.trys.push([1, 3, , 4]);
@@ -25955,7 +25641,7 @@ var IkasStateAPI = /** @class */ (function () {
25955
25641
  };
25956
25642
  return IkasStateAPI;
25957
25643
  }());
25958
- var templateObject_1$i;
25644
+ var templateObject_1$e;
25959
25645
 
25960
25646
  var IkasStorefrontDomain = /** @class */ (function () {
25961
25647
  function IkasStorefrontDomain(data) {
@@ -26048,7 +25734,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
26048
25734
  return __generator(this, function (_b) {
26049
25735
  switch (_b.label) {
26050
25736
  case 0:
26051
- QUERY = src(templateObject_1$j || (templateObject_1$j = __makeTemplateObject(["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "], ["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "])));
25737
+ QUERY = src(templateObject_1$f || (templateObject_1$f = __makeTemplateObject(["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "], ["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "])));
26052
25738
  _b.label = 1;
26053
25739
  case 1:
26054
25740
  _b.trys.push([1, 3, , 4]);
@@ -26078,7 +25764,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
26078
25764
  };
26079
25765
  return IkasStorefrontAPI;
26080
25766
  }());
26081
- var templateObject_1$j;
25767
+ var templateObject_1$f;
26082
25768
 
26083
25769
  var IkasThemeAPI = /** @class */ (function () {
26084
25770
  function IkasThemeAPI() {
@@ -26101,6 +25787,63 @@ var IkasThemeAPI = /** @class */ (function () {
26101
25787
  return IkasThemeAPI;
26102
25788
  }());
26103
25789
 
25790
+ var IkasVariantTypeAPI = /** @class */ (function () {
25791
+ function IkasVariantTypeAPI() {
25792
+ }
25793
+ IkasVariantTypeAPI.listVariantTypes = function (idList) {
25794
+ return __awaiter(this, void 0, void 0, function () {
25795
+ var LIST_VARIANT_TYPE, _a, data, errors, err_1;
25796
+ return __generator(this, function (_b) {
25797
+ switch (_b.label) {
25798
+ case 0:
25799
+ LIST_VARIANT_TYPE = src(templateObject_1$g || (templateObject_1$g = __makeTemplateObject(["\n query listVariantType($id: StringFilterInput!) {\n listVariantType(id: $id) {\n id\n createdAt\n updatedAt\n deleted\n name\n selectionType\n values {\n id\n createdAt\n updatedAt\n deleted\n name\n thumbnailImageId\n colorCode\n }\n }\n }\n "], ["\n query listVariantType($id: StringFilterInput!) {\n listVariantType(id: $id) {\n id\n createdAt\n updatedAt\n deleted\n name\n selectionType\n values {\n id\n createdAt\n updatedAt\n deleted\n name\n thumbnailImageId\n colorCode\n }\n }\n }\n "])));
25800
+ _b.label = 1;
25801
+ case 1:
25802
+ _b.trys.push([1, 3, , 4]);
25803
+ return [4 /*yield*/, apollo
25804
+ .getClient()
25805
+ .query({
25806
+ query: LIST_VARIANT_TYPE,
25807
+ variables: {
25808
+ id: {
25809
+ in: idList || [],
25810
+ },
25811
+ },
25812
+ })];
25813
+ case 2:
25814
+ _a = _b.sent(), data = _a.data, errors = _a.errors;
25815
+ if (errors && errors.length) {
25816
+ return [2 /*return*/, []];
25817
+ }
25818
+ return [2 /*return*/, data.listVariantType.map(function (vt) {
25819
+ return new IkasVariantType({
25820
+ id: vt.id,
25821
+ name: vt.name,
25822
+ selectionType: vt.selectionType,
25823
+ values: vt.values.map(function (vv) {
25824
+ return new IkasVariantValue({
25825
+ id: vv.id,
25826
+ name: vv.name,
25827
+ colorCode: vv.colorCode,
25828
+ thumbnailImageId: vv.thumbnailImageId,
25829
+ variantTypeId: vt.id,
25830
+ });
25831
+ }),
25832
+ });
25833
+ })];
25834
+ case 3:
25835
+ err_1 = _b.sent();
25836
+ console.log(err_1);
25837
+ return [3 /*break*/, 4];
25838
+ case 4: return [2 /*return*/, []];
25839
+ }
25840
+ });
25841
+ });
25842
+ };
25843
+ return IkasVariantTypeAPI;
25844
+ }());
25845
+ var templateObject_1$g;
25846
+
26104
25847
  function styleInject(css, ref) {
26105
25848
  if ( ref === void 0 ) ref = {};
26106
25849
  var insertAt = ref.insertAt;
@@ -28392,8 +28135,8 @@ var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void
28392
28135
  ];
28393
28136
  brandCategoryMetaData = metaData.filter(function (m) { return m.targetType && targetTypes.includes(m.targetType); });
28394
28137
  productMetaData = metaData.filter(function (m) { return m.targetType && m.targetType === IkasHTMLMetaDataTargetType.PRODUCT; });
28395
- return [4 /*yield*/, IkasProductAPI.listProducts({
28396
- idList: productMetaData.map(function (p) { return p.targetId; }),
28138
+ return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
28139
+ productIdList: productMetaData.map(function (p) { return p.targetId; }),
28397
28140
  })];
28398
28141
  case 2:
28399
28142
  productsResponse = _b.sent();
@@ -28419,7 +28162,7 @@ var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void
28419
28162
  }
28420
28163
  }
28421
28164
  };
28422
- for (_i = 0, _a = productsResponse.products; _i < _a.length; _i++) {
28165
+ for (_i = 0, _a = (productsResponse === null || productsResponse === void 0 ? void 0 : productsResponse.data) || []; _i < _a.length; _i++) {
28423
28166
  product = _a[_i];
28424
28167
  _loop_1(product);
28425
28168
  }
@@ -28964,4 +28707,4 @@ var IkasBaseStore = /** @class */ (function () {
28964
28707
  return IkasBaseStore;
28965
28708
  }());
28966
28709
 
28967
- export { AccountInfoForm, index$3 as AccountPage, AddressForm, addresses as AddressesPage, Analytics, AnalyticsBody, AnalyticsHead, cart as CartPage, _id_$1 as CheckoutPage, ContactForm, _slug_ as CustomPage, editor$1 as EditorPage, EmailRule, EqualsRule, favoriteProducts as FavoriteProductsPage, ForgotPasswordForm, forgotPassword as ForgotPasswordPage, IkasAmountTypeEnum$1 as IkasAmountTypeEnum, IkasApplicableProductFilterValue, IkasBaseStore, IkasBrand, IkasBrandAPI, IkasBrandList, IkasBrandListPropValue, IkasBrandListSortType, IkasBrandListType, IkasBrandPropValue, IkasCardAssociation, IkasCardType, IkasCartAPI, IkasCategory, IkasCategoryAPI, IkasCategoryList, IkasCategoryListPropValue, IkasCategoryListSortType, IkasCategoryListType, IkasCategoryPropValue, IkasCheckout, IkasCheckoutAPI, IkasCheckoutPage, IkasCheckoutRecoveryEmailStatus, IkasCheckoutRecoveryStatus, IkasCheckoutStatus, IkasCityAPI, IkasContactForm, IkasContactFormAPI, IkasCountryAPI, IkasCustomer, IkasCustomerAPI, IkasCustomerAddress, IkasDistrictAPI, IkasFavoriteProduct, IkasFavoriteProductAPI, IkasHTMLMetaData, IkasHTMLMetaDataAPI, IkasHTMLMetaDataTargetType, IkasImage, IkasLinkPropValue, IkasLinkType, IkasMerchantAPI, IkasMerchantSettings, IkasNavigationLink, IkasOrder, IkasOrderCancelledReason, IkasOrderLineItem, IkasOrderPackageFulfillStatus, IkasOrderPackageStatus, IkasOrderPaymentStatus, IkasOrderShippingMethod, IkasOrderStatus, IkasOrderTransaction, IkasPage, IkasPageComponentPropValue, IkasPageDataProvider, IkasPageEditor, IkasPageHead, IkasPaymentMethod, IkasProduct, IkasProductAPI, IkasProductAttribute, IkasProductAttributeAPI, IkasProductAttributeValue, IkasProductDetail, IkasProductDetailPropValue, IkasProductFilter, IkasProductFilterDisplayType, IkasProductFilterSettings, IkasProductFilterSortType, IkasProductFilterType, IkasProductFilterValue, IkasProductList, IkasProductListPropValue, IkasProductListSortType, IkasProductListType, IkasProductPrice, IkasProductSearchAPI, IkasProductType, IkasProductVariant, IkasProductVariantType, IkasShippingMethod, IkasShippingMethodEnum, IkasStateAPI, IkasStorefrontAPI, IkasStorefrontConfig, IkasTheme, IkasThemeAPI, IkasThemeComponent, IkasThemeComponentProp, IkasThemeComponentPropType, IkasThemeCustomData, IkasThemeCustomDataType, IkasThemePage, IkasThemePageComponent, IkasThemePageType, IkasThemeSettings, IkasTransactionStatusEnum, IkasTransactionTypeEnum, IkasVariantSelectionType, IkasVariantType, IkasVariantTypeAPI, IkasVariantValue, Image, home as IndexPage, LessThanRule, LoginForm, login as LoginPage, MaxRule, MinRule, _404 as NotFoundPage, _id_$2 as OrderDetailPage, index$4 as OrdersPage, PhoneRule, RangeValue, RecoverPasswordForm, recoverPassword as RecoverPasswordPage, RegisterForm, register as RegisterPage, RequiredRule, search as SearchPage, index$2 as SlugPage, ValidationRule, Validator, ValidatorErrorType, apollo, decodeBase64, formatMoney, parseRangeStr, pascalCase, stringToSlug, validatePhoneNumber };
28710
+ export { AccountInfoForm, index$3 as AccountPage, AddressForm, addresses as AddressesPage, Analytics, AnalyticsBody, AnalyticsHead, cart as CartPage, _id_$1 as CheckoutPage, ContactForm, _slug_ as CustomPage, editor$1 as EditorPage, EmailRule, EqualsRule, favoriteProducts as FavoriteProductsPage, ForgotPasswordForm, forgotPassword as ForgotPasswordPage, IkasAmountTypeEnum$1 as IkasAmountTypeEnum, IkasApplicableProductFilterValue, IkasBaseStore, IkasBrand, IkasBrandAPI, IkasBrandList, IkasBrandListPropValue, IkasBrandListSortType, IkasBrandListType, IkasBrandPropValue, IkasCardAssociation, IkasCardType, IkasCartAPI, IkasCategory, IkasCategoryAPI, IkasCategoryList, IkasCategoryListPropValue, IkasCategoryListSortType, IkasCategoryListType, IkasCategoryPropValue, IkasCheckout, IkasCheckoutAPI, IkasCheckoutPage, IkasCheckoutRecoveryEmailStatus, IkasCheckoutRecoveryStatus, IkasCheckoutStatus, IkasCityAPI, IkasContactForm, IkasContactFormAPI, IkasCountryAPI, IkasCustomer, IkasCustomerAPI, IkasCustomerAddress, IkasDistrictAPI, IkasFavoriteProduct, IkasFavoriteProductAPI, IkasHTMLMetaData, IkasHTMLMetaDataAPI, IkasHTMLMetaDataTargetType, IkasImage, IkasLinkPropValue, IkasLinkType, IkasMerchantAPI, IkasMerchantSettings, IkasNavigationLink, IkasOrder, IkasOrderCancelledReason, IkasOrderLineItem, IkasOrderPackageFulfillStatus, IkasOrderPackageStatus, IkasOrderPaymentStatus, IkasOrderShippingMethod, IkasOrderStatus, IkasOrderTransaction, IkasPage, IkasPageComponentPropValue, IkasPageDataProvider, IkasPageEditor, IkasPageHead, IkasPaymentMethod, IkasProduct, IkasProductAttribute, IkasProductAttributeAPI, IkasProductAttributeValue, IkasProductDetail, IkasProductDetailPropValue, IkasProductFilter, IkasProductFilterDisplayType, IkasProductFilterSettings, IkasProductFilterSortType, IkasProductFilterType, IkasProductFilterValue, IkasProductList, IkasProductListPropValue, IkasProductListSortType, IkasProductListType, IkasProductPrice, IkasProductSearchAPI, IkasProductType, IkasProductVariant, IkasProductVariantType, IkasShippingMethod, IkasShippingMethodEnum, IkasStateAPI, IkasStorefrontAPI, IkasStorefrontConfig, IkasTheme, IkasThemeAPI, IkasThemeComponent, IkasThemeComponentProp, IkasThemeComponentPropType, IkasThemeCustomData, IkasThemeCustomDataType, IkasThemePage, IkasThemePageComponent, IkasThemePageType, IkasThemeSettings, IkasTransactionStatusEnum, IkasTransactionTypeEnum, IkasVariantSelectionType, IkasVariantType, IkasVariantTypeAPI, IkasVariantValue, Image, home as IndexPage, LessThanRule, LoginForm, login as LoginPage, MaxRule, MinRule, _404 as NotFoundPage, _id_$2 as OrderDetailPage, index$4 as OrdersPage, PhoneRule, RangeValue, RecoverPasswordForm, recoverPassword as RecoverPasswordPage, RegisterForm, register as RegisterPage, RequiredRule, search as SearchPage, index$2 as SlugPage, ValidationRule, Validator, ValidatorErrorType, apollo, decodeBase64, formatMoney, parseRangeStr, pascalCase, stringToSlug, validatePhoneNumber };
package/build/index.js CHANGED
@@ -11312,6 +11312,8 @@ var IkasCategoryPropValueProvider = /** @class */ (function () {
11312
11312
  if (this.categoryPropValue.usePageData) {
11313
11313
  return [2 /*return*/, this.pageSpecificData];
11314
11314
  }
11315
+ if (!this.categoryPropValue.categoryId)
11316
+ return [2 /*return*/, null];
11315
11317
  _a.label = 1;
11316
11318
  case 1:
11317
11319
  _a.trys.push([1, 3, , 4]);
@@ -11326,7 +11328,7 @@ var IkasCategoryPropValueProvider = /** @class */ (function () {
11326
11328
  err_1 = _a.sent();
11327
11329
  console.log(err_1);
11328
11330
  return [3 /*break*/, 4];
11329
- case 4: return [2 /*return*/, new IkasCategory({})];
11331
+ case 4: return [2 /*return*/, null];
11330
11332
  }
11331
11333
  });
11332
11334
  });
@@ -20075,12 +20077,12 @@ var IkasCustomerStore = /** @class */ (function () {
20075
20077
  favoriteProductsResult = _b.sent();
20076
20078
  if (!favoriteProductsResult.length)
20077
20079
  return [2 /*return*/, []];
20078
- return [4 /*yield*/, IkasProductAPI.listProducts({
20079
- idList: favoriteProductsResult.map(function (fP) { return fP.productId; }),
20080
+ return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
20081
+ productIdList: favoriteProductsResult.map(function (fP) { return fP.productId; }),
20080
20082
  })];
20081
20083
  case 2:
20082
20084
  productsResult = _b.sent();
20083
- return [2 /*return*/, productsResult.products];
20085
+ return [2 /*return*/, (productsResult === null || productsResult === void 0 ? void 0 : productsResult.data) || []];
20084
20086
  case 3:
20085
20087
  _b.sent();
20086
20088
  return [2 /*return*/, []];
@@ -25201,322 +25203,6 @@ var IkasMerchantAPI = /** @class */ (function () {
25201
25203
  }());
25202
25204
  var templateObject_1$9;
25203
25205
 
25204
- /**
25205
- * Flattens `array` a single level deep.
25206
- *
25207
- * @static
25208
- * @memberOf _
25209
- * @since 0.1.0
25210
- * @category Array
25211
- * @param {Array} array The array to flatten.
25212
- * @returns {Array} Returns the new flattened array.
25213
- * @example
25214
- *
25215
- * _.flatten([1, [2, [3, [4]], 5]]);
25216
- * // => [1, 2, [3, [4]], 5]
25217
- */
25218
- function flatten(array) {
25219
- var length = array == null ? 0 : array.length;
25220
- return length ? _baseFlatten(array, 1) : [];
25221
- }
25222
-
25223
- var flatten_1 = flatten;
25224
-
25225
- var IkasVariantTypeAPI = /** @class */ (function () {
25226
- function IkasVariantTypeAPI() {
25227
- }
25228
- IkasVariantTypeAPI.listVariantTypes = function (idList) {
25229
- return __awaiter(this, void 0, void 0, function () {
25230
- var LIST_VARIANT_TYPE, _a, data, errors, err_1;
25231
- return __generator(this, function (_b) {
25232
- switch (_b.label) {
25233
- case 0:
25234
- LIST_VARIANT_TYPE = src(templateObject_1$a || (templateObject_1$a = __makeTemplateObject(["\n query listVariantType($id: StringFilterInput!) {\n listVariantType(id: $id) {\n id\n createdAt\n updatedAt\n deleted\n name\n selectionType\n values {\n id\n createdAt\n updatedAt\n deleted\n name\n thumbnailImageId\n colorCode\n }\n }\n }\n "], ["\n query listVariantType($id: StringFilterInput!) {\n listVariantType(id: $id) {\n id\n createdAt\n updatedAt\n deleted\n name\n selectionType\n values {\n id\n createdAt\n updatedAt\n deleted\n name\n thumbnailImageId\n colorCode\n }\n }\n }\n "])));
25235
- _b.label = 1;
25236
- case 1:
25237
- _b.trys.push([1, 3, , 4]);
25238
- return [4 /*yield*/, apollo
25239
- .getClient()
25240
- .query({
25241
- query: LIST_VARIANT_TYPE,
25242
- variables: {
25243
- id: {
25244
- in: idList || [],
25245
- },
25246
- },
25247
- })];
25248
- case 2:
25249
- _a = _b.sent(), data = _a.data, errors = _a.errors;
25250
- if (errors && errors.length) {
25251
- return [2 /*return*/, []];
25252
- }
25253
- return [2 /*return*/, data.listVariantType.map(function (vt) {
25254
- return new IkasVariantType({
25255
- id: vt.id,
25256
- name: vt.name,
25257
- selectionType: vt.selectionType,
25258
- values: vt.values.map(function (vv) {
25259
- return new IkasVariantValue({
25260
- id: vv.id,
25261
- name: vv.name,
25262
- colorCode: vv.colorCode,
25263
- thumbnailImageId: vv.thumbnailImageId,
25264
- variantTypeId: vt.id,
25265
- });
25266
- }),
25267
- });
25268
- })];
25269
- case 3:
25270
- err_1 = _b.sent();
25271
- console.log(err_1);
25272
- return [3 /*break*/, 4];
25273
- case 4: return [2 /*return*/, []];
25274
- }
25275
- });
25276
- });
25277
- };
25278
- return IkasVariantTypeAPI;
25279
- }());
25280
- var templateObject_1$a;
25281
-
25282
- // TODO remove this api
25283
- var IkasStockLocationAPI = /** @class */ (function () {
25284
- function IkasStockLocationAPI() {
25285
- }
25286
- IkasStockLocationAPI.listStockLocation = function () {
25287
- return __awaiter(this, void 0, void 0, function () {
25288
- var QUERY, _a, data;
25289
- return __generator(this, function (_b) {
25290
- switch (_b.label) {
25291
- case 0:
25292
- QUERY = src(templateObject_1$b || (templateObject_1$b = __makeTemplateObject(["\n query listStockLocation {\n listStockLocation {\n id\n }\n }\n "], ["\n query listStockLocation {\n listStockLocation {\n id\n }\n }\n "])));
25293
- _b.label = 1;
25294
- case 1:
25295
- _b.trys.push([1, 3, , 4]);
25296
- return [4 /*yield*/, apollo
25297
- .getClient()
25298
- .query({
25299
- query: QUERY,
25300
- })];
25301
- case 2:
25302
- _a = _b.sent(), data = _a.data, _a.errors;
25303
- if (data && data.listStockLocation.length)
25304
- return [2 /*return*/, data.listStockLocation[0]];
25305
- return [3 /*break*/, 4];
25306
- case 3:
25307
- _b.sent();
25308
- return [3 /*break*/, 4];
25309
- case 4: return [2 /*return*/];
25310
- }
25311
- });
25312
- });
25313
- };
25314
- return IkasStockLocationAPI;
25315
- }());
25316
- var templateObject_1$b;
25317
-
25318
- // TODO remove this api
25319
- var IkasProductStockLocationAPI = /** @class */ (function () {
25320
- function IkasProductStockLocationAPI() {
25321
- }
25322
- IkasProductStockLocationAPI.listProductStockLocation = function (stockLocationIdList, variantIdList) {
25323
- return __awaiter(this, void 0, void 0, function () {
25324
- var QUERY, _a, data, errors, err_1;
25325
- return __generator(this, function (_b) {
25326
- switch (_b.label) {
25327
- case 0:
25328
- QUERY = src(templateObject_1$c || (templateObject_1$c = __makeTemplateObject(["\n query listProductStockLocation(\n $stockLocationIdList: [String!]!\n $variantIdList: [String!]!\n ) {\n listProductStockLocation(\n stockLocationIdList: $stockLocationIdList\n variantIdList: $variantIdList\n ) {\n variantId\n stockLocationId\n stockCount\n }\n }\n "], ["\n query listProductStockLocation(\n $stockLocationIdList: [String!]!\n $variantIdList: [String!]!\n ) {\n listProductStockLocation(\n stockLocationIdList: $stockLocationIdList\n variantIdList: $variantIdList\n ) {\n variantId\n stockLocationId\n stockCount\n }\n }\n "])));
25329
- _b.label = 1;
25330
- case 1:
25331
- _b.trys.push([1, 3, , 4]);
25332
- return [4 /*yield*/, apollo
25333
- .getClient()
25334
- .query({
25335
- query: QUERY,
25336
- variables: {
25337
- stockLocationIdList: stockLocationIdList,
25338
- variantIdList: variantIdList,
25339
- },
25340
- })];
25341
- case 2:
25342
- _a = _b.sent(), data = _a.data, errors = _a.errors;
25343
- if (data && data.listProductStockLocation)
25344
- return [2 /*return*/, data.listProductStockLocation];
25345
- console.log(errors);
25346
- return [3 /*break*/, 4];
25347
- case 3:
25348
- err_1 = _b.sent();
25349
- console.error(JSON.stringify(err_1, null, 2));
25350
- return [3 /*break*/, 4];
25351
- case 4: return [2 /*return*/];
25352
- }
25353
- });
25354
- });
25355
- };
25356
- return IkasProductStockLocationAPI;
25357
- }());
25358
- var templateObject_1$c;
25359
-
25360
- var IkasProductAPI = /** @class */ (function () {
25361
- function IkasProductAPI() {
25362
- }
25363
- IkasProductAPI.listProducts = function (params) {
25364
- return __awaiter(this, void 0, void 0, function () {
25365
- var LIST_PRODUCTS, variables, _a, data, errors, products, count, brandIds, categoryIds, variantTypeIds, stockLocation, stocks_1, variantIdList_1, productStockLocations, brandsResponse_1, categoriesResponse_1, variantTypes_1, err_1;
25366
- return __generator(this, function (_b) {
25367
- switch (_b.label) {
25368
- case 0:
25369
- LIST_PRODUCTS = src(templateObject_1$d || (templateObject_1$d = __makeTemplateObject(["\n query listProduct(\n $id: StringFilterInput\n $pagination: PaginationInput\n $search: String\n $brandId: StringFilterInput\n $categoryIds: CategoryFilterInput\n ) {\n listProduct(\n id: $id\n pagination: $pagination\n search: $search\n brandId: $brandId\n categoryIds: $categoryIds\n ) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n type\n shortDescription\n description\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\n brandId\n categoryIds\n productVariantTypes {\n order\n variantTypeId\n variantValueIds\n }\n variants {\n id\n createdAt\n updatedAt\n deleted\n sku\n barcodeList\n isActive\n variantValueIds {\n variantTypeId\n variantValueId\n }\n attributes {\n value\n productAttributeId\n productAttributeOptionId\n }\n images {\n order\n isMain\n imageId\n }\n prices {\n sellPrice\n discountPrice\n buyPrice\n currency\n }\n }\n attributes {\n value\n productAttributeId\n productAttributeOptionId\n }\n }\n count\n }\n }\n "], ["\n query listProduct(\n $id: StringFilterInput\n $pagination: PaginationInput\n $search: String\n $brandId: StringFilterInput\n $categoryIds: CategoryFilterInput\n ) {\n listProduct(\n id: $id\n pagination: $pagination\n search: $search\n brandId: $brandId\n categoryIds: $categoryIds\n ) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n type\n shortDescription\n description\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\n brandId\n categoryIds\n productVariantTypes {\n order\n variantTypeId\n variantValueIds\n }\n variants {\n id\n createdAt\n updatedAt\n deleted\n sku\n barcodeList\n isActive\n variantValueIds {\n variantTypeId\n variantValueId\n }\n attributes {\n value\n productAttributeId\n productAttributeOptionId\n }\n images {\n order\n isMain\n imageId\n }\n prices {\n sellPrice\n discountPrice\n buyPrice\n currency\n }\n }\n attributes {\n value\n productAttributeId\n productAttributeOptionId\n }\n }\n count\n }\n }\n "])));
25370
- _b.label = 1;
25371
- case 1:
25372
- _b.trys.push([1, 9, , 10]);
25373
- variables = {
25374
- search: params === null || params === void 0 ? void 0 : params.search,
25375
- };
25376
- if ((params === null || params === void 0 ? void 0 : params.idList) && params.idList.length) {
25377
- variables.id = {
25378
- in: params.idList,
25379
- };
25380
- }
25381
- if (params === null || params === void 0 ? void 0 : params.page) {
25382
- variables.pagination = {
25383
- page: params.page,
25384
- limit: params.limit || 10,
25385
- };
25386
- }
25387
- if (params === null || params === void 0 ? void 0 : params.brandId) {
25388
- variables.brandId = {
25389
- eq: params.brandId,
25390
- };
25391
- }
25392
- if ((params === null || params === void 0 ? void 0 : params.categoryIds) && params.categoryIds.length) {
25393
- variables.categoryIds = {
25394
- in: params.categoryIds,
25395
- };
25396
- }
25397
- return [4 /*yield*/, apollo
25398
- .getClient()
25399
- .query({
25400
- query: LIST_PRODUCTS,
25401
- variables: variables,
25402
- })];
25403
- case 2:
25404
- _a = _b.sent(), data = _a.data, errors = _a.errors;
25405
- if (errors && errors.length) {
25406
- console.log(errors);
25407
- return [2 /*return*/, {
25408
- products: [],
25409
- count: 0,
25410
- }];
25411
- }
25412
- products = data.listProduct.data;
25413
- count = data.listProduct.count;
25414
- brandIds = products
25415
- .map(function (p) { return p.brandId; })
25416
- .filter(function (id) { return !!id; });
25417
- categoryIds = flatten_1(products.map(function (p) { return p.categoryIds || []; }));
25418
- variantTypeIds = flatten_1(products.map(function (p) { var _a; return ((_a = p.productVariantTypes) === null || _a === void 0 ? void 0 : _a.map(function (pvt) { return pvt.variantTypeId; })) || []; }));
25419
- return [4 /*yield*/, IkasStockLocationAPI.listStockLocation()];
25420
- case 3:
25421
- stockLocation = _b.sent();
25422
- stocks_1 = {};
25423
- products.forEach(function (p) {
25424
- p.variants.forEach(function (v) {
25425
- stocks_1[v.id] = 0;
25426
- });
25427
- });
25428
- if (!stockLocation) return [3 /*break*/, 5];
25429
- variantIdList_1 = [];
25430
- products.forEach(function (p) {
25431
- return p.variants.forEach(function (v) { return variantIdList_1.push(v.id); });
25432
- });
25433
- return [4 /*yield*/, IkasProductStockLocationAPI.listProductStockLocation([stockLocation.id], variantIdList_1)];
25434
- case 4:
25435
- productStockLocations = _b.sent();
25436
- productStockLocations === null || productStockLocations === void 0 ? void 0 : productStockLocations.forEach(function (psl) {
25437
- stocks_1[psl.variantId] = psl.stockCount;
25438
- });
25439
- _b.label = 5;
25440
- case 5: return [4 /*yield*/, IkasBrandAPI.listBrands({
25441
- idList: brandIds,
25442
- page: 1,
25443
- limit: brandIds.length,
25444
- })];
25445
- case 6:
25446
- brandsResponse_1 = _b.sent();
25447
- return [4 /*yield*/, IkasCategoryAPI.listCategories({
25448
- idList: categoryIds,
25449
- page: 1,
25450
- limit: categoryIds.length,
25451
- })];
25452
- case 7:
25453
- categoriesResponse_1 = _b.sent();
25454
- return [4 /*yield*/, IkasVariantTypeAPI.listVariantTypes(variantTypeIds)];
25455
- case 8:
25456
- variantTypes_1 = _b.sent();
25457
- return [2 /*return*/, {
25458
- products: products.map(function (p) {
25459
- var _a;
25460
- return new IkasProduct({
25461
- id: p.id,
25462
- name: p.name,
25463
- type: p.type,
25464
- description: p.description || undefined,
25465
- shortDescription: p.shortDescription || undefined,
25466
- metaData: new IkasHTMLMetaData(p.metaData),
25467
- brand: p.brandId
25468
- ? brandsResponse_1.brands.find(function (b) { return b.id === p.brandId; })
25469
- : null,
25470
- categories: p.categoryIds
25471
- ? p.categoryIds.map(function (categoryId) {
25472
- return categoriesResponse_1.categories.find(function (c) { return c.id === categoryId; });
25473
- })
25474
- : [],
25475
- variants: p.variants.map(function (v, index) {
25476
- var _a;
25477
- return new IkasProductVariant({
25478
- id: v.id,
25479
- sku: v.sku,
25480
- barcodeList: v.barcodeList || [],
25481
- variantValues: v.variantValueIds
25482
- ? v.variantValueIds.map(function (vvId) {
25483
- var variantType = variantTypes_1.find(function (vt) { return vt.id === vvId.variantTypeId; });
25484
- return variantType.values.find(function (vv) { return vv.id === vvId.variantValueId; });
25485
- })
25486
- : [],
25487
- images: (_a = v.images) === null || _a === void 0 ? void 0 : _a.map(function (i) { return new IkasImage(i.imageId); }),
25488
- attributes: v.attributes || [],
25489
- price: new IkasProductPrice(v.prices[0]),
25490
- stock: stocks_1[v.id] || 0,
25491
- });
25492
- }),
25493
- attributes: p.attributes || [],
25494
- variantTypes: (_a = p.productVariantTypes) === null || _a === void 0 ? void 0 : _a.map(function (pvt) {
25495
- return new IkasProductVariantType({
25496
- variantType: variantTypes_1.find(function (vt) { return vt.id === pvt.variantTypeId; }),
25497
- variantValueIds: pvt.variantValueIds || [],
25498
- });
25499
- }),
25500
- });
25501
- }),
25502
- count: count,
25503
- }];
25504
- case 9:
25505
- err_1 = _b.sent();
25506
- console.log(err_1);
25507
- return [3 /*break*/, 10];
25508
- case 10: return [2 /*return*/, {
25509
- products: [],
25510
- count: 0,
25511
- }];
25512
- }
25513
- });
25514
- });
25515
- };
25516
- return IkasProductAPI;
25517
- }());
25518
- var templateObject_1$d;
25519
-
25520
25206
  var IkasProductSearchAPI = /** @class */ (function () {
25521
25207
  function IkasProductSearchAPI() {
25522
25208
  }
@@ -25527,7 +25213,7 @@ var IkasProductSearchAPI = /** @class */ (function () {
25527
25213
  switch (_b.label) {
25528
25214
  case 0:
25529
25215
  _b.trys.push([0, 2, , 3]);
25530
- SEARCH_PRODUCTS = src(templateObject_1$e || (templateObject_1$e = __makeTemplateObject(["\n query searchProducts($input: SearchInput!) {\n searchProducts(input: $input) {\n count\n data\n facets {\n id\n values {\n count\n id\n }\n }\n limit\n page\n totalCount\n }\n }\n "], ["\n query searchProducts($input: SearchInput!) {\n searchProducts(input: $input) {\n count\n data\n facets {\n id\n values {\n count\n id\n }\n }\n limit\n page\n totalCount\n }\n }\n "])));
25216
+ SEARCH_PRODUCTS = src(templateObject_1$a || (templateObject_1$a = __makeTemplateObject(["\n query searchProducts($input: SearchInput!) {\n searchProducts(input: $input) {\n count\n data\n facets {\n id\n values {\n count\n id\n }\n }\n limit\n page\n totalCount\n }\n }\n "], ["\n query searchProducts($input: SearchInput!) {\n searchProducts(input: $input) {\n count\n data\n facets {\n id\n values {\n count\n id\n }\n }\n limit\n page\n totalCount\n }\n }\n "])));
25531
25217
  return [4 /*yield*/, apollo
25532
25218
  .getClient()
25533
25219
  .query({
@@ -25704,7 +25390,7 @@ function simpleToProduct(simple) {
25704
25390
  }),
25705
25391
  });
25706
25392
  }
25707
- var templateObject_1$e, templateObject_2$5;
25393
+ var templateObject_1$a, templateObject_2$5;
25708
25394
 
25709
25395
  var IkasProductAttributeAPI = /** @class */ (function () {
25710
25396
  function IkasProductAttributeAPI() {
@@ -25715,7 +25401,7 @@ var IkasProductAttributeAPI = /** @class */ (function () {
25715
25401
  return __generator(this, function (_b) {
25716
25402
  switch (_b.label) {
25717
25403
  case 0:
25718
- LIST_PRODUCT_ATTRIBUTES = src(templateObject_1$f || (templateObject_1$f = __makeTemplateObject(["\n query listProductAttribute($id: StringFilterInput!) {\n listProductAttribute(id: $id) {\n id\n createdAt\n updatedAt\n deleted\n name\n description\n type\n options {\n id\n createdAt\n updatedAt\n deleted\n name\n }\n }\n }\n "], ["\n query listProductAttribute($id: StringFilterInput!) {\n listProductAttribute(id: $id) {\n id\n createdAt\n updatedAt\n deleted\n name\n description\n type\n options {\n id\n createdAt\n updatedAt\n deleted\n name\n }\n }\n }\n "])));
25404
+ LIST_PRODUCT_ATTRIBUTES = src(templateObject_1$b || (templateObject_1$b = __makeTemplateObject(["\n query listProductAttribute($id: StringFilterInput!) {\n listProductAttribute(id: $id) {\n id\n createdAt\n updatedAt\n deleted\n name\n description\n type\n options {\n id\n createdAt\n updatedAt\n deleted\n name\n }\n }\n }\n "], ["\n query listProductAttribute($id: StringFilterInput!) {\n listProductAttribute(id: $id) {\n id\n createdAt\n updatedAt\n deleted\n name\n description\n type\n options {\n id\n createdAt\n updatedAt\n deleted\n name\n }\n }\n }\n "])));
25719
25405
  _b.label = 1;
25720
25406
  case 1:
25721
25407
  _b.trys.push([1, 3, , 4]);
@@ -25748,7 +25434,7 @@ var IkasProductAttributeAPI = /** @class */ (function () {
25748
25434
  };
25749
25435
  return IkasProductAttributeAPI;
25750
25436
  }());
25751
- var templateObject_1$f;
25437
+ var templateObject_1$b;
25752
25438
 
25753
25439
  var IkasFavoriteProductAPI = /** @class */ (function () {
25754
25440
  function IkasFavoriteProductAPI() {
@@ -25759,7 +25445,7 @@ var IkasFavoriteProductAPI = /** @class */ (function () {
25759
25445
  return __generator(this, function (_b) {
25760
25446
  switch (_b.label) {
25761
25447
  case 0:
25762
- LIST_FAVORITE_PRODUCTS = src(templateObject_1$g || (templateObject_1$g = __makeTemplateObject(["\n query listFavoriteProducts {\n listFavoriteProducts {\n id\n createdAt\n updatedAt\n deleted\n productId\n customerId\n }\n }\n "], ["\n query listFavoriteProducts {\n listFavoriteProducts {\n id\n createdAt\n updatedAt\n deleted\n productId\n customerId\n }\n }\n "])));
25448
+ LIST_FAVORITE_PRODUCTS = src(templateObject_1$c || (templateObject_1$c = __makeTemplateObject(["\n query listFavoriteProducts {\n listFavoriteProducts {\n id\n createdAt\n updatedAt\n deleted\n productId\n customerId\n }\n }\n "], ["\n query listFavoriteProducts {\n listFavoriteProducts {\n id\n createdAt\n updatedAt\n deleted\n productId\n customerId\n }\n }\n "])));
25763
25449
  _b.label = 1;
25764
25450
  case 1:
25765
25451
  _b.trys.push([1, 3, , 4]);
@@ -25844,7 +25530,7 @@ var IkasFavoriteProductAPI = /** @class */ (function () {
25844
25530
  };
25845
25531
  return IkasFavoriteProductAPI;
25846
25532
  }());
25847
- var templateObject_1$g, templateObject_2$6, templateObject_3$2;
25533
+ var templateObject_1$c, templateObject_2$6, templateObject_3$2;
25848
25534
 
25849
25535
  var IkasContactFormAPI = /** @class */ (function () {
25850
25536
  function IkasContactFormAPI() {
@@ -25855,7 +25541,7 @@ var IkasContactFormAPI = /** @class */ (function () {
25855
25541
  return __generator(this, function (_b) {
25856
25542
  switch (_b.label) {
25857
25543
  case 0:
25858
- MUTATION = src(templateObject_1$h || (templateObject_1$h = __makeTemplateObject(["\n mutation sendContactFormToMerchant(\n $email: String!\n $message: String!\n $firstName: String!\n $lastName: String!\n ) {\n sendContactFormToMerchant(\n email: $email\n message: $message\n firstName: $firstName\n lastName: $lastName\n )\n }\n "], ["\n mutation sendContactFormToMerchant(\n $email: String!\n $message: String!\n $firstName: String!\n $lastName: String!\n ) {\n sendContactFormToMerchant(\n email: $email\n message: $message\n firstName: $firstName\n lastName: $lastName\n )\n }\n "])));
25544
+ MUTATION = src(templateObject_1$d || (templateObject_1$d = __makeTemplateObject(["\n mutation sendContactFormToMerchant(\n $email: String!\n $message: String!\n $firstName: String!\n $lastName: String!\n ) {\n sendContactFormToMerchant(\n email: $email\n message: $message\n firstName: $firstName\n lastName: $lastName\n )\n }\n "], ["\n mutation sendContactFormToMerchant(\n $email: String!\n $message: String!\n $firstName: String!\n $lastName: String!\n ) {\n sendContactFormToMerchant(\n email: $email\n message: $message\n firstName: $firstName\n lastName: $lastName\n )\n }\n "])));
25859
25545
  _b.label = 1;
25860
25546
  case 1:
25861
25547
  _b.trys.push([1, 3, , 4]);
@@ -25887,7 +25573,7 @@ var IkasContactFormAPI = /** @class */ (function () {
25887
25573
  };
25888
25574
  return IkasContactFormAPI;
25889
25575
  }());
25890
- var templateObject_1$h;
25576
+ var templateObject_1$d;
25891
25577
 
25892
25578
  var IkasStateAPI = /** @class */ (function () {
25893
25579
  function IkasStateAPI() {
@@ -25898,7 +25584,7 @@ var IkasStateAPI = /** @class */ (function () {
25898
25584
  return __generator(this, function (_b) {
25899
25585
  switch (_b.label) {
25900
25586
  case 0:
25901
- QUERY = src(templateObject_1$i || (templateObject_1$i = __makeTemplateObject(["\n query listState($countryId: StringFilterInput!) {\n listState(countryId: $countryId) {\n id\n name\n stateCode\n }\n }\n "], ["\n query listState($countryId: StringFilterInput!) {\n listState(countryId: $countryId) {\n id\n name\n stateCode\n }\n }\n "])));
25587
+ QUERY = src(templateObject_1$e || (templateObject_1$e = __makeTemplateObject(["\n query listState($countryId: StringFilterInput!) {\n listState(countryId: $countryId) {\n id\n name\n stateCode\n }\n }\n "], ["\n query listState($countryId: StringFilterInput!) {\n listState(countryId: $countryId) {\n id\n name\n stateCode\n }\n }\n "])));
25902
25588
  _b.label = 1;
25903
25589
  case 1:
25904
25590
  _b.trys.push([1, 3, , 4]);
@@ -25935,7 +25621,7 @@ var IkasStateAPI = /** @class */ (function () {
25935
25621
  };
25936
25622
  return IkasStateAPI;
25937
25623
  }());
25938
- var templateObject_1$i;
25624
+ var templateObject_1$e;
25939
25625
 
25940
25626
  var IkasStorefrontDomain = /** @class */ (function () {
25941
25627
  function IkasStorefrontDomain(data) {
@@ -26028,7 +25714,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
26028
25714
  return __generator(this, function (_b) {
26029
25715
  switch (_b.label) {
26030
25716
  case 0:
26031
- QUERY = src(templateObject_1$j || (templateObject_1$j = __makeTemplateObject(["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "], ["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "])));
25717
+ QUERY = src(templateObject_1$f || (templateObject_1$f = __makeTemplateObject(["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "], ["\n query getStorefront($storefrontId: String!) {\n getStorefront(id: $storefrontId) {\n id\n name\n themeId\n themeVersionId\n userId\n # domains {\n # id\n # merchantDomainId\n # name\n # redirectDomainName\n # }\n regions {\n id\n locale\n # themeJSON\n privacyPolicy\n returnPolicy\n termsOfService\n }\n }\n }\n "])));
26032
25718
  _b.label = 1;
26033
25719
  case 1:
26034
25720
  _b.trys.push([1, 3, , 4]);
@@ -26058,7 +25744,7 @@ var IkasStorefrontAPI = /** @class */ (function () {
26058
25744
  };
26059
25745
  return IkasStorefrontAPI;
26060
25746
  }());
26061
- var templateObject_1$j;
25747
+ var templateObject_1$f;
26062
25748
 
26063
25749
  var IkasThemeAPI = /** @class */ (function () {
26064
25750
  function IkasThemeAPI() {
@@ -26081,6 +25767,63 @@ var IkasThemeAPI = /** @class */ (function () {
26081
25767
  return IkasThemeAPI;
26082
25768
  }());
26083
25769
 
25770
+ var IkasVariantTypeAPI = /** @class */ (function () {
25771
+ function IkasVariantTypeAPI() {
25772
+ }
25773
+ IkasVariantTypeAPI.listVariantTypes = function (idList) {
25774
+ return __awaiter(this, void 0, void 0, function () {
25775
+ var LIST_VARIANT_TYPE, _a, data, errors, err_1;
25776
+ return __generator(this, function (_b) {
25777
+ switch (_b.label) {
25778
+ case 0:
25779
+ LIST_VARIANT_TYPE = src(templateObject_1$g || (templateObject_1$g = __makeTemplateObject(["\n query listVariantType($id: StringFilterInput!) {\n listVariantType(id: $id) {\n id\n createdAt\n updatedAt\n deleted\n name\n selectionType\n values {\n id\n createdAt\n updatedAt\n deleted\n name\n thumbnailImageId\n colorCode\n }\n }\n }\n "], ["\n query listVariantType($id: StringFilterInput!) {\n listVariantType(id: $id) {\n id\n createdAt\n updatedAt\n deleted\n name\n selectionType\n values {\n id\n createdAt\n updatedAt\n deleted\n name\n thumbnailImageId\n colorCode\n }\n }\n }\n "])));
25780
+ _b.label = 1;
25781
+ case 1:
25782
+ _b.trys.push([1, 3, , 4]);
25783
+ return [4 /*yield*/, apollo
25784
+ .getClient()
25785
+ .query({
25786
+ query: LIST_VARIANT_TYPE,
25787
+ variables: {
25788
+ id: {
25789
+ in: idList || [],
25790
+ },
25791
+ },
25792
+ })];
25793
+ case 2:
25794
+ _a = _b.sent(), data = _a.data, errors = _a.errors;
25795
+ if (errors && errors.length) {
25796
+ return [2 /*return*/, []];
25797
+ }
25798
+ return [2 /*return*/, data.listVariantType.map(function (vt) {
25799
+ return new IkasVariantType({
25800
+ id: vt.id,
25801
+ name: vt.name,
25802
+ selectionType: vt.selectionType,
25803
+ values: vt.values.map(function (vv) {
25804
+ return new IkasVariantValue({
25805
+ id: vv.id,
25806
+ name: vv.name,
25807
+ colorCode: vv.colorCode,
25808
+ thumbnailImageId: vv.thumbnailImageId,
25809
+ variantTypeId: vt.id,
25810
+ });
25811
+ }),
25812
+ });
25813
+ })];
25814
+ case 3:
25815
+ err_1 = _b.sent();
25816
+ console.log(err_1);
25817
+ return [3 /*break*/, 4];
25818
+ case 4: return [2 /*return*/, []];
25819
+ }
25820
+ });
25821
+ });
25822
+ };
25823
+ return IkasVariantTypeAPI;
25824
+ }());
25825
+ var templateObject_1$g;
25826
+
26084
25827
  function styleInject(css, ref) {
26085
25828
  if ( ref === void 0 ) ref = {};
26086
25829
  var insertAt = ref.insertAt;
@@ -28372,8 +28115,8 @@ var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void
28372
28115
  ];
28373
28116
  brandCategoryMetaData = metaData.filter(function (m) { return m.targetType && targetTypes.includes(m.targetType); });
28374
28117
  productMetaData = metaData.filter(function (m) { return m.targetType && m.targetType === exports.IkasHTMLMetaDataTargetType.PRODUCT; });
28375
- return [4 /*yield*/, IkasProductAPI.listProducts({
28376
- idList: productMetaData.map(function (p) { return p.targetId; }),
28118
+ return [4 /*yield*/, IkasProductSearchAPI.searchProducts({
28119
+ productIdList: productMetaData.map(function (p) { return p.targetId; }),
28377
28120
  })];
28378
28121
  case 2:
28379
28122
  productsResponse = _b.sent();
@@ -28399,7 +28142,7 @@ var getStaticPaths = function (context) { return __awaiter(void 0, void 0, void
28399
28142
  }
28400
28143
  }
28401
28144
  };
28402
- for (_i = 0, _a = productsResponse.products; _i < _a.length; _i++) {
28145
+ for (_i = 0, _a = (productsResponse === null || productsResponse === void 0 ? void 0 : productsResponse.data) || []; _i < _a.length; _i++) {
28403
28146
  product = _a[_i];
28404
28147
  _loop_1(product);
28405
28148
  }
@@ -29003,7 +28746,6 @@ exports.IkasPageDataProvider = IkasPageDataProvider;
29003
28746
  exports.IkasPageEditor = IkasPageEditor;
29004
28747
  exports.IkasPageHead = IkasPageHead;
29005
28748
  exports.IkasProduct = IkasProduct;
29006
- exports.IkasProductAPI = IkasProductAPI;
29007
28749
  exports.IkasProductAttribute = IkasProductAttribute;
29008
28750
  exports.IkasProductAttributeAPI = IkasProductAttributeAPI;
29009
28751
  exports.IkasProductAttributeValue = IkasProductAttributeValue;
@@ -1,8 +1,8 @@
1
1
  import { IkasCategory, IkasCategoryPropValue } from "../../../models/index";
2
2
  import IkasPropValueProvider from "./index";
3
- export declare class IkasCategoryPropValueProvider implements IkasPropValueProvider<IkasCategory> {
3
+ export declare class IkasCategoryPropValueProvider implements IkasPropValueProvider<IkasCategory | null> {
4
4
  private categoryPropValue;
5
5
  private pageSpecificData?;
6
6
  constructor(prop: IkasCategoryPropValue, pageSpecificData?: any);
7
- getValue(): Promise<IkasCategory>;
7
+ getValue(): Promise<IkasCategory | null>;
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.88",
3
+ "version": "0.0.89",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",
@@ -1,92 +0,0 @@
1
- import { StringFilterInput, PaginationInput, CategoryFilterInput, ProductTypeEnum, HTMLMetaDataTargetTypeEnum } from "../../../__generated__/global-types";
2
- export interface listProduct_listProduct_data_metaData {
3
- __typename: "HTMLMetaData";
4
- slug: string;
5
- pageTitle: string | null;
6
- description: string | null;
7
- targetId: string | null;
8
- targetType: HTMLMetaDataTargetTypeEnum | null;
9
- redirectTo: string | null;
10
- }
11
- export interface listProduct_listProduct_data_productVariantTypes {
12
- __typename: "ProductVariantType";
13
- order: number;
14
- variantTypeId: string;
15
- variantValueIds: string[] | null;
16
- }
17
- export interface listProduct_listProduct_data_variants_variantValueIds {
18
- __typename: "VariantValueRelation";
19
- variantTypeId: string;
20
- variantValueId: string;
21
- }
22
- export interface listProduct_listProduct_data_variants_attributes {
23
- __typename: "ProductAttributeValue";
24
- value: string | null;
25
- productAttributeId: string | null;
26
- productAttributeOptionId: string | null;
27
- }
28
- export interface listProduct_listProduct_data_variants_images {
29
- __typename: "ProductImage";
30
- order: number;
31
- isMain: boolean;
32
- imageId: string | null;
33
- }
34
- export interface listProduct_listProduct_data_variants_prices {
35
- __typename: "ProductPrice";
36
- sellPrice: number;
37
- discountPrice: number | null;
38
- buyPrice: number | null;
39
- currency: string | null;
40
- }
41
- export interface listProduct_listProduct_data_variants {
42
- __typename: "Variant";
43
- id: string;
44
- createdAt: any | null;
45
- updatedAt: any | null;
46
- deleted: boolean | null;
47
- sku: string | null;
48
- barcodeList: string[] | null;
49
- isActive: boolean | null;
50
- variantValueIds: listProduct_listProduct_data_variants_variantValueIds[] | null;
51
- attributes: listProduct_listProduct_data_variants_attributes[] | null;
52
- images: listProduct_listProduct_data_variants_images[] | null;
53
- prices: listProduct_listProduct_data_variants_prices[];
54
- }
55
- export interface listProduct_listProduct_data_attributes {
56
- __typename: "ProductAttributeValue";
57
- value: string | null;
58
- productAttributeId: string | null;
59
- productAttributeOptionId: string | null;
60
- }
61
- export interface listProduct_listProduct_data {
62
- __typename: "Product";
63
- id: string;
64
- createdAt: any | null;
65
- updatedAt: any | null;
66
- deleted: boolean | null;
67
- name: string;
68
- type: ProductTypeEnum;
69
- shortDescription: string | null;
70
- description: string | null;
71
- metaData: listProduct_listProduct_data_metaData | null;
72
- brandId: string | null;
73
- categoryIds: string[] | null;
74
- productVariantTypes: listProduct_listProduct_data_productVariantTypes[] | null;
75
- variants: listProduct_listProduct_data_variants[];
76
- attributes: listProduct_listProduct_data_attributes[] | null;
77
- }
78
- export interface listProduct_listProduct {
79
- __typename: "ProductPaginationResponse";
80
- data: listProduct_listProduct_data[];
81
- count: number;
82
- }
83
- export interface listProduct {
84
- listProduct: listProduct_listProduct;
85
- }
86
- export interface listProductVariables {
87
- id?: StringFilterInput | null;
88
- pagination?: PaginationInput | null;
89
- search?: string | null;
90
- brandId?: StringFilterInput | null;
91
- categoryIds?: CategoryFilterInput | null;
92
- }
@@ -1,17 +0,0 @@
1
- import { IkasProduct } from "../../models/index";
2
- export declare class IkasProductAPI {
3
- static listProducts(params?: ListProductsParams): Promise<ListProductsResponse>;
4
- }
5
- declare type ListProductsParams = {
6
- idList?: string[];
7
- page?: number;
8
- limit?: number;
9
- search?: string;
10
- brandId?: string;
11
- categoryIds?: string[];
12
- };
13
- declare type ListProductsResponse = {
14
- products: IkasProduct[];
15
- count: number;
16
- };
17
- export {};