Skip to content

Commit 1366923

Browse files
committed
some adjusts
1 parent 61b54d2 commit 1366923

File tree

4 files changed

+62
-14
lines changed

4 files changed

+62
-14
lines changed

components/elastic_email/actions/add-contact/add-contact.mjs

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { ConfigurationError } from "@pipedream/platform";
2-
import { STATUS_OPTIONS } from "../../common/constants.mjs";
2+
import {
3+
CONSENT_TRACKING_OPTIONS,
4+
STATUS_OPTIONS,
5+
} from "../../common/constants.mjs";
36
import { parseObject } from "../../common/utils.mjs";
47
import app from "../../elastic_email.app.mjs";
58

@@ -49,10 +52,23 @@ export default {
4952
description: "A key-value collection of custom contact fields which can be used in the system. Only already existing custom fields will be saved.",
5053
optional: true,
5154
},
52-
consent: {
53-
type: "object",
54-
label: "Consent",
55-
description: "An object with consent settings. **Example: \"ConsentIP\": \"192.168.0.1\", \"ConsentDate\": \"1/1/2015 0:00:00 AM\", \"ConsentTracking\": \"Unknown\"}**",
55+
consentIP: {
56+
type: "string",
57+
label: "Consent IP",
58+
description: "IP address of consent to send this contact(s) your email. If not provided your current public IP address is used for consent.",
59+
optional: true,
60+
},
61+
consentDate: {
62+
type: "string",
63+
label: "Consent Date",
64+
description: "Date of consent to send this contact(s) your email. If not provided current date is used for consent.",
65+
optional: true,
66+
},
67+
consentTracking: {
68+
type: "string",
69+
label: "Consent Tracking",
70+
description: "Tracking of consent to send this contact(s) your email. Defaults to \"Unknown\".",
71+
options: CONSENT_TRACKING_OPTIONS,
5672
optional: true,
5773
},
5874
},
@@ -69,7 +85,11 @@ export default {
6985
FirstName: this.firstName,
7086
LastName: this.lastName,
7187
CustomFields: parseObject(this.customFields),
72-
Consent: parseObject(this.consent),
88+
Consent: {
89+
ConsentIP: this.consentIP,
90+
ConsentDate: this.consentDate,
91+
ConsentTracking: this.consentTracking,
92+
},
7393
},
7494
],
7595
});

components/elastic_email/actions/send-email/send-email.mjs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import { ENCODING_OPTIONS } from "../../common/constants.mjs";
1+
import {
2+
BODY_CONTENT_TYPE_OPTIONS,
3+
ENCODING_OPTIONS,
4+
} from "../../common/constants.mjs";
25
import { parseObject } from "../../common/utils.mjs";
36
import app from "../../elastic_email.app.mjs";
47

@@ -20,10 +23,17 @@ export default {
2023
label: "From",
2124
description: "Your e-mail with an optional name (e.g.: [email protected])",
2225
},
23-
body: {
24-
type: "string[]",
25-
label: "Body",
26-
description: "List of e-mail body parts, with user-provided MIME types (text/html, text/plain etc). **Format: {\"ContentType\": \"HTML\", \"Content\": \"email content\", \"\": \"\"}**",
26+
bodyContentType: {
27+
type: "string",
28+
label: "Body Content Type",
29+
description: "Type of body part",
30+
options: BODY_CONTENT_TYPE_OPTIONS,
31+
optional: true,
32+
},
33+
bodyContent: {
34+
type: "string",
35+
label: "Body Content",
36+
description: "Actual content of the body part",
2737
optional: true,
2838
},
2939
merge: {
@@ -98,7 +108,12 @@ export default {
98108
})),
99109
Content: {
100110
From: this.from,
101-
Body: parseObject(this.body),
111+
Body: [
112+
{
113+
ContentType: this.bodyContentType,
114+
Body: this.bodyContent,
115+
},
116+
],
102117
Merge: parseObject(this.merge),
103118
ReplyTo: this.replyTo,
104119
Subject: this.subject,

components/elastic_email/common/constants.mjs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,16 @@ export const ENCODING_OPTIONS = [
2121
"Base64",
2222
"Uue",
2323
];
24+
25+
export const CONSENT_TRACKING_OPTIONS = [
26+
"Unknown",
27+
"Allow",
28+
"Deny",
29+
];
30+
31+
export const BODY_CONTENT_TYPE_OPTIONS = [
32+
"HTML",
33+
"PlainText",
34+
"AMP",
35+
"CSS",
36+
];

components/elastic_email/elastic_email.app.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ export default {
77
propDefinitions: {
88
email: {
99
type: "string",
10-
label: "Email Subject",
11-
description: "Subject of the email",
10+
label: "Email",
11+
description: "The contact's email",
1212
},
1313
listNames: {
1414
type: "string[]",

0 commit comments

Comments
 (0)