@haus-tech/product-import-export-plugin 3.0.17 → 3.0.18
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.
- package/dist/providers/import-providers/import-parser.d.ts +1 -0
- package/dist/providers/import-providers/import-parser.js +1 -0
- package/dist/providers/import-providers/product-importer.js +8 -1
- package/dist/services/product-export.service.js +2 -1
- package/dist/ui/components/export-dialog.component.d.ts +1 -1
- package/dist/ui/components/export-dialog.component.js +1 -0
- package/dist/ui/components/export-dialog.component.ts +2 -0
- package/package.json +1 -1
|
@@ -377,6 +377,7 @@ let ImportParser = class ImportParser {
|
|
|
377
377
|
price: r.price ? parseNumber(r.price) : undefined,
|
|
378
378
|
taxCategory: parseString(r.taxCategory),
|
|
379
379
|
stockOnHand: parseNumber(r.stockOnHand),
|
|
380
|
+
enabled: parseBoolean(r.enabled),
|
|
380
381
|
trackInventory: r.trackInventory == null || r.trackInventory === ''
|
|
381
382
|
? generated_types_1.GlobalFlag.INHERIT
|
|
382
383
|
: parseBoolean(r.trackInventory)
|
|
@@ -251,6 +251,9 @@ let ProductImporter = class ProductImporter {
|
|
|
251
251
|
});
|
|
252
252
|
}
|
|
253
253
|
await this.fastImporter.initialize(ctx.channel);
|
|
254
|
+
const allVariantSkus = rows
|
|
255
|
+
.map((row) => row.variants.map((variant) => variant.sku))
|
|
256
|
+
.reduce((acc, val) => acc.concat(val), []);
|
|
254
257
|
for (const { product, variants } of rows) {
|
|
255
258
|
const productMainTranslation = this.getTranslationByCodeOrFirst(product.translations, ctx.languageCode);
|
|
256
259
|
const assetsToImport = (0, lodash_1.compact)(product.assetPaths.map((assetPath, idx) => {
|
|
@@ -280,7 +283,10 @@ let ProductImporter = class ProductImporter {
|
|
|
280
283
|
const foundVariants = await this.connection.getRepository(ctx, core_1.ProductVariant).findBy({
|
|
281
284
|
sku: (0, typeorm_1.In)(variantSkus),
|
|
282
285
|
});
|
|
283
|
-
|
|
286
|
+
const variantsWhereDeletedAtUndefined = foundVariants.filter((v) => {
|
|
287
|
+
return !v.deletedAt;
|
|
288
|
+
});
|
|
289
|
+
if (variantsWhereDeletedAtUndefined.length) {
|
|
284
290
|
checkExistingProduct = { id: foundVariants[0].productId };
|
|
285
291
|
}
|
|
286
292
|
}
|
|
@@ -463,6 +469,7 @@ let ProductImporter = class ProductImporter {
|
|
|
463
469
|
taxCategoryId: this.getMatchingTaxCategoryId(variant.taxCategory, taxCategories.items),
|
|
464
470
|
stockOnHand: variant.stockOnHand,
|
|
465
471
|
trackInventory: variant.trackInventory,
|
|
472
|
+
enabled: variant.enabled,
|
|
466
473
|
optionIds,
|
|
467
474
|
translations: await Promise.all(variant.translations.map(async (translation) => {
|
|
468
475
|
const productTranslation = product.translations.find((t) => t.languageCode === translation.languageCode);
|
|
@@ -86,7 +86,7 @@ let ProductExportService = class ProductExportService {
|
|
|
86
86
|
headers.push({ id: 'assets', title: 'assets' }, ...languages.map((lang) => ({ id: `facets:${lang}`, title: `facets:${lang}` })), ...languages.map((lang) => ({ id: `optionGroups:${lang}`, title: `optionGroups:${lang}` })), ...languages.map((lang) => ({ id: `optionValues:${lang}`, title: `optionValues:${lang}` })), { id: 'sku', title: 'sku' }, { id: 'price', title: 'price' }, { id: 'taxCategory', title: 'taxCategory' }, { id: 'stockOnHand', title: 'stockOnHand' }, { id: 'trackInventory', title: 'trackInventory' }, { id: 'variantAssets', title: 'variantAssets' }, ...languages.map((lang) => ({ id: `variantFacets:${lang}`, title: `variantFacets:${lang}` })), ...filteredCustomFieldNames.map((field) => ({
|
|
87
87
|
id: field,
|
|
88
88
|
title: field,
|
|
89
|
-
})));
|
|
89
|
+
})), { id: 'enabled', title: 'enabled' });
|
|
90
90
|
const selectedExportFieldsArray = selectedExportFields.split(',');
|
|
91
91
|
const selectedExportFieldsSet = new Set(selectedExportFieldsArray);
|
|
92
92
|
const filteredHeaders = headers.filter((header) => {
|
|
@@ -212,6 +212,7 @@ let ProductExportService = class ProductExportService {
|
|
|
212
212
|
record.stockOnHand = stockOnHand;
|
|
213
213
|
record.trackInventory = variant.trackInventory.toLowerCase();
|
|
214
214
|
record.variantAssets = variantAssets;
|
|
215
|
+
record.enabled = variant.enabled.toString();
|
|
215
216
|
for (const field of filteredCustomFieldNames) {
|
|
216
217
|
const [entity, fieldName, type] = field.split(':');
|
|
217
218
|
if (entity === 'product') {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ElementRef, AfterViewInit, OnInit } from '@angular/core';
|
|
2
2
|
import { Dialog } from '@vendure/admin-ui/core';
|
|
3
3
|
type ProductFields = 'productId' | 'name' | 'slug' | 'description' | 'assets' | 'facets' | 'optionGroups';
|
|
4
|
-
type VariantFields = 'sku' | 'optionValues' | 'price' | 'taxCategory' | 'stockOnHand' | 'trackInventory' | 'variantAssets' | 'variantFacets';
|
|
4
|
+
type VariantFields = 'sku' | 'optionValues' | 'price' | 'taxCategory' | 'stockOnHand' | 'trackInventory' | 'variantAssets' | 'variantFacets' | 'enabled';
|
|
5
5
|
type ExportFields = Array<ProductFields | VariantFields>;
|
|
6
6
|
interface PluginInitOptions {
|
|
7
7
|
defaultFileName?: string;
|
|
@@ -22,6 +22,7 @@ type VariantFields =
|
|
|
22
22
|
| 'trackInventory'
|
|
23
23
|
| 'variantAssets'
|
|
24
24
|
| 'variantFacets'
|
|
25
|
+
| 'enabled'
|
|
25
26
|
|
|
26
27
|
type ExportFields = Array<ProductFields | VariantFields>
|
|
27
28
|
interface PluginInitOptions {
|
|
@@ -81,6 +82,7 @@ export class ExportDialogComponent
|
|
|
81
82
|
'trackInventory',
|
|
82
83
|
'variantAssets',
|
|
83
84
|
'variantFacets',
|
|
85
|
+
'enabled',
|
|
84
86
|
]
|
|
85
87
|
|
|
86
88
|
config: PluginInitOptions
|