@activepieces/piece-deftform 0.0.1
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/package.json +16 -0
- package/src/index.d.ts +4 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +46 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/add-form-response.d.ts +5 -0
- package/src/lib/actions/add-form-response.d.ts.map +1 -0
- package/src/lib/actions/add-form-response.js +40 -0
- package/src/lib/actions/add-form-response.js.map +1 -0
- package/src/lib/actions/get-all-forms.d.ts +2 -0
- package/src/lib/actions/get-all-forms.d.ts.map +1 -0
- package/src/lib/actions/get-all-forms.js +52 -0
- package/src/lib/actions/get-all-forms.js.map +1 -0
- package/src/lib/actions/get-form-fields.d.ts +4 -0
- package/src/lib/actions/get-form-fields.d.ts.map +1 -0
- package/src/lib/actions/get-form-fields.js +42 -0
- package/src/lib/actions/get-form-fields.js.map +1 -0
- package/src/lib/actions/get-form-responses.d.ts +4 -0
- package/src/lib/actions/get-form-responses.d.ts.map +1 -0
- package/src/lib/actions/get-form-responses.js +35 -0
- package/src/lib/actions/get-form-responses.js.map +1 -0
- package/src/lib/actions/get-submission-pdf.d.ts +4 -0
- package/src/lib/actions/get-submission-pdf.d.ts.map +1 -0
- package/src/lib/actions/get-submission-pdf.js +36 -0
- package/src/lib/actions/get-submission-pdf.js.map +1 -0
- package/src/lib/actions/get-workspace.d.ts +2 -0
- package/src/lib/actions/get-workspace.d.ts.map +1 -0
- package/src/lib/actions/get-workspace.js +26 -0
- package/src/lib/actions/get-workspace.js.map +1 -0
- package/src/lib/actions/update-form-settings.d.ts +43 -0
- package/src/lib/actions/update-form-settings.d.ts.map +1 -0
- package/src/lib/actions/update-form-settings.js +284 -0
- package/src/lib/actions/update-form-settings.js.map +1 -0
- package/src/lib/auth.d.ts +2 -0
- package/src/lib/auth.d.ts.map +1 -0
- package/src/lib/auth.js +38 -0
- package/src/lib/auth.js.map +1 -0
- package/src/lib/common/index.d.ts +18 -0
- package/src/lib/common/index.d.ts.map +1 -0
- package/src/lib/common/index.js +85 -0
- package/src/lib/common/index.js.map +1 -0
- package/src/lib/triggers/new-form-response.d.ts +11 -0
- package/src/lib/triggers/new-form-response.d.ts.map +1 -0
- package/src/lib/triggers/new-form-response.js +49 -0
- package/src/lib/triggers/new-form-response.js.map +1 -0
package/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-deftform",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"main": "./src/index.js",
|
|
5
|
+
"types": "./src/index.d.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc -p tsconfig.lib.json && cp package.json dist/",
|
|
8
|
+
"lint": "eslint 'src/**/*.ts'"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@activepieces/pieces-common": "0.12.3",
|
|
12
|
+
"@activepieces/pieces-framework": "0.28.1",
|
|
13
|
+
"@activepieces/shared": "0.71.2",
|
|
14
|
+
"tslib": "2.6.2"
|
|
15
|
+
}
|
|
16
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAU1C,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB,eAAO,MAAM,QAAQ,mHAyBnB,CAAC"}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deftform = exports.deftformAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const shared_1 = require("@activepieces/shared");
|
|
8
|
+
const auth_1 = require("./lib/auth");
|
|
9
|
+
Object.defineProperty(exports, "deftformAuth", { enumerable: true, get: function () { return auth_1.deftformAuth; } });
|
|
10
|
+
const get_workspace_1 = require("./lib/actions/get-workspace");
|
|
11
|
+
const get_all_forms_1 = require("./lib/actions/get-all-forms");
|
|
12
|
+
const get_form_fields_1 = require("./lib/actions/get-form-fields");
|
|
13
|
+
const get_form_responses_1 = require("./lib/actions/get-form-responses");
|
|
14
|
+
const get_submission_pdf_1 = require("./lib/actions/get-submission-pdf");
|
|
15
|
+
const add_form_response_1 = require("./lib/actions/add-form-response");
|
|
16
|
+
const update_form_settings_1 = require("./lib/actions/update-form-settings");
|
|
17
|
+
const new_form_response_1 = require("./lib/triggers/new-form-response");
|
|
18
|
+
exports.deftform = (0, pieces_framework_1.createPiece)({
|
|
19
|
+
displayName: 'Deftform',
|
|
20
|
+
description: 'Build powerful forms and automate your workflow with Deftform.',
|
|
21
|
+
minimumSupportedRelease: '0.36.1',
|
|
22
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/deftform.png',
|
|
23
|
+
categories: [shared_1.PieceCategory.FORMS_AND_SURVEYS],
|
|
24
|
+
auth: auth_1.deftformAuth,
|
|
25
|
+
authors: ['cumonvip1'],
|
|
26
|
+
actions: [
|
|
27
|
+
get_workspace_1.getWorkspaceDetails,
|
|
28
|
+
get_all_forms_1.getAllForms,
|
|
29
|
+
get_form_fields_1.getFormFields,
|
|
30
|
+
get_form_responses_1.getFormResponses,
|
|
31
|
+
get_submission_pdf_1.getSubmissionPdf,
|
|
32
|
+
add_form_response_1.addFormResponse,
|
|
33
|
+
update_form_settings_1.updateFormSettings,
|
|
34
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
35
|
+
baseUrl: () => 'https://deftform.com/api/v1',
|
|
36
|
+
auth: auth_1.deftformAuth,
|
|
37
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
38
|
+
return ({
|
|
39
|
+
Authorization: `Bearer ${auth}`,
|
|
40
|
+
});
|
|
41
|
+
}),
|
|
42
|
+
}),
|
|
43
|
+
],
|
|
44
|
+
triggers: [new_form_response_1.newFormResponseTrigger],
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAA6D;AAC7D,+DAAwE;AACxE,iDAAqD;AACrD,qCAA0C;AAUjC,6FAVA,mBAAY,OAUA;AATrB,+DAAkE;AAClE,+DAA0D;AAC1D,mEAA8D;AAC9D,yEAAoE;AACpE,yEAAoE;AACpE,uEAAkE;AAClE,6EAAwE;AACxE,wEAA0E;AAI7D,QAAA,QAAQ,GAAG,IAAA,8BAAW,EAAC;IAChC,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,gEAAgE;IAC7E,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,kDAAkD;IAC3D,UAAU,EAAE,CAAC,sBAAa,CAAC,iBAAiB,CAAC;IAC7C,IAAI,EAAE,mBAAY;IAClB,OAAO,EAAE,CAAC,WAAW,CAAC;IACtB,OAAO,EAAE;QACL,mCAAmB;QACnB,2BAAW;QACX,+BAAa;QACb,qCAAgB;QAChB,qCAAgB;QAChB,mCAAe;QACf,yCAAkB;QAClB,IAAA,yCAAyB,EAAC;YACtB,OAAO,EAAE,GAAG,EAAE,CAAC,6BAA6B;YAC5C,IAAI,EAAE,mBAAY;YAClB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC1B,aAAa,EAAE,UAAU,IAAI,EAAE;iBAClC,CAAC,CAAA;cAAA;SACL,CAAC;KACL;IACD,QAAQ,EAAE,CAAC,0CAAsB,CAAC;CACrC,CAAC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const addFormResponse: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
formId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
responseData: import("@activepieces/pieces-framework").ObjectProperty<true>;
|
|
4
|
+
}>;
|
|
5
|
+
//# sourceMappingURL=add-form-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-form-response.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/add-form-response.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,eAAe;;;EA4B1B,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addFormResponse = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.addFormResponse = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.deftformAuth,
|
|
11
|
+
name: 'add_form_response',
|
|
12
|
+
displayName: 'Add Form Response',
|
|
13
|
+
description: `Submits a new response programmatically to a form.
|
|
14
|
+
**Note:** This does **not** trigger email notifications to the form admin, unlike regular public submissions.`,
|
|
15
|
+
props: {
|
|
16
|
+
formId: common_1.DeftformCommon.formDropdown,
|
|
17
|
+
responseData: pieces_framework_1.Property.Object({
|
|
18
|
+
displayName: 'Response Data',
|
|
19
|
+
description: 'Key-value pairs where each key is the field UUID and the value is the user input.',
|
|
20
|
+
required: true,
|
|
21
|
+
}),
|
|
22
|
+
},
|
|
23
|
+
run(context) {
|
|
24
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
var _a, _b, _c, _d;
|
|
26
|
+
const response = yield (0, common_1.deftformApiCall)({
|
|
27
|
+
token: context.auth.secret_text,
|
|
28
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
29
|
+
path: `/forms/${context.propsValue.formId}/response`,
|
|
30
|
+
body: { data: context.propsValue.responseData },
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
id: (_b = (_a = response.body.data) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : null,
|
|
34
|
+
uuid: (_d = (_c = response.body.data) === null || _c === void 0 ? void 0 : _c.uuid) !== null && _d !== void 0 ? _d : null,
|
|
35
|
+
message: 'Response submitted successfully.',
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=add-form-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-form-response.js","sourceRoot":"","sources":["../../../../src/lib/actions/add-form-response.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,kCAAuC;AACvC,sCAA4D;AAE/C,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE;8GAC6F;IAC1G,KAAK,EAAE;QACH,MAAM,EAAE,uBAAc,CAAC,YAAY;QACnC,YAAY,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC1B,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,mFAAmF;YAChG,QAAQ,EAAE,IAAI;SACjB,CAAC;KACL;IACK,GAAG,CAAC,OAAO;;;YACb,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAe,EAA4C;gBAC9E,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;gBAC/B,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,IAAI,EAAE,UAAU,OAAO,CAAC,UAAU,CAAC,MAAM,WAAW;gBACpD,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,YAAY,EAAE;aAClD,CAAC,CAAC;YAEH,OAAO;gBACH,EAAE,EAAE,MAAA,MAAA,QAAQ,CAAC,IAAI,CAAC,IAAI,0CAAE,EAAE,mCAAI,IAAI;gBAClC,IAAI,EAAE,MAAA,MAAA,QAAQ,CAAC,IAAI,CAAC,IAAI,0CAAE,IAAI,mCAAI,IAAI;gBACtC,OAAO,EAAE,kCAAkC;aAC9C,CAAC;QACN,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-all-forms.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/get-all-forms.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW,yHAqCtB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAllForms = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.getAllForms = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.deftformAuth,
|
|
11
|
+
name: 'get_all_forms',
|
|
12
|
+
displayName: 'Get All Forms and Fields',
|
|
13
|
+
description: 'Lists all forms in your workspace, including their fields.',
|
|
14
|
+
props: {},
|
|
15
|
+
run(context) {
|
|
16
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
const response = yield (0, common_1.deftformApiCall)({
|
|
18
|
+
token: context.auth.secret_text,
|
|
19
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
20
|
+
path: '/forms',
|
|
21
|
+
});
|
|
22
|
+
return response.body.data.map((form) => {
|
|
23
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
24
|
+
const f = form;
|
|
25
|
+
const fieldsRaw = Array.isArray(f['fields'])
|
|
26
|
+
? f['fields']
|
|
27
|
+
: [];
|
|
28
|
+
return {
|
|
29
|
+
id: (_a = f['id']) !== null && _a !== void 0 ? _a : null,
|
|
30
|
+
name: (_b = f['name']) !== null && _b !== void 0 ? _b : null,
|
|
31
|
+
description: (_c = f['description']) !== null && _c !== void 0 ? _c : null,
|
|
32
|
+
is_closed: (_d = f['is_closed']) !== null && _d !== void 0 ? _d : null,
|
|
33
|
+
slug: (_e = f['slug']) !== null && _e !== void 0 ? _e : null,
|
|
34
|
+
created_at: (_f = f['created_at']) !== null && _f !== void 0 ? _f : null,
|
|
35
|
+
updated_at: (_g = f['updated_at']) !== null && _g !== void 0 ? _g : null,
|
|
36
|
+
fields_count: fieldsRaw.length,
|
|
37
|
+
fields: fieldsRaw.map((field) => {
|
|
38
|
+
var _a, _b, _c, _d;
|
|
39
|
+
return ({
|
|
40
|
+
id: (_a = field['id']) !== null && _a !== void 0 ? _a : null,
|
|
41
|
+
label: (_c = (_b = field['label']) !== null && _b !== void 0 ? _b : field['name']) !== null && _c !== void 0 ? _c : null,
|
|
42
|
+
type: (_d = field['type']) !== null && _d !== void 0 ? _d : null,
|
|
43
|
+
});
|
|
44
|
+
}),
|
|
45
|
+
responses_limit: (_h = f['responses_limit']) !== null && _h !== void 0 ? _h : null,
|
|
46
|
+
admin_email_subject: (_j = f['admin_email_subject']) !== null && _j !== void 0 ? _j : null,
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=get-all-forms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-all-forms.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-all-forms.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,+DAAyD;A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K,EAAE,EAAE;;wBAAC,OAAA,CAAC;4BAC9B,EAAE,EAAE,MAAA,KAAK,CAAC,IAAI,CAAC,mCAAI,IAAI;4BACvB,KAAK,EAAE,MAAA,MAAA,KAAK,CAAC,OAAO,CAAC,mCAAI,KAAK,CAAC,MAAM,CAAC,mCAAI,IAAI;4BAC9C,IAAI,EAAE,MAAA,KAAK,CAAC,MAAM,CAAC,mCAAI,IAAI;yBAC9B,CAAC,CAAA;qBAAA,CAAC;oBACH,eAAe,EAAE,MAAA,CAAC,CAAC,iBAAiB,CAAC,mCAAI,IAAI;oBAC7C,mBAAmB,EAAE,MAAA,CAAC,CAAC,qBAAqB,CAAC,mCAAI,IAAI;iBACxD,CAAC;YACN,CAAC,CAAC,CAAC;QACP,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const getFormFields: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
formId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
}>;
|
|
4
|
+
//# sourceMappingURL=get-form-fields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-form-fields.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/get-form-fields.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa;;EA8BxB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFormFields = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.getFormFields = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.deftformAuth,
|
|
11
|
+
name: 'get_form_fields',
|
|
12
|
+
displayName: 'Get Form Fields',
|
|
13
|
+
description: 'Retrieves only the fields of a specific form. Great for understanding the structure before building automations.',
|
|
14
|
+
props: {
|
|
15
|
+
formId: common_1.DeftformCommon.formDropdown,
|
|
16
|
+
},
|
|
17
|
+
run(context) {
|
|
18
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const response = yield (0, common_1.deftformApiCall)({
|
|
20
|
+
token: context.auth.secret_text,
|
|
21
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
22
|
+
path: `/forms/${context.propsValue.formId}/fields`,
|
|
23
|
+
});
|
|
24
|
+
return response.body.data.map((field) => {
|
|
25
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
26
|
+
const f = field;
|
|
27
|
+
return {
|
|
28
|
+
id: (_a = f['id']) !== null && _a !== void 0 ? _a : null,
|
|
29
|
+
name: (_b = f['name']) !== null && _b !== void 0 ? _b : null,
|
|
30
|
+
label: (_c = f['label']) !== null && _c !== void 0 ? _c : null,
|
|
31
|
+
type: (_d = f['type']) !== null && _d !== void 0 ? _d : null,
|
|
32
|
+
required: (_e = f['required']) !== null && _e !== void 0 ? _e : null,
|
|
33
|
+
options: Array.isArray(f['options']) ? f['options'] : null,
|
|
34
|
+
default_value: (_f = f['default_value']) !== null && _f !== void 0 ? _f : null,
|
|
35
|
+
placeholder: (_g = f['placeholder']) !== null && _g !== void 0 ? _g : null,
|
|
36
|
+
validation: (_h = f['validation']) !== null && _h !== void 0 ? _h : null,
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=get-form-fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-form-fields.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-form-fields.ts"],"names":[],"mappings":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IAAI;oBACrC,UAAU,EAAE,MAAA,CAAC,CAAC,YAAY,CAAC,mCAAI,IAAI;iBACtC,CAAC;YACN,CAAC,CAAC,CAAC;QACP,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const getFormResponses: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
formId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
}>;
|
|
4
|
+
//# sourceMappingURL=get-form-responses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-form-responses.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/get-form-responses.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB;;EAgC3B,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getFormResponses = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.getFormResponses = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.deftformAuth,
|
|
11
|
+
name: 'get_form_responses',
|
|
12
|
+
displayName: 'Get Form Responses',
|
|
13
|
+
description: 'Retrieves all submissions (responses) for a specific form. Useful for reporting and data exports.',
|
|
14
|
+
props: {
|
|
15
|
+
formId: common_1.DeftformCommon.formDropdown,
|
|
16
|
+
},
|
|
17
|
+
run(context) {
|
|
18
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
const response = yield (0, common_1.deftformApiCall)({
|
|
20
|
+
token: context.auth.secret_text,
|
|
21
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
22
|
+
path: `/responses/${context.propsValue.formId}`,
|
|
23
|
+
});
|
|
24
|
+
return response.body.data.map((item) => {
|
|
25
|
+
var _a, _b, _c, _d, _e;
|
|
26
|
+
const i = item;
|
|
27
|
+
return Object.assign({ id: (_a = i['id']) !== null && _a !== void 0 ? _a : null, uuid: (_b = i['uuid']) !== null && _b !== void 0 ? _b : null, form_id: (_c = i['form_id']) !== null && _c !== void 0 ? _c : null, created_at: (_d = i['created_at']) !== null && _d !== void 0 ? _d : null, updated_at: (_e = i['updated_at']) !== null && _e !== void 0 ? _e : null }, Object.fromEntries(Object.entries(i['fields'] || {}).map(([k, v]) => [
|
|
28
|
+
`field_${k}`,
|
|
29
|
+
typeof v === 'object' ? JSON.stringify(v) : v,
|
|
30
|
+
])));
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=get-form-responses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-form-responses.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-form-responses.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,+DAAyD;AACzD,kCAAuC;AACvC,sCAA4D;AAE/C,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,mGAAmG;IAChH,KAAK,EAAE;QACH,MAAM,EAAE,uBAAc,CAAC,YAAY;KACtC;IACK,GAAG,CAAC,OAAO;;YACb,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAe,EAAsB;gBACxD,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;gBAC/B,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,cAAc,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE;aAClD,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;;gBACnC,MAAM,CAAC,GAAG,IAA+B,CAAC;gBAC1C,uBACI,EAAE,EAAE,MAAA,CAAC,CAAC,IAAI,CAAC,mCAAI,IAAI,EACnB,IAAI,EAAE,MAAA,CAAC,CAAC,MAAM,CAAC,mCAAI,IAAI,EACvB,OAAO,EAAE,MAAA,CAAC,CAAC,SAAS,CAAC,mCAAI,IAAI,EAC7B,UAAU,EAAE,MAAA,CAAC,CAAC,YAAY,CAAC,mCAAI,IAAI,EACnC,UAAU,EAAE,MAAA,CAAC,CAAC,YAAY,CAAC,mCAAI,IAAI,IAChC,MAAM,CAAC,WAAW,CACjB,MAAM,CAAC,OAAO,CAAE,CAAC,CAAC,QAAQ,CAA6B,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC;oBAC3E,SAAS,CAAC,EAAE;oBACZ,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;iBAChD,CAAC,CACL,EACH;YACN,CAAC,CAAC,CAAC;QACP,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const getSubmissionPdf: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
responseUuid: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
}>;
|
|
4
|
+
//# sourceMappingURL=get-submission-pdf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-submission-pdf.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/get-submission-pdf.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB;;EAwB3B,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSubmissionPdf = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.getSubmissionPdf = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.deftformAuth,
|
|
11
|
+
name: 'get_submission_pdf',
|
|
12
|
+
displayName: 'Get Submission PDF',
|
|
13
|
+
description: 'Generates a PDF download link for a specific form submission by its unique response UUID.',
|
|
14
|
+
props: {
|
|
15
|
+
responseUuid: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Response UUID',
|
|
17
|
+
description: 'The unique identifier of the submission. You can find this in the form responses list.',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
},
|
|
21
|
+
run(context) {
|
|
22
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
var _a, _b, _c, _d;
|
|
24
|
+
const response = yield (0, common_1.deftformApiCall)({
|
|
25
|
+
token: context.auth.secret_text,
|
|
26
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
27
|
+
path: `/response/${context.propsValue.responseUuid}/pdf`,
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
pdf_url: (_d = (_b = (_a = response.body.data) === null || _a === void 0 ? void 0 : _a.pdf_url) !== null && _b !== void 0 ? _b : (_c = response.body.data) === null || _c === void 0 ? void 0 : _c.url) !== null && _d !== void 0 ? _d : null,
|
|
31
|
+
response_uuid: context.propsValue.responseUuid,
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=get-submission-pdf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-submission-pdf.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-submission-pdf.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,+DAAyD;AACzD,kCAAuC;AACvC,sCAA4C;AAE/B,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,2FAA2F;IACxG,KAAK,EAAE;QACH,YAAY,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,wFAAwF;YACrG,QAAQ,EAAE,IAAI;SACjB,CAAC;KACL;IACK,GAAG,CAAC,OAAO;;;YACb,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAe,EAAgD;gBAClF,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;gBAC/B,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,aAAa,OAAO,CAAC,UAAU,CAAC,YAAY,MAAM;aAC3D,CAAC,CAAC;YAEH,OAAO;gBACH,OAAO,EAAE,MAAA,MAAA,MAAA,QAAQ,CAAC,IAAI,CAAC,IAAI,0CAAE,OAAO,mCAAI,MAAA,QAAQ,CAAC,IAAI,CAAC,IAAI,0CAAE,GAAG,mCAAI,IAAI;gBACvE,aAAa,EAAE,OAAO,CAAC,UAAU,CAAC,YAAY;aACjD,CAAC;QACN,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-workspace.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/get-workspace.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,mBAAmB,yHAc9B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWorkspaceDetails = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.getWorkspaceDetails = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.deftformAuth,
|
|
11
|
+
name: 'get_workspace_details',
|
|
12
|
+
displayName: 'Get Workspace Details',
|
|
13
|
+
description: 'Retrieves all information about your Deftform workspace. Useful as a connection test.',
|
|
14
|
+
props: {},
|
|
15
|
+
run(context) {
|
|
16
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
const response = yield (0, common_1.deftformApiCall)({
|
|
18
|
+
token: context.auth.secret_text,
|
|
19
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
20
|
+
path: '/workspace',
|
|
21
|
+
});
|
|
22
|
+
return (0, common_1.flattenObject)(response.body);
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=get-workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-workspace.js","sourceRoot":"","sources":["../../../../src/lib/actions/get-workspace.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,+DAAyD;AACzD,kCAAuC;AACvC,sCAA2D;AAE9C,QAAA,mBAAmB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,uBAAuB;IACpC,WAAW,EAAE,uFAAuF;IACpG,KAAK,EAAE,EAAE;IACH,GAAG,CAAC,OAAO;;YACb,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAe,EAA0B;gBAC5D,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW;gBAC/B,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,IAAI,EAAE,YAAY;aACrB,CAAC,CAAC;YACH,OAAO,IAAA,sBAAa,EAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACxC,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare const updateFormSettings: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
formId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
generalHeader: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
4
|
+
name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
description: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
6
|
+
isClosed: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
7
|
+
responsesLimit: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
8
|
+
afterSubmissionHeader: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
9
|
+
afterMessage: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
10
|
+
afterRedirectUrl: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
+
afterRedirectDelay: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
12
|
+
ctaLabel: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
13
|
+
ctaLabelContinue: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
14
|
+
closedMessage: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
15
|
+
adminEmailHeader: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
16
|
+
adminEmailSubject: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
17
|
+
adminEmailNote: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
18
|
+
adminEmailAttachPdf: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
19
|
+
includeResponseInEmail: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
20
|
+
afterMessageEmail: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
21
|
+
afterMessageEmailSubject: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
22
|
+
seoHeader: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
23
|
+
seoTitle: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
24
|
+
seoDescription: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
25
|
+
seoAllowBots: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
26
|
+
integrationsHeader: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
27
|
+
discordEnabled: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
28
|
+
slackEnabled: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
29
|
+
googleSheetsEnabled: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
30
|
+
hubspotEnabled: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
31
|
+
securityHeader: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
32
|
+
captcha: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
33
|
+
captureLocation: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
34
|
+
layoutHeader: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
35
|
+
showFormTitle: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
36
|
+
showMultipageProgress: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
37
|
+
aiSummaryEnabled: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
38
|
+
sendPdfToRespondent: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
39
|
+
numberHeader: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
40
|
+
numberPrefix: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
41
|
+
numberSuffix: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
42
|
+
}>;
|
|
43
|
+
//# sourceMappingURL=update-form-settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-form-settings.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/update-form-settings.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiQ7B,CAAC"}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateFormSettings = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const auth_1 = require("../auth");
|
|
8
|
+
const common_1 = require("../common");
|
|
9
|
+
exports.updateFormSettings = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.deftformAuth,
|
|
11
|
+
name: 'update_form_settings',
|
|
12
|
+
displayName: 'Update Form Settings',
|
|
13
|
+
description: 'Updates any combination of form settings via a single call — from title and status to integrations, SEO, and security.',
|
|
14
|
+
props: {
|
|
15
|
+
formId: common_1.DeftformCommon.formDropdown,
|
|
16
|
+
generalHeader: pieces_framework_1.Property.MarkDown({
|
|
17
|
+
value: '## General Settings',
|
|
18
|
+
}),
|
|
19
|
+
name: pieces_framework_1.Property.ShortText({
|
|
20
|
+
displayName: 'Form Name',
|
|
21
|
+
description: 'New display name of the form. Leave empty to keep the current value.',
|
|
22
|
+
required: false,
|
|
23
|
+
}),
|
|
24
|
+
description: pieces_framework_1.Property.LongText({
|
|
25
|
+
displayName: 'Form Description',
|
|
26
|
+
description: 'New description shown on the public form page.',
|
|
27
|
+
required: false,
|
|
28
|
+
}),
|
|
29
|
+
isClosed: pieces_framework_1.Property.Checkbox({
|
|
30
|
+
displayName: 'Close Form',
|
|
31
|
+
description: 'When checked, the form stops accepting new submissions.',
|
|
32
|
+
required: false,
|
|
33
|
+
}),
|
|
34
|
+
responsesLimit: pieces_framework_1.Property.Number({
|
|
35
|
+
displayName: 'Responses Limit',
|
|
36
|
+
description: 'Maximum number of submissions allowed. Leave empty for unlimited responses.',
|
|
37
|
+
required: false,
|
|
38
|
+
}),
|
|
39
|
+
afterSubmissionHeader: pieces_framework_1.Property.MarkDown({
|
|
40
|
+
value: '## After-Submission Behaviour',
|
|
41
|
+
}),
|
|
42
|
+
afterMessage: pieces_framework_1.Property.LongText({
|
|
43
|
+
displayName: 'After-Submission Message',
|
|
44
|
+
description: 'Message shown on screen after the user submits the form.',
|
|
45
|
+
required: false,
|
|
46
|
+
}),
|
|
47
|
+
afterRedirectUrl: pieces_framework_1.Property.ShortText({
|
|
48
|
+
displayName: 'After-Submission Redirect URL',
|
|
49
|
+
description: 'URL to redirect the respondent to after submission (instead of showing a message).',
|
|
50
|
+
required: false,
|
|
51
|
+
}),
|
|
52
|
+
afterRedirectDelay: pieces_framework_1.Property.Number({
|
|
53
|
+
displayName: 'Redirect Delay (seconds)',
|
|
54
|
+
description: 'Number of seconds to wait before redirecting. Leave empty for instant redirect.',
|
|
55
|
+
required: false,
|
|
56
|
+
}),
|
|
57
|
+
ctaLabel: pieces_framework_1.Property.ShortText({
|
|
58
|
+
displayName: 'CTA Label',
|
|
59
|
+
description: 'Text on the primary button shown after submission (e.g. "Download").',
|
|
60
|
+
required: false,
|
|
61
|
+
}),
|
|
62
|
+
ctaLabelContinue: pieces_framework_1.Property.ShortText({
|
|
63
|
+
displayName: 'CTA Label Continue',
|
|
64
|
+
description: 'Text on the secondary button shown after submission (e.g. "Next").',
|
|
65
|
+
required: false,
|
|
66
|
+
}),
|
|
67
|
+
closedMessage: pieces_framework_1.Property.LongText({
|
|
68
|
+
displayName: 'Closed Form Message',
|
|
69
|
+
description: 'Message shown when a user tries to access a closed form.',
|
|
70
|
+
required: false,
|
|
71
|
+
}),
|
|
72
|
+
adminEmailHeader: pieces_framework_1.Property.MarkDown({
|
|
73
|
+
value: '## Admin Notification Email',
|
|
74
|
+
}),
|
|
75
|
+
adminEmailSubject: pieces_framework_1.Property.ShortText({
|
|
76
|
+
displayName: 'Notification Email Subject',
|
|
77
|
+
description: 'Subject line of the email sent to admins on each new submission.',
|
|
78
|
+
required: false,
|
|
79
|
+
}),
|
|
80
|
+
adminEmailNote: pieces_framework_1.Property.LongText({
|
|
81
|
+
displayName: 'Notification Email Note',
|
|
82
|
+
description: 'Custom note added to the top of the admin notification email.',
|
|
83
|
+
required: false,
|
|
84
|
+
}),
|
|
85
|
+
adminEmailAttachPdf: pieces_framework_1.Property.Checkbox({
|
|
86
|
+
displayName: 'Attach Submission PDF',
|
|
87
|
+
description: 'Attach a PDF version of the submission to the admin email.',
|
|
88
|
+
required: false,
|
|
89
|
+
}),
|
|
90
|
+
includeResponseInEmail: pieces_framework_1.Property.Checkbox({
|
|
91
|
+
displayName: 'Include Response in Email',
|
|
92
|
+
description: 'Include the full response data in the admin notification body.',
|
|
93
|
+
required: false,
|
|
94
|
+
}),
|
|
95
|
+
afterMessageEmail: pieces_framework_1.Property.LongText({
|
|
96
|
+
displayName: 'Respondent Confirmation Email Message',
|
|
97
|
+
description: 'Message sent to the respondent in their confirmation email (if enabled).',
|
|
98
|
+
required: false,
|
|
99
|
+
}),
|
|
100
|
+
afterMessageEmailSubject: pieces_framework_1.Property.ShortText({
|
|
101
|
+
displayName: 'Respondent Confirmation Email Subject',
|
|
102
|
+
description: 'Subject line of the confirmation email sent to the respondent.',
|
|
103
|
+
required: false,
|
|
104
|
+
}),
|
|
105
|
+
seoHeader: pieces_framework_1.Property.MarkDown({
|
|
106
|
+
value: '## SEO Settings',
|
|
107
|
+
}),
|
|
108
|
+
seoTitle: pieces_framework_1.Property.ShortText({
|
|
109
|
+
displayName: 'SEO Title',
|
|
110
|
+
description: 'Custom HTML title tag for the public form page.',
|
|
111
|
+
required: false,
|
|
112
|
+
}),
|
|
113
|
+
seoDescription: pieces_framework_1.Property.ShortText({
|
|
114
|
+
displayName: 'SEO Description',
|
|
115
|
+
description: 'Meta description for the public form page.',
|
|
116
|
+
required: false,
|
|
117
|
+
}),
|
|
118
|
+
seoAllowBots: pieces_framework_1.Property.Checkbox({
|
|
119
|
+
displayName: 'Allow Search-Engine Bots',
|
|
120
|
+
description: 'When checked, search engines may index the public form page.',
|
|
121
|
+
required: false,
|
|
122
|
+
}),
|
|
123
|
+
integrationsHeader: pieces_framework_1.Property.MarkDown({
|
|
124
|
+
value: '## Integrations',
|
|
125
|
+
}),
|
|
126
|
+
discordEnabled: pieces_framework_1.Property.Checkbox({
|
|
127
|
+
displayName: 'Discord Notifications',
|
|
128
|
+
description: 'When checked, a notification is sent to the configured Discord channel on each submission.',
|
|
129
|
+
required: false,
|
|
130
|
+
}),
|
|
131
|
+
slackEnabled: pieces_framework_1.Property.Checkbox({
|
|
132
|
+
displayName: 'Slack Notifications',
|
|
133
|
+
description: 'When checked, a notification is sent to the configured Slack channel on each submission.',
|
|
134
|
+
required: false,
|
|
135
|
+
}),
|
|
136
|
+
googleSheetsEnabled: pieces_framework_1.Property.Checkbox({
|
|
137
|
+
displayName: 'Google Sheets Integration',
|
|
138
|
+
description: 'When checked, submissions are automatically synced to Google Sheets.',
|
|
139
|
+
required: false,
|
|
140
|
+
}),
|
|
141
|
+
hubspotEnabled: pieces_framework_1.Property.Checkbox({
|
|
142
|
+
displayName: 'HubSpot Integration',
|
|
143
|
+
description: 'When checked, submissions are pushed to HubSpot as contacts or deals.',
|
|
144
|
+
required: false,
|
|
145
|
+
}),
|
|
146
|
+
securityHeader: pieces_framework_1.Property.MarkDown({
|
|
147
|
+
value: '## Security',
|
|
148
|
+
}),
|
|
149
|
+
captcha: pieces_framework_1.Property.StaticDropdown({
|
|
150
|
+
displayName: 'CAPTCHA',
|
|
151
|
+
description: 'Protection against spam bots.',
|
|
152
|
+
required: false,
|
|
153
|
+
options: {
|
|
154
|
+
options: [
|
|
155
|
+
{ label: 'ALTCHA', value: 'altcha' },
|
|
156
|
+
{ label: 'Turnstile (Cloudflare)', value: 'turnstile' },
|
|
157
|
+
{ label: 'reCAPTCHA', value: 'recaptcha' },
|
|
158
|
+
{ label: 'None', value: 'none' },
|
|
159
|
+
],
|
|
160
|
+
},
|
|
161
|
+
}),
|
|
162
|
+
captureLocation: pieces_framework_1.Property.Checkbox({
|
|
163
|
+
displayName: 'Capture Location',
|
|
164
|
+
description: 'Record the respondent location (IP-based geolocation).',
|
|
165
|
+
required: false,
|
|
166
|
+
}),
|
|
167
|
+
layoutHeader: pieces_framework_1.Property.MarkDown({
|
|
168
|
+
value: '## Layout & Display',
|
|
169
|
+
}),
|
|
170
|
+
showFormTitle: pieces_framework_1.Property.Checkbox({
|
|
171
|
+
displayName: 'Show Form Title',
|
|
172
|
+
description: 'Display the form title at the top of the public page.',
|
|
173
|
+
required: false,
|
|
174
|
+
}),
|
|
175
|
+
showMultipageProgress: pieces_framework_1.Property.Checkbox({
|
|
176
|
+
displayName: 'Show Multi-Page Progress',
|
|
177
|
+
description: 'Show a progress bar when the form has multiple pages.',
|
|
178
|
+
required: false,
|
|
179
|
+
}),
|
|
180
|
+
aiSummaryEnabled: pieces_framework_1.Property.Checkbox({
|
|
181
|
+
displayName: 'AI Summary',
|
|
182
|
+
description: 'Enable the AI-powered summary on the form dashboard.',
|
|
183
|
+
required: false,
|
|
184
|
+
}),
|
|
185
|
+
sendPdfToRespondent: pieces_framework_1.Property.Checkbox({
|
|
186
|
+
displayName: 'Send PDF to Respondent',
|
|
187
|
+
description: 'Attach a PDF version of the submission to the respondent confirmation email.',
|
|
188
|
+
required: false,
|
|
189
|
+
}),
|
|
190
|
+
numberHeader: pieces_framework_1.Property.MarkDown({
|
|
191
|
+
value: '## Submission Numbering',
|
|
192
|
+
}),
|
|
193
|
+
numberPrefix: pieces_framework_1.Property.ShortText({
|
|
194
|
+
displayName: 'Number Prefix',
|
|
195
|
+
description: 'Text added before the submission number (e.g. "INV-").',
|
|
196
|
+
required: false,
|
|
197
|
+
}),
|
|
198
|
+
numberSuffix: pieces_framework_1.Property.ShortText({
|
|
199
|
+
displayName: 'Number Suffix',
|
|
200
|
+
description: 'Text added after the submission number (e.g. "-A").',
|
|
201
|
+
required: false,
|
|
202
|
+
}),
|
|
203
|
+
},
|
|
204
|
+
run(context) {
|
|
205
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
206
|
+
var _a, _b, _c, _d, _e, _f;
|
|
207
|
+
const body = {};
|
|
208
|
+
if (context.propsValue.name !== undefined)
|
|
209
|
+
body['name'] = context.propsValue.name;
|
|
210
|
+
if (context.propsValue.description !== undefined)
|
|
211
|
+
body['description'] = context.propsValue.description;
|
|
212
|
+
if (context.propsValue.isClosed !== undefined)
|
|
213
|
+
body['is_closed'] = context.propsValue.isClosed;
|
|
214
|
+
if (context.propsValue.responsesLimit !== undefined)
|
|
215
|
+
body['responses_limit'] = context.propsValue.responsesLimit;
|
|
216
|
+
if (context.propsValue.afterMessage !== undefined)
|
|
217
|
+
body['after_message'] = context.propsValue.afterMessage;
|
|
218
|
+
if (context.propsValue.afterRedirectUrl !== undefined)
|
|
219
|
+
body['after_redirect_url'] = context.propsValue.afterRedirectUrl;
|
|
220
|
+
if (context.propsValue.afterRedirectDelay !== undefined)
|
|
221
|
+
body['after_redirect_delay'] = context.propsValue.afterRedirectDelay;
|
|
222
|
+
if (context.propsValue.ctaLabel !== undefined)
|
|
223
|
+
body['cta_label'] = context.propsValue.ctaLabel;
|
|
224
|
+
if (context.propsValue.ctaLabelContinue !== undefined)
|
|
225
|
+
body['cta_label_continue'] = context.propsValue.ctaLabelContinue;
|
|
226
|
+
if (context.propsValue.closedMessage !== undefined)
|
|
227
|
+
body['closed_message'] = context.propsValue.closedMessage;
|
|
228
|
+
if (context.propsValue.adminEmailSubject !== undefined)
|
|
229
|
+
body['admin_email_subject'] = context.propsValue.adminEmailSubject;
|
|
230
|
+
if (context.propsValue.adminEmailNote !== undefined)
|
|
231
|
+
body['admin_email_note'] = context.propsValue.adminEmailNote;
|
|
232
|
+
if (context.propsValue.adminEmailAttachPdf !== undefined)
|
|
233
|
+
body['admin_email_attach_pdf'] = context.propsValue.adminEmailAttachPdf;
|
|
234
|
+
if (context.propsValue.includeResponseInEmail !== undefined)
|
|
235
|
+
body['include_response_in_email'] = context.propsValue.includeResponseInEmail;
|
|
236
|
+
if (context.propsValue.afterMessageEmail !== undefined)
|
|
237
|
+
body['after_message_email'] = context.propsValue.afterMessageEmail;
|
|
238
|
+
if (context.propsValue.afterMessageEmailSubject !== undefined)
|
|
239
|
+
body['after_message_email_subject'] = context.propsValue.afterMessageEmailSubject;
|
|
240
|
+
if (context.propsValue.seoTitle !== undefined)
|
|
241
|
+
body['seo_title'] = context.propsValue.seoTitle;
|
|
242
|
+
if (context.propsValue.seoDescription !== undefined)
|
|
243
|
+
body['seo_description'] = context.propsValue.seoDescription;
|
|
244
|
+
if (context.propsValue.seoAllowBots !== undefined)
|
|
245
|
+
body['seo_allow_bots'] = context.propsValue.seoAllowBots;
|
|
246
|
+
if (context.propsValue.discordEnabled !== undefined)
|
|
247
|
+
body['discord_enabled'] = context.propsValue.discordEnabled;
|
|
248
|
+
if (context.propsValue.slackEnabled !== undefined)
|
|
249
|
+
body['slack_enabled'] = context.propsValue.slackEnabled;
|
|
250
|
+
if (context.propsValue.googleSheetsEnabled !== undefined)
|
|
251
|
+
body['google_sheets_enabled'] = context.propsValue.googleSheetsEnabled;
|
|
252
|
+
if (context.propsValue.hubspotEnabled !== undefined)
|
|
253
|
+
body['hubspot_enabled'] = context.propsValue.hubspotEnabled;
|
|
254
|
+
if (context.propsValue.captcha !== undefined)
|
|
255
|
+
body['captcha'] = context.propsValue.captcha;
|
|
256
|
+
if (context.propsValue.captureLocation !== undefined)
|
|
257
|
+
body['capture_location'] = context.propsValue.captureLocation;
|
|
258
|
+
if (context.propsValue.showFormTitle !== undefined)
|
|
259
|
+
body['show_formtitle'] = context.propsValue.showFormTitle;
|
|
260
|
+
if (context.propsValue.showMultipageProgress !== undefined)
|
|
261
|
+
body['show_multipage_progress'] = context.propsValue.showMultipageProgress;
|
|
262
|
+
if (context.propsValue.aiSummaryEnabled !== undefined)
|
|
263
|
+
body['ai_summary_enabled'] = context.propsValue.aiSummaryEnabled;
|
|
264
|
+
if (context.propsValue.sendPdfToRespondent !== undefined)
|
|
265
|
+
body['send_pdf_to_respondent'] = context.propsValue.sendPdfToRespondent;
|
|
266
|
+
if (context.propsValue.numberPrefix !== undefined)
|
|
267
|
+
body['number_prefix'] = context.propsValue.numberPrefix;
|
|
268
|
+
if (context.propsValue.numberSuffix !== undefined)
|
|
269
|
+
body['number_suffix'] = context.propsValue.numberSuffix;
|
|
270
|
+
const response = yield (0, common_1.deftformApiCall)({
|
|
271
|
+
token: context.auth.secret_text,
|
|
272
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
273
|
+
path: `/forms/${context.propsValue.formId}/settings`,
|
|
274
|
+
body,
|
|
275
|
+
});
|
|
276
|
+
return {
|
|
277
|
+
id: (_b = (_a = response.body.data) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : null,
|
|
278
|
+
name: (_d = (_c = response.body.data) === null || _c === void 0 ? void 0 : _c.name) !== null && _d !== void 0 ? _d : null,
|
|
279
|
+
updated_at: (_f = (_e = response.body.data) === null || _e === void 0 ? void 0 : _e.updated_at) !== null && _f !== void 0 ? _f : null,
|
|
280
|
+
};
|
|
281
|
+
});
|
|
282
|
+
},
|
|
283
|
+
});
|
|
284
|
+
//# sourceMappingURL=update-form-settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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,UAAU,OAAO,CAAC,UAAU,CAAC,MAAM,WAAW;gBACpD,IAAI;aACP,CAAC,CAAC;YAEH,OAAO;gBACH,EAAE,EAAE,MAAA,MAAA,QAAQ,CAAC,IAAI,CAAC,IAAI,0CAAE,EAAE,mCAAI,IAAI;gBAClC,IAAI,EAAE,MAAA,MAAA,QAAQ,CAAC,IAAI,CAAC,IAAI,0CAAE,IAAI,mCAAI,IAAI;gBACtC,UAAU,EAAE,MAAA,MAAA,QAAQ,CAAC,IAAI,CAAC,IAAI,0CAAE,UAAU,mCAAI,IAAI;aACrD,CAAC;QACN,CAAC;KAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,mEA6BvB,CAAC"}
|
package/src/lib/auth.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deftformAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
exports.deftformAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
8
|
+
displayName: 'API Key',
|
|
9
|
+
description: `To get your Deftform API key:
|
|
10
|
+
1. Log in to your Deftform workspace at https://deftform.com
|
|
11
|
+
2. Go to **Settings > API** (https://deftform.com/settings/api)
|
|
12
|
+
3. Click **Create API Key**
|
|
13
|
+
4. Copy the key and paste it here
|
|
14
|
+
|
|
15
|
+
Need help? See https://deftform.com/docs/api`,
|
|
16
|
+
required: true,
|
|
17
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
18
|
+
try {
|
|
19
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
20
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
21
|
+
url: 'https://deftform.com/api/v1/workspace',
|
|
22
|
+
headers: {
|
|
23
|
+
Accept: 'application/json',
|
|
24
|
+
'Content-Type': 'application/json',
|
|
25
|
+
},
|
|
26
|
+
authentication: {
|
|
27
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
28
|
+
token: auth,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
return { valid: true };
|
|
32
|
+
}
|
|
33
|
+
catch (e) {
|
|
34
|
+
return { valid: false, error: 'Invalid API Key. Make sure you copied the full key from Deftform.' };
|
|
35
|
+
}
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAA2D;AAC3D,+DAAyF;AAE5E,QAAA,YAAY,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC7C,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE;;;;;;6CAM4B;IACzC,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACrB,IAAI,CAAC;YACD,MAAM,0BAAU,CAAC,WAAW,CAAC;gBACzB,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,uCAAuC;gBAC5C,OAAO,EAAE;oBACL,MAAM,EAAE,kBAAkB;oBAC1B,cAAc,EAAE,kBAAkB;iBACrC;gBACD,cAAc,EAAE;oBACZ,IAAI,EAAE,kCAAkB,CAAC,YAAY;oBACrC,KAAK,EAAE,IAAI;iBACd;aACJ,CAAC,CAAC;YACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QAC3B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACT,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,mEAAmE,EAAE,CAAC;QACxG,CAAC;IACL,CAAC,CAAA;CACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HttpMethod, HttpMessageBody, HttpResponse } from '@activepieces/pieces-common';
|
|
2
|
+
export declare function deftformApiCall<T extends HttpMessageBody>({ token, method, path, body, queryParams, }: {
|
|
3
|
+
token: string;
|
|
4
|
+
method: HttpMethod;
|
|
5
|
+
path: string;
|
|
6
|
+
body?: unknown;
|
|
7
|
+
queryParams?: Record<string, string>;
|
|
8
|
+
}): Promise<HttpResponse<T>>;
|
|
9
|
+
export declare function getApiToken(context: {
|
|
10
|
+
auth: {
|
|
11
|
+
secret_text: string;
|
|
12
|
+
};
|
|
13
|
+
}): string;
|
|
14
|
+
export declare function flattenObject(obj: Record<string, unknown>, prefix?: string): Record<string, unknown>;
|
|
15
|
+
export declare const DeftformCommon: {
|
|
16
|
+
formDropdown: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,UAAU,EAEV,eAAe,EACf,YAAY,EACf,MAAM,6BAA6B,CAAC;AAMrC,wBAAsB,eAAe,CAAC,CAAC,SAAS,eAAe,EAAE,EAC7D,KAAK,EACL,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,WAAW,GACd,EAAE;IACC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAe3B;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GAAG,MAAM,CAE9E;AAED,wBAAgB,aAAa,CACzB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,MAAM,SAAK,GACZ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAoBzB;AAED,eAAO,MAAM,cAAc;;CA6B1B,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DeftformCommon = void 0;
|
|
4
|
+
exports.deftformApiCall = deftformApiCall;
|
|
5
|
+
exports.getApiToken = getApiToken;
|
|
6
|
+
exports.flattenObject = flattenObject;
|
|
7
|
+
const tslib_1 = require("tslib");
|
|
8
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
9
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
10
|
+
const auth_1 = require("../auth");
|
|
11
|
+
const BASE_URL = 'https://deftform.com/api/v1';
|
|
12
|
+
function deftformApiCall(_a) {
|
|
13
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ token, method, path, body, queryParams, }) {
|
|
14
|
+
return yield pieces_common_1.httpClient.sendRequest({
|
|
15
|
+
method,
|
|
16
|
+
url: `${BASE_URL}${path}`,
|
|
17
|
+
headers: {
|
|
18
|
+
Accept: 'application/json',
|
|
19
|
+
'Content-Type': 'application/json',
|
|
20
|
+
},
|
|
21
|
+
authentication: {
|
|
22
|
+
type: pieces_common_1.AuthenticationType.BEARER_TOKEN,
|
|
23
|
+
token,
|
|
24
|
+
},
|
|
25
|
+
queryParams,
|
|
26
|
+
body,
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function getApiToken(context) {
|
|
31
|
+
return context.auth.secret_text;
|
|
32
|
+
}
|
|
33
|
+
function flattenObject(obj, prefix = '') {
|
|
34
|
+
const result = {};
|
|
35
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
36
|
+
const flatKey = prefix ? `${prefix}_${key}` : key;
|
|
37
|
+
if (value === null || value === undefined) {
|
|
38
|
+
result[flatKey] = null;
|
|
39
|
+
}
|
|
40
|
+
else if (Array.isArray(value)) {
|
|
41
|
+
result[flatKey] = value
|
|
42
|
+
.map((v) => (typeof v === 'object' ? JSON.stringify(v) : String(v)))
|
|
43
|
+
.join(', ');
|
|
44
|
+
}
|
|
45
|
+
else if (typeof value === 'object') {
|
|
46
|
+
Object.assign(result, flattenObject(value, flatKey));
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
result[flatKey] = value;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
exports.DeftformCommon = {
|
|
55
|
+
formDropdown: pieces_framework_1.Property.Dropdown({
|
|
56
|
+
displayName: 'Form',
|
|
57
|
+
description: 'Select the form to use',
|
|
58
|
+
refreshers: [],
|
|
59
|
+
required: true,
|
|
60
|
+
auth: auth_1.deftformAuth,
|
|
61
|
+
options: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
62
|
+
if (!auth) {
|
|
63
|
+
return { disabled: true, options: [], placeholder: 'Please connect your account first' };
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
const response = yield deftformApiCall({
|
|
67
|
+
token: auth.secret_text,
|
|
68
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
69
|
+
path: '/forms',
|
|
70
|
+
});
|
|
71
|
+
return {
|
|
72
|
+
disabled: false,
|
|
73
|
+
options: response.body.data.map((f) => ({
|
|
74
|
+
label: f.name,
|
|
75
|
+
value: f.id,
|
|
76
|
+
})),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
return { disabled: true, options: [], placeholder: 'Failed to load forms. Check your connection.' };
|
|
81
|
+
}
|
|
82
|
+
}),
|
|
83
|
+
}),
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/common/index.ts"],"names":[],"mappings":";;;AAYA,0CA2BC;AAED,kCAEC;AAED,sCAuBC;;AApED,+DAMqC;AACrC,qEAA0D;AAC1D,kCAAuC;AAEvC,MAAM,QAAQ,GAAG,6BAA6B,CAAC;AAE/C,SAAsB,eAAe;iEAA4B,EAC7D,KAAK,EACL,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,WAAW,GAOd;QACG,OAAO,MAAM,0BAAU,CAAC,WAAW,CAAI;YACnC,MAAM;YACN,GAAG,EAAE,GAAG,QAAQ,GAAG,IAAI,EAAE;YACzB,OAAO,EAAE;gBACL,MAAM,EAAE,kBAAkB;gBAC1B,cAAc,EAAE,kBAAkB;aACrC;YACD,cAAc,EAAE;gBACZ,IAAI,EAAE,kCAAkB,CAAC,YAAY;gBACrC,KAAK;aACR;YACD,WAAW;YACX,IAAI;SACP,CAAC,CAAC;IACP,CAAC;CAAA;AAED,SAAgB,WAAW,CAAC,OAA0C;IAClE,OAAO,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC;AACpC,CAAC;AAED,SAAgB,aAAa,CACzB,GAA4B,EAC5B,MAAM,GAAG,EAAE;IAEX,MAAM,MAAM,GAA4B,EAAE,CAAC;IAE3C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7C,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QAElD,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxC,MAAM,CAAC,OA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AC,CAAC;gBACH,OAAO;oBACH,QAAQ,EAAE,KAAK;oBACf,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;wBACpC,KAAK,EAAE,CAAC,CAAC,IAAI;wBACb,KAAK,EAAE,CAAC,CAAC,EAAE;qBACd,CAAC,CAAC;iBACN,CAAC;YACN,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,8CAA8C,EAAE,CAAC;YACxG,CAAC;QACL,CAAC,CAAA;KACJ,CAAC;CACL,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
+
export declare const newFormResponseTrigger: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
3
|
+
instructions: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
4
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
5
|
+
instructions: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
6
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
7
|
+
instructions: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
8
|
+
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
9
|
+
instructions: import("@activepieces/pieces-framework/dist/src/lib/property/input/markdown-property").MarkDownProperty;
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=new-form-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-form-response.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/new-form-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,eAAe,EAAY,MAAM,gCAAgC,CAAC;AAa1F,eAAO,MAAM,sBAAsB;;;;;;;;EA0BjC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.newFormResponseTrigger = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const auth_1 = require("../auth");
|
|
7
|
+
const setupMarkdown = `
|
|
8
|
+
**Setup instructions:**
|
|
9
|
+
1. In your Deftform workspace go to **Settings → Notifications / Connections**.
|
|
10
|
+
2. Under **Webhook**, click **ADD ENDPOINT** and paste the URL below:
|
|
11
|
+
\`\`\`
|
|
12
|
+
{{webhookUrl}}
|
|
13
|
+
\`\`\`
|
|
14
|
+
3. Save the endpoint, then open the form you want to watch, go to its **Notifications / Connections** tab, and enable the webhook you just created.
|
|
15
|
+
`;
|
|
16
|
+
exports.newFormResponseTrigger = (0, pieces_framework_1.createTrigger)({
|
|
17
|
+
auth: auth_1.deftformAuth,
|
|
18
|
+
name: 'new_form_response',
|
|
19
|
+
displayName: 'New Form Response',
|
|
20
|
+
description: 'Triggers instantly when a new response is submitted to a Deftform form.',
|
|
21
|
+
props: {
|
|
22
|
+
instructions: pieces_framework_1.Property.MarkDown({ value: setupMarkdown }),
|
|
23
|
+
},
|
|
24
|
+
sampleData: {
|
|
25
|
+
data: [
|
|
26
|
+
[
|
|
27
|
+
{ label: 'Full name', response: 'John Doe', uuid: '6403fc2b-6d52-4231-b63f-db6ea9f651dd', custom_key: 'full_name' },
|
|
28
|
+
{ label: 'Email address', response: 'john@example.com', uuid: '6403fc2b-6d52-4231-b63f-db6ea9f651de', custom_key: 'email_address' },
|
|
29
|
+
],
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
type: pieces_framework_1.TriggerStrategy.WEBHOOK,
|
|
33
|
+
onEnable(_context) {
|
|
34
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
// Webhook URL is pasted manually into Deftform workspace settings.
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
onDisable(_context) {
|
|
39
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
// Nothing to unregister.
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
run(context) {
|
|
44
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
return [context.payload.body];
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=new-form-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"new-form-response.js","sourceRoot":"","sources":["../../../../src/lib/triggers/new-form-response.ts"],"names":[],"mappings":";;;;AAAA,qEAA0F;AAC1F,kCAAuC;AAEvC,MAAM,aAAa,GAAG;;;;;;;;CAQrB,CAAC;AAEW,QAAA,sBAAsB,GAAG,IAAA,gCAAa,EAAC;IAChD,IAAI,EAAE,mBAAY;IAClB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,yEAAyE;IACtF,KAAK,EAAE;QACH,YAAY,EAAE,2BAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;KAC5D;IACD,UAAU,EAAE;QACR,IAAI,EAAE;YACF;gBACI,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,sCAAsC,EAAE,UAAU,EAAE,WAAW,EAAE;gBACnH,EAAE,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,kBAAkB,EAAE,IAAI,EAAE,sCAAsC,EAAE,UAAU,EAAE,eAAe,EAAE;aACtI;SACJ;KACJ;IACD,IAAI,EAAE,kCAAe,CAAC,OAAO;IACvB,QAAQ,CAAC,QAAQ;;YACnB,mEAAmE;QACvE,CAAC;KAAA;IACK,SAAS,CAAC,QAAQ;;YACpB,yBAAyB;QAC7B,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACb,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAClC,CAAC;KAAA;CACJ,CAAC,CAAC"}
|