@ikas/storefront 0.0.16 → 0.0.17

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.
@@ -70,6 +70,7 @@ export interface listProduct_listProduct_data {
70
70
  description: string | null;
71
71
  taxValue: number | null;
72
72
  metaData: listProduct_listProduct_data_metaData | null;
73
+ brandId: string | null;
73
74
  categoryIds: string[] | null;
74
75
  productVariantTypes: listProduct_listProduct_data_productVariantTypes[] | null;
75
76
  variants: listProduct_listProduct_data_variants[];
package/build/index.es.js CHANGED
@@ -12275,9 +12275,9 @@ var IkasImage = /** @class */ (function () {
12275
12275
  Object.defineProperty(IkasImage.prototype, "src", {
12276
12276
  get: function () {
12277
12277
  if (this.id.includes("/"))
12278
- return "" + process.env.NEXT_PUBLIC_IMG_BASE_URL + this.id + "/1024/1024/img.webp";
12278
+ return "" + process.env.NEXT_PUBLIC_IMG_BASE_URL + this.id + "/1920/1920/img.webp";
12279
12279
  var merchantId = decodeBase64(this.editorApiKey || IkasStorefrontConfig.config.apiKey || "");
12280
- return "" + process.env.NEXT_PUBLIC_IMG_BASE_URL + merchantId + "/" + this.id + "/1024/1024/img.webp";
12280
+ return "" + process.env.NEXT_PUBLIC_IMG_BASE_URL + merchantId + "/" + this.id + "/1920/1920/img.webp";
12281
12281
  },
12282
12282
  enumerable: false,
12283
12283
  configurable: true
@@ -13133,7 +13133,7 @@ var IkasProduct = /** @class */ (function () {
13133
13133
  this.metaData = data.metaData
13134
13134
  ? new IkasHTMLMetaData(data.metaData)
13135
13135
  : undefined;
13136
- this.brand = data.brand || null;
13136
+ this.brand = data.brand ? new IkasBrand(data.brand) : null;
13137
13137
  this.categories = data.categories
13138
13138
  ? data.categories.map(function (c) { return new IkasCategory(c); })
13139
13139
  : [];
@@ -19312,14 +19312,14 @@ var IkasProductAPI = /** @class */ (function () {
19312
19312
  }
19313
19313
  IkasProductAPI.listProducts = function (params) {
19314
19314
  return __awaiter(this, void 0, void 0, function () {
19315
- var LIST_PRODUCTS, variables, _a, data, errors, products, count, categoryIds, variantTypeIds, stockLocation, stocks_1, variantIdList_1, productStockLocations, categoriesResponse_1, variantTypes_1, err_1;
19315
+ 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;
19316
19316
  return __generator(this, function (_b) {
19317
19317
  switch (_b.label) {
19318
19318
  case 0:
19319
- LIST_PRODUCTS = src(templateObject_1$d || (templateObject_1$d = __makeTemplateObject(["\n query listProduct(\n $id: StringFilterInput\n $paginationInput: PaginationInput\n $search: String\n ) {\n listProduct(\n id: $id\n paginationInput: $paginationInput\n search: $search\n ) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n type\n shortDescription\n description\n taxValue\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\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 $paginationInput: PaginationInput\n $search: String\n ) {\n listProduct(\n id: $id\n paginationInput: $paginationInput\n search: $search\n ) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n type\n shortDescription\n description\n taxValue\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\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 "])));
19319
+ LIST_PRODUCTS = src(templateObject_1$d || (templateObject_1$d = __makeTemplateObject(["\n query listProduct(\n $id: StringFilterInput\n $paginationInput: PaginationInput\n $search: String\n ) {\n listProduct(\n id: $id\n paginationInput: $paginationInput\n search: $search\n ) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n type\n shortDescription\n description\n taxValue\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 $paginationInput: PaginationInput\n $search: String\n ) {\n listProduct(\n id: $id\n paginationInput: $paginationInput\n search: $search\n ) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n type\n shortDescription\n description\n taxValue\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 "])));
19320
19320
  _b.label = 1;
19321
19321
  case 1:
19322
- _b.trys.push([1, 8, , 9]);
19322
+ _b.trys.push([1, 9, , 10]);
19323
19323
  variables = {
19324
19324
  search: params === null || params === void 0 ? void 0 : params.search,
19325
19325
  };
@@ -19351,6 +19351,9 @@ var IkasProductAPI = /** @class */ (function () {
19351
19351
  }
19352
19352
  products = data.listProduct.data;
19353
19353
  count = data.listProduct.count;
19354
+ brandIds = products
19355
+ .map(function (p) { return p.brandId; })
19356
+ .filter(function (id) { return !id; });
19354
19357
  categoryIds = flatten_1(products.map(function (p) { return p.categoryIds || []; }));
19355
19358
  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; })) || []; }));
19356
19359
  return [4 /*yield*/, IkasStockLocationAPI.listStockLocation()];
@@ -19374,15 +19377,22 @@ var IkasProductAPI = /** @class */ (function () {
19374
19377
  stocks_1[psl.variantId] = psl.stockCount;
19375
19378
  });
19376
19379
  _b.label = 5;
19377
- case 5: return [4 /*yield*/, IkasCategoryAPI.listCategories({
19378
- idList: categoryIds,
19380
+ case 5: return [4 /*yield*/, IkasBrandAPI.listBrands({
19381
+ idList: brandIds,
19379
19382
  page: 1,
19380
- limit: categoryIds.length,
19383
+ limit: brandIds.length,
19381
19384
  })];
19382
19385
  case 6:
19386
+ brandsResponse_1 = _b.sent();
19387
+ return [4 /*yield*/, IkasCategoryAPI.listCategories({
19388
+ idList: categoryIds,
19389
+ page: 1,
19390
+ limit: categoryIds.length,
19391
+ })];
19392
+ case 7:
19383
19393
  categoriesResponse_1 = _b.sent();
19384
19394
  return [4 /*yield*/, IkasVariantTypeAPI.listVariantTypes(variantTypeIds)];
19385
- case 7:
19395
+ case 8:
19386
19396
  variantTypes_1 = _b.sent();
19387
19397
  return [2 /*return*/, {
19388
19398
  products: products.map(function (p) {
@@ -19395,6 +19405,9 @@ var IkasProductAPI = /** @class */ (function () {
19395
19405
  shortDescription: p.shortDescription || undefined,
19396
19406
  taxValue: p.taxValue,
19397
19407
  metaData: new IkasHTMLMetaData(p.metaData),
19408
+ brand: p.brandId
19409
+ ? brandsResponse_1.brands.find(function (b) { return b.id === p.brandId; })
19410
+ : null,
19398
19411
  categories: p.categoryIds
19399
19412
  ? p.categoryIds.map(function (categoryId) {
19400
19413
  return categoriesResponse_1.categories.find(function (c) { return c.id === categoryId; });
@@ -19429,11 +19442,11 @@ var IkasProductAPI = /** @class */ (function () {
19429
19442
  }),
19430
19443
  count: count,
19431
19444
  }];
19432
- case 8:
19445
+ case 9:
19433
19446
  err_1 = _b.sent();
19434
19447
  console.log(err_1);
19435
- return [3 /*break*/, 9];
19436
- case 9: return [2 /*return*/, {
19448
+ return [3 /*break*/, 10];
19449
+ case 10: return [2 /*return*/, {
19437
19450
  products: [],
19438
19451
  count: 0,
19439
19452
  }];
package/build/index.js CHANGED
@@ -12288,9 +12288,9 @@ var IkasImage = /** @class */ (function () {
12288
12288
  Object.defineProperty(IkasImage.prototype, "src", {
12289
12289
  get: function () {
12290
12290
  if (this.id.includes("/"))
12291
- return "" + process.env.NEXT_PUBLIC_IMG_BASE_URL + this.id + "/1024/1024/img.webp";
12291
+ return "" + process.env.NEXT_PUBLIC_IMG_BASE_URL + this.id + "/1920/1920/img.webp";
12292
12292
  var merchantId = decodeBase64(this.editorApiKey || IkasStorefrontConfig.config.apiKey || "");
12293
- return "" + process.env.NEXT_PUBLIC_IMG_BASE_URL + merchantId + "/" + this.id + "/1024/1024/img.webp";
12293
+ return "" + process.env.NEXT_PUBLIC_IMG_BASE_URL + merchantId + "/" + this.id + "/1920/1920/img.webp";
12294
12294
  },
12295
12295
  enumerable: false,
12296
12296
  configurable: true
@@ -13129,7 +13129,7 @@ var IkasProduct = /** @class */ (function () {
13129
13129
  this.metaData = data.metaData
13130
13130
  ? new IkasHTMLMetaData(data.metaData)
13131
13131
  : undefined;
13132
- this.brand = data.brand || null;
13132
+ this.brand = data.brand ? new IkasBrand(data.brand) : null;
13133
13133
  this.categories = data.categories
13134
13134
  ? data.categories.map(function (c) { return new IkasCategory(c); })
13135
13135
  : [];
@@ -19296,14 +19296,14 @@ var IkasProductAPI = /** @class */ (function () {
19296
19296
  }
19297
19297
  IkasProductAPI.listProducts = function (params) {
19298
19298
  return __awaiter(this, void 0, void 0, function () {
19299
- var LIST_PRODUCTS, variables, _a, data, errors, products, count, categoryIds, variantTypeIds, stockLocation, stocks_1, variantIdList_1, productStockLocations, categoriesResponse_1, variantTypes_1, err_1;
19299
+ 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;
19300
19300
  return __generator(this, function (_b) {
19301
19301
  switch (_b.label) {
19302
19302
  case 0:
19303
- LIST_PRODUCTS = src(templateObject_1$d || (templateObject_1$d = __makeTemplateObject(["\n query listProduct(\n $id: StringFilterInput\n $paginationInput: PaginationInput\n $search: String\n ) {\n listProduct(\n id: $id\n paginationInput: $paginationInput\n search: $search\n ) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n type\n shortDescription\n description\n taxValue\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\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 $paginationInput: PaginationInput\n $search: String\n ) {\n listProduct(\n id: $id\n paginationInput: $paginationInput\n search: $search\n ) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n type\n shortDescription\n description\n taxValue\n metaData {\n slug\n pageTitle\n description\n targetId\n targetType\n redirectTo\n }\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 "])));
19303
+ LIST_PRODUCTS = src(templateObject_1$d || (templateObject_1$d = __makeTemplateObject(["\n query listProduct(\n $id: StringFilterInput\n $paginationInput: PaginationInput\n $search: String\n ) {\n listProduct(\n id: $id\n paginationInput: $paginationInput\n search: $search\n ) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n type\n shortDescription\n description\n taxValue\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 $paginationInput: PaginationInput\n $search: String\n ) {\n listProduct(\n id: $id\n paginationInput: $paginationInput\n search: $search\n ) {\n data {\n id\n createdAt\n updatedAt\n deleted\n name\n type\n shortDescription\n description\n taxValue\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 "])));
19304
19304
  _b.label = 1;
19305
19305
  case 1:
19306
- _b.trys.push([1, 8, , 9]);
19306
+ _b.trys.push([1, 9, , 10]);
19307
19307
  variables = {
19308
19308
  search: params === null || params === void 0 ? void 0 : params.search,
19309
19309
  };
@@ -19335,6 +19335,9 @@ var IkasProductAPI = /** @class */ (function () {
19335
19335
  }
19336
19336
  products = data.listProduct.data;
19337
19337
  count = data.listProduct.count;
19338
+ brandIds = products
19339
+ .map(function (p) { return p.brandId; })
19340
+ .filter(function (id) { return !id; });
19338
19341
  categoryIds = flatten_1(products.map(function (p) { return p.categoryIds || []; }));
19339
19342
  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; })) || []; }));
19340
19343
  return [4 /*yield*/, IkasStockLocationAPI.listStockLocation()];
@@ -19358,15 +19361,22 @@ var IkasProductAPI = /** @class */ (function () {
19358
19361
  stocks_1[psl.variantId] = psl.stockCount;
19359
19362
  });
19360
19363
  _b.label = 5;
19361
- case 5: return [4 /*yield*/, IkasCategoryAPI.listCategories({
19362
- idList: categoryIds,
19364
+ case 5: return [4 /*yield*/, IkasBrandAPI.listBrands({
19365
+ idList: brandIds,
19363
19366
  page: 1,
19364
- limit: categoryIds.length,
19367
+ limit: brandIds.length,
19365
19368
  })];
19366
19369
  case 6:
19370
+ brandsResponse_1 = _b.sent();
19371
+ return [4 /*yield*/, IkasCategoryAPI.listCategories({
19372
+ idList: categoryIds,
19373
+ page: 1,
19374
+ limit: categoryIds.length,
19375
+ })];
19376
+ case 7:
19367
19377
  categoriesResponse_1 = _b.sent();
19368
19378
  return [4 /*yield*/, IkasVariantTypeAPI.listVariantTypes(variantTypeIds)];
19369
- case 7:
19379
+ case 8:
19370
19380
  variantTypes_1 = _b.sent();
19371
19381
  return [2 /*return*/, {
19372
19382
  products: products.map(function (p) {
@@ -19379,6 +19389,9 @@ var IkasProductAPI = /** @class */ (function () {
19379
19389
  shortDescription: p.shortDescription || undefined,
19380
19390
  taxValue: p.taxValue,
19381
19391
  metaData: new IkasHTMLMetaData(p.metaData),
19392
+ brand: p.brandId
19393
+ ? brandsResponse_1.brands.find(function (b) { return b.id === p.brandId; })
19394
+ : null,
19382
19395
  categories: p.categoryIds
19383
19396
  ? p.categoryIds.map(function (categoryId) {
19384
19397
  return categoriesResponse_1.categories.find(function (c) { return c.id === categoryId; });
@@ -19413,11 +19426,11 @@ var IkasProductAPI = /** @class */ (function () {
19413
19426
  }),
19414
19427
  count: count,
19415
19428
  }];
19416
- case 8:
19429
+ case 9:
19417
19430
  err_1 = _b.sent();
19418
19431
  console.log(err_1);
19419
- return [3 /*break*/, 9];
19420
- case 9: return [2 /*return*/, {
19432
+ return [3 /*break*/, 10];
19433
+ case 10: return [2 /*return*/, {
19421
19434
  products: [],
19422
19435
  count: 0,
19423
19436
  }];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/storefront",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "main": "./build/index.js",
5
5
  "module": "./build/index.es.js",
6
6
  "author": "Umut Ozan Yıldırım",