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