-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - richpanel #15108
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
New Components - richpanel #15108
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
197eede
richpanel init
luancazarine 70cb6c3
[Components] richpanel #15105
luancazarine 1777796
pnpm update
luancazarine a6cc2ee
[Components] richpanel #15105
luancazarine af516f2
Merge branch 'master' into issue-15105
luancazarine 100b8bb
pnpm update
luancazarine 7a2b467
fix import
luancazarine 0f16150
Add some props
luancazarine 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 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 |
|---|---|---|
|
|
@@ -8,4 +8,4 @@ export default { | |
| console.log(Object.keys(this.$auth)); | ||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
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 |
|---|---|---|
|
|
@@ -8,4 +8,4 @@ export default { | |
| console.log(Object.keys(this.$auth)); | ||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
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 |
|---|---|---|
|
|
@@ -8,4 +8,4 @@ export default { | |
| console.log(Object.keys(this.$auth)); | ||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
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 |
|---|---|---|
|
|
@@ -8,4 +8,4 @@ export default { | |
| console.log(Object.keys(this.$auth)); | ||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
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 |
|---|---|---|
|
|
@@ -8,4 +8,4 @@ export default { | |
| console.log(Object.keys(this.$auth)); | ||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
46 changes: 46 additions & 0 deletions
46
components/richpanel/actions/add-ticket-message/add-ticket-message.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,46 @@ | ||
| import richpanel from "../../richpanel.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "richpanel-add-ticket-message", | ||
| name: "Add Ticket Message", | ||
| description: "Adds a message to an existing ticket. [See the documentation](https://developer.richpanel.com/reference/update-a-conversation)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| richpanel, | ||
| conversationId: { | ||
| propDefinition: [ | ||
| richpanel, | ||
| "conversationId", | ||
| ], | ||
| }, | ||
| commentBody: { | ||
| propDefinition: [ | ||
| richpanel, | ||
| "commentBody", | ||
| ], | ||
| }, | ||
| commentSenderType: { | ||
| propDefinition: [ | ||
| richpanel, | ||
| "commentSenderType", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.richpanel.updateTicket({ | ||
| $, | ||
| conversationId: this.conversationId, | ||
| data: { | ||
| ticket: { | ||
| comment: { | ||
| body: this.commentBody, | ||
| sender_type: this.commentSenderType, | ||
| }, | ||
| }, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Added message to ticket ${this.conversationId} successfully`); | ||
| return response; | ||
| }, | ||
| }; | ||
206 changes: 206 additions & 0 deletions
206
components/richpanel/actions/create-ticket/create-ticket.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,206 @@ | ||
| import { ConfigurationError } from "@pipedream/platform"; | ||
| import { VIA_CHANNEL_OPTIONS } from "../../common/constants.mjs"; | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
| import richpanel from "../../richpanel.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "richpanel-create-ticket", | ||
| name: "Create Ticket", | ||
| description: "Creates a new support ticket in Richpanel. [See the documentation](https://developer.richpanel.com/reference/create-conversation).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| richpanel, | ||
| id: { | ||
| propDefinition: [ | ||
| richpanel, | ||
| "createId", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| status: { | ||
| propDefinition: [ | ||
| richpanel, | ||
| "status", | ||
| ], | ||
| }, | ||
| subject: { | ||
| type: "string", | ||
| label: "Subject", | ||
| description: "The subject of the ticket.", | ||
| optional: true, | ||
| }, | ||
| commentBody: { | ||
| propDefinition: [ | ||
| richpanel, | ||
| "commentBody", | ||
| ], | ||
| }, | ||
| priority: { | ||
| type: "string", | ||
| label: "Priority", | ||
| description: "The priority of the ticket.", | ||
| options: [ | ||
| "HIGH", | ||
| "LOW", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| commentSenderType: { | ||
| propDefinition: [ | ||
| richpanel, | ||
| "commentSenderType", | ||
| ], | ||
| }, | ||
| viaChannel: { | ||
| type: "string", | ||
| label: "Via Channel", | ||
| description: "The channel via which the ticket is created.", | ||
| reloadProps: true, | ||
| options: VIA_CHANNEL_OPTIONS, | ||
| }, | ||
| viaSourceFromAddress: { | ||
| type: "string", | ||
| label: "Via Source From Address", | ||
| description: "The email address of the source from.", | ||
| hidden: true, | ||
| }, | ||
| viaSourceFromName: { | ||
| type: "string", | ||
| label: "Via Source From Name", | ||
| description: "The name of the source from.", | ||
| hidden: true, | ||
| }, | ||
| viaSourceToAddress: { | ||
| type: "string", | ||
| label: "Via Source To Address", | ||
| description: "The email address of the source to.", | ||
| hidden: true, | ||
| }, | ||
| viaSourceToName: { | ||
| type: "string", | ||
| label: "Via Source To Name", | ||
| description: "The name of the source to.", | ||
| hidden: true, | ||
| }, | ||
| viaSourceFromNumber: { | ||
| type: "string", | ||
| label: "Via Source From Number", | ||
| description: "The phone number of the source from.", | ||
| hidden: true, | ||
| }, | ||
| viaSourceToNumber: { | ||
| type: "string", | ||
| label: "Via Source To Number", | ||
| description: "The phone number of the source to.", | ||
| hidden: true, | ||
| }, | ||
| viaSourceFrom: { | ||
| type: "object", | ||
| label: "Via Source From", | ||
| description: "The object source from which the ticket was created. **Examples: {\"address\": \"[email protected]\"} or {\"id\": \"+16692668044\"}. It depends on the selected channel**.", | ||
| hidden: true, | ||
| }, | ||
| viaSourceTo: { | ||
| type: "object", | ||
| label: "Via Source To", | ||
| description: "The object source to which the ticket was created. **Examples: {\"address\": \"[email protected]\"} or {\"id\": \"+16692668044\"}. It depends on the selected channel**.", | ||
| hidden: true, | ||
| }, | ||
| tags: { | ||
| propDefinition: [ | ||
| richpanel, | ||
| "tags", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async additionalProps(props) { | ||
| switch (this.viaChannel) { | ||
| case "email" : | ||
| props.viaSourceFromAddress.hidden = false; | ||
| props.viaSourceFromName.hidden = false; | ||
| props.viaSourceToAddress.hidden = false; | ||
| props.viaSourceToName.hidden = false; | ||
| props.viaSourceFrom.hidden = true; | ||
| props.viaSourceTo.hidden = true; | ||
| props.viaSourceFromNumber.hidden = true; | ||
| props.viaSourceToNumber.hidden = true; | ||
| break; | ||
| case "aircall" : | ||
| props.viaSourceFromNumber.hidden = false; | ||
| props.viaSourceToNumber.hidden = false; | ||
| props.viaSourceFrom.hidden = true; | ||
| props.viaSourceTo.hidden = true; | ||
| props.viaSourceFromAddress.hidden = true; | ||
| props.viaSourceFromName.hidden = true; | ||
| props.viaSourceToAddress.hidden = true; | ||
| props.viaSourceToName.hidden = true; | ||
| break; | ||
| default: | ||
| props.viaSourceFrom.hidden = false; | ||
| props.viaSourceTo.hidden = false; | ||
| props.viaSourceFromAddress.hidden = true; | ||
| props.viaSourceFromName.hidden = true; | ||
| props.viaSourceToAddress.hidden = true; | ||
| props.viaSourceToName.hidden = true; | ||
| props.viaSourceFromNumber.hidden = true; | ||
| props.viaSourceToNumber.hidden = true; | ||
| } | ||
| return {}; | ||
| }, | ||
| async run({ $ }) { | ||
| try { | ||
| const source = {}; | ||
| switch (this.viaChannel) { | ||
| case "email" : | ||
| source.from = { | ||
| address: this.viaSourceFromAddress, | ||
| name: this.viaSourceFromName, | ||
| }; | ||
| source.to = { | ||
| address: this.viaSourceToAddress, | ||
| name: this.viaSourceToName, | ||
| }; | ||
| break; | ||
| case "aircall" : | ||
| source.from = { | ||
| id: this.viaSourceFromNumber, | ||
| }; | ||
| source.to = { | ||
| id: this.viaSourceToNumber, | ||
| }; | ||
| break; | ||
| default: | ||
| source.from = parseObject(this.viaSourceFrom); | ||
| source.to = parseObject(this.viaSourceTo); | ||
| } | ||
|
|
||
| const response = await this.richpanel.createTicket({ | ||
| $, | ||
| data: { | ||
| ticket: { | ||
| id: this.id, | ||
| status: this.status, | ||
| subject: this.subject, | ||
| comment: { | ||
| body: this.commentBody, | ||
| sender_type: this.commentSenderType, | ||
| }, | ||
| priority: this.priority, | ||
| via: { | ||
| channel: this.viaChannel, | ||
| source, | ||
| }, | ||
| tags: parseObject(this.tags), | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Created ticket ${response.ticket.id}`); | ||
| return response; | ||
| } catch ({ response }) { | ||
| throw new ConfigurationError(response?.data?.error?.message); | ||
| } | ||
| }, | ||
| }; |
37 changes: 37 additions & 0 deletions
37
components/richpanel/actions/update-ticket-status/update-ticket-status.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,37 @@ | ||
| import richpanel from "../../richpanel.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "richpanel-update-ticket-status", | ||
| name: "Update Ticket Status", | ||
| description: "Updates the status of an existing ticket in Richpanel. [See the documentation](https://developer.richpanel.com/reference/update-a-conversation).", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| richpanel, | ||
| conversationId: { | ||
| propDefinition: [ | ||
| richpanel, | ||
| "conversationId", | ||
| ], | ||
| }, | ||
| status: { | ||
| propDefinition: [ | ||
| richpanel, | ||
| "status", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.richpanel.updateTicket({ | ||
| $, | ||
| conversationId: this.conversationId, | ||
| data: { | ||
| ticket: { | ||
| status: this.status, | ||
| }, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Updated ticket ${this.conversationId} to status ${this.status}`); | ||
| return response; | ||
| }, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
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,52 @@ | ||
| export const STATUS_OPTIONS = [ | ||
| { | ||
| label: "Open", | ||
| value: "OPEN", | ||
| }, | ||
| { | ||
| label: "Closed", | ||
| value: "CLOSED", | ||
| }, | ||
| ]; | ||
|
|
||
| export const COMMENT_SENDER_TYPE_OPTIONS = [ | ||
| { | ||
| label: "Customer", | ||
| value: "customer", | ||
| }, | ||
| { | ||
| label: "Operator", | ||
| value: "operator", | ||
| }, | ||
| ]; | ||
|
|
||
| export const VIA_CHANNEL_OPTIONS = [ | ||
| { | ||
| label: "Email", | ||
| value: "email", | ||
| }, | ||
| { | ||
| label: "Messenger", | ||
| value: "messenger", | ||
| }, | ||
| { | ||
| label: "Facebook Message", | ||
| value: "facebook_message", | ||
| }, | ||
| { | ||
| label: "Instagram", | ||
| value: "instagram", | ||
| }, | ||
| { | ||
| label: "Aircall", | ||
| value: "aircall", | ||
| }, | ||
| { | ||
| label: "Phone", | ||
| value: "phone", | ||
| }, | ||
| { | ||
| label: "WhatsApp", | ||
| value: "whatsapp", | ||
| }, | ||
| ]; |
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.