-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[Components] cloze - New components #14639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| import app from "../../cloze.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "cloze-create-note", | ||
| name: "Create Note", | ||
| description: "Creates a note in Cloze. [See the documentation](https://api.cloze.com/api-docs/#!/Content/post_v1_createcontent).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| uniqueId: { | ||
| type: "string", | ||
| label: "Unique ID", | ||
| 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.", | ||
| }, | ||
| source: { | ||
| type: "string", | ||
| label: "Source", | ||
| description: "The source that this content record originally came from (Eg. `todoist.com`). Must be a valid domain.", | ||
| }, | ||
| date: { | ||
| type: "string", | ||
| label: "Date", | ||
| 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`.", | ||
| optional: true, | ||
| }, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| from: { | ||
| type: "string", | ||
| label: "From", | ||
| 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`)", | ||
| optional: true, | ||
| }, | ||
| subject: { | ||
| type: "string", | ||
| label: "Subject", | ||
| description: "Subject of the communication record.", | ||
| optional: true, | ||
| }, | ||
| body: { | ||
| type: "string", | ||
| label: "Body", | ||
| description: "Body text of the communication record.", | ||
| }, | ||
| additionalData: { | ||
| type: "object", | ||
| label: "Additional Data", | ||
| description: "Additional details for the note in JSON format. [See the documentation](https://api.cloze.com/api-docs/#!/Content/post_v1_createcontent).", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| uniqueId, | ||
| date, | ||
| from, | ||
| source, | ||
| subject, | ||
| body, | ||
| additionalData, | ||
| } = this; | ||
|
|
||
| const response = await app.addContentRecord({ | ||
| $, | ||
| data: { | ||
| uniqueid: uniqueId, | ||
| date, | ||
| style: "note", | ||
| from, | ||
| source, | ||
| subject, | ||
| body, | ||
| ...additionalData, | ||
| }, | ||
| }); | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| $.export("$summary", "Successfully created note."); | ||
|
|
||
| return response; | ||
| }, | ||
| }; | ||
148 changes: 148 additions & 0 deletions
148
components/cloze/actions/create-update-company/create-update-company.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| import app from "../../cloze.app.mjs"; | ||
| import utils from "../../common/utils.mjs"; | ||
|
|
||
| export default { | ||
| key: "cloze-create-update-company", | ||
| name: "Create Or Update Company", | ||
| 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).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| name: { | ||
| type: "string", | ||
| label: "Company Name", | ||
| description: "The name of the company.", | ||
| optional: true, | ||
| }, | ||
| emails: { | ||
| type: "string[]", | ||
| label: "Emails", | ||
| 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).", | ||
| optional: true, | ||
| }, | ||
| phones: { | ||
| type: "string[]", | ||
| label: "Phones", | ||
| 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).", | ||
| optional: true, | ||
| }, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| domains: { | ||
| type: "string[]", | ||
| label: "Domains", | ||
| description: "The domains of the company.", | ||
| optional: true, | ||
| }, | ||
| segment: { | ||
| type: "string", | ||
| label: "Segment", | ||
| description: "The segment of the company.", | ||
| optional: true, | ||
| options: [ | ||
| "customer", | ||
| "partner", | ||
| "supplier", | ||
| "investor", | ||
| "advisor", | ||
| "competitor", | ||
| "custom1", | ||
| "custom2", | ||
| "custom3", | ||
| "custom4", | ||
| "custom5", | ||
| "coworker", | ||
| "family", | ||
| "friend", | ||
| "network", | ||
| "personal1", | ||
| "personal2", | ||
| ], | ||
| }, | ||
| step: { | ||
| type: "string", | ||
| label: "Step", | ||
| description: "Unique Id of Next Step", | ||
| optional: true, | ||
| }, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| stage: { | ||
| type: "string", | ||
| label: "Stage", | ||
| description: "The stage of the company.", | ||
| optional: true, | ||
| options: [ | ||
| { | ||
| label: "Lead Stage", | ||
| value: "lead", | ||
| }, | ||
| { | ||
| label: "Potential Stage", | ||
| value: "future", | ||
| }, | ||
| { | ||
| label: "Active Stage", | ||
| value: "current", | ||
| }, | ||
| { | ||
| label: "Inactive Stage", | ||
| value: "past", | ||
| }, | ||
| { | ||
| label: "Lost Stage", | ||
| value: "out", | ||
| }, | ||
| ], | ||
| }, | ||
| assignTo: { | ||
| type: "string", | ||
| label: "Assign To", | ||
| description: "Assign this company to this team member.", | ||
| optional: true, | ||
| }, | ||
| additionalData: { | ||
| type: "object", | ||
| label: "Additional Data", | ||
| description: "Additional details for the company in JSON format. [See the documentation](https://api.cloze.com/api-docs/#!/Relations_-_Companies/post_v1_companies_create).", | ||
| optional: true, | ||
| }, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| methods: { | ||
| createCompany(args = {}) { | ||
| return this.app.post({ | ||
| path: "/companies/create", | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| async run({ $ }) { | ||
| const { | ||
| createCompany, | ||
| name, | ||
| emails, | ||
| phones, | ||
| domains, | ||
| segment, | ||
| step, | ||
| stage, | ||
| assignTo, | ||
| additionalData, | ||
| } = this; | ||
|
|
||
| const response = await createCompany({ | ||
| $, | ||
| data: { | ||
| name, | ||
| emails: utils.parseArray(emails), | ||
| phones: utils.parseArray(phones), | ||
| domains, | ||
| segment, | ||
| step, | ||
| stage, | ||
| assignTo, | ||
| ...additionalData, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", "Successfully created/updated company."); | ||
| return response; | ||
| }, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
115 changes: 115 additions & 0 deletions
115
components/cloze/actions/create-update-project/create-update-project.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| import app from "../../cloze.app.mjs"; | ||
| import utils from "../../common/utils.mjs"; | ||
|
|
||
| export default { | ||
| key: "cloze-create-update-project", | ||
| name: "Create Or Update Project", | ||
| 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).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| name: { | ||
| type: "string", | ||
| label: "Project Name", | ||
| description: "The name of the project.", | ||
| }, | ||
| appLinks: { | ||
| type: "string[]", | ||
| label: "App Links", | ||
| 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).", | ||
| optional: true, | ||
| default: [ | ||
| JSON.stringify({ | ||
| source: "na16.salesforce.com", | ||
| uniqueid: "sdf234v", | ||
| }), | ||
| ], | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| summary: { | ||
| type: "string", | ||
| label: "Project Summary", | ||
| description: "The summary of the project.", | ||
| optional: true, | ||
| }, | ||
| stage: { | ||
| type: "string", | ||
| label: "Stage", | ||
| description: "The stage of the project.", | ||
| optional: true, | ||
| options: [ | ||
| { | ||
| label: "Potential Stage", | ||
| value: "future", | ||
| }, | ||
| { | ||
| label: "Active Stage", | ||
| value: "current", | ||
| }, | ||
| { | ||
| label: "Won or Done stage", | ||
| value: "won", | ||
| }, | ||
| { | ||
| label: "Lost Stage", | ||
| value: "lost", | ||
| }, | ||
| ], | ||
| }, | ||
| segment: { | ||
| type: "string", | ||
| label: "Segment", | ||
| description: "The segment of the project.", | ||
| optional: true, | ||
| options: [ | ||
| "project", | ||
| "project1", | ||
| "project2", | ||
| "project3", | ||
| "project4", | ||
| "project5", | ||
| ], | ||
| }, | ||
| additionalData: { | ||
| type: "object", | ||
| label: "Additional Data", | ||
| description: "Additional details for the project in JSON format. [See the documentation](https://api.cloze.com/api-docs/#!/Relations_-_Projects/post_v1_projects_create).", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| methods: { | ||
| createProject(args = {}) { | ||
| return this.app.post({ | ||
| path: "/projects/create", | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| createProject, | ||
| name, | ||
| appLinks, | ||
| summary, | ||
| stage, | ||
| segment, | ||
| additionalData, | ||
| } = this; | ||
|
|
||
| const response = await createProject({ | ||
| $, | ||
| data: { | ||
| name, | ||
| appLinks: utils.parseArray(appLinks), | ||
| summary, | ||
| stage, | ||
| segment, | ||
| ...additionalData, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", "Successfully created/updated project."); | ||
|
|
||
| return response; | ||
| }, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.