diff --git a/.gitignore b/.gitignore index 91e093160a..1b2f93c3f3 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ package-lock.json yarn.lock google-generated-credentials.json _START_PACKAGE +.env +.vscode diff --git a/packages/nodes-base/nodes/ActiveCampaign/ActiveCampaign.node.ts b/packages/nodes-base/nodes/ActiveCampaign/ActiveCampaign.node.ts index e6efe97457..a7b47f6e20 100644 --- a/packages/nodes-base/nodes/ActiveCampaign/ActiveCampaign.node.ts +++ b/packages/nodes-base/nodes/ActiveCampaign/ActiveCampaign.node.ts @@ -1,6 +1,7 @@ import { IExecuteFunctions, } from 'n8n-core'; + import { IDataObject, INodeTypeDescription, @@ -11,8 +12,39 @@ import { import { activeCampaignApiRequest, activeCampaignApiRequestAllItems, + IProduct, } from './GenericFunctions'; +import { + contactOperations, + contactFields +} from './ContactDescription'; + +import { + dealOperations, + dealFields +} from './DealDescription'; + +import { + ecomOrderOperations, + ecomOrderFields +} from './EcomOrderDescription'; + +import { + ecomCustomerOperations, + ecomCustomerFields +} from './EcomCustomerDescription'; + +import { + ecomOrderProductsOperations, + ecomOrderProductsFields +} from './EcomOrderProductsDescription'; + +import { + connectionOperations, + connectionFields +} from './ConnectionDescription'; + interface CustomProperty { name: string; value: string; @@ -59,6 +91,9 @@ export class ActiveCampaign implements INodeType { } ], properties: [ + // ---------------------------------- + // resources + // ---------------------------------- { displayName: 'Resource', name: 'resource', @@ -68,367 +103,73 @@ export class ActiveCampaign implements INodeType { name: 'Contact', value: 'contact', }, + { + name: 'Deal', + value: 'deal', + }, + { + name: 'Connection', + value: 'connection' + }, + { + name: 'E-commerce Order', + value: 'ecommerceOrder', + }, + { + name: 'E-Commerce Customer', + value: 'ecommerceCustomer', + }, + { + name: 'E-commerce Order Products', + value: 'ecommerceOrderProducts' + } ], default: 'contact', description: 'The resource to operate on.', }, - - // ---------------------------------- // operations // ---------------------------------- - { - displayName: 'Operation', - name: 'operation', - type: 'options', - displayOptions: { - show: { - resource: [ - 'contact', - ], - }, - }, - options: [ - { - name: 'Create', - value: 'create', - description: 'Create a contact', - }, - { - name: 'Delete', - value: 'delete', - description: 'Delete a contact', - }, - { - name: 'Get', - value: 'get', - description: 'Get data of a contact', - }, - { - name: 'Get All', - value: 'getAll', - description: 'Get data of all contact', - }, - { - name: 'Update', - value: 'update', - description: 'Update a contact', - }, - ], - default: 'create', - description: 'The operation to perform.', - }, - - + ...contactOperations, + ...dealOperations, + ...connectionOperations, + ...ecomOrderOperations, + ...ecomCustomerOperations, + ...ecomOrderProductsOperations, + // ---------------------------------- + // fields + // ---------------------------------- // ---------------------------------- // contact // ---------------------------------- + ...contactFields, // ---------------------------------- - // contact:create + // deal // ---------------------------------- - { - displayName: 'Email', - name: 'email', - type: 'string', - default: '', - required: true, - displayOptions: { - show: { - operation: [ - 'create', - ], - resource: [ - 'contact', - ], - }, - }, - description: 'The email of the contact to create', - }, - { - displayName: 'Update if exists', - name: 'updateIfExists', - type: 'boolean', - displayOptions: { - show: { - operation: [ - 'create', - ], - resource: [ - 'contact', - ], - }, - }, - default: false, - description: 'Update user if it exists already. If not set and user exists it will error instead.', - }, - { - displayName: 'Additional Fields', - name: 'additionalFields', - type: 'collection', - placeholder: 'Add Field', - displayOptions: { - show: { - operation: [ - 'create', - ], - resource: [ - 'contact', - ], - }, - }, - default: {}, - options: [ - { - displayName: 'First Name', - name: 'firstName', - type: 'string', - default: '', - description: 'The first name of the contact to create', - }, - { - displayName: 'Last Name', - name: 'lastName', - type: 'string', - default: '', - description: 'The last name of the contact to create', - }, - { - displayName: 'Phone', - name: 'phone', - type: 'string', - default: '', - description: 'Phone number of the contact.', - }, - { - displayName: 'Custom Properties', - name: 'customProperties', - placeholder: 'Add Custom Property', - description: 'Adds a custom property to set also values which have not been predefined.', - type: 'fixedCollection', - typeOptions: { - multipleValues: true, - }, - default: {}, - options: [ - { - name: 'property', - displayName: 'Property', - values: [ - { - displayName: 'Property Name', - name: 'name', - type: 'string', - default: '', - description: 'Name of the property to set.', - }, - { - displayName: 'Property Value', - name: 'value', - type: 'string', - default: '', - description: 'Value of the property to set.', - }, - ] - }, - ], - }, - ], - }, + ...dealFields, // ---------------------------------- - // contact:delete + // connection // ---------------------------------- - { - displayName: 'Contact ID', - name: 'contactId', - type: 'number', - displayOptions: { - show: { - operation: [ - 'delete', - ], - resource: [ - 'contact', - ], - }, - }, - default: 0, - required: true, - description: 'ID of the contact to delete.', - }, + ...connectionFields, // ---------------------------------- - // person:get + // ecommerceOrder // ---------------------------------- - { - displayName: 'Contact ID', - name: 'contactId', - type: 'number', - displayOptions: { - show: { - operation: [ - 'get', - ], - resource: [ - 'contact', - ], - }, - }, - default: 0, - required: true, - description: 'ID of the contact to get.', - }, + ...ecomOrderFields, // ---------------------------------- - // contact:getAll + // ecommerceCustomer // ---------------------------------- - { - displayName: 'Return All', - name: 'returnAll', - type: 'boolean', - displayOptions: { - show: { - operation: [ - 'getAll', - ], - resource: [ - 'contact', - ], - }, - }, - default: false, - description: 'If all results should be returned or only up to a given limit.', - }, - { - displayName: 'Limit', - name: 'limit', - type: 'number', - displayOptions: { - show: { - operation: [ - 'getAll', - ], - resource: [ - 'contact', - ], - returnAll: [ - false, - ], - }, - }, - typeOptions: { - minValue: 1, - maxValue: 500, - }, - default: 100, - description: 'How many results to return.', - }, + ...ecomCustomerFields, // ---------------------------------- - // contact:update + // ecommerceOrderProducts // ---------------------------------- - { - displayName: 'Contact ID', - name: 'contactId', - type: 'number', - displayOptions: { - show: { - operation: [ - 'update', - ], - resource: [ - 'contact', - ], - }, - }, - default: 0, - required: true, - description: 'ID of the contact to update.', - }, - { - displayName: 'Update Fields', - name: 'updateFields', - type: 'collection', - description: 'The fields to update.', - placeholder: 'Add Field', - displayOptions: { - show: { - operation: [ - 'update', - ], - resource: [ - 'contact', - ], - }, - }, - default: {}, - options: [ - { - displayName: 'Email', - name: 'email', - type: 'string', - default: '', - description: 'Email of the contact.', - }, - { - displayName: 'First Name', - name: 'firstName', - type: 'string', - default: '', - description: 'First name of the contact', - }, - { - displayName: 'Last Name', - name: 'lastName', - type: 'string', - default: '', - description: 'Last name of the contact', - }, - { - displayName: 'Phone', - name: 'phone', - type: 'string', - default: '', - description: 'Phone number of the contact.', - }, - { - displayName: 'Custom Properties', - name: 'customProperties', - placeholder: 'Add Custom Property', - description: 'Adds a custom property to set also values which have not been predefined.', - type: 'fixedCollection', - typeOptions: { - multipleValues: true, - }, - default: {}, - options: [ - { - name: 'property', - displayName: 'Property', - values: [ - { - displayName: 'Property Name', - name: 'name', - type: 'string', - default: '', - description: 'Name of the property to set.', - }, - { - displayName: 'Property Value', - name: 'value', - type: 'string', - default: '', - description: 'Value of the property to set.', - }, - ] - }, - ], - }, - ], - }, + ...ecomOrderProductsFields, ], }; @@ -477,9 +218,11 @@ export class ActiveCampaign implements INodeType { } dataKey = 'contact'; + body.contact = { email: this.getNodeParameter('email', i) as string, } as IDataObject; + const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; addAdditionalFields(body.contact as IDataObject, additionalFields); @@ -505,7 +248,7 @@ export class ActiveCampaign implements INodeType { } else if (operation === 'getAll') { // ---------------------------------- - // persons:getAll + // contacts:getAll // ---------------------------------- requestMethod = 'GET'; @@ -529,11 +272,417 @@ export class ActiveCampaign implements INodeType { endpoint = `/api/3/contacts/${contactId}`; dataKey = 'contact'; + body.contact = {} as IDataObject; + const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; addAdditionalFields(body.contact as IDataObject, updateFields); + } else { + throw new Error(`The operation "${operation}" is not known`); } + } else if (resource === 'deal') { + if (operation === 'create') { + // ---------------------------------- + // deal:create + // ---------------------------------- + + requestMethod = 'POST'; + + endpoint = '/api/3/deals'; + + body.deal = { + title: this.getNodeParameter('title', i) as string, + contact: this.getNodeParameter('contact', i) as string, + value: this.getNodeParameter('value', i) as number, + currency: this.getNodeParameter('currency', i) as string, + } as IDataObject; + + const group = this.getNodeParameter('group', i) as string; + if (group !== '') { + addAdditionalFields(body.deal as IDataObject, { group }); + } + + const owner = this.getNodeParameter('owner', i) as string; + if (owner !== '') { + addAdditionalFields(body.deal as IDataObject, { owner }); + } + + const stage = this.getNodeParameter('stage', i) as string; + if (stage !== '') { + addAdditionalFields(body.deal as IDataObject, { stage }); + } + + const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; + addAdditionalFields(body.deal as IDataObject, additionalFields); + + } else if (operation === 'update') { + // ---------------------------------- + // deal:update + // ---------------------------------- + + requestMethod = 'PUT'; + + const dealId = this.getNodeParameter('dealId', i) as number; + endpoint = `/api/3/deals/${dealId}`; + + body.deal = {} as IDataObject; + + const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; + addAdditionalFields(body.deal as IDataObject, updateFields); + + } else if (operation === 'delete') { + // ---------------------------------- + // deal:delete + // ---------------------------------- + + requestMethod = 'DELETE'; + + const dealId = this.getNodeParameter('dealId', i) as number; + endpoint = `/api/3/deals/${dealId}`; + + } else if (operation === 'get') { + // ---------------------------------- + // deal:get + // ---------------------------------- + + requestMethod = 'GET'; + + const dealId = this.getNodeParameter('dealId', i) as number; + endpoint = `/api/3/deals/${dealId}`; + + } else if (operation === 'getAll') { + // ---------------------------------- + // deals:getAll + // ---------------------------------- + + requestMethod = 'GET'; + + returnAll = this.getNodeParameter('returnAll', i) as boolean; + if (returnAll === false) { + qs.limit = this.getNodeParameter('limit', i) as number; + } + + endpoint = `/api/3/deals`; + + } else if (operation === 'createNote') { + // ---------------------------------- + // deal:createNote + // ---------------------------------- + requestMethod = 'POST'; + + body.note = { + note: this.getNodeParameter('dealNote', i) as string, + } as IDataObject; + + const dealId = this.getNodeParameter('dealId', i) as number; + endpoint = `/api/3/deals/${dealId}/notes`; + + } else if (operation === 'updateNote') { + // ---------------------------------- + // deal:updateNote + // ---------------------------------- + requestMethod = 'PUT'; + + body.note = { + note: this.getNodeParameter('dealNote', i) as string, + } as IDataObject; + + const dealId = this.getNodeParameter('dealId', i) as number; + const dealNoteId = this.getNodeParameter('dealNoteId', i) as number; + endpoint = `/api/3/deals/${dealId}/notes/${dealNoteId}`; + + } else { + throw new Error(`The operation "${operation}" is not known`); + } + } else if (resource === 'connection') { + if (operation === 'create') { + // ---------------------------------- + // connection:create + // ---------------------------------- + + requestMethod = 'POST'; + + endpoint = '/api/3/connections'; + + body.connection = { + service: this.getNodeParameter('service', i) as string, + externalid: this.getNodeParameter('externalid', i) as string, + name: this.getNodeParameter('name', i) as string, + logoUrl: this.getNodeParameter('logoUrl', i) as string, + linkUrl: this.getNodeParameter('linkUrl', i) as string, + } as IDataObject; + + } else if (operation === 'update') { + // ---------------------------------- + // connection:update + // ---------------------------------- + + requestMethod = 'PUT'; + + const connectionId = this.getNodeParameter('connectionId', i) as number; + endpoint = `/api/3/connections/${connectionId}`; + + body.connection = {} as IDataObject; + + const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; + addAdditionalFields(body.connection as IDataObject, updateFields); + + } else if (operation === 'delete') { + // ---------------------------------- + // connection:delete + // ---------------------------------- + + requestMethod = 'DELETE'; + + const connectionId = this.getNodeParameter('connectionId', i) as number; + endpoint = `/api/3/connections/${connectionId}`; + + } else if (operation === 'get') { + // ---------------------------------- + // connection:get + // ---------------------------------- + + requestMethod = 'GET'; + + const connectionId = this.getNodeParameter('connectionId', i) as number; + endpoint = `/api/3/connections/${connectionId}`; + + } else if (operation === 'getAll') { + // ---------------------------------- + // connections:getAll + // ---------------------------------- + + requestMethod = 'GET'; + + returnAll = this.getNodeParameter('returnAll', i) as boolean; + if (returnAll === false) { + qs.limit = this.getNodeParameter('limit', i) as number; + } + + endpoint = `/api/3/connections`; + + } else { + throw new Error(`The operation "${operation}" is not known`); + } + } else if (resource === 'ecommerceOrder') { + if (operation === 'create') { + // ---------------------------------- + // ecommerceOrder:create + // ---------------------------------- + + requestMethod = 'POST'; + + endpoint = '/api/3/ecomOrders'; + + body.ecomOrder = { + source: this.getNodeParameter('source', i) as string, + email: this.getNodeParameter('email', i) as string, + totalPrice: this.getNodeParameter('totalPrice', i) as number, + currency: this.getNodeParameter('currency', i).toString().toUpperCase() as string, + externalCreatedDate: this.getNodeParameter('externalCreatedDate', i) as string, + connectionid: this.getNodeParameter('connectionid', i) as number, + customerid: this.getNodeParameter('customerid', i) as number, + } as IDataObject; + + const externalid = this.getNodeParameter('externalid', i) as string; + if (externalid !== '') { + addAdditionalFields(body.ecomOrder as IDataObject, { externalid }); + } + + const externalcheckoutid = this.getNodeParameter('externalcheckoutid', i) as string; + if (externalcheckoutid !== '') { + addAdditionalFields(body.ecomOrder as IDataObject, { externalcheckoutid }); + } + + const abandonedDate = this.getNodeParameter('abandonedDate', i) as string; + if (abandonedDate !== '') { + addAdditionalFields(body.ecomOrder as IDataObject, { abandonedDate }); + } + + const orderProducts = this.getNodeParameter('orderProducts', i) as unknown as IProduct[]; + addAdditionalFields(body.ecomOrder as IDataObject, { orderProducts }); + + const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; + addAdditionalFields(body.ecomOrder as IDataObject, additionalFields); + + } else if (operation === 'update') { + // ---------------------------------- + // ecommerceOrder:update + // ---------------------------------- + + requestMethod = 'PUT'; + + const orderId = this.getNodeParameter('orderId', i) as number; + endpoint = `/api/3/ecomOrders/${orderId}`; + + body.ecomOrder = {} as IDataObject; + + const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; + addAdditionalFields(body.ecomOrder as IDataObject, updateFields); + + } else if (operation === 'delete') { + // ---------------------------------- + // ecommerceOrder:delete + // ---------------------------------- + + requestMethod = 'DELETE'; + + const orderId = this.getNodeParameter('orderId', i) as number; + endpoint = `/api/3/ecomOrders/${orderId}`; + + } else if (operation === 'get') { + // ---------------------------------- + // ecommerceOrder:get + // ---------------------------------- + + requestMethod = 'GET'; + + const orderId = this.getNodeParameter('orderId', i) as number; + endpoint = `/api/3/ecomOrders/${orderId}`; + + } else if (operation === 'getAll') { + // ---------------------------------- + // ecommerceOrders:getAll + // ---------------------------------- + + requestMethod = 'GET'; + + returnAll = this.getNodeParameter('returnAll', i) as boolean; + if (returnAll === false) { + qs.limit = this.getNodeParameter('limit', i) as number; + } + + endpoint = `/api/3/ecomOrders`; + + } else { + throw new Error(`The operation "${operation}" is not known`); + } + } else if (resource === 'ecommerceCustomer') { + if (operation === 'create') { + // ---------------------------------- + // ecommerceCustomer:create + // ---------------------------------- + + requestMethod = 'POST'; + + endpoint = '/api/3/ecomCustomers'; + + body.ecomCustomer = { + connectionid: this.getNodeParameter('connectionid', i) as string, + externalid: this.getNodeParameter('externalid', i) as string, + email: this.getNodeParameter('email', i) as string, + } as IDataObject; + + const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject; + if (additionalFields.acceptsMarketing !== undefined) { + if (additionalFields.acceptsMarketing === true) { + additionalFields.acceptsMarketing = '1'; + } else { + additionalFields.acceptsMarketing = '0'; + } + } + addAdditionalFields(body.ecomCustomer as IDataObject, additionalFields); + + } else if (operation === 'update') { + // ---------------------------------- + // ecommerceCustomer:update + // ---------------------------------- + + requestMethod = 'PUT'; + + const ecommerceCustomerId = this.getNodeParameter('ecommerceCustomerId', i) as number; + endpoint = `/api/3/ecomCustomers/${ecommerceCustomerId}`; + + body.ecomCustomer = {} as IDataObject; + + const updateFields = this.getNodeParameter('updateFields', i) as IDataObject; + if (updateFields.acceptsMarketing !== undefined) { + if (updateFields.acceptsMarketing === true) { + updateFields.acceptsMarketing = '1'; + } else { + updateFields.acceptsMarketing = '0'; + } + } + addAdditionalFields(body.ecomCustomer as IDataObject, updateFields); + + } else if (operation === 'delete') { + // ---------------------------------- + // ecommerceCustomer:delete + // ---------------------------------- + + requestMethod = 'DELETE'; + + const ecommerceCustomerId = this.getNodeParameter('ecommerceCustomerId', i) as number; + endpoint = `/api/3/ecomCustomers/${ecommerceCustomerId}`; + + } else if (operation === 'get') { + // ---------------------------------- + // ecommerceCustomer:get + // ---------------------------------- + + requestMethod = 'GET'; + + const ecommerceCustomerId = this.getNodeParameter('ecommerceCustomerId', i) as number; + endpoint = `/api/3/ecomCustomers/${ecommerceCustomerId}`; + + } else if (operation === 'getAll') { + // ---------------------------------- + // ecommerceCustomers:getAll + // ---------------------------------- + + requestMethod = 'GET'; + + returnAll = this.getNodeParameter('returnAll', i) as boolean; + if (returnAll === false) { + qs.limit = this.getNodeParameter('limit', i) as number; + } + + endpoint = `/api/3/ecomCustomers`; + + } else { + throw new Error(`The operation "${operation}" is not known`); + } + } else if (resource === 'ecommerceOrderProducts') { + if (operation === 'getByProductId') { + // ---------------------------------- + // ecommerceOrderProducts:getByProductId + // ---------------------------------- + + requestMethod = 'GET'; + + const procuctId = this.getNodeParameter('procuctId', i) as number; + endpoint = `/api/3/ecomOrderProducts/${procuctId}`; + + + } else if (operation === 'getByOrderId') { + // ---------------------------------- + // ecommerceOrderProducts:getByOrderId + // ---------------------------------- + + requestMethod = 'GET'; + + const orderId = this.getNodeParameter('orderId', i) as number; + endpoint = `/api/3/ecomOrders/${orderId}/orderProducts`; + + } else if (operation === 'getAll') { + // ---------------------------------- + // ecommerceOrderProductss:getAll + // ---------------------------------- + + requestMethod = 'GET'; + + returnAll = this.getNodeParameter('returnAll', i) as boolean; + if (returnAll === false) { + qs.limit = this.getNodeParameter('limit', i) as number; + } + + endpoint = `/api/3/ecomOrderProducts`; + + } else { + throw new Error(`The operation "${operation}" is not known`); + } + } else { throw new Error(`The resource "${resource}" is not known!`); } @@ -554,4 +703,4 @@ export class ActiveCampaign implements INodeType { return [this.helpers.returnJsonArray(returnData)]; } -} +} \ No newline at end of file diff --git a/packages/nodes-base/nodes/ActiveCampaign/ConnectionDescription.ts b/packages/nodes-base/nodes/ActiveCampaign/ConnectionDescription.ts new file mode 100644 index 0000000000..2b82d6bebb --- /dev/null +++ b/packages/nodes-base/nodes/ActiveCampaign/ConnectionDescription.ts @@ -0,0 +1,324 @@ +import { INodeProperties } from "n8n-workflow"; + +import { allCurrencies } from './currencies'; + +export const connectionOperations = [ + { + displayName: 'Operation', + name: 'operation', + type: 'options', + displayOptions: { + show: { + resource: [ + 'connection', + ], + }, + }, + options: [ + { + name: 'Create', + value: 'create', + description: 'Create a connection', + }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a connection', + }, + { + name: 'Get', + value: 'get', + description: 'Get data of a connection', + }, + { + name: 'Get All', + value: 'getAll', + description: 'Get data of all connections', + }, + { + name: 'Update', + value: 'update', + description: 'Update a connection', + }, + ], + default: 'create', + description: 'The operation to perform.', + }, + +] as INodeProperties[]; + +export const connectionFields = [ + // ---------------------------------- + // connection:create + // ---------------------------------- + { + displayName: 'Service', + name: 'service', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'connection', + ], + }, + }, + description: 'The name of the service.', + }, + { + displayName: 'External accout ID', + name: 'externalid', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'connection', + ], + }, + }, + description: 'The id of the account in the external service.', + }, + { + displayName: 'Account Name', + name: 'name', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'connection', + ], + }, + }, + description: 'The name associated with the account in the external service. Often this will be a company name (e.g., "My Toystore, Inc.").', + }, + { + displayName: 'Logo URL', + name: 'logoUrl', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'connection', + ], + }, + }, + description: 'The URL to a logo image for the external service.', + }, + { + displayName: 'Link URL', + name: 'linkUrl', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'connection', + ], + }, + }, + description: 'The URL to a page where the integration with the external service can be managed in the third-party\'s website.', + }, + + // ---------------------------------- + // connection:update + // ---------------------------------- + { + displayName: 'Connection ID', + name: 'connectionId', + type: 'number', + displayOptions: { + show: { + operation: [ + 'update', + ], + resource: [ + 'connection', + ], + }, + }, + default: 0, + required: true, + description: 'ID of the connection to update.', + }, + { + displayName: 'Update Fields', + name: 'updateFields', + type: 'collection', + description: 'The fields to update.', + placeholder: 'Add Field', + displayOptions: { + show: { + operation: [ + 'update', + ], + resource: [ + 'connection', + ], + }, + }, + default: {}, + options: [ + { + displayName: 'Service', + name: 'service', + type: 'string', + default: '', + description: 'The name of the service.', + }, + { + displayName: 'External accout ID', + name: 'externalid', + type: 'string', + default: '', + description: 'The id of the account in the external service.', + }, + { + displayName: 'Account Name', + name: 'name', + type: 'string', + default: '', + description: 'The name associated with the account in the external service. Often this will be a company name (e.g., "My Toystore, Inc.").', + }, + { + displayName: 'Logo URL', + name: 'logoUrl', + type: 'string', + default: '', + description: 'The URL to a logo image for the external service.', + }, + { + displayName: 'Link URL', + name: 'linkUrl', + type: 'string', + default: '', + description: 'The URL to a page where the integration with the external service can be managed in the third-party\'s website.', + }, + { + displayName: 'Status', + name: 'status', + type: 'number', + default: 1, + description: 'The status of the connection (0 = error; 1 = connected)', + }, + { + displayName: 'Syncronisation Status', + name: 'syncStatus', + type: 'number', + default: 1, + description: 'The status of a sync triggered on the connection (0 = sync stopped; 1 = sync running).', + }, + ] + }, + + // ---------------------------------- + // connection:delete + // ---------------------------------- + { + displayName: 'Connection ID', + name: 'connectionId', + type: 'number', + displayOptions: { + show: { + operation: [ + 'delete', + ], + resource: [ + 'connection', + ], + }, + }, + default: 0, + required: true, + description: 'ID of the connection to delete.', + }, + + // ---------------------------------- + // connection:get + // ---------------------------------- + { + displayName: 'Connection ID', + name: 'connectionId', + type: 'number', + displayOptions: { + show: { + operation: [ + 'get', + ], + resource: [ + 'connection', + ], + }, + }, + default: 0, + required: true, + description: 'ID of the connection to get.', + }, + + // ---------------------------------- + // connection:getAll + // ---------------------------------- + { + displayName: 'Return All', + name: 'returnAll', + type: 'boolean', + displayOptions: { + show: { + operation: [ + 'getAll', + ], + resource: [ + 'connection', + ], + }, + }, + default: false, + description: 'If all results should be returned or only up to a given limit.', + }, + { + displayName: 'Limit', + name: 'limit', + type: 'number', + displayOptions: { + show: { + operation: [ + 'getAll', + ], + resource: [ + 'connection', + ], + returnAll: [ + false, + ], + }, + }, + typeOptions: { + minValue: 1, + maxValue: 500, + }, + default: 100, + description: 'How many results to return.', + }, +] as INodeProperties[]; \ No newline at end of file diff --git a/packages/nodes-base/nodes/ActiveCampaign/ContactDescription.ts b/packages/nodes-base/nodes/ActiveCampaign/ContactDescription.ts new file mode 100644 index 0000000000..25b42b3678 --- /dev/null +++ b/packages/nodes-base/nodes/ActiveCampaign/ContactDescription.ts @@ -0,0 +1,351 @@ +import { INodeProperties } from "n8n-workflow"; + +export const contactOperations = [ + { + displayName: 'Operation', + name: 'operation', + type: 'options', + displayOptions: { + show: { + resource: [ + 'contact', + ], + }, + }, + options: [ + { + name: 'Create', + value: 'create', + description: 'Create a contact', + }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a contact', + }, + { + name: 'Get', + value: 'get', + description: 'Get data of a contact', + }, + { + name: 'Get All', + value: 'getAll', + description: 'Get data of all contact', + }, + { + name: 'Update', + value: 'update', + description: 'Update a contact', + }, + ], + default: 'create', + description: 'The operation to perform.', + }, +] as INodeProperties[]; + +export const contactFields = [ + // ---------------------------------- + // contact:create + // ---------------------------------- + { + displayName: 'Email', + name: 'email', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'contact', + ], + }, + }, + description: 'The email of the contact to create.', + }, + { + displayName: 'Update if exists', + name: 'updateIfExists', + type: 'boolean', + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'contact', + ], + }, + }, + default: false, + description: 'Update user if it exists already. If not set and user exists it will error instead.', + }, + { + displayName: 'Additional Fields', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'contact', + ], + }, + }, + default: {}, + options: [ + { + displayName: 'First Name', + name: 'firstName', + type: 'string', + default: '', + description: 'The first name of the contact to create.', + }, + { + displayName: 'Last Name', + name: 'lastName', + type: 'string', + default: '', + description: 'The last name of the contact to create.', + }, + { + displayName: 'Phone', + name: 'phone', + type: 'string', + default: '', + description: 'Phone number of the contact.', + }, + { + displayName: 'Custom Properties', + name: 'customProperties', + placeholder: 'Add Custom Property', + description: 'Adds a custom property to set also values which have not been predefined.', + type: 'fixedCollection', + typeOptions: { + multipleValues: true, + }, + default: {}, + options: [ + { + name: 'property', + displayName: 'Property', + values: [ + { + displayName: 'Property Name', + name: 'name', + type: 'string', + default: '', + description: 'Name of the property to set.', + }, + { + displayName: 'Property Value', + name: 'value', + type: 'string', + default: '', + description: 'Value of the property to set.', + }, + ] + }, + ], + }, + ], + }, + + // ---------------------------------- + // contact:update + // ---------------------------------- + { + displayName: 'Contact ID', + name: 'contactId', + type: 'number', + displayOptions: { + show: { + operation: [ + 'update', + ], + resource: [ + 'contact', + ], + }, + }, + default: 0, + required: true, + description: 'ID of the contact to update.', + }, + { + displayName: 'Update Fields', + name: 'updateFields', + type: 'collection', + description: 'The fields to update.', + placeholder: 'Add Field', + displayOptions: { + show: { + operation: [ + 'update', + ], + resource: [ + 'contact', + ], + }, + }, + default: {}, + options: [ + { + displayName: 'Email', + name: 'email', + type: 'string', + default: '', + description: 'Email of the contact.', + }, + { + displayName: 'First Name', + name: 'firstName', + type: 'string', + default: '', + description: 'First name of the contact.', + }, + { + displayName: 'Last Name', + name: 'lastName', + type: 'string', + default: '', + description: 'Last name of the contact.', + }, + { + displayName: 'Phone', + name: 'phone', + type: 'string', + default: '', + description: 'Phone number of the contact.', + }, + { + displayName: 'Custom Properties', + name: 'customProperties', + placeholder: 'Add Custom Property', + description: 'Adds a custom property to set also values which have not been predefined.', + type: 'fixedCollection', + typeOptions: { + multipleValues: true, + }, + default: {}, + options: [ + { + name: 'property', + displayName: 'Property', + values: [ + { + displayName: 'Property Name', + name: 'name', + type: 'string', + default: '', + description: 'Name of the property to set.', + }, + { + displayName: 'Property Value', + name: 'value', + type: 'string', + default: '', + description: 'Value of the property to set.', + }, + ] + }, + ], + }, + ], + }, + + // ---------------------------------- + // contact:delete + // ---------------------------------- + { + displayName: 'Contact ID', + name: 'contactId', + type: 'number', + displayOptions: { + show: { + operation: [ + 'delete', + ], + resource: [ + 'contact', + ], + }, + }, + default: 0, + required: true, + description: 'ID of the contact to delete.', + }, + + // ---------------------------------- + // contact:get + // ---------------------------------- + { + displayName: 'Contact ID', + name: 'contactId', + type: 'number', + displayOptions: { + show: { + operation: [ + 'get', + ], + resource: [ + 'contact', + ], + }, + }, + default: 0, + required: true, + description: 'ID of the contact to get.', + }, + + // ---------------------------------- + // contact:getAll + // ---------------------------------- + { + displayName: 'Return All', + name: 'returnAll', + type: 'boolean', + displayOptions: { + show: { + operation: [ + 'getAll', + ], + resource: [ + 'contact', + ], + }, + }, + default: false, + description: 'If all results should be returned or only up to a given limit.', + }, + { + displayName: 'Limit', + name: 'limit', + type: 'number', + displayOptions: { + show: { + operation: [ + 'getAll', + ], + resource: [ + 'contact', + ], + returnAll: [ + false, + ], + }, + }, + typeOptions: { + minValue: 1, + maxValue: 500, + }, + default: 100, + description: 'How many results to return.', + }, +] as INodeProperties[]; diff --git a/packages/nodes-base/nodes/ActiveCampaign/DealDescription.ts b/packages/nodes-base/nodes/ActiveCampaign/DealDescription.ts new file mode 100644 index 0000000000..940157e5f0 --- /dev/null +++ b/packages/nodes-base/nodes/ActiveCampaign/DealDescription.ts @@ -0,0 +1,529 @@ +import { INodeProperties } from "n8n-workflow"; + +import { allCurrencies } from './currencies'; + +export const dealOperations = [ + { + displayName: 'Operation', + name: 'operation', + type: 'options', + displayOptions: { + show: { + resource: [ + 'deal', + ], + }, + }, + options: [ + { + name: 'Create', + value: 'create', + description: 'Create a deal', + }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a deal', + }, + { + name: 'Get', + value: 'get', + description: 'Get data of a deal', + }, + { + name: 'Get All', + value: 'getAll', + description: 'Get data of all deals', + }, + { + name: 'Update', + value: 'update', + description: 'Update a deal', + }, + { + name: 'Create Note', + value: 'createNote', + description: 'Create a deal note', + }, + { + name: 'Update deal note', + value: 'updateNote', + description: 'Update a deal note', + }, + ], + default: 'create', + description: 'The operation to perform.', + }, + +] as INodeProperties[]; + +export const dealFields = [ + // ---------------------------------- + // deal:create + // ---------------------------------- + { + displayName: 'Title', + name: 'title', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'deal', + ], + }, + }, + description: 'The title of the deal', + }, + { + displayName: 'Deal\'s contact ID', + name: 'contact', + type: 'number', + default: 0, + required: true, + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'deal', + ], + }, + }, + description: 'The ID of the deal\'s contact', + }, + { + displayName: 'Deal value', + name: 'value', + type: 'number', + default: 0, + required: true, + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'deal', + ], + }, + }, + description: 'The value of the deal in cents', + }, + { + displayName: 'Currency', + name: 'currency', + type: 'options', + default: 'eur', + required: true, + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'deal', + ], + }, + }, + options: allCurrencies, + description: 'The currency of the deal in 3-character ISO format', + }, + { + displayName: 'Deal pipeline ID', + name: 'group', + type: 'string', + default: '', + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'deal', + ], + }, + }, + description: 'The pipeline ID of the deal', + }, + { + displayName: 'Deal stage ID', + name: 'stage', + type: 'string', + default: '', + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'deal', + ], + }, + }, + description: 'The stage ID of the deal', + }, + { + displayName: 'Deal owner ID', + name: 'owner', + type: 'string', + default: '', + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'deal', + ], + }, + }, + description: 'The owner ID of the deal', + }, + { + displayName: 'Additional Fields', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'deal', + ], + }, + }, + default: {}, + options: [ + { + displayName: 'Description', + name: 'description', + type: 'string', + default: '', + description: 'The description of the deal', + }, + + { + displayName: 'Deal percentage', + name: 'percent', + type: 'number', + default: 0, + description: 'The percentage of the deal', + }, + { + displayName: 'Deal status', + name: 'status', + type: 'number', + default: 0, + description: 'The status of the deal', + }, + ] + }, + + // ---------------------------------- + // deal:update + // ---------------------------------- + { + displayName: 'Deal ID', + name: 'dealId', + type: 'number', + displayOptions: { + show: { + operation: [ + 'update', + ], + resource: [ + 'deal', + ], + }, + }, + default: 0, + required: true, + description: 'ID of the deal to update.', + }, + { + displayName: 'Update Fields', + name: 'updateFields', + type: 'collection', + description: 'The fields to update.', + placeholder: 'Add Field', + displayOptions: { + show: { + operation: [ + 'update', + ], + resource: [ + 'deal', + ], + }, + }, + default: {}, + options: [ + { + displayName: 'Title', + name: 'title', + type: 'string', + default: '', + description: 'The title of the deal', + }, + { + displayName: 'Deal\'s contact ID', + name: 'contact', + type: 'number', + default: 0, + description: 'The ID of the deal\'s contact', + }, + { + displayName: 'Deal value', + name: 'value', + type: 'number', + default: 0, + description: 'The value of the deal in cents', + }, + { + displayName: 'Currency', + name: 'currency', + type: 'options', + options: allCurrencies, + default: 'eur', + description: 'The currency of the deal in 3-character ISO format', + }, + { + displayName: 'Description', + name: 'description', + type: 'string', + default: '', + description: 'The description of the deal', + }, + { + displayName: 'Deal pipeline ID', + name: 'group', + type: 'string', + default: '', + description: 'The pipeline ID of the deal', + }, + { + displayName: 'Deal stage ID', + name: 'stage', + type: 'string', + default: '', + description: 'The stage ID of the deal', + }, + { + displayName: 'Deal owner ID', + name: 'owner', + type: 'string', + default: '', + description: 'The owner ID of the deal', + }, + { + displayName: 'Deal percentage', + name: 'percent', + type: 'number', + default: 0, + description: 'The percentage of the deal', + }, + { + displayName: 'Deal status', + name: 'status', + type: 'number', + default: 0, + description: 'The status of the deal', + }, + ] + }, + + // ---------------------------------- + // deal:delete + // ---------------------------------- + { + displayName: 'Deal ID', + name: 'dealId', + type: 'number', + default: 0, + required: true, + displayOptions: { + show: { + operation: [ + 'delete', + ], + resource: [ + 'deal', + ], + }, + }, + description: 'The ID of the deal to delete.', + }, + + // ---------------------------------- + // deal:get + // ---------------------------------- + { + displayName: 'Deal ID', + name: 'dealId', + type: 'number', + default: 0, + required: true, + displayOptions: { + show: { + operation: [ + 'get', + ], + resource: [ + 'deal', + ], + }, + }, + description: 'The ID of the deal to get.', + }, + + // ---------------------------------- + // deal:getAll + // ---------------------------------- + { + displayName: 'Return All', + name: 'returnAll', + type: 'boolean', + displayOptions: { + show: { + operation: [ + 'getAll', + ], + resource: [ + 'deal', + ], + }, + }, + default: false, + description: 'If all results should be returned or only up to a given limit.', + }, + { + displayName: 'Limit', + name: 'limit', + type: 'number', + displayOptions: { + show: { + operation: [ + 'getAll', + ], + resource: [ + 'deal', + ], + returnAll: [ + false, + ], + }, + }, + typeOptions: { + minValue: 1, + maxValue: 500, + }, + default: 100, + description: 'How many results to return.', + }, + + // ---------------------------------- + // dealNote:create + // ---------------------------------- + { + displayName: 'Deal ID', + name: 'dealId', + type: 'number', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'createNote', + ], + resource: [ + 'deal', + ], + }, + }, + description: 'The ID of the deal note', + }, + { + displayName: 'Deal Note', + name: 'dealNote', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'createNote', + ], + resource: [ + 'deal', + ], + }, + }, + description: 'The content of the deal note', + }, + + // ---------------------------------- + // dealNote:update + // ---------------------------------- + { + displayName: 'Deal ID', + name: 'dealId', + type: 'number', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'updateNote', + ], + resource: [ + 'deal', + ], + }, + }, + description: 'The ID of the deal note', + }, + { + displayName: 'Deal note ID', + name: 'dealNoteId', + type: 'number', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'updateNote', + ], + resource: [ + 'deal', + ], + }, + }, + description: 'The ID of the deal note', + }, + { + displayName: 'Deal Note', + name: 'dealNote', + type: 'string', + default: '', + displayOptions: { + show: { + operation: [ + 'updateNote', + ], + resource: [ + 'deal', + ], + }, + }, + description: 'The content of the deal note', + }, + +] as INodeProperties[]; \ No newline at end of file diff --git a/packages/nodes-base/nodes/ActiveCampaign/EcomCustomerDescription.ts b/packages/nodes-base/nodes/ActiveCampaign/EcomCustomerDescription.ts new file mode 100644 index 0000000000..2b8b0d33cd --- /dev/null +++ b/packages/nodes-base/nodes/ActiveCampaign/EcomCustomerDescription.ts @@ -0,0 +1,290 @@ +import { INodeProperties } from "n8n-workflow"; + +export const ecomCustomerOperations = [ + { + displayName: 'Operation', + name: 'operation', + type: 'options', + displayOptions: { + show: { + resource: [ + 'ecommerceCustomer', + ], + }, + }, + options: [ + { + name: 'Create', + value: 'create', + description: 'Create a E-commerce Customer', + }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a E-commerce Customer', + }, + { + name: 'Get', + value: 'get', + description: 'Get data of a E-commerce Customer', + }, + { + name: 'Get All', + value: 'getAll', + description: 'Get data of all E-commerce Customer', + }, + { + name: 'Update', + value: 'update', + description: 'Update a E-commerce Customer', + }, + ], + default: 'create', + description: 'The operation to perform.', + }, +] as INodeProperties[]; + +export const ecomCustomerFields = [ + // ---------------------------------- + // ecommerceCustomer:create + // ---------------------------------- + { + displayName: 'Service ID', + name: 'connectionid', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'ecommerceCustomer', + ], + }, + }, + description: 'The id of the connection object for the service where the customer originates.', + }, + { + displayName: 'Customer ID', + name: 'externalid', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'ecommerceCustomer', + ], + }, + }, + description: 'The id of the customer in the external service.', + }, + { + displayName: 'Customer Email', + name: 'email', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'ecommerceCustomer', + ], + }, + }, + description: 'The email address of the customer.', + }, + { + displayName: 'Additional Fields', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'ecommerceCustomer', + ], + }, + }, + default: {}, + options: [ + { + displayName: 'Accepts Marketing', + name: 'acceptsMarketing', + type: 'boolean', + default: false, + description: 'Indication of whether customer has opt-ed in to marketing communications.', + }, + ], + }, + + // ---------------------------------- + // ecommerceCustomer:update + // ---------------------------------- + { + displayName: 'Customer ID', + name: 'ecommerceCustomerId', + type: 'number', + displayOptions: { + show: { + operation: [ + 'update', + ], + resource: [ + 'ecommerceCustomer', + ], + }, + }, + default: 0, + required: true, + description: 'ID of the E-commerce customer to update.', + }, + { + displayName: 'Update Fields', + name: 'updateFields', + type: 'collection', + description: 'The fields to update.', + placeholder: 'Add Field', + displayOptions: { + show: { + operation: [ + 'update', + ], + resource: [ + 'ecommerceCustomer', + ], + }, + }, + default: {}, + options: [ + { + displayName: 'Service ID', + name: 'connectionid', + type: 'string', + default: '', + description: 'The id of the connection object for the service where the customer originates.', + }, + { + displayName: 'Customer ID', + name: 'externalid', + type: 'string', + default: '', + description: 'The id of the customer in the external service.', + }, + { + displayName: 'Customer Email', + name: 'email', + type: 'string', + default: '', + description: 'The email address of the customer.', + }, + { + displayName: 'Accepts Marketing', + name: 'acceptsMarketing', + type: 'boolean', + default: false, + description: 'Indication of whether customer has opt-ed in to marketing communications.', + }, + ], + }, + + // ---------------------------------- + // ecommerceCustomer:delete + // ---------------------------------- + { + displayName: 'Customer ID', + name: 'ecommerceCustomerId', + type: 'number', + displayOptions: { + show: { + operation: [ + 'delete', + ], + resource: [ + 'ecommerceCustomer', + ], + }, + }, + default: 0, + required: true, + description: 'ID of the E-commerce customer to delete.', + }, + + // ---------------------------------- + // ecommerceCustomer:get + // ---------------------------------- + { + displayName: 'Customer ID', + name: 'ecommerceCustomerId', + type: 'number', + displayOptions: { + show: { + operation: [ + 'get', + ], + resource: [ + 'ecommerceCustomer', + ], + }, + }, + default: 0, + required: true, + description: 'ID of the E-commerce customer to get.', + }, + + // ---------------------------------- + // ecommerceCustomer:getAll + // ---------------------------------- + { + displayName: 'Return All', + name: 'returnAll', + type: 'boolean', + displayOptions: { + show: { + operation: [ + 'getAll', + ], + resource: [ + 'ecommerceCustomer', + ], + }, + }, + default: false, + description: 'If all results should be returned or only up to a given limit.', + }, + { + displayName: 'Limit', + name: 'limit', + type: 'number', + displayOptions: { + show: { + operation: [ + 'getAll', + ], + resource: [ + 'ecommerceCustomer', + ], + returnAll: [ + false, + ], + }, + }, + typeOptions: { + minValue: 1, + maxValue: 500, + }, + default: 100, + description: 'How many results to return.', + }, +] as INodeProperties[]; diff --git a/packages/nodes-base/nodes/ActiveCampaign/EcomOrderDescription.ts b/packages/nodes-base/nodes/ActiveCampaign/EcomOrderDescription.ts new file mode 100644 index 0000000000..525fa0eb20 --- /dev/null +++ b/packages/nodes-base/nodes/ActiveCampaign/EcomOrderDescription.ts @@ -0,0 +1,716 @@ +import { INodeProperties } from "n8n-workflow"; + +import { allCurrencies } from './currencies'; + +export const ecomOrderOperations = [ + { + displayName: 'Operation', + name: 'operation', + type: 'options', + displayOptions: { + show: { + resource: [ + 'ecommerceOrder', + ], + }, + }, + options: [ + { + name: 'Create', + value: 'create', + description: 'Create a order', + }, + { + name: 'Delete', + value: 'delete', + description: 'Delete a order', + }, + { + name: 'Get', + value: 'get', + description: 'Get data of a order', + }, + { + name: 'Get All', + value: 'getAll', + description: 'Get data of all orders', + }, + { + name: 'Update', + value: 'update', + description: 'Update a order', + }, + ], + default: 'create', + description: 'The operation to perform.', + }, +] as INodeProperties[]; + +export const ecomOrderFields = [ + // ---------------------------------- + // ecommerceOrder:create + // ---------------------------------- + { + displayName: 'External ID', + name: 'externalid', + type: 'string', + default: '', + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'ecommerceOrder', + ], + }, + }, + description: 'The id of the order in the external service. ONLY REQUIRED IF EXTERNALCHECKOUTID NOT INCLUDED', + }, + { + displayName: 'External checkout ID', + name: 'externalcheckoutid', + type: 'string', + default: '', + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'ecommerceOrder', + ], + }, + }, + description: 'The id of the cart in the external service. ONLY REQUIRED IF EXTERNALID IS NOT INCLUDED.', + }, + { + displayName: 'Order source', + name: 'source', + type: 'number', + default: 0, + required: true, + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'ecommerceOrder', + ], + }, + }, + description: 'The order source code (0 - will not trigger automations, 1 - will trigger automations).', + }, + { + displayName: 'Customer Email', + name: 'email', + type: 'string', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'ecommerceOrder', + ], + }, + }, + description: 'The email address of the customer who placed the order.', + }, + { + displayName: 'Total price', + name: 'totalPrice', + type: 'number', + default: 0, + required: true, + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'ecommerceOrder', + ], + }, + }, + description: 'The total price of the order in cents, including tax and shipping charges. (i.e. $456.78 => 45678). Must be greater than or equal to zero.', + }, + { + displayName: 'Order currency', + name: 'currency', + type: 'options', + default: 'eur', + required: true, + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'ecommerceOrder', + ], + }, + }, + options: allCurrencies, + description: 'The currency of the order (3-digit ISO code, e.g., "USD").', + }, + { + displayName: 'Connection ID', + name: 'connectionid', + type: 'number', + default: 0, + required: true, + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'ecommerceOrder', + ], + }, + }, + description: 'The id of the connection from which this order originated.', + }, + { + displayName: 'Customer ID', + name: 'customerid', + type: 'number', + default: 0, + required: true, + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'ecommerceOrder', + ], + }, + }, + description: 'The id of the customer associated with this order.', + }, + { + displayName: 'Creation Date', + name: 'externalCreatedDate', + type: 'dateTime', + default: '', + required: true, + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'ecommerceOrder', + ], + }, + }, + description: 'The date the order was placed.', + }, + { + displayName: 'Abandoning Date', + name: 'abandonedDate', + type: 'dateTime', + default: '', + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'ecommerceOrder', + ], + }, + }, + description: 'The date the cart was abandoned. REQUIRED ONLY IF INCLUDING EXTERNALCHECKOUTID.', + }, + { + displayName: 'Products', + name: 'orderProducts', + type: 'collection', + typeOptions: { + multipleValues: true, + multipleValueButtonText: 'Add product', + }, + displayOptions: { + show: { + operation: [ + 'create' + ], + resource: [ + 'ecommerceOrder', + ], + }, + }, + default: {}, + description: 'All ordered products', + placeholder: 'Add product field', + options: [ + { + displayName: 'Name', + name: 'name', + type: 'string', + default: '', + description: 'The name of the product', + }, + { + displayName: 'Price', + name: 'price', + type: 'number', + default: 0, + description: 'The price of the product, in cents. (i.e. $456.78 => 45678). Must be greater than or equal to zero.', + }, + { + displayName: 'Product Quantity', + name: 'quantity', + type: 'number', + default: 0, + description: 'The quantity ordered.', + }, + { + displayName: 'Product external ID', + name: 'externalid', + type: 'string', + default: '', + description: 'The id of the product in the external service.', + }, + { + displayName: 'Product Category', + name: 'category', + type: 'string', + default: '', + description: 'The category of the product.', + }, + { + displayName: 'SKU', + name: 'sku', + type: 'string', + default: '', + description: 'The SKU for the product.', + }, + { + displayName: 'Description', + name: 'description', + type: 'string', + default: '', + description: 'The description of the product.', + }, + { + displayName: 'Image URL', + name: 'imageUrl', + type: 'string', + default: '', + description: 'An Image URL that displays an image of the product.', + }, + { + displayName: 'Product URL', + name: 'productUrl', + type: 'string', + default: '', + description: 'A URL linking to the product in your store.', + }, + ], + }, + { + displayName: 'Additional Fields', + name: 'additionalFields', + type: 'collection', + placeholder: 'Add Field', + displayOptions: { + show: { + operation: [ + 'create', + ], + resource: [ + 'ecommerceOrder', + ], + }, + }, + default: {}, + options: [ + { + displayName: 'Shipping Amount', + name: 'shippingAmount', + type: 'number', + default: 0, + description: 'The total shipping amount for the order in cents .', + }, + + { + displayName: 'Tax Amount', + name: 'taxAmount', + type: 'number', + default: 0, + description: 'The total tax amount for the order in cents.', + }, + { + displayName: 'Discount Amount', + name: 'discountAmount', + type: 'number', + default: 0, + description: 'The total discount amount for the order in cents.', + }, + { + displayName: 'Order URL', + name: 'orderUrl', + type: 'string', + default: '', + description: 'The URL for the order in the external service.', + }, + { + displayName: 'External updated date', + name: 'externalUpdatedDate', + type: 'dateTime', + default: '', + description: 'The date the order was updated.', + }, + { + displayName: 'Shipping Method', + name: 'shippingMethod', + type: 'string', + default: '', + description: 'The shipping method of the order.', + }, + { + displayName: 'Order Number', + name: 'orderNumber', + type: 'string', + default: '', + description: 'The order number. This can be different than the externalid.', + }, + + ] + }, + + // ---------------------------------- + // ecommerceOrder:update + // ---------------------------------- + { + displayName: 'Order ID', + name: 'orderId', + type: 'number', + default: 0, + displayOptions: { + show: { + operation: [ + 'update', + ], + resource: [ + 'ecommerceOrder', + ], + }, + }, + description: 'The id of the e-commerce order.', + }, + + { + displayName: 'Add Field', + name: 'updateFields', + type: 'collection', + placeholder: 'Add Field', + displayOptions: { + show: { + operation: [ + 'update', + ], + resource: [ + 'ecommerceOrder', + ], + }, + }, + default: {}, + options: [ + { + displayName: 'External ID', + name: 'externalid', + type: 'string', + default: '', + description: 'The id of the order in the external service. ONLY REQUIRED IF EXTERNALCHECKOUTID NOT INCLUDED', + }, + { + displayName: 'External checkout ID', + name: 'externalcheckoutid', + type: 'string', + default: '', + description: 'The id of the cart in the external service. ONLY REQUIRED IF EXTERNALID IS NOT INCLUDED.', + }, + { + displayName: 'Order source', + name: 'source', + type: 'number', + default: 0, + description: 'The order source code (0 - will not trigger automations, 1 - will trigger automations).', + }, + { + displayName: 'Customer Email', + name: 'email', + type: 'string', + default: '', + description: 'The email address of the customer who placed the order.', + }, + { + displayName: 'Total price', + name: 'totalPrice', + type: 'number', + default: 0, + description: 'The total price of the order in cents, including tax and shipping charges. (i.e. $456.78 => 45678). Must be greater than or equal to zero.', + }, + { + displayName: 'Order currency', + name: 'currency', + type: 'options', + default: 'eur', + options: allCurrencies, + description: 'The currency of the order (3-digit ISO code, e.g., "USD").', + }, + { + displayName: 'Connection ID', + name: 'connectionid', + type: 'number', + default: 0, + description: 'The id of the connection from which this order originated.', + }, + { + displayName: 'Customer ID', + name: 'customerid', + type: 'number', + default: 0, + description: 'The id of the customer associated with this order.', + }, + { + displayName: 'Creation Date', + name: 'externalupdatedDate', + type: 'dateTime', + default: '', + description: 'The date the order was placed.', + }, + { + displayName: 'Abandoning Date', + name: 'abandonedDate', + type: 'dateTime', + default: '', + description: 'The date the cart was abandoned. REQUIRED ONLY IF INCLUDING EXTERNALCHECKOUTID.', + }, + { + displayName: 'Shipping Amount', + name: 'shippingAmount', + type: 'number', + default: 0, + description: 'The total shipping amount for the order in cents .', + }, + + { + displayName: 'Tax Amount', + name: 'taxAmount', + type: 'number', + default: 0, + description: 'The total tax amount for the order in cents.', + }, + { + displayName: 'Discount Amount', + name: 'discountAmount', + type: 'number', + default: 0, + description: 'The total discount amount for the order in cents.', + }, + { + displayName: 'Order URL', + name: 'orderUrl', + type: 'string', + default: '', + description: 'The URL for the order in the external service.', + }, + { + displayName: 'External updated date', + name: 'externalUpdatedDate', + type: 'dateTime', + default: '', + description: 'The date the order was updated.', + }, + { + displayName: 'Shipping Method', + name: 'shippingMethod', + type: 'string', + default: '', + description: 'The shipping method of the order.', + }, + { + displayName: 'Order Number', + name: 'orderNumber', + type: 'string', + default: '', + description: 'The order number. This can be different than the externalid.', + }, + + { + displayName: 'Products', + name: 'orderProducts', + type: 'collection', + typeOptions: { + multipleValues: true, + multipleValueButtonText: 'Add product', + }, + default: {}, + description: 'All ordered products', + placeholder: 'Add product field', + options: [ + { + displayName: 'Name', + name: 'name', + type: 'string', + default: '', + description: 'The name of the product', + }, + { + displayName: 'Price', + name: 'price', + type: 'number', + default: 0, + description: 'The price of the product, in cents. (i.e. $456.78 => 45678). Must be greater than or equal to zero.', + }, + { + displayName: 'Product Quantity', + name: 'quantity', + type: 'number', + default: 0, + description: 'The quantity ordered.', + }, + { + displayName: 'Product external ID', + name: 'externalid', + type: 'string', + default: '', + description: 'The id of the product in the external service.', + }, + { + displayName: 'Product Category', + name: 'category', + type: 'string', + default: '', + description: 'The category of the product.', + }, + { + displayName: 'SKU', + name: 'sku', + type: 'string', + default: '', + description: 'The SKU for the product.', + }, + { + displayName: 'Description', + name: 'description', + type: 'string', + default: '', + description: 'The description of the product.', + }, + { + displayName: 'Image URL', + name: 'imageUrl', + type: 'string', + default: '', + description: 'An Image URL that displays an image of the product.', + }, + { + displayName: 'Product URL', + name: 'productUrl', + type: 'string', + default: '', + description: 'A URL linking to the product in your store.', + }, + ], + }, + + ] + }, + + // ---------------------------------- + // ecommerceOrder:delete + // ---------------------------------- + { + displayName: 'Order ID', + name: 'orderId', + type: 'number', + default: 0, + displayOptions: { + show: { + operation: [ + 'delete', + ], + resource: [ + 'ecommerceOrder', + ], + }, + }, + description: 'The id of the e-commerce order.', + }, + + // ---------------------------------- + // ecommerceOrder:get + // ---------------------------------- + { + displayName: 'Order ID', + name: 'orderId', + type: 'number', + default: 0, + displayOptions: { + show: { + operation: [ + 'get', + ], + resource: [ + 'ecommerceOrder', + ], + }, + }, + description: 'The id of the e-commerce order.', + }, + + // ---------------------------------- + // ecommerceOrder:getAll + // ---------------------------------- + { + displayName: 'Return All', + name: 'returnAll', + type: 'boolean', + displayOptions: { + show: { + operation: [ + 'getAll', + ], + resource: [ + 'ecommerceOrder', + ], + }, + }, + default: false, + description: 'If all results should be returned or only up to a given limit.', + }, + { + displayName: 'Limit', + name: 'limit', + type: 'number', + displayOptions: { + show: { + operation: [ + 'getAll', + ], + resource: [ + 'ecommerceOrder', + ], + returnAll: [ + false, + ], + }, + }, + typeOptions: { + minValue: 1, + maxValue: 500, + }, + default: 100, + description: 'How many results to return.', + }, +] as INodeProperties[]; \ No newline at end of file diff --git a/packages/nodes-base/nodes/ActiveCampaign/EcomOrderProductsDescription.ts b/packages/nodes-base/nodes/ActiveCampaign/EcomOrderProductsDescription.ts new file mode 100644 index 0000000000..1f53c47f0b --- /dev/null +++ b/packages/nodes-base/nodes/ActiveCampaign/EcomOrderProductsDescription.ts @@ -0,0 +1,124 @@ +import { INodeProperties } from "n8n-workflow"; + +export const ecomOrderProductsOperations = [ + { + displayName: 'Operation', + name: 'operation', + type: 'options', + displayOptions: { + show: { + resource: [ + 'ecommerceOrderProducts', + ], + }, + }, + options: [ + { + name: 'Get All', + value: 'getAll', + description: 'Get data of all order products', + }, + { + name: 'Get by Product ID', + value: 'getByProductId', + description: 'Get data of a ordered product', + }, + { + name: 'Get by Order ID', + value: 'getByOrderId', + description: 'Get data of an order\'s products', + }, + ], + default: 'getAll', + description: 'The operation to perform.', + }, +] as INodeProperties[]; + +export const ecomOrderProductsFields = [ + // ---------------------------------- + // ecommerceOrderProducts:getByOrderId + // ---------------------------------- + { + displayName: 'Order ID', + name: 'orderId', + type: 'number', + default: 0, + displayOptions: { + show: { + operation: [ + 'getByOrderId', + ], + resource: [ + 'ecommerceOrderProducts', + ], + }, + }, + description: 'The ID of the order whose products you\'d like returned.', + }, + + // ---------------------------------- + // ecommerceOrderProducts:getByProductId + // ---------------------------------- + { + displayName: 'Product ID', + name: 'procuctId', + type: 'number', + default: 0, + displayOptions: { + show: { + operation: [ + 'getByProductId', + ], + resource: [ + 'ecommerceOrderProducts', + ], + }, + }, + description: 'The ID of the product you\'d like returned.', + }, + + // ---------------------------------- + // ecommerceOrderProducts:getAll + // ---------------------------------- + { + displayName: 'Return All', + name: 'returnAll', + type: 'boolean', + displayOptions: { + show: { + operation: [ + 'getAll', + ], + resource: [ + 'ecommerceOrderProducts', + ], + }, + }, + default: false, + description: 'If all results should be returned or only up to a given limit.', + }, + { + displayName: 'Limit', + name: 'limit', + type: 'number', + displayOptions: { + show: { + operation: [ + 'getAll', + ], + resource: [ + 'ecommerceOrderProducts', + ], + returnAll: [ + false, + ], + }, + }, + typeOptions: { + minValue: 1, + maxValue: 500, + }, + default: 100, + description: 'How many results to return.', + }, +] as INodeProperties[]; \ No newline at end of file diff --git a/packages/nodes-base/nodes/ActiveCampaign/GenericFunctions.ts b/packages/nodes-base/nodes/ActiveCampaign/GenericFunctions.ts index 169c9f1146..fe607b80b9 100644 --- a/packages/nodes-base/nodes/ActiveCampaign/GenericFunctions.ts +++ b/packages/nodes-base/nodes/ActiveCampaign/GenericFunctions.ts @@ -9,6 +9,12 @@ import { import { OptionsWithUri } from 'request'; +export interface IProduct { + fields: { + item?: object[]; + }; +} + /** * Make an API request to ActiveCampaign @@ -99,10 +105,14 @@ export async function activeCampaignApiRequestAllItems(this: IHookFunctions | IE if (dataKey === undefined) { returnData.push.apply(returnData, responseData); - itemsReceived += returnData.length; + if (returnData !== undefined) { + itemsReceived += returnData.length; + } } else { returnData.push.apply(returnData, responseData[dataKey]); - itemsReceived += responseData[dataKey].length; + if (responseData[dataKey] !== undefined) { + itemsReceived += responseData[dataKey].length; + } } query.offset = itemsReceived; diff --git a/packages/nodes-base/nodes/ActiveCampaign/currencies.ts b/packages/nodes-base/nodes/ActiveCampaign/currencies.ts new file mode 100644 index 0000000000..e979999eef --- /dev/null +++ b/packages/nodes-base/nodes/ActiveCampaign/currencies.ts @@ -0,0 +1,173 @@ +export const allCurrencies = [ + { name: 'Euro', value: 'eur' }, + { name: 'United States Dollar', value: 'usd' }, + { name: 'British Pound Sterling', value: 'gbp' }, + { name: 'Swiss Franc', value: 'chf' }, + { name: 'Renminbi', value: 'cny' }, + { name: '--------', value: '' }, + { name: 'United Arab Emirates Dirham', value: 'aed' }, + { name: 'Afghan Afghani', value: 'afn' }, + { name: 'Albanian Lek', value: 'all' }, + { name: 'Armenian Dram', value: 'amd' }, + { name: 'Netherlands Antillean Guilder', value: 'ang' }, + { name: 'Angolan Kwanza', value: 'aoa' }, + { name: 'Argentine Peso', value: 'ars' }, + { name: 'Australian Dollar', value: 'aud' }, + { name: 'Aruban Florin', value: 'awg' }, + { name: 'Azerbaijani Manat', value: 'azn' }, + { name: 'Bosnia-Herzegovina Convertible Mark', value: 'bam' }, + { name: 'Barbadian Dollar', value: 'bbd' }, + { name: 'Bangladeshi Taka', value: 'bdt' }, + { name: 'Bulgarian Lev', value: 'bgn' }, + { name: 'Bahraini Dinar', value: 'bhd' }, + { name: 'Burundian Franc', value: 'bif' }, + { name: 'Bermudan Dollar', value: 'bmd' }, + { name: 'Brunei Dollar', value: 'bnd' }, + { name: 'Bolivian Boliviano', value: 'bob' }, + { name: 'Brazilian Real', value: 'brl' }, + { name: 'Bahamian Dollar', value: 'bsd' }, + { name: 'Bitcoin', value: 'btc' }, + { name: 'Bhutanese Ngultrum', value: 'btn' }, + { name: 'Botswanan Pula', value: 'bwp' }, + { name: 'Belarusian Ruble', value: 'byn' }, + { name: 'Belize Dollar', value: 'bzd' }, + { name: 'Canadian Dollar', value: 'cad' }, + { name: 'Congolese Franc', value: 'cdf' }, + { name: 'Chilean Unit of Account (UF)', value: 'clf' }, + { name: 'Chilean Peso', value: 'clp' }, + { name: 'Chinese Yuan (Offshore)', value: 'cnh' }, + { name: 'Colombian Peso', value: 'cop' }, + { name: 'Costa Rican Colón', value: 'crc' }, + { name: 'Cuban Convertible Peso', value: 'cuc' }, + { name: 'Cuban Peso', value: 'cup' }, + { name: 'Cape Verdean Escudo', value: 'cve' }, + { name: 'Czech Republic Koruna', value: 'czk' }, + { name: 'Djiboutian Franc', value: 'djf' }, + { name: 'Danish Krone', value: 'dkk' }, + { name: 'Dominican Peso', value: 'dop' }, + { name: 'Algerian Dinar', value: 'dzd' }, + { name: 'Egyptian Pound', value: 'egp' }, + { name: 'Eritrean Nakfa', value: 'ern' }, + { name: 'Ethiopian Birr', value: 'etb' }, + { name: 'Fijian Dollar', value: 'fjd' }, + { name: 'Falkland Islands Pound', value: 'fkp' }, + { name: 'Georgian Lari', value: 'gel' }, + { name: 'Guernsey Pound', value: 'ggp' }, + { name: 'Ghanaian Cedi', value: 'ghs' }, + { name: 'Gibraltar Pound', value: 'gip' }, + { name: 'Gambian Dalasi', value: 'gmd' }, + { name: 'Guinean Franc', value: 'gnf' }, + { name: 'Guatemalan Quetzal', value: 'gtq' }, + { name: 'Guyanaese Dollar', value: 'gyd' }, + { name: 'Hong Kong Dollar', value: 'hkd' }, + { name: 'Honduran Lempira', value: 'hnl' }, + { name: 'Croatian Kuna', value: 'hrk' }, + { name: 'Haitian Gourde', value: 'htg' }, + { name: 'Hungarian Forint', value: 'huf' }, + { name: 'Indonesian Rupiah', value: 'idr' }, + { name: 'Israeli New Sheqel', value: 'ils' }, + { name: 'Manx pound', value: 'imp' }, + { name: 'Indian Rupee', value: 'inr' }, + { name: 'Iraqi Dinar', value: 'iqd' }, + { name: 'Iranian Rial', value: 'irr' }, + { name: 'Icelandic Króna', value: 'isk' }, + { name: 'Jersey Pound', value: 'jep' }, + { name: 'Jamaican Dollar', value: 'jmd' }, + { name: 'Jordanian Dinar', value: 'jod' }, + { name: 'Japanese Yen', value: 'jpy' }, + { name: 'Kenyan Shilling', value: 'kes' }, + { name: 'Kyrgystani Som', value: 'kgs' }, + { name: 'Cambodian Riel', value: 'khr' }, + { name: 'Comorian Franc', value: 'kmf' }, + { name: 'North Korean Won', value: 'kpw' }, + { name: 'South Korean Won', value: 'krw' }, + { name: 'Kuwaiti Dinar', value: 'kwd' }, + { name: 'Cayman Islands Dollar', value: 'kyd' }, + { name: 'Kazakhstani Tenge', value: 'kzt' }, + { name: 'Laotian Kip', value: 'lak' }, + { name: 'Lebanese Pound', value: 'lbp' }, + { name: 'Sri Lankan Rupee', value: 'lkr' }, + { name: 'Liberian Dollar', value: 'lrd' }, + { name: 'Lesotho Loti', value: 'lsl' }, + { name: 'Libyan Dinar', value: 'lyd' }, + { name: 'Moroccan Dirham', value: 'mad' }, + { name: 'Moldovan Leu', value: 'mdl' }, + { name: 'Malagasy Ariary', value: 'mga' }, + { name: 'Macedonian Denar', value: 'mkd' }, + { name: 'Myanma Kyat', value: 'mmk' }, + { name: 'Mongolian Tugrik', value: 'mnt' }, + { name: 'Macanese Pataca', value: 'mop' }, + { name: 'Mauritanian Ouguiya (pre-2018)', value: 'mro' }, + { name: 'Mauritanian Ouguiya', value: 'mru' }, + { name: 'Mauritian Rupee', value: 'mur' }, + { name: 'Maldivian Rufiyaa', value: 'mvr' }, + { name: 'Malawian Kwacha', value: 'mwk' }, + { name: 'Mexican Peso', value: 'mxn' }, + { name: 'Malaysian Ringgit', value: 'myr' }, + { name: 'Mozambican Metical', value: 'mzn' }, + { name: 'Namibian Dollar', value: 'nad' }, + { name: 'Nigerian Naira', value: 'ngn' }, + { name: 'Nicaraguan Córdoba', value: 'nio' }, + { name: 'Norwegian Krone', value: 'nok' }, + { name: 'Nepalese Rupee', value: 'npr' }, + { name: 'New Zealand Dollar', value: 'nzd' }, + { name: 'Omani Rial', value: 'omr' }, + { name: 'Panamanian Balboa', value: 'pab' }, + { name: 'Peruvian Nuevo Sol', value: 'pen' }, + { name: 'Papua New Guinean Kina', value: 'pgk' }, + { name: 'Philippine Peso', value: 'php' }, + { name: 'Pakistani Rupee', value: 'pkr' }, + { name: 'Polish Zloty', value: 'pln' }, + { name: 'Paraguayan Guarani', value: 'pyg' }, + { name: 'Qatari Rial', value: 'qar' }, + { name: 'Romanian Leu', value: 'ron' }, + { name: 'Serbian Dinar', value: 'rsd' }, + { name: 'Russian Ruble', value: 'rub' }, + { name: 'Rwandan Franc', value: 'rwf' }, + { name: 'Saudi Riyal', value: 'sar' }, + { name: 'Solomon Islands Dollar', value: 'sbd' }, + { name: 'Seychellois Rupee', value: 'scr' }, + { name: 'Sudanese Pound', value: 'sdg' }, + { name: 'Swedish Krona', value: 'sek' }, + { name: 'Singapore Dollar', value: 'sgd' }, + { name: 'Saint Helena Pound', value: 'shp' }, + { name: 'Sierra Leonean Leone', value: 'sll' }, + { name: 'Somali Shilling', value: 'sos' }, + { name: 'Surinamese Dollar', value: 'srd' }, + { name: 'South Sudanese Pound', value: 'ssp' }, + { name: 'São Tomé and Príncipe Dobra (pre-2018)', value: 'std' }, + { name: 'São Tomé and Príncipe Dobra', value: 'stn' }, + { name: 'Salvadoran Colón', value: 'svc' }, + { name: 'Syrian Pound', value: 'syp' }, + { name: 'Swazi Lilangeni', value: 'szl' }, + { name: 'Thai Baht', value: 'thb' }, + { name: 'Tajikistani Somoni', value: 'tjs' }, + { name: 'Turkmenistani Manat', value: 'tmt' }, + { name: 'Tunisian Dinar', value: 'tnd' }, + { name: "Tongan Pa'anga", value: 'top' }, + { name: 'Turkish Lira', value: 'try' }, + { name: 'Trinidad and Tobago Dollar', value: 'ttd' }, + { name: 'New Taiwan Dollar', value: 'twd' }, + { name: 'Tanzanian Shilling', value: 'tzs' }, + { name: 'Ukrainian Hryvnia', value: 'uah' }, + { name: 'Ugandan Shilling', value: 'ugx' }, + { name: 'Uruguayan Peso', value: 'uyu' }, + { name: 'Uzbekistan Som', value: 'uzs' }, + { name: 'Venezuelan Bolívar Fuerte', value: 'vef' }, + { name: 'Vietnamese Dong', value: 'vnd' }, + { name: 'Vanuatu Vatu', value: 'vuv' }, + { name: 'Samoan Tala', value: 'wst' }, + { name: 'CFA Franc BEAC', value: 'xaf' }, + { name: 'Silver Ounce', value: 'xag' }, + { name: 'Gold Ounce', value: 'xau' }, + { name: 'East Caribbean Dollar', value: 'xcd' }, + { name: 'Special Drawing Rights', value: 'xdr' }, + { name: 'CFA Franc BCEAO', value: 'xof' }, + { name: 'Palladium Ounce', value: 'xpd' }, + { name: 'CFP Franc', value: 'xpf' }, + { name: 'Platinum Ounce', value: 'xpt' }, + { name: 'Yemeni Rial', value: 'yer' }, + { name: 'South African Rand', value: 'zar' }, + { name: 'Zambian Kwacha', value: 'zmw' }, + { name: 'Zimbabwean Dollar', value: 'zwl' } +]; diff --git a/packages/nodes-base/nodes/utils/allCurrencies.ts b/packages/nodes-base/nodes/utils/allCurrencies.ts new file mode 100644 index 0000000000..2924edc323 --- /dev/null +++ b/packages/nodes-base/nodes/utils/allCurrencies.ts @@ -0,0 +1,174 @@ +const allCurrencies = [ + { name: 'Euro', value: 'eur' }, + { name: 'United States Dollar', value: 'usd' }, + { name: 'British Pound Sterling', value: 'gbp' }, + { name: 'Swiss Franc', value: 'chf' }, + { name: 'Renminbi', value: 'cny' }, + { name: '--------', value: '' }, + { name: 'United Arab Emirates Dirham', value: 'aed' }, + { name: 'Afghan Afghani', value: 'afn' }, + { name: 'Albanian Lek', value: 'all' }, + { name: 'Armenian Dram', value: 'amd' }, + { name: 'Netherlands Antillean Guilder', value: 'ang' }, + { name: 'Angolan Kwanza', value: 'aoa' }, + { name: 'Argentine Peso', value: 'ars' }, + { name: 'Australian Dollar', value: 'aud' }, + { name: 'Aruban Florin', value: 'awg' }, + { name: 'Azerbaijani Manat', value: 'azn' }, + { name: 'Bosnia-Herzegovina Convertible Mark', value: 'bam' }, + { name: 'Barbadian Dollar', value: 'bbd' }, + { name: 'Bangladeshi Taka', value: 'bdt' }, + { name: 'Bulgarian Lev', value: 'bgn' }, + { name: 'Bahraini Dinar', value: 'bhd' }, + { name: 'Burundian Franc', value: 'bif' }, + { name: 'Bermudan Dollar', value: 'bmd' }, + { name: 'Brunei Dollar', value: 'bnd' }, + { name: 'Bolivian Boliviano', value: 'bob' }, + { name: 'Brazilian Real', value: 'brl' }, + { name: 'Bahamian Dollar', value: 'bsd' }, + { name: 'Bitcoin', value: 'btc' }, + { name: 'Bhutanese Ngultrum', value: 'btn' }, + { name: 'Botswanan Pula', value: 'bwp' }, + { name: 'Belarusian Ruble', value: 'byn' }, + { name: 'Belize Dollar', value: 'bzd' }, + { name: 'Canadian Dollar', value: 'cad' }, + { name: 'Congolese Franc', value: 'cdf' }, + { name: 'Chilean Unit of Account (UF)', value: 'clf' }, + { name: 'Chilean Peso', value: 'clp' }, + { name: 'Chinese Yuan (Offshore)', value: 'cnh' }, + { name: 'Colombian Peso', value: 'cop' }, + { name: 'Costa Rican Colón', value: 'crc' }, + { name: 'Cuban Convertible Peso', value: 'cuc' }, + { name: 'Cuban Peso', value: 'cup' }, + { name: 'Cape Verdean Escudo', value: 'cve' }, + { name: 'Czech Republic Koruna', value: 'czk' }, + { name: 'Djiboutian Franc', value: 'djf' }, + { name: 'Danish Krone', value: 'dkk' }, + { name: 'Dominican Peso', value: 'dop' }, + { name: 'Algerian Dinar', value: 'dzd' }, + { name: 'Egyptian Pound', value: 'egp' }, + { name: 'Eritrean Nakfa', value: 'ern' }, + { name: 'Ethiopian Birr', value: 'etb' }, + { name: 'Fijian Dollar', value: 'fjd' }, + { name: 'Falkland Islands Pound', value: 'fkp' }, + { name: 'Georgian Lari', value: 'gel' }, + { name: 'Guernsey Pound', value: 'ggp' }, + { name: 'Ghanaian Cedi', value: 'ghs' }, + { name: 'Gibraltar Pound', value: 'gip' }, + { name: 'Gambian Dalasi', value: 'gmd' }, + { name: 'Guinean Franc', value: 'gnf' }, + { name: 'Guatemalan Quetzal', value: 'gtq' }, + { name: 'Guyanaese Dollar', value: 'gyd' }, + { name: 'Hong Kong Dollar', value: 'hkd' }, + { name: 'Honduran Lempira', value: 'hnl' }, + { name: 'Croatian Kuna', value: 'hrk' }, + { name: 'Haitian Gourde', value: 'htg' }, + { name: 'Hungarian Forint', value: 'huf' }, + { name: 'Indonesian Rupiah', value: 'idr' }, + { name: 'Israeli New Sheqel', value: 'ils' }, + { name: 'Manx pound', value: 'imp' }, + { name: 'Indian Rupee', value: 'inr' }, + { name: 'Iraqi Dinar', value: 'iqd' }, + { name: 'Iranian Rial', value: 'irr' }, + { name: 'Icelandic Króna', value: 'isk' }, + { name: 'Jersey Pound', value: 'jep' }, + { name: 'Jamaican Dollar', value: 'jmd' }, + { name: 'Jordanian Dinar', value: 'jod' }, + { name: 'Japanese Yen', value: 'jpy' }, + { name: 'Kenyan Shilling', value: 'kes' }, + { name: 'Kyrgystani Som', value: 'kgs' }, + { name: 'Cambodian Riel', value: 'khr' }, + { name: 'Comorian Franc', value: 'kmf' }, + { name: 'North Korean Won', value: 'kpw' }, + { name: 'South Korean Won', value: 'krw' }, + { name: 'Kuwaiti Dinar', value: 'kwd' }, + { name: 'Cayman Islands Dollar', value: 'kyd' }, + { name: 'Kazakhstani Tenge', value: 'kzt' }, + { name: 'Laotian Kip', value: 'lak' }, + { name: 'Lebanese Pound', value: 'lbp' }, + { name: 'Sri Lankan Rupee', value: 'lkr' }, + { name: 'Liberian Dollar', value: 'lrd' }, + { name: 'Lesotho Loti', value: 'lsl' }, + { name: 'Libyan Dinar', value: 'lyd' }, + { name: 'Moroccan Dirham', value: 'mad' }, + { name: 'Moldovan Leu', value: 'mdl' }, + { name: 'Malagasy Ariary', value: 'mga' }, + { name: 'Macedonian Denar', value: 'mkd' }, + { name: 'Myanma Kyat', value: 'mmk' }, + { name: 'Mongolian Tugrik', value: 'mnt' }, + { name: 'Macanese Pataca', value: 'mop' }, + { name: 'Mauritanian Ouguiya (pre-2018)', value: 'mro' }, + { name: 'Mauritanian Ouguiya', value: 'mru' }, + { name: 'Mauritian Rupee', value: 'mur' }, + { name: 'Maldivian Rufiyaa', value: 'mvr' }, + { name: 'Malawian Kwacha', value: 'mwk' }, + { name: 'Mexican Peso', value: 'mxn' }, + { name: 'Malaysian Ringgit', value: 'myr' }, + { name: 'Mozambican Metical', value: 'mzn' }, + { name: 'Namibian Dollar', value: 'nad' }, + { name: 'Nigerian Naira', value: 'ngn' }, + { name: 'Nicaraguan Córdoba', value: 'nio' }, + { name: 'Norwegian Krone', value: 'nok' }, + { name: 'Nepalese Rupee', value: 'npr' }, + { name: 'New Zealand Dollar', value: 'nzd' }, + { name: 'Omani Rial', value: 'omr' }, + { name: 'Panamanian Balboa', value: 'pab' }, + { name: 'Peruvian Nuevo Sol', value: 'pen' }, + { name: 'Papua New Guinean Kina', value: 'pgk' }, + { name: 'Philippine Peso', value: 'php' }, + { name: 'Pakistani Rupee', value: 'pkr' }, + { name: 'Polish Zloty', value: 'pln' }, + { name: 'Paraguayan Guarani', value: 'pyg' }, + { name: 'Qatari Rial', value: 'qar' }, + { name: 'Romanian Leu', value: 'ron' }, + { name: 'Serbian Dinar', value: 'rsd' }, + { name: 'Russian Ruble', value: 'rub' }, + { name: 'Rwandan Franc', value: 'rwf' }, + { name: 'Saudi Riyal', value: 'sar' }, + { name: 'Solomon Islands Dollar', value: 'sbd' }, + { name: 'Seychellois Rupee', value: 'scr' }, + { name: 'Sudanese Pound', value: 'sdg' }, + { name: 'Swedish Krona', value: 'sek' }, + { name: 'Singapore Dollar', value: 'sgd' }, + { name: 'Saint Helena Pound', value: 'shp' }, + { name: 'Sierra Leonean Leone', value: 'sll' }, + { name: 'Somali Shilling', value: 'sos' }, + { name: 'Surinamese Dollar', value: 'srd' }, + { name: 'South Sudanese Pound', value: 'ssp' }, + { name: 'São Tomé and Príncipe Dobra (pre-2018)', value: 'std' }, + { name: 'São Tomé and Príncipe Dobra', value: 'stn' }, + { name: 'Salvadoran Colón', value: 'svc' }, + { name: 'Syrian Pound', value: 'syp' }, + { name: 'Swazi Lilangeni', value: 'szl' }, + { name: 'Thai Baht', value: 'thb' }, + { name: 'Tajikistani Somoni', value: 'tjs' }, + { name: 'Turkmenistani Manat', value: 'tmt' }, + { name: 'Tunisian Dinar', value: 'tnd' }, + { name: "Tongan Pa'anga", value: 'top' }, + { name: 'Turkish Lira', value: 'try' }, + { name: 'Trinidad and Tobago Dollar', value: 'ttd' }, + { name: 'New Taiwan Dollar', value: 'twd' }, + { name: 'Tanzanian Shilling', value: 'tzs' }, + { name: 'Ukrainian Hryvnia', value: 'uah' }, + { name: 'Ugandan Shilling', value: 'ugx' }, + { name: 'Uruguayan Peso', value: 'uyu' }, + { name: 'Uzbekistan Som', value: 'uzs' }, + { name: 'Venezuelan Bolívar Fuerte', value: 'vef' }, + { name: 'Vietnamese Dong', value: 'vnd' }, + { name: 'Vanuatu Vatu', value: 'vuv' }, + { name: 'Samoan Tala', value: 'wst' }, + { name: 'CFA Franc BEAC', value: 'xaf' }, + { name: 'Silver Ounce', value: 'xag' }, + { name: 'Gold Ounce', value: 'xau' }, + { name: 'East Caribbean Dollar', value: 'xcd' }, + { name: 'Special Drawing Rights', value: 'xdr' }, + { name: 'CFA Franc BCEAO', value: 'xof' }, + { name: 'Palladium Ounce', value: 'xpd' }, + { name: 'CFP Franc', value: 'xpf' }, + { name: 'Platinum Ounce', value: 'xpt' }, + { name: 'Yemeni Rial', value: 'yer' }, + { name: 'South African Rand', value: 'zar' }, + { name: 'Zambian Kwacha', value: 'zmw' }, + { name: 'Zimbabwean Dollar', value: 'zwl' } +// tslint:disable-next-line: semicolon +] \ No newline at end of file