feat: Convert all app files to JS
This commit is contained in:
@@ -2,7 +2,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Subject',
|
||||
key: 'subject',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
variables: true,
|
||||
description: '',
|
||||
@@ -10,7 +10,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Assignee',
|
||||
key: 'assigneeId',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: false,
|
||||
variables: true,
|
||||
description:
|
||||
@@ -37,14 +37,14 @@ export const fields = [
|
||||
{
|
||||
label: 'Collaborators',
|
||||
key: 'collaborators',
|
||||
type: 'dynamic' as const,
|
||||
type: 'dynamic',
|
||||
required: false,
|
||||
description: '',
|
||||
fields: [
|
||||
{
|
||||
label: 'Collaborator',
|
||||
key: 'collaborator',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: '',
|
||||
@@ -68,7 +68,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Collaborator Emails',
|
||||
key: 'collaboratorEmails',
|
||||
type: 'dynamic' as const,
|
||||
type: 'dynamic',
|
||||
required: false,
|
||||
description:
|
||||
'You have the option to include individuals who are not Zendesk users as Collaborators by adding their email addresses here.',
|
||||
@@ -76,7 +76,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Collaborator Email',
|
||||
key: 'collaboratorEmail',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: '',
|
||||
@@ -86,7 +86,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Group',
|
||||
key: 'groupId',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: 'Allocate this ticket to a specific group.',
|
||||
@@ -104,7 +104,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Requester Name',
|
||||
key: 'requesterName',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
description:
|
||||
@@ -113,7 +113,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Requester Email',
|
||||
key: 'requesterEmail',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
description:
|
||||
@@ -122,7 +122,7 @@ export const fields = [
|
||||
{
|
||||
label: 'First Comment/Description Format',
|
||||
key: 'format',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: '',
|
||||
@@ -134,7 +134,7 @@ export const fields = [
|
||||
{
|
||||
label: 'First Comment/Description',
|
||||
key: 'comment',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
variables: true,
|
||||
description: '',
|
||||
@@ -142,7 +142,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Should the first comment be public?',
|
||||
key: 'publicOrNot',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: '',
|
||||
@@ -154,7 +154,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Tags',
|
||||
key: 'tags',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: 'A comma separated list of tags.',
|
||||
@@ -162,7 +162,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Status',
|
||||
key: 'status',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: '',
|
||||
@@ -178,7 +178,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Type',
|
||||
key: 'type',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: '',
|
||||
@@ -192,7 +192,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Due At',
|
||||
key: 'dueAt',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: 'Limited to tickets typed as "task".',
|
||||
@@ -200,7 +200,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Priority',
|
||||
key: 'priority',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: '',
|
||||
@@ -214,7 +214,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Submitter',
|
||||
key: 'submitterId',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: '',
|
||||
@@ -236,7 +236,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Ticket Form',
|
||||
key: 'ticketForm',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: false,
|
||||
variables: true,
|
||||
description:
|
||||
@@ -255,14 +255,14 @@ export const fields = [
|
||||
{
|
||||
label: 'Sharing Agreements',
|
||||
key: 'sharingAgreements',
|
||||
type: 'dynamic' as const,
|
||||
type: 'dynamic',
|
||||
required: false,
|
||||
description: '',
|
||||
fields: [
|
||||
{
|
||||
label: 'Sharing Agreement',
|
||||
key: 'sharingAgreement',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: '',
|
||||
@@ -282,7 +282,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Brand',
|
||||
key: 'brandId',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: false,
|
||||
variables: true,
|
||||
description:
|
||||
@@ -1,11 +1,6 @@
|
||||
import { IJSONArray, IJSONObject } from '@automatisch/types';
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
import { fields } from './fields';
|
||||
import isEmpty from 'lodash/isEmpty';
|
||||
|
||||
type Payload = {
|
||||
ticket: IJSONObject;
|
||||
};
|
||||
import defineAction from '../../../../helpers/define-action.js';
|
||||
import { fields } from './fields.js';
|
||||
import isEmpty from 'lodash/isEmpty.js';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Create ticket',
|
||||
@@ -32,15 +27,14 @@ export default defineAction({
|
||||
brandId,
|
||||
} = $.step.parameters;
|
||||
|
||||
const collaborators = $.step.parameters.collaborators as IJSONArray;
|
||||
const collaborators = $.step.parameters.collaborators;
|
||||
const collaboratorIds = collaborators?.map(
|
||||
(collaborator: IJSONObject) => collaborator.collaborator
|
||||
(collaborator) => collaborator.collaborator
|
||||
);
|
||||
|
||||
const collaboratorEmails = $.step.parameters
|
||||
.collaboratorEmails as IJSONArray;
|
||||
const collaboratorEmails = $.step.parameters.collaboratorEmails;
|
||||
const formattedCollaboratorEmails = collaboratorEmails?.map(
|
||||
(collaboratorEmail: IJSONObject) => collaboratorEmail.collaboratorEmail
|
||||
(collaboratorEmail) => collaboratorEmail.collaboratorEmail
|
||||
);
|
||||
|
||||
const formattedCollaborators = [
|
||||
@@ -48,17 +42,15 @@ export default defineAction({
|
||||
...formattedCollaboratorEmails,
|
||||
];
|
||||
|
||||
const sharingAgreements = $.step.parameters.sharingAgreements as IJSONArray;
|
||||
const sharingAgreements = $.step.parameters.sharingAgreements;
|
||||
const sharingAgreementIds = sharingAgreements
|
||||
?.filter(isEmpty)
|
||||
.map((sharingAgreement: IJSONObject) =>
|
||||
Number(sharingAgreement.sharingAgreement)
|
||||
);
|
||||
.map((sharingAgreement) => Number(sharingAgreement.sharingAgreement));
|
||||
|
||||
const tags = $.step.parameters.tags as string;
|
||||
const tags = $.step.parameters.tags;
|
||||
const formattedTags = tags.split(',');
|
||||
|
||||
const payload: Payload = {
|
||||
const payload = {
|
||||
ticket: {
|
||||
subject,
|
||||
assignee_id: assigneeId,
|
||||
@@ -2,7 +2,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Name',
|
||||
key: 'name',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
variables: true,
|
||||
description: '',
|
||||
@@ -10,7 +10,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Email',
|
||||
key: 'email',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
variables: true,
|
||||
description:
|
||||
@@ -19,7 +19,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Details',
|
||||
key: 'details',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: '',
|
||||
@@ -27,7 +27,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Notes',
|
||||
key: 'notes',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
description:
|
||||
@@ -36,7 +36,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Phone',
|
||||
key: 'phone',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
description:
|
||||
@@ -45,7 +45,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Tags',
|
||||
key: 'tags',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: 'A comma separated list of tags.',
|
||||
@@ -53,7 +53,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Role',
|
||||
key: 'role',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
description:
|
||||
@@ -62,7 +62,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Organization',
|
||||
key: 'organizationId',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: 'Assign this user to a specific organization.',
|
||||
@@ -80,7 +80,7 @@ export const fields = [
|
||||
{
|
||||
label: 'External Id',
|
||||
key: 'externalId',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
description:
|
||||
@@ -89,7 +89,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Verified',
|
||||
key: 'verified',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: false,
|
||||
description:
|
||||
"Specify if you can verify that the user's assertion of their identity is accurate.",
|
||||
@@ -1,10 +1,5 @@
|
||||
import { IJSONObject } from '@automatisch/types';
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
import { fields } from './fields';
|
||||
|
||||
type Payload = {
|
||||
user: IJSONObject;
|
||||
};
|
||||
import defineAction from '../../../../helpers/define-action.js';
|
||||
import { fields } from './fields.js';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Create user',
|
||||
@@ -25,10 +20,10 @@ export default defineAction({
|
||||
verified,
|
||||
} = $.step.parameters;
|
||||
|
||||
const tags = $.step.parameters.tags as string;
|
||||
const tags = $.step.parameters.tags;
|
||||
const formattedTags = tags.split(',');
|
||||
|
||||
const payload: Payload = {
|
||||
const payload = {
|
||||
user: {
|
||||
name,
|
||||
email,
|
||||
@@ -1,4 +1,4 @@
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
import defineAction from '../../../../helpers/define-action.js';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Delete ticket',
|
||||
@@ -8,7 +8,7 @@ export default defineAction({
|
||||
{
|
||||
label: 'Ticket',
|
||||
key: 'ticketId',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
variables: true,
|
||||
description: 'Select the ticket you want to delete.',
|
||||
@@ -1,4 +1,4 @@
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
import defineAction from '../../../../helpers/define-action.js';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Delete user',
|
||||
@@ -8,7 +8,7 @@ export default defineAction({
|
||||
{
|
||||
label: 'User',
|
||||
key: 'userId',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
variables: true,
|
||||
description: 'Select the user you want to modify.',
|
||||
@@ -1,4 +1,4 @@
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
import defineAction from '../../../../helpers/define-action.js';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Find ticket',
|
||||
@@ -8,7 +8,7 @@ export default defineAction({
|
||||
{
|
||||
label: 'Query',
|
||||
key: 'query',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: true,
|
||||
variables: true,
|
||||
description:
|
||||
15
packages/backend/src/apps/zendesk/actions/index.js
Normal file
15
packages/backend/src/apps/zendesk/actions/index.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import createTicket from './create-ticket/index.js';
|
||||
import createUser from './create-user/index.js';
|
||||
import deleteTicket from './delete-ticket/index.js';
|
||||
import deleteUser from './delete-user/index.js';
|
||||
import findTicket from './find-ticket/index.js';
|
||||
import updateTicket from './update-ticket/index.js';
|
||||
|
||||
export default [
|
||||
createTicket,
|
||||
createUser,
|
||||
deleteTicket,
|
||||
deleteUser,
|
||||
findTicket,
|
||||
updateTicket,
|
||||
];
|
||||
@@ -1,15 +0,0 @@
|
||||
import createTicket from './create-ticket';
|
||||
import createUser from './create-user';
|
||||
import deleteTicket from './delete-ticket';
|
||||
import deleteUser from './delete-user';
|
||||
import findTicket from './find-ticket';
|
||||
import updateTicket from './update-ticket';
|
||||
|
||||
export default [
|
||||
createTicket,
|
||||
createUser,
|
||||
deleteTicket,
|
||||
deleteUser,
|
||||
findTicket,
|
||||
updateTicket,
|
||||
];
|
||||
@@ -2,7 +2,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Ticket',
|
||||
key: 'ticketId',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: true,
|
||||
variables: true,
|
||||
description: 'Select the ticket you want to change.',
|
||||
@@ -20,7 +20,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Subject',
|
||||
key: 'subject',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: '',
|
||||
@@ -28,7 +28,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Assignee',
|
||||
key: 'assigneeId',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: false,
|
||||
variables: true,
|
||||
description:
|
||||
@@ -55,7 +55,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Group',
|
||||
key: 'groupId',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: 'Allocate this ticket to a specific group.',
|
||||
@@ -73,7 +73,7 @@ export const fields = [
|
||||
{
|
||||
label: 'New Status',
|
||||
key: 'status',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: '',
|
||||
@@ -89,7 +89,7 @@ export const fields = [
|
||||
{
|
||||
label: 'New comment to add to the ticket',
|
||||
key: 'comment',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: '',
|
||||
@@ -97,7 +97,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Should the first comment be public?',
|
||||
key: 'publicOrNot',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: '',
|
||||
@@ -109,7 +109,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Tags',
|
||||
key: 'tags',
|
||||
type: 'string' as const,
|
||||
type: 'string',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: 'A comma separated list of tags.',
|
||||
@@ -117,7 +117,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Type',
|
||||
key: 'type',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: '',
|
||||
@@ -131,7 +131,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Priority',
|
||||
key: 'priority',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: '',
|
||||
@@ -145,7 +145,7 @@ export const fields = [
|
||||
{
|
||||
label: 'Submitter',
|
||||
key: 'submitterId',
|
||||
type: 'dropdown' as const,
|
||||
type: 'dropdown',
|
||||
required: false,
|
||||
variables: true,
|
||||
description: '',
|
||||
@@ -1,7 +1,7 @@
|
||||
import defineAction from '../../../../helpers/define-action';
|
||||
import { fields } from './fields';
|
||||
import isEmpty from 'lodash/isEmpty';
|
||||
import omitBy from 'lodash/omitBy';
|
||||
import defineAction from '../../../../helpers/define-action.js';
|
||||
import { fields } from './fields.js';
|
||||
import isEmpty from 'lodash/isEmpty.js';
|
||||
import omitBy from 'lodash/omitBy.js';
|
||||
|
||||
export default defineAction({
|
||||
name: 'Update ticket',
|
||||
@@ -23,7 +23,7 @@ export default defineAction({
|
||||
submitterId,
|
||||
} = $.step.parameters;
|
||||
|
||||
const tags = $.step.parameters.tags as string;
|
||||
const tags = $.step.parameters.tags;
|
||||
const formattedTags = tags.split(',');
|
||||
|
||||
const payload = {
|
||||
Reference in New Issue
Block a user