goods-exporter 1.4.5 → 1.4.7

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.
@@ -334,6 +334,7 @@ class InsalesFormatter {
334
334
  "\u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F",
335
335
  "\u0421\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 \u0432\u0438\u0434\u0435\u043E",
336
336
  "\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440: \u0410\u0440\u0442\u0438\u043A\u0443\u043B",
337
+ "\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440: \u041F\u043E\u043B (\u0421\u0438\u0441\u0442\u0435\u043C\u043D\u044B\u0439)",
337
338
  "\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B",
338
339
  "\u0421\u0432\u043E\u0439\u0441\u0442\u0432\u0430",
339
340
  "\u0420\u0430\u0437\u043C\u0435\u0440\u043D\u0430\u044F \u0441\u0435\u0442\u043A\u0430",
@@ -379,7 +380,8 @@ class InsalesFormatter {
379
380
  \u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F: product.parentId === void 0 ? void 0 : product.images?.join(" "),
380
381
  "\u0421\u0441\u044B\u043B\u043A\u0430 \u043D\u0430 \u0432\u0438\u0434\u0435\u043E": product.videos ? product.videos[0] : void 0,
381
382
  "\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440: \u0410\u0440\u0442\u0438\u043A\u0443\u043B": product.vendorCode,
382
- // TODO: брать из обычных параметров
383
+ // TODO: брать из обычных параметров,
384
+ "\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440: \u041F\u043E\u043B (\u0421\u0438\u0441\u0442\u0435\u043C\u043D\u044B\u0439)": product.gender,
383
385
  ...getParams(product),
384
386
  ...getProperties(product),
385
387
  "\u0420\u0430\u0437\u043C\u0435\u0440\u043D\u0430\u044F \u0441\u0435\u0442\u043A\u0430": JSON.stringify(product.sizes),
@@ -422,7 +424,23 @@ class PriceFormatter {
422
424
  async format(writableStream, products, _categories, _brands, _) {
423
425
  const priceMap = /* @__PURE__ */ new Map();
424
426
  products.forEach((product) => {
425
- const existing = priceMap.get(product.productId);
427
+ if (!priceMap.has(product.productId)) {
428
+ priceMap.set(product.productId, {
429
+ productId: product.productId,
430
+ skus: []
431
+ });
432
+ }
433
+ const productPrice = priceMap.get(product.productId);
434
+ if (!productPrice) {
435
+ console.error(`Product ${product.productId} not found in price map`);
436
+ return;
437
+ }
438
+ if (!product.price) {
439
+ return;
440
+ }
441
+ if (product.variantId === productPrice.productId) {
442
+ return;
443
+ }
426
444
  const sku = {
427
445
  skuId: String(product.variantId),
428
446
  price: product.price,
@@ -435,14 +453,7 @@ class PriceFormatter {
435
453
  max: product.timeDelivery.max ?? 0
436
454
  };
437
455
  }
438
- if (existing) {
439
- existing.skus.push(sku);
440
- } else {
441
- priceMap.set(product.productId, {
442
- productId: product.productId,
443
- skus: [sku]
444
- });
445
- }
456
+ productPrice.skus.push(sku);
446
457
  });
447
458
  const result = Array.from(priceMap.values());
448
459
  const stream = new JsonStreamStringify(result);