n8n-nodes-mailchimp-cmdesign 0.3.0 → 0.3.2

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.
@@ -3,14 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createUpdateSubscriber = void 0;
4
4
  const n8n_workflow_1 = require("n8n-workflow");
5
5
  async function createUpdateSubscriber(apiUrl, apiKey) {
6
- var _a, _b;
6
+ var _a;
7
7
  const listId = this.getNodeParameter('listId', 0);
8
8
  const email = this.getNodeParameter('email', 0);
9
9
  const mapping = this.getNodeParameter('subscriberFieldMapping', 0);
10
+ const items = this.getInputData();
10
11
  const mergeFields = {};
11
12
  if (((_a = mapping === null || mapping === void 0 ? void 0 : mapping.subscriberFields) === null || _a === void 0 ? void 0 : _a.length) > 0) {
12
13
  for (const field of mapping.subscriberFields) {
13
- mergeFields[field.mailChimpField] = String((_b = field.subscriberIncomingKey) !== null && _b !== void 0 ? _b : '');
14
+ const value = items[0].json[field.subscriberIncomingKey];
15
+ if (value !== undefined && value !== null && String(value).trim() !== '') {
16
+ mergeFields[field.mailChimpField] = String(value);
17
+ }
14
18
  }
15
19
  }
16
20
  const body = {
@@ -33,7 +33,7 @@ const subscriberInputs = [
33
33
  },
34
34
  {
35
35
  displayName: 'MailchimpCm Field Name or ID',
36
- name: 'mailAirField',
36
+ name: 'mailChimpField',
37
37
  type: 'options',
38
38
  description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
39
39
  typeOptions: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n8n-nodes-mailchimp-cmdesign",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "n8n node to interact with Mailchimp API",
5
5
  "main": "index.js",
6
6
  "scripts": {