UNPKG

@aurigma/design-atoms

Version:

Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.

29 lines 1.2 kB
import { BaseProductCommand } from "./BaseProductCommand"; import { NotImplementedException } from "@aurigma/design-atoms-model/Exception"; import { ItemUtils } from "../../Utils/ItemUtils"; import { ItemsCommand } from "@aurigma/design-atoms-interfaces"; export class FillPlaceholdersCommand extends BaseProductCommand { constructor(historyArgs, product, args, _commandManager) { super(product, historyArgs, args); this._commandManager = _commandManager; } async _executeCommandBody() { const emptyPlaceholders = ItemUtils.getEmptyPlaceholdersFromProduct(this._product); const dataList = this._args.metadataList.map((data, index) => ({ imageData: data, item: emptyPlaceholders[index] })) .filter(listItem => listItem.item != null); await this._commandManager.execute(ItemsCommand.setImageMetadata, { dataList: dataList }); return dataList.map(d => d.item); } redo() { throw new NotImplementedException(); } undo() { throw new NotImplementedException(); } } //# sourceMappingURL=FillPlaceholdersCommand.js.map