feat: Convert all app files to JS

This commit is contained in:
Faruk AYDIN
2024-01-05 17:44:21 +01:00
parent b95478b635
commit 43dba351c3
1030 changed files with 5114 additions and 6436 deletions

View File

@@ -1,9 +1,5 @@
import defineAction from '../../../../helpers/define-action';
import { filterProvidedFields } from '../../common/filter-provided-fields';
type LabelIds = { __id: string; leadLabelId: string }[];
type LabelValue = { amount?: number; currency?: string };
import defineAction from '../../../../helpers/define-action.js';
import { filterProvidedFields } from '../../common/filter-provided-fields.js';
export default defineAction({
name: 'Create lead',
@@ -13,7 +9,7 @@ export default defineAction({
{
label: 'Title',
key: 'title',
type: 'string' as const,
type: 'string',
required: true,
description: '',
variables: true,
@@ -21,7 +17,7 @@ export default defineAction({
{
label: 'Person',
key: 'personId',
type: 'dropdown' as const,
type: 'dropdown',
required: false,
description:
'Lead must be associated with at least one person or organization.',
@@ -40,7 +36,7 @@ export default defineAction({
{
label: 'Organization',
key: 'organizationId',
type: 'dropdown' as const,
type: 'dropdown',
required: false,
description:
'Lead must be associated with at least one person or organization.',
@@ -59,7 +55,7 @@ export default defineAction({
{
label: 'Owner',
key: 'ownerId',
type: 'dropdown' as const,
type: 'dropdown',
required: false,
description:
'Select user who will be marked as the owner of this lead. If omitted, the authorized user will be used.',
@@ -78,14 +74,14 @@ export default defineAction({
{
label: 'Lead Labels',
key: 'labelIds',
type: 'dynamic' as const,
type: 'dynamic',
required: false,
description: '',
fields: [
{
label: 'Label',
key: 'leadLabelId',
type: 'dropdown' as const,
type: 'dropdown',
required: false,
variables: true,
source: {
@@ -104,7 +100,7 @@ export default defineAction({
{
label: 'Expected Close Date',
key: 'expectedCloseDate',
type: 'string' as const,
type: 'string',
required: false,
description: 'E.g. 2023-10-23',
variables: true,
@@ -112,7 +108,7 @@ export default defineAction({
{
label: 'Lead Value',
key: 'value',
type: 'string' as const,
type: 'string',
required: false,
description: 'E.g. 150',
variables: true,
@@ -120,7 +116,7 @@ export default defineAction({
{
label: 'Lead Value Currency',
key: 'currency',
type: 'dropdown' as const,
type: 'dropdown',
required: false,
description: 'This field is required if a Lead Value amount is provided.',
variables: true,
@@ -149,25 +145,25 @@ export default defineAction({
currency,
} = $.step.parameters;
const onlyLabelIds = (labelIds as LabelIds)
const onlyLabelIds = labelIds
.map((labelId) => labelId.leadLabelId)
.filter(Boolean);
const labelValue: LabelValue = {};
const labelValue = {};
if (value) {
labelValue.amount = Number(value);
}
if (currency) {
labelValue.currency = currency as string;
labelValue.currency = currency;
}
const fields = {
title: title as string,
title: title,
person_id: Number(personId),
organization_id: Number(organizationId),
owner_id: Number(ownerId),
expected_close_date: expectedCloseDate as string,
expected_close_date: expectedCloseDate,
label_ids: onlyLabelIds,
value: labelValue,
};