@memberjunction/actions-bizapps-formbuilders 2.112.0-beta
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.
- package/IMPLEMENTATION_PLAN.md +311 -0
- package/README.md +498 -0
- package/dist/base/base-form-builder.action.d.ts +153 -0
- package/dist/base/base-form-builder.action.d.ts.map +1 -0
- package/dist/base/base-form-builder.action.js +301 -0
- package/dist/base/base-form-builder.action.js.map +1 -0
- package/dist/base/index.d.ts +2 -0
- package/dist/base/index.d.ts.map +1 -0
- package/dist/base/index.js +18 -0
- package/dist/base/index.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/google-forms/actions/export-csv.action.d.ts +31 -0
- package/dist/providers/google-forms/actions/export-csv.action.d.ts.map +1 -0
- package/dist/providers/google-forms/actions/export-csv.action.js +165 -0
- package/dist/providers/google-forms/actions/export-csv.action.js.map +1 -0
- package/dist/providers/google-forms/actions/get-form.action.d.ts +28 -0
- package/dist/providers/google-forms/actions/get-form.action.d.ts.map +1 -0
- package/dist/providers/google-forms/actions/get-form.action.js +151 -0
- package/dist/providers/google-forms/actions/get-form.action.js.map +1 -0
- package/dist/providers/google-forms/actions/get-single-response.action.d.ts +31 -0
- package/dist/providers/google-forms/actions/get-single-response.action.d.ts.map +1 -0
- package/dist/providers/google-forms/actions/get-single-response.action.js +150 -0
- package/dist/providers/google-forms/actions/get-single-response.action.js.map +1 -0
- package/dist/providers/google-forms/actions/get-statistics.action.d.ts +36 -0
- package/dist/providers/google-forms/actions/get-statistics.action.d.ts.map +1 -0
- package/dist/providers/google-forms/actions/get-statistics.action.js +254 -0
- package/dist/providers/google-forms/actions/get-statistics.action.js.map +1 -0
- package/dist/providers/google-forms/actions/index.d.ts +5 -0
- package/dist/providers/google-forms/actions/index.d.ts.map +1 -0
- package/dist/providers/google-forms/actions/index.js +23 -0
- package/dist/providers/google-forms/actions/index.js.map +1 -0
- package/dist/providers/google-forms/googleforms-base.action.d.ts +197 -0
- package/dist/providers/google-forms/googleforms-base.action.d.ts.map +1 -0
- package/dist/providers/google-forms/googleforms-base.action.js +352 -0
- package/dist/providers/google-forms/googleforms-base.action.js.map +1 -0
- package/dist/providers/google-forms/index.d.ts +3 -0
- package/dist/providers/google-forms/index.d.ts.map +1 -0
- package/dist/providers/google-forms/index.js +21 -0
- package/dist/providers/google-forms/index.js.map +1 -0
- package/dist/providers/jotform/actions/create-form.action.d.ts +61 -0
- package/dist/providers/jotform/actions/create-form.action.d.ts.map +1 -0
- package/dist/providers/jotform/actions/create-form.action.js +259 -0
- package/dist/providers/jotform/actions/create-form.action.js.map +1 -0
- package/dist/providers/jotform/actions/export-csv.action.d.ts +31 -0
- package/dist/providers/jotform/actions/export-csv.action.d.ts.map +1 -0
- package/dist/providers/jotform/actions/export-csv.action.js +187 -0
- package/dist/providers/jotform/actions/export-csv.action.js.map +1 -0
- package/dist/providers/jotform/actions/get-form.action.d.ts +31 -0
- package/dist/providers/jotform/actions/get-form.action.d.ts.map +1 -0
- package/dist/providers/jotform/actions/get-form.action.js +188 -0
- package/dist/providers/jotform/actions/get-form.action.js.map +1 -0
- package/dist/providers/jotform/actions/get-single-submission.action.d.ts +31 -0
- package/dist/providers/jotform/actions/get-single-submission.action.d.ts.map +1 -0
- package/dist/providers/jotform/actions/get-single-submission.action.js +138 -0
- package/dist/providers/jotform/actions/get-single-submission.action.js.map +1 -0
- package/dist/providers/jotform/actions/get-statistics.action.d.ts +39 -0
- package/dist/providers/jotform/actions/get-statistics.action.d.ts.map +1 -0
- package/dist/providers/jotform/actions/get-statistics.action.js +290 -0
- package/dist/providers/jotform/actions/get-statistics.action.js.map +1 -0
- package/dist/providers/jotform/actions/get-submissions.action.d.ts +34 -0
- package/dist/providers/jotform/actions/get-submissions.action.d.ts.map +1 -0
- package/dist/providers/jotform/actions/get-submissions.action.js +218 -0
- package/dist/providers/jotform/actions/get-submissions.action.js.map +1 -0
- package/dist/providers/jotform/actions/index.d.ts +9 -0
- package/dist/providers/jotform/actions/index.d.ts.map +1 -0
- package/dist/providers/jotform/actions/index.js +27 -0
- package/dist/providers/jotform/actions/index.js.map +1 -0
- package/dist/providers/jotform/actions/update-form.action.d.ts +38 -0
- package/dist/providers/jotform/actions/update-form.action.d.ts.map +1 -0
- package/dist/providers/jotform/actions/update-form.action.js +232 -0
- package/dist/providers/jotform/actions/update-form.action.js.map +1 -0
- package/dist/providers/jotform/actions/watch-new-submissions.action.d.ts +32 -0
- package/dist/providers/jotform/actions/watch-new-submissions.action.d.ts.map +1 -0
- package/dist/providers/jotform/actions/watch-new-submissions.action.js +229 -0
- package/dist/providers/jotform/actions/watch-new-submissions.action.js.map +1 -0
- package/dist/providers/jotform/index.d.ts +3 -0
- package/dist/providers/jotform/index.d.ts.map +1 -0
- package/dist/providers/jotform/index.js +21 -0
- package/dist/providers/jotform/index.js.map +1 -0
- package/dist/providers/jotform/jotform-base.action.d.ts +96 -0
- package/dist/providers/jotform/jotform-base.action.d.ts.map +1 -0
- package/dist/providers/jotform/jotform-base.action.js +269 -0
- package/dist/providers/jotform/jotform-base.action.js.map +1 -0
- package/dist/providers/surveymonkey/actions/create-survey.action.d.ts +48 -0
- package/dist/providers/surveymonkey/actions/create-survey.action.d.ts.map +1 -0
- package/dist/providers/surveymonkey/actions/create-survey.action.js +192 -0
- package/dist/providers/surveymonkey/actions/create-survey.action.js.map +1 -0
- package/dist/providers/surveymonkey/actions/export-csv.action.d.ts +30 -0
- package/dist/providers/surveymonkey/actions/export-csv.action.d.ts.map +1 -0
- package/dist/providers/surveymonkey/actions/export-csv.action.js +173 -0
- package/dist/providers/surveymonkey/actions/export-csv.action.js.map +1 -0
- package/dist/providers/surveymonkey/actions/get-responses.action.d.ts +33 -0
- package/dist/providers/surveymonkey/actions/get-responses.action.d.ts.map +1 -0
- package/dist/providers/surveymonkey/actions/get-responses.action.js +243 -0
- package/dist/providers/surveymonkey/actions/get-responses.action.js.map +1 -0
- package/dist/providers/surveymonkey/actions/get-single-response.action.d.ts +30 -0
- package/dist/providers/surveymonkey/actions/get-single-response.action.d.ts.map +1 -0
- package/dist/providers/surveymonkey/actions/get-single-response.action.js +149 -0
- package/dist/providers/surveymonkey/actions/get-single-response.action.js.map +1 -0
- package/dist/providers/surveymonkey/actions/get-statistics.action.d.ts +38 -0
- package/dist/providers/surveymonkey/actions/get-statistics.action.d.ts.map +1 -0
- package/dist/providers/surveymonkey/actions/get-statistics.action.js +261 -0
- package/dist/providers/surveymonkey/actions/get-statistics.action.js.map +1 -0
- package/dist/providers/surveymonkey/actions/get-survey.action.d.ts +27 -0
- package/dist/providers/surveymonkey/actions/get-survey.action.d.ts.map +1 -0
- package/dist/providers/surveymonkey/actions/get-survey.action.js +180 -0
- package/dist/providers/surveymonkey/actions/get-survey.action.js.map +1 -0
- package/dist/providers/surveymonkey/actions/index.d.ts +9 -0
- package/dist/providers/surveymonkey/actions/index.d.ts.map +1 -0
- package/dist/providers/surveymonkey/actions/index.js +27 -0
- package/dist/providers/surveymonkey/actions/index.js.map +1 -0
- package/dist/providers/surveymonkey/actions/update-survey.action.d.ts +39 -0
- package/dist/providers/surveymonkey/actions/update-survey.action.d.ts.map +1 -0
- package/dist/providers/surveymonkey/actions/update-survey.action.js +217 -0
- package/dist/providers/surveymonkey/actions/update-survey.action.js.map +1 -0
- package/dist/providers/surveymonkey/actions/watch-new-responses.action.d.ts +31 -0
- package/dist/providers/surveymonkey/actions/watch-new-responses.action.d.ts.map +1 -0
- package/dist/providers/surveymonkey/actions/watch-new-responses.action.js +214 -0
- package/dist/providers/surveymonkey/actions/watch-new-responses.action.js.map +1 -0
- package/dist/providers/surveymonkey/index.d.ts +3 -0
- package/dist/providers/surveymonkey/index.d.ts.map +1 -0
- package/dist/providers/surveymonkey/index.js +21 -0
- package/dist/providers/surveymonkey/index.js.map +1 -0
- package/dist/providers/surveymonkey/surveymonkey-base.action.d.ts +193 -0
- package/dist/providers/surveymonkey/surveymonkey-base.action.d.ts.map +1 -0
- package/dist/providers/surveymonkey/surveymonkey-base.action.js +329 -0
- package/dist/providers/surveymonkey/surveymonkey-base.action.js.map +1 -0
- package/dist/providers/typeform/actions/create-form.action.d.ts +40 -0
- package/dist/providers/typeform/actions/create-form.action.d.ts.map +1 -0
- package/dist/providers/typeform/actions/create-form.action.js +205 -0
- package/dist/providers/typeform/actions/create-form.action.js.map +1 -0
- package/dist/providers/typeform/actions/export-csv.action.d.ts +31 -0
- package/dist/providers/typeform/actions/export-csv.action.d.ts.map +1 -0
- package/dist/providers/typeform/actions/export-csv.action.js +182 -0
- package/dist/providers/typeform/actions/export-csv.action.js.map +1 -0
- package/dist/providers/typeform/actions/get-form.action.d.ts +28 -0
- package/dist/providers/typeform/actions/get-form.action.d.ts.map +1 -0
- package/dist/providers/typeform/actions/get-form.action.js +172 -0
- package/dist/providers/typeform/actions/get-form.action.js.map +1 -0
- package/dist/providers/typeform/actions/get-responses.action.d.ts +34 -0
- package/dist/providers/typeform/actions/get-responses.action.d.ts.map +1 -0
- package/dist/providers/typeform/actions/get-responses.action.js +238 -0
- package/dist/providers/typeform/actions/get-responses.action.js.map +1 -0
- package/dist/providers/typeform/actions/get-single-response.action.d.ts +31 -0
- package/dist/providers/typeform/actions/get-single-response.action.d.ts.map +1 -0
- package/dist/providers/typeform/actions/get-single-response.action.js +161 -0
- package/dist/providers/typeform/actions/get-single-response.action.js.map +1 -0
- package/dist/providers/typeform/actions/get-statistics.action.d.ts +33 -0
- package/dist/providers/typeform/actions/get-statistics.action.d.ts.map +1 -0
- package/dist/providers/typeform/actions/get-statistics.action.js +257 -0
- package/dist/providers/typeform/actions/get-statistics.action.js.map +1 -0
- package/dist/providers/typeform/actions/index.d.ts +9 -0
- package/dist/providers/typeform/actions/index.d.ts.map +1 -0
- package/dist/providers/typeform/actions/index.js +27 -0
- package/dist/providers/typeform/actions/index.js.map +1 -0
- package/dist/providers/typeform/actions/update-form.action.d.ts +38 -0
- package/dist/providers/typeform/actions/update-form.action.d.ts.map +1 -0
- package/dist/providers/typeform/actions/update-form.action.js +228 -0
- package/dist/providers/typeform/actions/update-form.action.js.map +1 -0
- package/dist/providers/typeform/actions/watch-new-responses.action.d.ts +32 -0
- package/dist/providers/typeform/actions/watch-new-responses.action.d.ts.map +1 -0
- package/dist/providers/typeform/actions/watch-new-responses.action.js +215 -0
- package/dist/providers/typeform/actions/watch-new-responses.action.js.map +1 -0
- package/dist/providers/typeform/index.d.ts +3 -0
- package/dist/providers/typeform/index.d.ts.map +1 -0
- package/dist/providers/typeform/index.js +21 -0
- package/dist/providers/typeform/index.js.map +1 -0
- package/dist/providers/typeform/typeform-base.action.d.ts +121 -0
- package/dist/providers/typeform/typeform-base.action.d.ts.map +1 -0
- package/dist/providers/typeform/typeform-base.action.js +292 -0
- package/dist/providers/typeform/typeform-base.action.js.map +1 -0
- package/package.json +41 -0
- package/src/base/base-form-builder.action.ts +403 -0
- package/src/base/index.ts +1 -0
- package/src/index.ts +18 -0
- package/src/providers/google-forms/actions/export-csv.action.ts +167 -0
- package/src/providers/google-forms/actions/get-form.action.ts +151 -0
- package/src/providers/google-forms/actions/get-single-response.action.ts +150 -0
- package/src/providers/google-forms/actions/get-statistics.action.ts +273 -0
- package/src/providers/google-forms/actions/index.ts +7 -0
- package/src/providers/google-forms/googleforms-base.action.ts +517 -0
- package/src/providers/google-forms/index.ts +5 -0
- package/src/providers/jotform/actions/create-form.action.ts +281 -0
- package/src/providers/jotform/actions/export-csv.action.ts +189 -0
- package/src/providers/jotform/actions/get-form.action.ts +189 -0
- package/src/providers/jotform/actions/get-single-submission.action.ts +137 -0
- package/src/providers/jotform/actions/get-statistics.action.ts +308 -0
- package/src/providers/jotform/actions/get-submissions.action.ts +220 -0
- package/src/providers/jotform/actions/index.ts +11 -0
- package/src/providers/jotform/actions/update-form.action.ts +254 -0
- package/src/providers/jotform/actions/watch-new-submissions.action.ts +238 -0
- package/src/providers/jotform/index.ts +5 -0
- package/src/providers/jotform/jotform-base.action.ts +365 -0
- package/src/providers/surveymonkey/actions/create-survey.action.ts +196 -0
- package/src/providers/surveymonkey/actions/export-csv.action.ts +175 -0
- package/src/providers/surveymonkey/actions/get-responses.action.ts +245 -0
- package/src/providers/surveymonkey/actions/get-single-response.action.ts +148 -0
- package/src/providers/surveymonkey/actions/get-statistics.action.ts +280 -0
- package/src/providers/surveymonkey/actions/get-survey.action.ts +181 -0
- package/src/providers/surveymonkey/actions/index.ts +11 -0
- package/src/providers/surveymonkey/actions/update-survey.action.ts +234 -0
- package/src/providers/surveymonkey/actions/watch-new-responses.action.ts +221 -0
- package/src/providers/surveymonkey/index.ts +5 -0
- package/src/providers/surveymonkey/surveymonkey-base.action.ts +505 -0
- package/src/providers/typeform/actions/create-form.action.ts +211 -0
- package/src/providers/typeform/actions/export-csv.action.ts +184 -0
- package/src/providers/typeform/actions/get-form.action.ts +173 -0
- package/src/providers/typeform/actions/get-responses.action.ts +242 -0
- package/src/providers/typeform/actions/get-single-response.action.ts +160 -0
- package/src/providers/typeform/actions/get-statistics.action.ts +276 -0
- package/src/providers/typeform/actions/index.ts +11 -0
- package/src/providers/typeform/actions/update-form.action.ts +235 -0
- package/src/providers/typeform/actions/watch-new-responses.action.ts +222 -0
- package/src/providers/typeform/index.ts +5 -0
- package/src/providers/typeform/typeform-base.action.ts +387 -0
- package/tsconfig.json +18 -0
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
2
|
+
import { SurveyMonkeyBaseAction } from '../surveymonkey-base.action';
|
|
3
|
+
import { ActionParam, ActionResultSimple, RunActionParams } from '@memberjunction/actions-base';
|
|
4
|
+
import { BaseAction } from '@memberjunction/actions';
|
|
5
|
+
import { FormStatistics } from '../../../base/base-form-builder.action';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Action to calculate aggregate statistics from SurveyMonkey responses
|
|
9
|
+
*
|
|
10
|
+
* Security: Uses secure credential lookup via CompanyID instead of accepting tokens directly.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* await runAction({
|
|
15
|
+
* ActionName: 'Get SurveyMonkey Response Statistics',
|
|
16
|
+
* Params: [{
|
|
17
|
+
* Name: 'CompanyID',
|
|
18
|
+
* Value: 'your-company-id'
|
|
19
|
+
* }, {
|
|
20
|
+
* Name: 'SurveyID',
|
|
21
|
+
* Value: 'abc123'
|
|
22
|
+
* }, {
|
|
23
|
+
* Name: 'StartCreatedAt',
|
|
24
|
+
* Value: '2024-01-01T00:00:00Z'
|
|
25
|
+
* }]
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
@RegisterClass(BaseAction, 'Get SurveyMonkey Response Statistics')
|
|
30
|
+
export class GetSurveyMonkeyStatisticsAction extends SurveyMonkeyBaseAction {
|
|
31
|
+
|
|
32
|
+
public get Description(): string {
|
|
33
|
+
return 'Calculates comprehensive statistics from SurveyMonkey responses including completion rates, response trends, popular answers, and time-based analytics. Useful for dashboards and reporting.';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
protected async InternalRunAction(params: RunActionParams): Promise<ActionResultSimple> {
|
|
37
|
+
try {
|
|
38
|
+
const contextUser = params.ContextUser;
|
|
39
|
+
if (!contextUser) {
|
|
40
|
+
return {
|
|
41
|
+
Success: false,
|
|
42
|
+
ResultCode: 'MISSING_CONTEXT_USER',
|
|
43
|
+
Message: 'Context user is required for SurveyMonkey API calls'
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const companyId = this.getParamValue(params.Params, 'CompanyID');
|
|
48
|
+
|
|
49
|
+
const surveyId = this.getParamValue(params.Params, 'SurveyID');
|
|
50
|
+
if (!surveyId) {
|
|
51
|
+
return {
|
|
52
|
+
Success: false,
|
|
53
|
+
ResultCode: 'MISSING_SURVEY_ID',
|
|
54
|
+
Message: 'SurveyID parameter is required'
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const accessToken = await this.getSecureAPIToken(companyId, contextUser);
|
|
59
|
+
|
|
60
|
+
const startCreatedAt = this.getParamValue(params.Params, 'StartCreatedAt');
|
|
61
|
+
const endCreatedAt = this.getParamValue(params.Params, 'EndCreatedAt');
|
|
62
|
+
const maxResponses = this.getParamValue(params.Params, 'MaxResponses') || 10000;
|
|
63
|
+
const includeTopAnswers = this.getParamValue(params.Params, 'IncludeTopAnswers') !== false;
|
|
64
|
+
const topAnswersLimit = this.getParamValue(params.Params, 'TopAnswersLimit') || 10;
|
|
65
|
+
|
|
66
|
+
const smResponses = await this.getAllSurveyMonkeyResponses(surveyId, accessToken, {
|
|
67
|
+
start_created_at: startCreatedAt,
|
|
68
|
+
end_created_at: endCreatedAt,
|
|
69
|
+
maxResponses
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const responses = smResponses.map(r => this.normalizeSurveyMonkeyResponse(r));
|
|
73
|
+
|
|
74
|
+
const completedResponses = responses.filter(r => r.completed);
|
|
75
|
+
const partialResponses = responses.filter(r => !r.completed);
|
|
76
|
+
const completionRate = this.calculateCompletionRate(
|
|
77
|
+
completedResponses.length,
|
|
78
|
+
responses.length
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
const responsesByDate = this.groupResponsesByDate(responses);
|
|
82
|
+
|
|
83
|
+
const statistics: FormStatistics = {
|
|
84
|
+
totalResponses: responses.length,
|
|
85
|
+
completedResponses: completedResponses.length,
|
|
86
|
+
partialResponses: partialResponses.length,
|
|
87
|
+
completionRate,
|
|
88
|
+
averageCompletionTime: this.calculateAverageCompletionTime(responses),
|
|
89
|
+
responsesByDate
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
if (includeTopAnswers && responses.length > 0) {
|
|
93
|
+
const topAnswers: Record<string, Array<{ answer: string; count: number }>> = {};
|
|
94
|
+
const allFieldIds = new Set<string>();
|
|
95
|
+
|
|
96
|
+
for (const response of responses) {
|
|
97
|
+
for (const answer of response.answers) {
|
|
98
|
+
allFieldIds.add(answer.fieldId);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
for (const fieldId of allFieldIds) {
|
|
103
|
+
const fieldTopAnswers = this.findTopAnswers(responses, fieldId, topAnswersLimit);
|
|
104
|
+
if (fieldTopAnswers.length > 0) {
|
|
105
|
+
topAnswers[fieldId] = fieldTopAnswers;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
statistics.topAnswers = topAnswers;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const dailyBreakdown = this.calculateDailyBreakdown(responses);
|
|
113
|
+
const hourlyDistribution = this.calculateHourlyDistribution(responses);
|
|
114
|
+
|
|
115
|
+
const outputParams: ActionParam[] = [
|
|
116
|
+
{
|
|
117
|
+
Name: 'Statistics',
|
|
118
|
+
Type: 'Output',
|
|
119
|
+
Value: statistics
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
Name: 'TotalResponses',
|
|
123
|
+
Type: 'Output',
|
|
124
|
+
Value: statistics.totalResponses
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
Name: 'CompletedResponses',
|
|
128
|
+
Type: 'Output',
|
|
129
|
+
Value: statistics.completedResponses
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
Name: 'PartialResponses',
|
|
133
|
+
Type: 'Output',
|
|
134
|
+
Value: statistics.partialResponses
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
Name: 'CompletionRate',
|
|
138
|
+
Type: 'Output',
|
|
139
|
+
Value: statistics.completionRate
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
Name: 'AverageCompletionTime',
|
|
143
|
+
Type: 'Output',
|
|
144
|
+
Value: statistics.averageCompletionTime
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
Name: 'ResponsesByDate',
|
|
148
|
+
Type: 'Output',
|
|
149
|
+
Value: statistics.responsesByDate
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
Name: 'DailyBreakdown',
|
|
153
|
+
Type: 'Output',
|
|
154
|
+
Value: dailyBreakdown
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
Name: 'HourlyDistribution',
|
|
158
|
+
Type: 'Output',
|
|
159
|
+
Value: hourlyDistribution
|
|
160
|
+
}
|
|
161
|
+
];
|
|
162
|
+
|
|
163
|
+
if (includeTopAnswers) {
|
|
164
|
+
outputParams.push({
|
|
165
|
+
Name: 'TopAnswers',
|
|
166
|
+
Type: 'Output',
|
|
167
|
+
Value: statistics.topAnswers
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
for (const outputParam of outputParams) {
|
|
172
|
+
const existingParam = params.Params.find(p => p.Name === outputParam.Name);
|
|
173
|
+
if (existingParam) {
|
|
174
|
+
existingParam.Value = outputParam.Value;
|
|
175
|
+
} else {
|
|
176
|
+
params.Params.push(outputParam);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return {
|
|
181
|
+
Success: true,
|
|
182
|
+
ResultCode: 'SUCCESS',
|
|
183
|
+
Message: `Successfully calculated statistics from ${responses.length} SurveyMonkey responses (${completionRate}% completion rate)`
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
} catch (error) {
|
|
187
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
188
|
+
return {
|
|
189
|
+
Success: false,
|
|
190
|
+
ResultCode: 'ERROR',
|
|
191
|
+
Message: this.buildFormErrorMessage('Get SurveyMonkey Statistics', errorMessage, error)
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Calculate daily breakdown of responses
|
|
198
|
+
*/
|
|
199
|
+
private calculateDailyBreakdown(responses: any[]): Array<{ date: string; count: number; completed: number; partial: number }> {
|
|
200
|
+
const daily: Record<string, { count: number; completed: number; partial: number }> = {};
|
|
201
|
+
|
|
202
|
+
for (const response of responses) {
|
|
203
|
+
const dateKey = response.submittedAt.toISOString().split('T')[0];
|
|
204
|
+
if (!daily[dateKey]) {
|
|
205
|
+
daily[dateKey] = { count: 0, completed: 0, partial: 0 };
|
|
206
|
+
}
|
|
207
|
+
daily[dateKey].count++;
|
|
208
|
+
if (response.completed) {
|
|
209
|
+
daily[dateKey].completed++;
|
|
210
|
+
} else {
|
|
211
|
+
daily[dateKey].partial++;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return Object.entries(daily)
|
|
216
|
+
.map(([date, stats]) => ({ date, ...stats }))
|
|
217
|
+
.sort((a, b) => a.date.localeCompare(b.date));
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Calculate hourly distribution of responses
|
|
222
|
+
*/
|
|
223
|
+
private calculateHourlyDistribution(responses: any[]): Array<{ hour: number; count: number }> {
|
|
224
|
+
const hourly: Record<number, number> = {};
|
|
225
|
+
|
|
226
|
+
for (let i = 0; i < 24; i++) {
|
|
227
|
+
hourly[i] = 0;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
for (const response of responses) {
|
|
231
|
+
const hour = response.submittedAt.getHours();
|
|
232
|
+
hourly[hour]++;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return Object.entries(hourly).map(([hour, count]) => ({
|
|
236
|
+
hour: parseInt(hour),
|
|
237
|
+
count
|
|
238
|
+
}));
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
public get Params(): ActionParam[] {
|
|
242
|
+
return [
|
|
243
|
+
{
|
|
244
|
+
Name: 'CompanyID',
|
|
245
|
+
Type: 'Input',
|
|
246
|
+
Value: null
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
Name: 'SurveyID',
|
|
250
|
+
Type: 'Input',
|
|
251
|
+
Value: null
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
Name: 'StartCreatedAt',
|
|
255
|
+
Type: 'Input',
|
|
256
|
+
Value: null
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
Name: 'EndCreatedAt',
|
|
260
|
+
Type: 'Input',
|
|
261
|
+
Value: null
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
Name: 'MaxResponses',
|
|
265
|
+
Type: 'Input',
|
|
266
|
+
Value: 10000
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
Name: 'IncludeTopAnswers',
|
|
270
|
+
Type: 'Input',
|
|
271
|
+
Value: true
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
Name: 'TopAnswersLimit',
|
|
275
|
+
Type: 'Input',
|
|
276
|
+
Value: 10
|
|
277
|
+
}
|
|
278
|
+
];
|
|
279
|
+
}
|
|
280
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
2
|
+
import { SurveyMonkeyBaseAction } from '../surveymonkey-base.action';
|
|
3
|
+
import { ActionParam, ActionResultSimple, RunActionParams } from '@memberjunction/actions-base';
|
|
4
|
+
import { BaseAction } from '@memberjunction/actions';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Action to retrieve complete details of a SurveyMonkey survey including pages, questions, and settings
|
|
8
|
+
*
|
|
9
|
+
* Security: Uses secure credential lookup via CompanyID instead of accepting tokens directly.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* await runAction({
|
|
14
|
+
* ActionName: 'Get SurveyMonkey Details',
|
|
15
|
+
* Params: [{
|
|
16
|
+
* Name: 'CompanyID',
|
|
17
|
+
* Value: 'your-company-id'
|
|
18
|
+
* }, {
|
|
19
|
+
* Name: 'SurveyID',
|
|
20
|
+
* Value: '123456789'
|
|
21
|
+
* }]
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
@RegisterClass(BaseAction, 'Get SurveyMonkey Details')
|
|
26
|
+
export class GetSurveyMonkeyDetailsAction extends SurveyMonkeyBaseAction {
|
|
27
|
+
|
|
28
|
+
public get Description(): string {
|
|
29
|
+
return 'Retrieves complete details of a SurveyMonkey survey including title, pages, questions, settings, and metadata. Use this to inspect or backup survey configurations, analyze survey structure, and access survey metadata.';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
protected async InternalRunAction(params: RunActionParams): Promise<ActionResultSimple> {
|
|
33
|
+
try {
|
|
34
|
+
const contextUser = params.ContextUser;
|
|
35
|
+
if (!contextUser) {
|
|
36
|
+
return {
|
|
37
|
+
Success: false,
|
|
38
|
+
ResultCode: 'MISSING_CONTEXT_USER',
|
|
39
|
+
Message: 'Context user is required for SurveyMonkey API calls'
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const companyId = this.getParamValue(params.Params, 'CompanyID');
|
|
44
|
+
|
|
45
|
+
const surveyId = this.getParamValue(params.Params, 'SurveyID');
|
|
46
|
+
if (!surveyId) {
|
|
47
|
+
return {
|
|
48
|
+
Success: false,
|
|
49
|
+
ResultCode: 'MISSING_SURVEY_ID',
|
|
50
|
+
Message: 'SurveyID parameter is required'
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const accessToken = await this.getSecureAPIToken(companyId, contextUser);
|
|
55
|
+
|
|
56
|
+
// Fetch complete survey details from SurveyMonkey API
|
|
57
|
+
const response = await this.getAxiosInstance(accessToken).get(`/surveys/${surveyId}/details`);
|
|
58
|
+
const survey = response.data;
|
|
59
|
+
|
|
60
|
+
// Extract comprehensive survey information
|
|
61
|
+
const questionCount = survey.question_count || 0;
|
|
62
|
+
const pageCount = survey.page_count || 0;
|
|
63
|
+
const createdAt = survey.date_created || '';
|
|
64
|
+
const updatedAt = survey.date_modified || '';
|
|
65
|
+
|
|
66
|
+
// Determine survey status (active if response count exists, otherwise draft)
|
|
67
|
+
const status = survey.response_count > 0 ? 'active' : 'draft';
|
|
68
|
+
|
|
69
|
+
// Build comprehensive survey details object
|
|
70
|
+
const surveyOutput = {
|
|
71
|
+
id: survey.id,
|
|
72
|
+
title: survey.title,
|
|
73
|
+
nickname: survey.nickname,
|
|
74
|
+
href: survey.href,
|
|
75
|
+
language: survey.language,
|
|
76
|
+
questionCount,
|
|
77
|
+
pageCount,
|
|
78
|
+
responseCount: survey.response_count,
|
|
79
|
+
createdAt,
|
|
80
|
+
updatedAt,
|
|
81
|
+
status,
|
|
82
|
+
pages: survey.pages || [],
|
|
83
|
+
settings: {
|
|
84
|
+
buttons_text: survey.buttons_text || {},
|
|
85
|
+
custom_variables: survey.custom_variables || {},
|
|
86
|
+
folder_id: survey.folder_id,
|
|
87
|
+
category: survey.category,
|
|
88
|
+
quiz_options: survey.quiz_options,
|
|
89
|
+
preview: survey.preview,
|
|
90
|
+
edit_url: survey.edit_url,
|
|
91
|
+
collect_url: survey.collect_url,
|
|
92
|
+
analyze_url: survey.analyze_url,
|
|
93
|
+
summary_url: survey.summary_url
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// Prepare output parameters
|
|
98
|
+
const outputParams: ActionParam[] = [
|
|
99
|
+
{
|
|
100
|
+
Name: 'Survey',
|
|
101
|
+
Type: 'Output',
|
|
102
|
+
Value: surveyOutput
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
Name: 'SurveyID',
|
|
106
|
+
Type: 'Output',
|
|
107
|
+
Value: survey.id
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
Name: 'Title',
|
|
111
|
+
Type: 'Output',
|
|
112
|
+
Value: survey.title
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
Name: 'QuestionCount',
|
|
116
|
+
Type: 'Output',
|
|
117
|
+
Value: questionCount
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
Name: 'PageCount',
|
|
121
|
+
Type: 'Output',
|
|
122
|
+
Value: pageCount
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
Name: 'CreatedAt',
|
|
126
|
+
Type: 'Output',
|
|
127
|
+
Value: createdAt
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
Name: 'UpdatedAt',
|
|
131
|
+
Type: 'Output',
|
|
132
|
+
Value: updatedAt
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
Name: 'Status',
|
|
136
|
+
Type: 'Output',
|
|
137
|
+
Value: status
|
|
138
|
+
}
|
|
139
|
+
];
|
|
140
|
+
|
|
141
|
+
// Update params with output values
|
|
142
|
+
for (const outputParam of outputParams) {
|
|
143
|
+
const existingParam = params.Params.find(p => p.Name === outputParam.Name);
|
|
144
|
+
if (existingParam) {
|
|
145
|
+
existingParam.Value = outputParam.Value;
|
|
146
|
+
} else {
|
|
147
|
+
params.Params.push(outputParam);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
Success: true,
|
|
153
|
+
ResultCode: 'SUCCESS',
|
|
154
|
+
Message: `Successfully retrieved survey "${survey.title}" with ${questionCount} questions across ${pageCount} pages`
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
} catch (error) {
|
|
158
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
159
|
+
return {
|
|
160
|
+
Success: false,
|
|
161
|
+
ResultCode: 'ERROR',
|
|
162
|
+
Message: this.buildFormErrorMessage('Get SurveyMonkey Details', errorMessage, error)
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
public get Params(): ActionParam[] {
|
|
168
|
+
return [
|
|
169
|
+
{
|
|
170
|
+
Name: 'CompanyID',
|
|
171
|
+
Type: 'Input',
|
|
172
|
+
Value: null
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
Name: 'SurveyID',
|
|
176
|
+
Type: 'Input',
|
|
177
|
+
Value: null
|
|
178
|
+
}
|
|
179
|
+
];
|
|
180
|
+
}
|
|
181
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// SurveyMonkey Response Actions
|
|
2
|
+
export * from './get-responses.action';
|
|
3
|
+
export * from './get-single-response.action';
|
|
4
|
+
export * from './get-statistics.action';
|
|
5
|
+
export * from './export-csv.action';
|
|
6
|
+
export * from './watch-new-responses.action';
|
|
7
|
+
|
|
8
|
+
// SurveyMonkey Survey Management Actions
|
|
9
|
+
export * from './get-survey.action';
|
|
10
|
+
export * from './create-survey.action';
|
|
11
|
+
export * from './update-survey.action';
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
2
|
+
import { SurveyMonkeyBaseAction, SurveyMonkeySurveyDetails } from '../surveymonkey-base.action';
|
|
3
|
+
import { ActionParam, ActionResultSimple, RunActionParams } from '@memberjunction/actions-base';
|
|
4
|
+
import { BaseAction } from '@memberjunction/actions';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Action to update an existing SurveyMonkey survey
|
|
8
|
+
*
|
|
9
|
+
* IMPORTANT: When MergeWithExisting is true (default), fetches the current survey
|
|
10
|
+
* and merges your changes. When false, replaces entire survey data (use with caution).
|
|
11
|
+
*
|
|
12
|
+
* The action uses PATCH for partial updates when MergeWithExisting=true, which is
|
|
13
|
+
* the recommended approach for most use cases.
|
|
14
|
+
*
|
|
15
|
+
* Security: Uses secure credential lookup via CompanyID instead of accepting tokens directly.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* await runAction({
|
|
20
|
+
* ActionName: 'Update SurveyMonkey',
|
|
21
|
+
* Params: [{
|
|
22
|
+
* Name: 'CompanyID',
|
|
23
|
+
* Value: 'your-company-id'
|
|
24
|
+
* }, {
|
|
25
|
+
* Name: 'SurveyID',
|
|
26
|
+
* Value: 'abc123'
|
|
27
|
+
* }, {
|
|
28
|
+
* Name: 'Title',
|
|
29
|
+
* Value: 'Updated Survey Title'
|
|
30
|
+
* }, {
|
|
31
|
+
* Name: 'MergeWithExisting',
|
|
32
|
+
* Value: true
|
|
33
|
+
* }]
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
@RegisterClass(BaseAction, 'Update SurveyMonkey')
|
|
38
|
+
export class UpdateSurveyMonkeyAction extends SurveyMonkeyBaseAction {
|
|
39
|
+
public get Description(): string {
|
|
40
|
+
return 'Updates an existing SurveyMonkey survey. Set MergeWithExisting=true (default) to safely update only specified properties while preserving others. Set to false to replace entire survey data (not recommended).';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
protected async InternalRunAction(params: RunActionParams): Promise<ActionResultSimple> {
|
|
44
|
+
try {
|
|
45
|
+
const contextUser = params.ContextUser;
|
|
46
|
+
if (!contextUser) {
|
|
47
|
+
return {
|
|
48
|
+
Success: false,
|
|
49
|
+
ResultCode: 'MISSING_CONTEXT_USER',
|
|
50
|
+
Message: 'Context user is required for SurveyMonkey API calls',
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const companyId = this.getParamValue(params.Params, 'CompanyID');
|
|
55
|
+
|
|
56
|
+
const surveyId = this.getParamValue(params.Params, 'SurveyID');
|
|
57
|
+
if (!surveyId) {
|
|
58
|
+
return {
|
|
59
|
+
Success: false,
|
|
60
|
+
ResultCode: 'MISSING_SURVEY_ID',
|
|
61
|
+
Message: 'SurveyID parameter is required',
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const accessToken = await this.getSecureAPIToken(companyId, contextUser);
|
|
66
|
+
|
|
67
|
+
const mergeWithExisting = this.getParamValue(params.Params, 'MergeWithExisting') !== false;
|
|
68
|
+
|
|
69
|
+
const title = this.getParamValue(params.Params, 'Title');
|
|
70
|
+
const pages = this.getParamValue(params.Params, 'Pages');
|
|
71
|
+
const language = this.getParamValue(params.Params, 'Language');
|
|
72
|
+
const buttonsText = this.getParamValue(params.Params, 'ButtonsText');
|
|
73
|
+
|
|
74
|
+
// Check if any updates are provided
|
|
75
|
+
if (!title && !pages && !language && !buttonsText) {
|
|
76
|
+
return {
|
|
77
|
+
Success: false,
|
|
78
|
+
ResultCode: 'NO_CHANGES_PROVIDED',
|
|
79
|
+
Message: 'At least one of Title, Pages, Language, or ButtonsText must be provided',
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const updatedFields: string[] = [];
|
|
84
|
+
let existingSurvey: SurveyMonkeySurveyDetails | null = null;
|
|
85
|
+
|
|
86
|
+
// Get existing survey if merging
|
|
87
|
+
if (mergeWithExisting) {
|
|
88
|
+
existingSurvey = await this.getSurveyMonkeyDetails(surveyId, accessToken);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Build update data object
|
|
92
|
+
const updateData: {
|
|
93
|
+
title?: string;
|
|
94
|
+
nickname?: string;
|
|
95
|
+
language?: string;
|
|
96
|
+
buttons_text?: {
|
|
97
|
+
next_button?: string;
|
|
98
|
+
prev_button?: string;
|
|
99
|
+
done_button?: string;
|
|
100
|
+
exit_button?: string;
|
|
101
|
+
};
|
|
102
|
+
custom_variables?: Record<string, string>;
|
|
103
|
+
} = {};
|
|
104
|
+
|
|
105
|
+
// Add title if provided
|
|
106
|
+
if (title) {
|
|
107
|
+
updateData.title = title;
|
|
108
|
+
updatedFields.push('title');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Add language if provided
|
|
112
|
+
if (language) {
|
|
113
|
+
updateData.language = language;
|
|
114
|
+
updatedFields.push('language');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Handle buttons text
|
|
118
|
+
if (buttonsText) {
|
|
119
|
+
const buttonsObj = typeof buttonsText === 'string' ? JSON.parse(buttonsText) : buttonsText;
|
|
120
|
+
|
|
121
|
+
if (mergeWithExisting && existingSurvey?.buttons_text) {
|
|
122
|
+
updateData.buttons_text = { ...existingSurvey.buttons_text, ...buttonsObj };
|
|
123
|
+
} else {
|
|
124
|
+
updateData.buttons_text = buttonsObj;
|
|
125
|
+
}
|
|
126
|
+
updatedFields.push('buttons_text');
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Handle pages (if provided)
|
|
130
|
+
// Note: Pages require separate API calls to update individual pages/questions
|
|
131
|
+
// For now, we'll track it but handle basic survey properties only
|
|
132
|
+
if (pages) {
|
|
133
|
+
// Pages would need to be handled via separate API calls to /surveys/{id}/pages
|
|
134
|
+
// This is a more complex operation and may require additional implementation
|
|
135
|
+
updatedFields.push('pages (note: page updates require separate API calls)');
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Update the survey using PATCH (partial update)
|
|
139
|
+
const updatedSurvey = await this.updateSurveyMonkey(surveyId, accessToken, updateData);
|
|
140
|
+
|
|
141
|
+
// Build output parameters
|
|
142
|
+
const outputParams: ActionParam[] = [
|
|
143
|
+
{
|
|
144
|
+
Name: 'Survey',
|
|
145
|
+
Type: 'Output',
|
|
146
|
+
Value: updatedSurvey,
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
Name: 'SurveyID',
|
|
150
|
+
Type: 'Output',
|
|
151
|
+
Value: updatedSurvey.id,
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
Name: 'Title',
|
|
155
|
+
Type: 'Output',
|
|
156
|
+
Value: updatedSurvey.title,
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
Name: 'UpdatedFields',
|
|
160
|
+
Type: 'Output',
|
|
161
|
+
Value: updatedFields,
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
Name: 'PageCount',
|
|
165
|
+
Type: 'Output',
|
|
166
|
+
Value: updatedSurvey.page_count,
|
|
167
|
+
},
|
|
168
|
+
];
|
|
169
|
+
|
|
170
|
+
// Add output params to result
|
|
171
|
+
for (const outputParam of outputParams) {
|
|
172
|
+
const existingParam = params.Params.find((p) => p.Name === outputParam.Name);
|
|
173
|
+
if (existingParam) {
|
|
174
|
+
existingParam.Value = outputParam.Value;
|
|
175
|
+
} else {
|
|
176
|
+
params.Params.push(outputParam);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return {
|
|
181
|
+
Success: true,
|
|
182
|
+
ResultCode: 'SUCCESS',
|
|
183
|
+
Message: `Successfully updated survey "${updatedSurvey.title}" (ID: ${updatedSurvey.id}). Updated fields: ${updatedFields.join(', ')}`,
|
|
184
|
+
};
|
|
185
|
+
} catch (error) {
|
|
186
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
187
|
+
return {
|
|
188
|
+
Success: false,
|
|
189
|
+
ResultCode: 'ERROR',
|
|
190
|
+
Message: this.buildFormErrorMessage('Update SurveyMonkey', errorMessage, error),
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
public get Params(): ActionParam[] {
|
|
196
|
+
return [
|
|
197
|
+
{
|
|
198
|
+
Name: 'CompanyID',
|
|
199
|
+
Type: 'Input',
|
|
200
|
+
Value: null,
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
Name: 'SurveyID',
|
|
204
|
+
Type: 'Input',
|
|
205
|
+
Value: null,
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
Name: 'MergeWithExisting',
|
|
209
|
+
Type: 'Input',
|
|
210
|
+
Value: true,
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
Name: 'Title',
|
|
214
|
+
Type: 'Input',
|
|
215
|
+
Value: null,
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
Name: 'Pages',
|
|
219
|
+
Type: 'Input',
|
|
220
|
+
Value: null,
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
Name: 'Language',
|
|
224
|
+
Type: 'Input',
|
|
225
|
+
Value: null,
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
Name: 'ButtonsText',
|
|
229
|
+
Type: 'Input',
|
|
230
|
+
Value: null,
|
|
231
|
+
},
|
|
232
|
+
];
|
|
233
|
+
}
|
|
234
|
+
}
|