UNPKG

@tuanltntu/n8n-nodes-bitrix24

Version:

Comprehensive n8n community node for Bitrix24 API integration with CRM, Tasks, Chat, Telephony, and more

315 lines 8.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.productOperationFields = exports.productOperations = void 0; const ModuleManager_1 = require("../ModuleManager"); // Product operations const operationField = ModuleManager_1.ModuleManager.createSimpleField({ displayName: "Operation", name: "operation", type: "options", noDataExpression: true, options: [ { name: "Get", value: "get", description: "Get product", action: "Get a product", }, { name: "Get All", value: "getAll", description: "Get all products", action: "Get all products", }, { name: "Create", value: "create", description: "Create product", action: "Create a product", }, { name: "Update", value: "update", description: "Update product", action: "Update a product", }, { name: "Delete", value: "delete", description: "Delete product", action: "Delete a product", }, { name: "Get Fields", value: "getFields", description: "Get product fields", action: "Get product fields", }, ], default: "getAll", }, ModuleManager_1.BITRIX24_MODULES.PRODUCT); // Product ID field const productIdField = ModuleManager_1.ModuleManager.createSimpleField({ displayName: "Product ID", name: "productId", type: "string", required: true, default: "", description: "ID of the product", }, ModuleManager_1.BITRIX24_MODULES.PRODUCT, { operation: ["get", "update", "delete"], }); // Catalog ID field const catalogIdField = ModuleManager_1.ModuleManager.createSimpleField({ displayName: "Catalog ID", name: "catalogId", type: "string", required: true, default: "", description: "ID of the catalog", }, ModuleManager_1.BITRIX24_MODULES.PRODUCT, { operation: ["get", "update", "delete"], }); // Name field const nameField = ModuleManager_1.ModuleManager.createSimpleField({ displayName: "Name", name: "name", type: "string", required: true, default: "", description: "Name of the product", }, ModuleManager_1.BITRIX24_MODULES.PRODUCT, { operation: ["create"], }); // Currency field const currencyField = ModuleManager_1.ModuleManager.createSimpleField({ displayName: "Currency", name: "currency", type: "options", options: [ { name: "USD", value: "USD" }, { name: "EUR", value: "EUR" }, { name: "RUB", value: "RUB" }, { name: "UAH", value: "UAH" }, { name: "BYN", value: "BYN" }, { name: "KZT", value: "KZT" }, ], default: "USD", description: "Currency of the product", }, ModuleManager_1.BITRIX24_MODULES.PRODUCT, { operation: ["create"], }); // Price field const priceField = ModuleManager_1.ModuleManager.createSimpleField({ displayName: "Price", name: "price", type: "number", default: 0, description: "Price of the product", typeOptions: { minValue: 0, }, }, ModuleManager_1.BITRIX24_MODULES.PRODUCT, { operation: ["create"], }); // Return All field const returnAllField = ModuleManager_1.ModuleManager.createSimpleField({ displayName: "Return All", name: "returnAll", type: "boolean", default: false, description: "Whether to return all results or only up to a given limit", }, ModuleManager_1.BITRIX24_MODULES.PRODUCT, { operation: ["getAll"], }); // Limit field const limitField = ModuleManager_1.ModuleManager.createSimpleField({ displayName: "Limit", name: "limit", type: "number", default: 50, description: "Max number of results to return", typeOptions: { minValue: 1, }, }, ModuleManager_1.BITRIX24_MODULES.PRODUCT, { operation: ["getAll"], returnAll: [false], }); // Update fields collection const updateFieldsCollection = ModuleManager_1.ModuleManager.createSimpleCollection("Update Fields", ModuleManager_1.BITRIX24_MODULES.PRODUCT, { operation: ["update"] }, [ { displayName: "Name", name: "name", type: "string", default: "", description: "Name of the product", }, { displayName: "Currency", name: "currency", type: "string", default: "", description: "Currency of the product", }, { displayName: "Price", name: "price", type: "number", default: 0, description: "Price of the product", }, { displayName: "Description", name: "description", type: "string", default: "", description: "Description of the product", }, { displayName: "Sort", name: "sort", type: "number", default: 100, description: "Sort order", }, { displayName: "Active", name: "active", type: "options", options: [ { name: "Yes", value: "Y" }, { name: "No", value: "N" }, ], default: "Y", description: "Whether the product is active", }, ]); // Additional fields collection const additionalFieldsCollection = ModuleManager_1.ModuleManager.createSimpleCollection("Additional Fields", ModuleManager_1.BITRIX24_MODULES.PRODUCT, { operation: ["create"] }, [ { displayName: "Description", name: "description", type: "string", default: "", description: "Description of the product", }, { displayName: "Sort", name: "sort", type: "number", default: 100, description: "Sort order", }, { displayName: "Active", name: "active", type: "options", options: [ { name: "Yes", value: "Y" }, { name: "No", value: "N" }, ], default: "Y", description: "Whether the product is active", }, { displayName: "VAT ID", name: "vatId", type: "string", default: "", description: "VAT ID for the product", }, { displayName: "VAT Included", name: "vatIncluded", type: "options", options: [ { name: "Yes", value: "Y" }, { name: "No", value: "N" }, ], default: "N", description: "Whether VAT is included in the price", }, { displayName: "Measure Code", name: "measureCode", type: "string", default: "", description: "Measure code for the product", }, { displayName: "Measure Name", name: "measureName", type: "string", default: "", description: "Measure name for the product", }, { displayName: "XML ID", name: "xmlId", type: "string", default: "", description: "External ID for integration", }, { displayName: "Preview Picture", name: "previewPicture", type: "string", default: "", description: "Preview picture URL or file ID", }, { displayName: "Detail Picture", name: "detailPicture", type: "string", default: "", description: "Detail picture URL or file ID", }, ]); // Options collection const optionsCollection = ModuleManager_1.ModuleManager.createSimpleCollection("Options", ModuleManager_1.BITRIX24_MODULES.PRODUCT, {}, [ { displayName: "Access Token", name: "accessToken", type: "string", default: "", description: "Access token for authentication", }, { displayName: "Filter", name: "filter", type: "json", default: "{}", description: "Filter criteria", }, { displayName: "Select", name: "select", type: "string", default: "", description: "Comma-separated list of fields to select", }, { displayName: "Order", name: "order", type: "json", default: "{}", description: "Order criteria", }, ]); exports.productOperations = [ operationField, productIdField, catalogIdField, nameField, currencyField, priceField, returnAllField, limitField, updateFieldsCollection, additionalFieldsCollection, optionsCollection, ]; // Export legacy field names for backward compatibility exports.productOperationFields = exports.productOperations; //# sourceMappingURL=ProductDescription.js.map