@pipedream/productlane 0.0.1 → 0.1.0

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.
@@ -0,0 +1,42 @@
1
+ import productlane from "../../productlane.app.mjs";
2
+
3
+ export default {
4
+ key: "productlane-create-contact",
5
+ name: "Create Contact",
6
+ description: "Creates a new contact with email, name, and an array of segments in Productlane. [See the documentation](https://productlane.com/docs/api-reference/contacts/create-contact)",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ props: {
10
+ productlane,
11
+ email: {
12
+ propDefinition: [
13
+ productlane,
14
+ "email",
15
+ ],
16
+ },
17
+ name: {
18
+ type: "string",
19
+ label: "Name",
20
+ description: "The name of the contact",
21
+ optional: true,
22
+ },
23
+ segments: {
24
+ type: "string[]",
25
+ label: "Segments",
26
+ description: "Array of segments",
27
+ optional: true,
28
+ },
29
+ },
30
+ async run({ $ }) {
31
+ const response = await this.productlane.createContact({
32
+ $,
33
+ data: {
34
+ email: this.email,
35
+ name: this.name,
36
+ segments: this.segments,
37
+ },
38
+ });
39
+ $.export("$summary", `Successfully created contact ${this.email}`);
40
+ return response;
41
+ },
42
+ };
@@ -0,0 +1,100 @@
1
+ import {
2
+ ORIGIN_OPTIONS, PAIN_LEVEL_OPTIONS,
3
+ } from "../../common/constants.mjs";
4
+ import productlane from "../../productlane.app.mjs";
5
+
6
+ export default {
7
+ key: "productlane-create-feedback",
8
+ name: "Create Feedback",
9
+ description:
10
+ "Create new feedback in Productlane. [See the documentation](https://productlane.com/docs/api-reference/portal/create-feedback)",
11
+ version: "0.0.1",
12
+ type: "action",
13
+ props: {
14
+ productlane,
15
+ projectId: {
16
+ propDefinition: [
17
+ productlane,
18
+ "projectId",
19
+ ],
20
+ },
21
+ email: {
22
+ propDefinition: [
23
+ productlane,
24
+ "email",
25
+ ],
26
+ description: "The email for the feedback",
27
+ },
28
+ text: {
29
+ type: "string",
30
+ label: "Text",
31
+ description: "The text of the feedback",
32
+ },
33
+ notifyByEmail: {
34
+ propDefinition: [
35
+ productlane,
36
+ "notify",
37
+ ],
38
+ label: "Notify by Email",
39
+ description: "Whether to notify by email",
40
+ },
41
+ notifyBySlack: {
42
+ propDefinition: [
43
+ productlane,
44
+ "notify",
45
+ ],
46
+ label: "Notify by Slack",
47
+ description: "Whether to notify by slack",
48
+ },
49
+ origin: {
50
+ type: "string",
51
+ label: "Origin",
52
+ description: "The origin of the feedback",
53
+ optional: true,
54
+ options: ORIGIN_OPTIONS,
55
+ },
56
+ painLevel: {
57
+ type: "string",
58
+ label: "Pain Level",
59
+ description: "The pain level of the feedback",
60
+ options: PAIN_LEVEL_OPTIONS,
61
+ },
62
+ },
63
+ async run({ $ }) {
64
+ const {
65
+ email,
66
+ notifyByEmail,
67
+ notifyBySlack,
68
+ origin,
69
+ painLevel,
70
+ text,
71
+ projectId,
72
+ } = this;
73
+
74
+ const data = {
75
+ email: email,
76
+ notify: ((notifyByEmail ?? notifyBySlack) !== undefined)
77
+ ? {
78
+ email: notifyByEmail,
79
+ slack: notifyBySlack,
80
+ }
81
+ : undefined,
82
+ origin: origin,
83
+ painLevel: painLevel,
84
+ text: text,
85
+ projectId: projectId,
86
+ };
87
+
88
+ const response = await this.productlane.createFeedback({
89
+ $,
90
+ data,
91
+ });
92
+
93
+ $.export(
94
+ "$summary",
95
+ `Successfully created feedback with ID: ${response.id}`,
96
+ );
97
+
98
+ return response;
99
+ },
100
+ };
@@ -0,0 +1,36 @@
1
+ import productlane from "../../productlane.app.mjs";
2
+
3
+ export default {
4
+ key: "productlane-upvote-project",
5
+ name: "Upvote Project",
6
+ description: "Upvotes a project by ID. [See the documentation](https://productlane.com/docs/api-reference/portal/upvote-project)",
7
+ version: "0.0.1",
8
+ type: "action",
9
+ props: {
10
+ productlane,
11
+ projectId: {
12
+ propDefinition: [
13
+ productlane,
14
+ "projectId",
15
+ ],
16
+ },
17
+ email: {
18
+ propDefinition: [
19
+ productlane,
20
+ "email",
21
+ ],
22
+ description: "The email associated with the upvote",
23
+ },
24
+ },
25
+ async run({ $ }) {
26
+ const response = await this.productlane.upvoteProject({
27
+ $,
28
+ projectId: this.projectId,
29
+ data: {
30
+ email: this.email,
31
+ },
32
+ });
33
+ $.export("$summary", "Successfully upvoted project");
34
+ return response;
35
+ },
36
+ };
@@ -0,0 +1,20 @@
1
+ export const ORIGIN_OPTIONS = [
2
+ "INAPP",
3
+ "PORTAL",
4
+ "API",
5
+ "SLACK",
6
+ "INTERCOM",
7
+ "INTERCOM_ATTACHMENT",
8
+ "ZENDESK_ATTACHMENT",
9
+ "FRONT_ATTACHMENT",
10
+ "EMAIL",
11
+ "ZAPIER",
12
+ "HUBSPOT",
13
+ ];
14
+
15
+ export const PAIN_LEVEL_OPTIONS = [
16
+ "UNKNOWN",
17
+ "LOW",
18
+ "MEDIUM",
19
+ "HIGH",
20
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/productlane",
3
- "version": "0.0.1",
3
+ "version": "0.1.0",
4
4
  "description": "Pipedream Productlane Components",
5
5
  "main": "productlane.app.mjs",
6
6
  "keywords": [
@@ -11,5 +11,8 @@
11
11
  "author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
12
12
  "publishConfig": {
13
13
  "access": "public"
14
+ },
15
+ "dependencies": {
16
+ "@pipedream/platform": "^1.5.1"
14
17
  }
15
18
  }
@@ -1,11 +1,83 @@
1
+ import { axios } from "@pipedream/platform";
2
+
1
3
  export default {
2
4
  type: "app",
3
5
  app: "productlane",
4
- propDefinitions: {},
6
+ propDefinitions: {
7
+ projectId: {
8
+ type: "string",
9
+ label: "Project ID",
10
+ description: "The ID of the project. [See the documentation](https://productlane.com/docs/api-reference/portal/list-projects) for more information",
11
+ async options() {
12
+ const projects = await this.listProjects();
13
+ return projects.map((p) => ({
14
+ label: p.name,
15
+ value: p.id,
16
+ }));
17
+ },
18
+ },
19
+ email: {
20
+ type: "string",
21
+ label: "Email",
22
+ description: "The email of the contact",
23
+ },
24
+ notify: {
25
+ type: "boolean",
26
+ label: "Notify",
27
+ description: "Whether to notify",
28
+ optional: true,
29
+ },
30
+ },
5
31
  methods: {
6
- // this.$auth contains connected account data
7
- authKeys() {
8
- console.log(Object.keys(this.$auth));
32
+ _baseUrl() {
33
+ return "https://productlane.com/api/v1";
34
+ },
35
+ _workspaceId() {
36
+ return this.$auth.workspace_id;
37
+ },
38
+ async _makeRequest({
39
+ $ = this,
40
+ path,
41
+ headers,
42
+ ...otherOpts
43
+ }) {
44
+ return axios($, {
45
+ ...otherOpts,
46
+ url: this._baseUrl() + path,
47
+ headers: {
48
+ ...headers,
49
+ Authorization: `Bearer ${this.$auth.api_key}`,
50
+ },
51
+ });
52
+ },
53
+ async createContact(opts) {
54
+ return this._makeRequest({
55
+ ...opts,
56
+ path: "/contacts",
57
+ method: "POST",
58
+ });
59
+ },
60
+ async upvoteProject({
61
+ projectId, ...opts
62
+ }) {
63
+ return this._makeRequest({
64
+ ...opts,
65
+ path: `/projects/${projectId}/upvotes`,
66
+ method: "POST",
67
+ });
68
+ },
69
+ async createFeedback(opts) {
70
+ return this._makeRequest({
71
+ ...opts,
72
+ path: "/feedback",
73
+ method: "POST",
74
+ });
75
+ },
76
+ async listProjects() {
77
+ const { projects } = await this._makeRequest({
78
+ path: `/projects/${this._workspaceId()}`,
79
+ });
80
+ return projects;
9
81
  },
10
82
  },
11
- };
83
+ };