@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,61 @@
|
|
|
1
|
+
import { JotFormBaseAction } from '../jotform-base.action';
|
|
2
|
+
import { ActionParam, ActionResultSimple, RunActionParams } from '@memberjunction/actions-base';
|
|
3
|
+
/**
|
|
4
|
+
* Action to create a new JotForm programmatically
|
|
5
|
+
*
|
|
6
|
+
* Security: API credentials are retrieved securely from Company Integrations
|
|
7
|
+
* instead of being passed as parameters.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* await runAction({
|
|
12
|
+
* ActionName: 'Create JotForm',
|
|
13
|
+
* Params: [{
|
|
14
|
+
* Name: 'CompanyID',
|
|
15
|
+
* Value: 'your-company-id'
|
|
16
|
+
* }, {
|
|
17
|
+
* Name: 'Title',
|
|
18
|
+
* Value: 'Customer Feedback Form'
|
|
19
|
+
* }, {
|
|
20
|
+
* Name: 'Questions',
|
|
21
|
+
* Value: [{
|
|
22
|
+
* type: 'control_text',
|
|
23
|
+
* text: 'What is your name?',
|
|
24
|
+
* name: 'name',
|
|
25
|
+
* required: 'Yes'
|
|
26
|
+
* }, {
|
|
27
|
+
* type: 'control_email',
|
|
28
|
+
* text: 'What is your email address?',
|
|
29
|
+
* name: 'email',
|
|
30
|
+
* required: 'Yes'
|
|
31
|
+
* }]
|
|
32
|
+
* }, {
|
|
33
|
+
* Name: 'Properties',
|
|
34
|
+
* Value: {
|
|
35
|
+
* thankYouURL: 'https://example.com/thank-you',
|
|
36
|
+
* requiresPassword: false
|
|
37
|
+
* }
|
|
38
|
+
* }]
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare class CreateJotFormAction extends JotFormBaseAction {
|
|
43
|
+
get Description(): string;
|
|
44
|
+
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
45
|
+
/**
|
|
46
|
+
* Build questions object in JotForm API format
|
|
47
|
+
* JotForm uses numeric keys for questions (1, 2, 3, etc.)
|
|
48
|
+
*/
|
|
49
|
+
private buildQuestionsObject;
|
|
50
|
+
/**
|
|
51
|
+
* Extract additional question properties (required, validation, options, etc.)
|
|
52
|
+
*/
|
|
53
|
+
private extractQuestionProperties;
|
|
54
|
+
/**
|
|
55
|
+
* Flatten nested form data into JotForm API parameter format
|
|
56
|
+
* JotForm API expects: properties[title]=value, questions[1][type]=value, etc.
|
|
57
|
+
*/
|
|
58
|
+
private flattenFormData;
|
|
59
|
+
get Params(): ActionParam[];
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=create-form.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-form.action.d.ts","sourceRoot":"","sources":["../../../../src/providers/jotform/actions/create-form.action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAGhG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,qBACa,mBAAoB,SAAQ,iBAAiB;IAEtD,IAAW,WAAW,IAAI,MAAM,CAE/B;cAEe,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA8GvF;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAiB5B;;OAEG;IACH,OAAO,CAAC,yBAAyB;IA8CjC;;;OAGG;IACH,OAAO,CAAC,eAAe;IAgBvB,IAAW,MAAM,IAAI,WAAW,EAAE,CA4BjC;CACJ"}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.CreateJotFormAction = void 0;
|
|
10
|
+
const global_1 = require("@memberjunction/global");
|
|
11
|
+
const jotform_base_action_1 = require("../jotform-base.action");
|
|
12
|
+
const actions_1 = require("@memberjunction/actions");
|
|
13
|
+
/**
|
|
14
|
+
* Action to create a new JotForm programmatically
|
|
15
|
+
*
|
|
16
|
+
* Security: API credentials are retrieved securely from Company Integrations
|
|
17
|
+
* instead of being passed as parameters.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* await runAction({
|
|
22
|
+
* ActionName: 'Create JotForm',
|
|
23
|
+
* Params: [{
|
|
24
|
+
* Name: 'CompanyID',
|
|
25
|
+
* Value: 'your-company-id'
|
|
26
|
+
* }, {
|
|
27
|
+
* Name: 'Title',
|
|
28
|
+
* Value: 'Customer Feedback Form'
|
|
29
|
+
* }, {
|
|
30
|
+
* Name: 'Questions',
|
|
31
|
+
* Value: [{
|
|
32
|
+
* type: 'control_text',
|
|
33
|
+
* text: 'What is your name?',
|
|
34
|
+
* name: 'name',
|
|
35
|
+
* required: 'Yes'
|
|
36
|
+
* }, {
|
|
37
|
+
* type: 'control_email',
|
|
38
|
+
* text: 'What is your email address?',
|
|
39
|
+
* name: 'email',
|
|
40
|
+
* required: 'Yes'
|
|
41
|
+
* }]
|
|
42
|
+
* }, {
|
|
43
|
+
* Name: 'Properties',
|
|
44
|
+
* Value: {
|
|
45
|
+
* thankYouURL: 'https://example.com/thank-you',
|
|
46
|
+
* requiresPassword: false
|
|
47
|
+
* }
|
|
48
|
+
* }]
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
let CreateJotFormAction = class CreateJotFormAction extends jotform_base_action_1.JotFormBaseAction {
|
|
53
|
+
get Description() {
|
|
54
|
+
return 'Creates a new JotForm with specified title, questions, and properties. Supports all question types including text inputs, email, dropdowns, checkboxes, file uploads, and more. Returns the new form ID, public URL, and admin URL.';
|
|
55
|
+
}
|
|
56
|
+
async InternalRunAction(params) {
|
|
57
|
+
try {
|
|
58
|
+
const contextUser = params.ContextUser;
|
|
59
|
+
if (!contextUser) {
|
|
60
|
+
return {
|
|
61
|
+
Success: false,
|
|
62
|
+
ResultCode: 'MISSING_CONTEXT_USER',
|
|
63
|
+
Message: 'Context user is required for JotForm API calls'
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const companyId = this.getParamValue(params.Params, 'CompanyID');
|
|
67
|
+
const apiToken = await this.getSecureAPIToken(companyId, contextUser);
|
|
68
|
+
const title = this.getParamValue(params.Params, 'Title');
|
|
69
|
+
if (!title) {
|
|
70
|
+
return {
|
|
71
|
+
Success: false,
|
|
72
|
+
ResultCode: 'MISSING_TITLE',
|
|
73
|
+
Message: 'Title parameter is required'
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
const questions = this.getParamValue(params.Params, 'Questions');
|
|
77
|
+
if (!questions || !Array.isArray(questions) || questions.length === 0) {
|
|
78
|
+
return {
|
|
79
|
+
Success: false,
|
|
80
|
+
ResultCode: 'MISSING_QUESTIONS',
|
|
81
|
+
Message: 'Questions parameter is required and must be a non-empty array'
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
const region = this.getParamValue(params.Params, 'Region');
|
|
85
|
+
const formData = {
|
|
86
|
+
'questions': this.buildQuestionsObject(questions),
|
|
87
|
+
'properties': {
|
|
88
|
+
'title': title
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const properties = this.getParamValue(params.Params, 'Properties');
|
|
92
|
+
if (properties && typeof properties === 'object') {
|
|
93
|
+
formData.properties = {
|
|
94
|
+
...formData.properties,
|
|
95
|
+
...properties
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
const response = await this.getAxiosInstance(apiToken, region).post('/user/forms', null, {
|
|
99
|
+
params: {
|
|
100
|
+
apiKey: apiToken,
|
|
101
|
+
...this.flattenFormData(formData)
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
const createdForm = response.data.content;
|
|
105
|
+
const formUrl = `https://form.jotform.com/${createdForm.id}`;
|
|
106
|
+
const adminUrl = `https://www.jotform.com/build/${createdForm.id}`;
|
|
107
|
+
const outputParams = [
|
|
108
|
+
{
|
|
109
|
+
Name: 'FormDetails',
|
|
110
|
+
Type: 'Output',
|
|
111
|
+
Value: createdForm
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
Name: 'FormID',
|
|
115
|
+
Type: 'Output',
|
|
116
|
+
Value: createdForm.id
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
Name: 'FormURL',
|
|
120
|
+
Type: 'Output',
|
|
121
|
+
Value: formUrl
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
Name: 'AdminURL',
|
|
125
|
+
Type: 'Output',
|
|
126
|
+
Value: adminUrl
|
|
127
|
+
}
|
|
128
|
+
];
|
|
129
|
+
for (const outputParam of outputParams) {
|
|
130
|
+
const existingParam = params.Params.find(p => p.Name === outputParam.Name);
|
|
131
|
+
if (existingParam) {
|
|
132
|
+
existingParam.Value = outputParam.Value;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
params.Params.push(outputParam);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return {
|
|
139
|
+
Success: true,
|
|
140
|
+
ResultCode: 'SUCCESS',
|
|
141
|
+
Message: `Successfully created JotForm "${title}" (ID: ${createdForm.id}). View at: ${formUrl}`
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
146
|
+
return {
|
|
147
|
+
Success: false,
|
|
148
|
+
ResultCode: 'ERROR',
|
|
149
|
+
Message: this.buildFormErrorMessage('Create JotForm', errorMessage, error)
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Build questions object in JotForm API format
|
|
155
|
+
* JotForm uses numeric keys for questions (1, 2, 3, etc.)
|
|
156
|
+
*/
|
|
157
|
+
buildQuestionsObject(questions) {
|
|
158
|
+
const questionsObj = {};
|
|
159
|
+
questions.forEach((question, index) => {
|
|
160
|
+
const questionId = index + 1;
|
|
161
|
+
questionsObj[questionId] = {
|
|
162
|
+
type: question.type,
|
|
163
|
+
text: question.text,
|
|
164
|
+
name: question.name || `question_${questionId}`,
|
|
165
|
+
order: String(questionId),
|
|
166
|
+
...this.extractQuestionProperties(question)
|
|
167
|
+
};
|
|
168
|
+
});
|
|
169
|
+
return questionsObj;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Extract additional question properties (required, validation, options, etc.)
|
|
173
|
+
*/
|
|
174
|
+
extractQuestionProperties(question) {
|
|
175
|
+
const props = {};
|
|
176
|
+
if (question.required != null) {
|
|
177
|
+
props.required = question.required === 'Yes' || question.required === true ? 'Yes' : 'No';
|
|
178
|
+
}
|
|
179
|
+
if (question.validation) {
|
|
180
|
+
props.validation = question.validation;
|
|
181
|
+
}
|
|
182
|
+
if (question.sublabel) {
|
|
183
|
+
props.sublabel = question.sublabel;
|
|
184
|
+
}
|
|
185
|
+
if (question.hint) {
|
|
186
|
+
props.hint = question.hint;
|
|
187
|
+
}
|
|
188
|
+
if (question.options && Array.isArray(question.options)) {
|
|
189
|
+
props.options = question.options.join('|');
|
|
190
|
+
}
|
|
191
|
+
if (question.special) {
|
|
192
|
+
props.special = question.special;
|
|
193
|
+
}
|
|
194
|
+
if (question.size) {
|
|
195
|
+
props.size = question.size;
|
|
196
|
+
}
|
|
197
|
+
if (question.maxsize) {
|
|
198
|
+
props.maxsize = question.maxsize;
|
|
199
|
+
}
|
|
200
|
+
if (question.allowTime) {
|
|
201
|
+
props.allowTime = question.allowTime;
|
|
202
|
+
}
|
|
203
|
+
if (question.payment) {
|
|
204
|
+
props.payment = question.payment;
|
|
205
|
+
}
|
|
206
|
+
return props;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Flatten nested form data into JotForm API parameter format
|
|
210
|
+
* JotForm API expects: properties[title]=value, questions[1][type]=value, etc.
|
|
211
|
+
*/
|
|
212
|
+
flattenFormData(data, prefix = '') {
|
|
213
|
+
const flattened = {};
|
|
214
|
+
for (const [key, value] of Object.entries(data)) {
|
|
215
|
+
const paramKey = prefix ? `${prefix}[${key}]` : key;
|
|
216
|
+
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
217
|
+
Object.assign(flattened, this.flattenFormData(value, paramKey));
|
|
218
|
+
}
|
|
219
|
+
else if (value != null) {
|
|
220
|
+
flattened[paramKey] = value;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return flattened;
|
|
224
|
+
}
|
|
225
|
+
get Params() {
|
|
226
|
+
return [
|
|
227
|
+
{
|
|
228
|
+
Name: 'CompanyID',
|
|
229
|
+
Type: 'Input',
|
|
230
|
+
Value: null
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
Name: 'Title',
|
|
234
|
+
Type: 'Input',
|
|
235
|
+
Value: null
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
Name: 'Questions',
|
|
239
|
+
Type: 'Input',
|
|
240
|
+
Value: null
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
Name: 'Properties',
|
|
244
|
+
Type: 'Input',
|
|
245
|
+
Value: null
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
Name: 'Region',
|
|
249
|
+
Type: 'Input',
|
|
250
|
+
Value: null
|
|
251
|
+
}
|
|
252
|
+
];
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
exports.CreateJotFormAction = CreateJotFormAction;
|
|
256
|
+
exports.CreateJotFormAction = CreateJotFormAction = __decorate([
|
|
257
|
+
(0, global_1.RegisterClass)(actions_1.BaseAction, 'Create JotForm')
|
|
258
|
+
], CreateJotFormAction);
|
|
259
|
+
//# sourceMappingURL=create-form.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-form.action.js","sourceRoot":"","sources":["../../../../src/providers/jotform/actions/create-form.action.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mDAAuD;AACvD,gEAA2D;AAE3D,qDAAqD;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAI;aACd;YACD;gBACI,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,IAAI;aACd;YACD;gBACI,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,IAAI;aACd;YACD;gBACI,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,IAAI;aACd;SACJ,CAAC;IACN,CAAC;CACJ,CAAA;AA3OY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,sBAAa,EAAC,oBAAU,EAAE,gBAAgB,CAAC;GAC/B,mBAAmB,CA2O/B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { JotFormBaseAction } from '../jotform-base.action';
|
|
2
|
+
import { ActionParam, ActionResultSimple, RunActionParams } from '@memberjunction/actions-base';
|
|
3
|
+
/**
|
|
4
|
+
* Action to export JotForm submissions as CSV format
|
|
5
|
+
*
|
|
6
|
+
* Security: API credentials are retrieved securely from Company Integrations
|
|
7
|
+
* instead of being passed as parameters.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* await runAction({
|
|
12
|
+
* ActionName: 'Export JotForm Submissions to CSV',
|
|
13
|
+
* Params: [{
|
|
14
|
+
* Name: 'CompanyID',
|
|
15
|
+
* Value: 'your-company-id'
|
|
16
|
+
* }, {
|
|
17
|
+
* Name: 'FormID',
|
|
18
|
+
* Value: '123456789'
|
|
19
|
+
* }, {
|
|
20
|
+
* Name: 'IncludeMetadata',
|
|
21
|
+
* Value: true
|
|
22
|
+
* }]
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare class ExportJotFormCSVAction extends JotFormBaseAction {
|
|
27
|
+
get Description(): string;
|
|
28
|
+
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
29
|
+
get Params(): ActionParam[];
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=export-csv.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-csv.action.d.ts","sourceRoot":"","sources":["../../../../src/providers/jotform/actions/export-csv.action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAGhG;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBACa,sBAAuB,SAAQ,iBAAiB;IAEzD,IAAW,WAAW,IAAI,MAAM,CAE/B;cAEe,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAkHvF,IAAW,MAAM,IAAI,WAAW,EAAE,CAsCjC;CACJ"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ExportJotFormCSVAction = void 0;
|
|
10
|
+
const global_1 = require("@memberjunction/global");
|
|
11
|
+
const jotform_base_action_1 = require("../jotform-base.action");
|
|
12
|
+
const actions_1 = require("@memberjunction/actions");
|
|
13
|
+
/**
|
|
14
|
+
* Action to export JotForm submissions as CSV format
|
|
15
|
+
*
|
|
16
|
+
* Security: API credentials are retrieved securely from Company Integrations
|
|
17
|
+
* instead of being passed as parameters.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* await runAction({
|
|
22
|
+
* ActionName: 'Export JotForm Submissions to CSV',
|
|
23
|
+
* Params: [{
|
|
24
|
+
* Name: 'CompanyID',
|
|
25
|
+
* Value: 'your-company-id'
|
|
26
|
+
* }, {
|
|
27
|
+
* Name: 'FormID',
|
|
28
|
+
* Value: '123456789'
|
|
29
|
+
* }, {
|
|
30
|
+
* Name: 'IncludeMetadata',
|
|
31
|
+
* Value: true
|
|
32
|
+
* }]
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
let ExportJotFormCSVAction = class ExportJotFormCSVAction extends jotform_base_action_1.JotFormBaseAction {
|
|
37
|
+
get Description() {
|
|
38
|
+
return 'Exports JotForm submissions to CSV format for use in spreadsheets, data analysis tools, or archival. Supports custom delimiters, optional metadata columns, and regional API endpoints.';
|
|
39
|
+
}
|
|
40
|
+
async InternalRunAction(params) {
|
|
41
|
+
try {
|
|
42
|
+
const contextUser = params.ContextUser;
|
|
43
|
+
if (!contextUser) {
|
|
44
|
+
return {
|
|
45
|
+
Success: false,
|
|
46
|
+
ResultCode: 'MISSING_CONTEXT_USER',
|
|
47
|
+
Message: 'Context user is required for JotForm API calls'
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
const companyId = this.getParamValue(params.Params, 'CompanyID');
|
|
51
|
+
const formId = this.getParamValue(params.Params, 'FormID');
|
|
52
|
+
if (!formId) {
|
|
53
|
+
return {
|
|
54
|
+
Success: false,
|
|
55
|
+
ResultCode: 'MISSING_FORM_ID',
|
|
56
|
+
Message: 'FormID parameter is required'
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const apiKey = await this.getSecureAPIToken(companyId, contextUser);
|
|
60
|
+
const region = this.getParamValue(params.Params, 'Region');
|
|
61
|
+
const filterParam = this.getParamValue(params.Params, 'Filter');
|
|
62
|
+
const includeMetadata = this.getParamValue(params.Params, 'IncludeMetadata') !== false;
|
|
63
|
+
const delimiter = this.getParamValue(params.Params, 'Delimiter') || ',';
|
|
64
|
+
const maxSubmissions = this.getParamValue(params.Params, 'MaxSubmissions') || 10000;
|
|
65
|
+
let filter = undefined;
|
|
66
|
+
if (filterParam) {
|
|
67
|
+
try {
|
|
68
|
+
filter = typeof filterParam === 'string' ? JSON.parse(filterParam) : filterParam;
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
return {
|
|
72
|
+
Success: false,
|
|
73
|
+
ResultCode: 'INVALID_FILTER',
|
|
74
|
+
Message: 'Filter parameter must be valid JSON object'
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const jfSubmissions = await this.getAllJotFormSubmissions(formId, apiKey, {
|
|
79
|
+
filter,
|
|
80
|
+
maxSubmissions,
|
|
81
|
+
region
|
|
82
|
+
});
|
|
83
|
+
if (jfSubmissions.length === 0) {
|
|
84
|
+
return {
|
|
85
|
+
Success: true,
|
|
86
|
+
ResultCode: 'NO_DATA',
|
|
87
|
+
Message: 'No submissions found matching the criteria'
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
const submissions = jfSubmissions.map(s => this.normalizeJotFormSubmission(s));
|
|
91
|
+
const { csv, headers } = this.convertToCSV(submissions, includeMetadata, delimiter);
|
|
92
|
+
const outputParams = [
|
|
93
|
+
{
|
|
94
|
+
Name: 'CSVData',
|
|
95
|
+
Type: 'Output',
|
|
96
|
+
Value: csv
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
Name: 'RowCount',
|
|
100
|
+
Type: 'Output',
|
|
101
|
+
Value: submissions.length
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
Name: 'Headers',
|
|
105
|
+
Type: 'Output',
|
|
106
|
+
Value: headers
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
Name: 'ColumnCount',
|
|
110
|
+
Type: 'Output',
|
|
111
|
+
Value: headers.length
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
Name: 'FileSize',
|
|
115
|
+
Type: 'Output',
|
|
116
|
+
Value: Buffer.byteLength(csv, 'utf8')
|
|
117
|
+
}
|
|
118
|
+
];
|
|
119
|
+
for (const outputParam of outputParams) {
|
|
120
|
+
const existingParam = params.Params.find(p => p.Name === outputParam.Name);
|
|
121
|
+
if (existingParam) {
|
|
122
|
+
existingParam.Value = outputParam.Value;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
params.Params.push(outputParam);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return {
|
|
129
|
+
Success: true,
|
|
130
|
+
ResultCode: 'SUCCESS',
|
|
131
|
+
Message: `Successfully exported ${submissions.length} submissions to CSV (${headers.length} columns, ${Buffer.byteLength(csv, 'utf8')} bytes)`
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
136
|
+
return {
|
|
137
|
+
Success: false,
|
|
138
|
+
ResultCode: 'ERROR',
|
|
139
|
+
Message: this.buildFormErrorMessage('Export JotForm to CSV', errorMessage, error)
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
get Params() {
|
|
144
|
+
return [
|
|
145
|
+
{
|
|
146
|
+
Name: 'CompanyID',
|
|
147
|
+
Type: 'Input',
|
|
148
|
+
Value: null
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
Name: 'FormID',
|
|
152
|
+
Type: 'Input',
|
|
153
|
+
Value: null
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
Name: 'Region',
|
|
157
|
+
Type: 'Input',
|
|
158
|
+
Value: 'us'
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
Name: 'Filter',
|
|
162
|
+
Type: 'Input',
|
|
163
|
+
Value: null
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
Name: 'IncludeMetadata',
|
|
167
|
+
Type: 'Input',
|
|
168
|
+
Value: true
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
Name: 'Delimiter',
|
|
172
|
+
Type: 'Input',
|
|
173
|
+
Value: ','
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
Name: 'MaxSubmissions',
|
|
177
|
+
Type: 'Input',
|
|
178
|
+
Value: 10000
|
|
179
|
+
}
|
|
180
|
+
];
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
exports.ExportJotFormCSVAction = ExportJotFormCSVAction;
|
|
184
|
+
exports.ExportJotFormCSVAction = ExportJotFormCSVAction = __decorate([
|
|
185
|
+
(0, global_1.RegisterClass)(actions_1.BaseAction, 'Export JotForm Submissions to CSV')
|
|
186
|
+
], ExportJotFormCSVAction);
|
|
187
|
+
//# sourceMappingURL=export-csv.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-csv.action.js","sourceRoot":"","sources":["../../../../src/providers/jotform/actions/export-csv.action.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mDAAuD;AACvD,gEAA2D;AAE3D,qDAAqD;AAErD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAuB,SAAQ,uCAAiB;IAEzD,IAAW,WAAW;QAClB,OAAO,yLAAyL,CAAC;IACrM,CAAC;IAES,KAAK,CAAC,iBAAiB,CAAC,MAAuB;QACrD,IAAI,CAAC;YACD,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;YACvC,IAAI,CAAC,WAAW,EAAE,CAAC;gBACf,OAAO;oBACH,OAAO,EAAE,KAAK;oBACd,UAAU,EAAE,sBAAsB;oBAClC,OAAO,EAAE,gDAAgD;iBAC5D,CAAC;YACN,CAAC;YAED,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;YA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jB,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,GAAG;aACb;YACD;gBACI,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,KAAK;aACf;SACJ,CAAC;IACN,CAAC;CACJ,CAAA;AA/JY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,sBAAa,EAAC,oBAAU,EAAE,mCAAmC,CAAC;GAClD,sBAAsB,CA+JlC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { JotFormBaseAction } from '../jotform-base.action';
|
|
2
|
+
import { ActionParam, ActionResultSimple, RunActionParams } from '@memberjunction/actions-base';
|
|
3
|
+
/**
|
|
4
|
+
* Action to retrieve complete details of a JotForm including questions, properties, and settings
|
|
5
|
+
*
|
|
6
|
+
* Security: API credentials are retrieved securely from Company Integrations
|
|
7
|
+
* instead of being passed as parameters.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* await runAction({
|
|
12
|
+
* ActionName: 'Get JotForm Details',
|
|
13
|
+
* Params: [{
|
|
14
|
+
* Name: 'CompanyID',
|
|
15
|
+
* Value: 'your-company-id'
|
|
16
|
+
* }, {
|
|
17
|
+
* Name: 'FormID',
|
|
18
|
+
* Value: '123456789'
|
|
19
|
+
* }, {
|
|
20
|
+
* Name: 'Region',
|
|
21
|
+
* Value: 'us'
|
|
22
|
+
* }]
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare class GetJotFormAction extends JotFormBaseAction {
|
|
27
|
+
get Description(): string;
|
|
28
|
+
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
29
|
+
get Params(): ActionParam[];
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=get-form.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-form.action.d.ts","sourceRoot":"","sources":["../../../../src/providers/jotform/actions/get-form.action.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAGhG;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBACa,gBAAiB,SAAQ,iBAAiB;IAEnD,IAAW,WAAW,IAAI,MAAM,CAE/B;cAEe,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAsIvF,IAAW,MAAM,IAAI,WAAW,EAAE,CAkBjC;CACJ"}
|