Skip to content

Commit 7ec4d71

Browse files
jcorteslcaresia
authored andcommitted
[Components] cloze - New components (#14639)
1 parent 2787314 commit 7ec4d71

File tree

18 files changed

+732
-21
lines changed

18 files changed

+732
-21
lines changed

components/cloze/.gitignore

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
import app from "../../cloze.app.mjs";
2+
3+
export default {
4+
key: "cloze-create-note",
5+
name: "Create Note",
6+
description: "Creates a note in Cloze. [See the documentation](https://api.cloze.com/api-docs/#!/Content/post_v1_createcontent).",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
uniqueId: {
12+
type: "string",
13+
label: "Unique ID",
14+
description: "A unique identifier for this content record. This will often be the unique Id in an external system so that updates can be matched up with the record in Cloze.",
15+
},
16+
source: {
17+
type: "string",
18+
label: "Source",
19+
description: "The source that this content record originally came from (Eg. `todoist.com`). Must be a valid domain.",
20+
},
21+
date: {
22+
type: "string",
23+
label: "Date",
24+
description: "When the content should show up in the timeline. Can be a string or a UTC timestamp in ms since the epoch. Eg. `2021-01-01` or `1609459200000`.",
25+
optional: true,
26+
},
27+
from: {
28+
type: "string",
29+
label: "From",
30+
description: "From address for this content record (the address of the person created the record). This can be an email address, phone number, social handle or app link (Eg. `na16.salesforce.com:006j000000Pkp1d`)",
31+
optional: true,
32+
},
33+
subject: {
34+
type: "string",
35+
label: "Subject",
36+
description: "Subject of the communication record.",
37+
optional: true,
38+
},
39+
body: {
40+
type: "string",
41+
label: "Body",
42+
description: "Body text of the communication record.",
43+
},
44+
additionalData: {
45+
type: "object",
46+
label: "Additional Data",
47+
description: "Additional details for the note in JSON format. [See the documentation](https://api.cloze.com/api-docs/#!/Content/post_v1_createcontent).",
48+
optional: true,
49+
},
50+
},
51+
async run({ $ }) {
52+
const {
53+
app,
54+
uniqueId,
55+
date,
56+
from,
57+
source,
58+
subject,
59+
body,
60+
additionalData,
61+
} = this;
62+
63+
const response = await app.addContentRecord({
64+
$,
65+
data: {
66+
uniqueid: uniqueId,
67+
date,
68+
style: "note",
69+
from,
70+
source,
71+
subject,
72+
body,
73+
...additionalData,
74+
},
75+
});
76+
77+
$.export("$summary", "Successfully created note.");
78+
79+
return response;
80+
},
81+
};
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
import app from "../../cloze.app.mjs";
2+
import utils from "../../common/utils.mjs";
3+
4+
export default {
5+
key: "cloze-create-update-company",
6+
name: "Create Or Update Company",
7+
description: "Create a new company or enhance an existing company within Cloze. Companies can be created with just a domain name or both a name and another unique identifier such as a phone number and email address. [See the documentation](https://api.cloze.com/api-docs/#!/Relations_-_Companies/post_v1_companies_create).",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
app,
12+
name: {
13+
type: "string",
14+
label: "Company Name",
15+
description: "The name of the company.",
16+
optional: true,
17+
},
18+
emails: {
19+
type: "string[]",
20+
label: "Emails",
21+
description: "The emails of the company. Each email should be a JSON object with `value` key. [See the documentation](https://api.cloze.com/api-docs/#!/Relations_-_Companies/post_v1_companies_create).",
22+
optional: true,
23+
},
24+
phones: {
25+
type: "string[]",
26+
label: "Phones",
27+
description: "The phones of the company. Each phone should be a JSON object with `value` key. [See the documentation](https://api.cloze.com/api-docs/#!/Relations_-_Companies/post_v1_companies_create).",
28+
optional: true,
29+
},
30+
domains: {
31+
type: "string[]",
32+
label: "Domains",
33+
description: "The domains of the company.",
34+
optional: true,
35+
},
36+
segment: {
37+
type: "string",
38+
label: "Segment",
39+
description: "The segment of the company.",
40+
optional: true,
41+
options: [
42+
"customer",
43+
"partner",
44+
"supplier",
45+
"investor",
46+
"advisor",
47+
"competitor",
48+
"custom1",
49+
"custom2",
50+
"custom3",
51+
"custom4",
52+
"custom5",
53+
"coworker",
54+
"family",
55+
"friend",
56+
"network",
57+
"personal1",
58+
"personal2",
59+
],
60+
},
61+
step: {
62+
type: "string",
63+
label: "Step",
64+
description: "Unique Id of Next Step",
65+
optional: true,
66+
},
67+
stage: {
68+
type: "string",
69+
label: "Stage",
70+
description: "The stage of the company.",
71+
optional: true,
72+
options: [
73+
{
74+
label: "Lead Stage",
75+
value: "lead",
76+
},
77+
{
78+
label: "Potential Stage",
79+
value: "future",
80+
},
81+
{
82+
label: "Active Stage",
83+
value: "current",
84+
},
85+
{
86+
label: "Inactive Stage",
87+
value: "past",
88+
},
89+
{
90+
label: "Lost Stage",
91+
value: "out",
92+
},
93+
],
94+
},
95+
assignTo: {
96+
type: "string",
97+
label: "Assign To",
98+
description: "Assign this company to this team member.",
99+
optional: true,
100+
},
101+
additionalData: {
102+
type: "object",
103+
label: "Additional Data",
104+
description: "Additional details for the company in JSON format. [See the documentation](https://api.cloze.com/api-docs/#!/Relations_-_Companies/post_v1_companies_create).",
105+
optional: true,
106+
},
107+
},
108+
methods: {
109+
createCompany(args = {}) {
110+
return this.app.post({
111+
path: "/companies/create",
112+
...args,
113+
});
114+
},
115+
},
116+
async run({ $ }) {
117+
const {
118+
createCompany,
119+
name,
120+
emails,
121+
phones,
122+
domains,
123+
segment,
124+
step,
125+
stage,
126+
assignTo,
127+
additionalData,
128+
} = this;
129+
130+
const response = await createCompany({
131+
$,
132+
data: {
133+
name,
134+
emails: utils.parseArray(emails),
135+
phones: utils.parseArray(phones),
136+
domains,
137+
segment,
138+
step,
139+
stage,
140+
assignTo,
141+
...additionalData,
142+
},
143+
});
144+
145+
$.export("$summary", "Successfully created/updated company.");
146+
return response;
147+
},
148+
};
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
import app from "../../cloze.app.mjs";
2+
import utils from "../../common/utils.mjs";
3+
4+
export default {
5+
key: "cloze-create-update-project",
6+
name: "Create Or Update Project",
7+
description: "Create a new project or merge updates into an existing one. [See the documentation](https://api.cloze.com/api-docs/#!/Relations_-_Projects/post_v1_projects_create).",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
app,
12+
name: {
13+
type: "string",
14+
label: "Project Name",
15+
description: "The name of the project.",
16+
},
17+
appLinks: {
18+
type: "string[]",
19+
label: "App Links",
20+
description: "The app links of the project. Each app link should be a JSON object with at least `source` and `uniqueid` keys. [See the documentation](https://api.cloze.com/api-docs/#!/Relations_-_Projects/post_v1_projects_create).",
21+
optional: true,
22+
default: [
23+
JSON.stringify({
24+
source: "na16.salesforce.com",
25+
uniqueid: "sdf234v",
26+
}),
27+
],
28+
},
29+
summary: {
30+
type: "string",
31+
label: "Project Summary",
32+
description: "The summary of the project.",
33+
optional: true,
34+
},
35+
stage: {
36+
type: "string",
37+
label: "Stage",
38+
description: "The stage of the project.",
39+
optional: true,
40+
options: [
41+
{
42+
label: "Potential Stage",
43+
value: "future",
44+
},
45+
{
46+
label: "Active Stage",
47+
value: "current",
48+
},
49+
{
50+
label: "Won or Done stage",
51+
value: "won",
52+
},
53+
{
54+
label: "Lost Stage",
55+
value: "lost",
56+
},
57+
],
58+
},
59+
segment: {
60+
type: "string",
61+
label: "Segment",
62+
description: "The segment of the project.",
63+
optional: true,
64+
options: [
65+
"project",
66+
"project1",
67+
"project2",
68+
"project3",
69+
"project4",
70+
"project5",
71+
],
72+
},
73+
additionalData: {
74+
type: "object",
75+
label: "Additional Data",
76+
description: "Additional details for the project in JSON format. [See the documentation](https://api.cloze.com/api-docs/#!/Relations_-_Projects/post_v1_projects_create).",
77+
optional: true,
78+
},
79+
},
80+
methods: {
81+
createProject(args = {}) {
82+
return this.app.post({
83+
path: "/projects/create",
84+
...args,
85+
});
86+
},
87+
},
88+
async run({ $ }) {
89+
const {
90+
createProject,
91+
name,
92+
appLinks,
93+
summary,
94+
stage,
95+
segment,
96+
additionalData,
97+
} = this;
98+
99+
const response = await createProject({
100+
$,
101+
data: {
102+
name,
103+
appLinks: utils.parseArray(appLinks),
104+
summary,
105+
stage,
106+
segment,
107+
...additionalData,
108+
},
109+
});
110+
111+
$.export("$summary", "Successfully created/updated project.");
112+
113+
return response;
114+
},
115+
};

components/cloze/app/cloze.app.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)