Skip to content

Commit a767494

Browse files
committed
new components
1 parent 89b584b commit a767494

File tree

11 files changed

+591
-29
lines changed

11 files changed

+591
-29
lines changed

components/teamleader_focus/actions/create-contact/create-contact.mjs

Lines changed: 63 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,88 @@ export default {
44
key: "teamleader_focus-create-contact",
55
name: "Create Contact",
66
description: "Add a new contact. [See the documentation](https://developer.teamleader.eu/#/reference/crm/contacts/contacts.add)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
type: "action",
99
props: {
1010
teamleaderFocus,
1111
firstName: {
12-
type: "string",
13-
label: "First Name",
14-
description: "First name of the new contact",
15-
optional: true,
12+
propDefinition: [
13+
teamleaderFocus,
14+
"firstName",
15+
],
1616
},
1717
lastName: {
18-
type: "string",
19-
label: "Last Name",
20-
description: "Last name of the new contact",
18+
propDefinition: [
19+
teamleaderFocus,
20+
"lastName",
21+
],
2122
},
2223
email: {
23-
type: "string",
24-
label: "Email",
25-
description: "Email address of the new contact",
26-
optional: true,
24+
propDefinition: [
25+
teamleaderFocus,
26+
"email",
27+
],
2728
},
2829
website: {
29-
type: "string",
30-
label: "Website",
31-
description: "Website of the new contact",
32-
optional: true,
30+
propDefinition: [
31+
teamleaderFocus,
32+
"website",
33+
],
3334
},
3435
phone: {
35-
type: "string",
36-
label: "Phone",
37-
description: "Phone number of the new contact",
38-
optional: true,
36+
propDefinition: [
37+
teamleaderFocus,
38+
"phone",
39+
],
40+
},
41+
iban: {
42+
propDefinition: [
43+
teamleaderFocus,
44+
"iban",
45+
],
46+
},
47+
bic: {
48+
propDefinition: [
49+
teamleaderFocus,
50+
"bic",
51+
],
52+
},
53+
language: {
54+
propDefinition: [
55+
teamleaderFocus,
56+
"language",
57+
],
58+
},
59+
remarks: {
60+
propDefinition: [
61+
teamleaderFocus,
62+
"remarks",
63+
],
64+
},
65+
tags: {
66+
propDefinition: [
67+
teamleaderFocus,
68+
"tags",
69+
],
70+
},
71+
marketingMailsConsent: {
72+
propDefinition: [
73+
teamleaderFocus,
74+
"marketingMailsConsent",
75+
],
3976
},
4077
},
4178
async run({ $ }) {
4279
const data = {
4380
first_name: this.firstName,
4481
last_name: this.lastName,
4582
website: this.website,
83+
iban: this.iban,
84+
bic: this.bic,
85+
language: this.language,
86+
remarks: this.remarks,
87+
tags: this.tags,
88+
marketing_mails_consent: this.marketingMailsConsent,
4689
};
4790
if (this.email) {
4891
data.emails = [

components/teamleader_focus/actions/create-deal/create-deal.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "teamleader_focus-create-deal",
66
name: "Create Deal",
77
description: "Add a new deal. [See the documentation](https://developer.teamleader.eu/#/reference/deals/deals/deals.create)",
8-
version: "0.1.0",
8+
version: "0.1.1",
99
type: "action",
1010
props: {
1111
teamleaderFocus,
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
import teamleaderFocus from "../../teamleader_focus.app.mjs";
2+
import constants from "../../common/constants.mjs";
3+
4+
export default {
5+
key: "teamleader_focus-update-company",
6+
name: "Update Company",
7+
description: "Update a company. [See the documentation](https://developer.focus.teamleader.eu/docs/api/companies-update)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
teamleaderFocus,
12+
companyId: {
13+
propDefinition: [
14+
teamleaderFocus,
15+
"company",
16+
],
17+
},
18+
name: {
19+
type: "string",
20+
label: "Name",
21+
description: "Name of the company",
22+
optional: true,
23+
},
24+
email: {
25+
type: "string",
26+
label: "Email",
27+
description: "Email of the company",
28+
optional: true,
29+
},
30+
phone: {
31+
type: "string",
32+
label: "Phone",
33+
description: "Phone number of the company",
34+
optional: true,
35+
},
36+
website: {
37+
type: "string",
38+
label: "Website",
39+
description: "Website of the company",
40+
optional: true,
41+
},
42+
businessTypeId: {
43+
propDefinition: [
44+
teamleaderFocus,
45+
"businessType",
46+
],
47+
},
48+
vatNumber: {
49+
type: "string",
50+
label: "VAT Number",
51+
description: "VAT number of the company",
52+
optional: true,
53+
},
54+
nationalIdentificationNumber: {
55+
type: "string",
56+
label: "National Identification Number",
57+
description: "National identification number of the company",
58+
optional: true,
59+
},
60+
iban: {
61+
type: "string",
62+
label: "IBAN",
63+
description: "IBAN of the company",
64+
optional: true,
65+
},
66+
bic: {
67+
type: "string",
68+
label: "BIC",
69+
description: "BIC of the company",
70+
optional: true,
71+
},
72+
language: {
73+
type: "string",
74+
label: "Language",
75+
description: "Language of the company. Example: `en`",
76+
optional: true,
77+
},
78+
responsibleUserId: {
79+
propDefinition: [
80+
teamleaderFocus,
81+
"user",
82+
],
83+
label: "Responsible User ID",
84+
description: "ID of the user responsible for the company",
85+
optional: true,
86+
},
87+
remarks: {
88+
type: "string",
89+
label: "Remarks",
90+
description: "Remarks about the company",
91+
optional: true,
92+
},
93+
tags: {
94+
type: "string[]",
95+
label: "Tags",
96+
description: "Tags of the company. Note: This will overwrite existing tags.",
97+
optional: true,
98+
},
99+
marketingMailsConsent: {
100+
type: "boolean",
101+
label: "Marketing Mails Consent",
102+
description: "Whether the company has consented to receive marketing emails",
103+
optional: true,
104+
},
105+
preferredCurrency: {
106+
type: "string",
107+
label: "Preferred Currency",
108+
description: "Preferred currency of the company",
109+
optional: true,
110+
options: constants.CURRENCY_CODES,
111+
},
112+
},
113+
async run({ $ }) {
114+
const data = {
115+
id: this.companyId,
116+
name: this.name,
117+
business_type_id: this.businessTypeId,
118+
vat_number: this.vatNumber,
119+
national_identification_number: this.nationalIdentificationNumber,
120+
iban: this.iban,
121+
bic: this.bic,
122+
language: this.language,
123+
responsible_user_id: this.responsibleUserId,
124+
remarks: this.remarks,
125+
tags: this.tags,
126+
marketing_mails_consent: this.marketingMailsConsent,
127+
preferred_currency: this.preferredCurrency,
128+
};
129+
130+
if (this.email) {
131+
data.emails = [
132+
{
133+
type: "primary",
134+
email: this.email,
135+
},
136+
];
137+
}
138+
if (this.phone) {
139+
data.telephones = [
140+
{
141+
type: "phone",
142+
number: this.phone,
143+
},
144+
];
145+
}
146+
147+
const response = await this.teamleaderFocus.updateCompany({
148+
data,
149+
$,
150+
});
151+
152+
$.export("$summary", `Successfully updated company with ID ${this.companyId}`);
153+
154+
return response;
155+
},
156+
};

0 commit comments

Comments
 (0)