Skip to content

Commit f00c943

Browse files
committed
updates
1 parent c40f0cd commit f00c943

File tree

4 files changed

+35
-17
lines changed

4 files changed

+35
-17
lines changed

components/zoho_survey/actions/send-email-invitation/send-email-invitation.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "zoho_survey-send-email-invitation",
55
name: "Send Email Invitation",
66
description: "Sends an email invitation with Zoho Survey.",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
type: "action",
99
props: {
1010
zohoSurvey,

components/zoho_survey/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/zoho_survey",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"description": "Pipedream Zoho Survey Components",
55
"main": "zoho_survey.app.mjs",
66
"keywords": [
@@ -13,6 +13,7 @@
1313
"access": "public"
1414
},
1515
"dependencies": {
16-
"@pipedream/platform": "^1.5.1"
16+
"@pipedream/platform": "^1.5.1",
17+
"html-entities-decoder": "^1.0.5"
1718
}
1819
}

components/zoho_survey/sources/new-survey-response/new-survey-response.mjs

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import common from "../common/base.mjs";
2+
import decode from "html-entities-decoder";
23
import sampleEmit from "./test-event.mjs";
34

45
export default {
56
...common,
67
key: "zoho_survey-new-survey-response",
78
name: "New Survey Response (Instant)",
89
description: "Emit new event when a new survey response is received in Zoho Surveys.",
9-
version: "0.0.2",
10+
version: "0.0.3",
1011
type: "source",
1112
dedupe: "unique",
1213
methods: {
@@ -17,8 +18,8 @@ export default {
1718
generateMeta(response) {
1819
const ts = Date.now();
1920
return {
20-
id: `${response["Response ID"]}${ts}`,
21-
summary: `New Response ${response["Response ID"]}`,
21+
id: `${response["RESPONSE_ID"]}${ts}`,
22+
summary: `New Response ${response["RESPONSE_ID"]}`,
2223
ts,
2324
};
2425
},
@@ -28,7 +29,7 @@ export default {
2829
if (Array.isArray(obj)) {
2930
obj.forEach((item) => recursiveSearch(item));
3031
} else if (obj && typeof obj === "object") {
31-
if ("label" in obj) {
32+
if ("label" in obj && "key" in obj) {
3233
labels[obj.key] = obj.label;
3334
}
3435
Object.values(obj).forEach((value) => recursiveSearch(value));
@@ -43,17 +44,32 @@ export default {
4344
groupId: this.groupId,
4445
surveyId: this.surveyId,
4546
});
46-
const labels = this.collectFieldLabels(variables);
47+
const questions = variables.find(({ label }) => label === "Questions");
48+
const respondentVariables = variables.find(({ label }) => label == "Respondent Variables");
49+
const labels = this.collectFieldLabels([
50+
...questions.variables,
51+
...respondentVariables.variables,
52+
]);
4753
const response = {};
4854
for (const [
4955
key,
5056
value,
5157
] of Object.entries(body)) {
52-
response[labels[key]] = value;
58+
response[key] = labels[key]
59+
? {
60+
label: decode(labels[key]),
61+
value: decode(value),
62+
}
63+
: decode(value);
5364
}
54-
for (const label of Object.values(labels)) {
55-
if (!response[label]) {
56-
response[label] = "";
65+
for (const [
66+
key,
67+
value,
68+
] of Object.entries(labels)) {
69+
if (!response[key]) {
70+
response[key] = {
71+
label: decode(value),
72+
};
5773
}
5874
}
5975
return response;

components/zoho_survey/zoho_survey.app.mjs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { axios } from "@pipedream/platform";
2+
import decode from "html-entities-decoder";
23
const DEFAULT_LIMIT = 50;
34

45
export default {
@@ -15,7 +16,7 @@ export default {
1516
portalId: value, portalName: label,
1617
}) => ({
1718
value,
18-
label,
19+
label: decode(label),
1920
})) || [];
2021
},
2122
},
@@ -30,7 +31,7 @@ export default {
3031
groupUniqueId: value, name: label,
3132
}) => ({
3233
value,
33-
label,
34+
label: decode(label),
3435
}));
3536
},
3637
},
@@ -56,7 +57,7 @@ export default {
5657
id: value, name: label,
5758
}) => ({
5859
value,
59-
label,
60+
label: decode(label),
6061
})) || [];
6162
},
6263
},
@@ -76,7 +77,7 @@ export default {
7677
id: value, name: label,
7778
}) => ({
7879
value,
79-
label,
80+
label: decode(label),
8081
})) || [];
8182
},
8283
},
@@ -100,7 +101,7 @@ export default {
100101
id: value, name: label,
101102
}) => ({
102103
value,
103-
label,
104+
label: decode(label),
104105
})) || [];
105106
},
106107
},

0 commit comments

Comments
 (0)