Skip to content

Commit 87b1e63

Browse files
committed
[Components] demandbase - new components
1 parent b4fb1d8 commit 87b1e63

File tree

10 files changed

+2613
-14
lines changed

10 files changed

+2613
-14
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,291 @@
1+
import app from "../../demandbase.app.mjs";
2+
import utils from "../../common/utils.mjs";
3+
import agents from "../../common/agents.mjs";
4+
import states from "../../common/states.mjs";
5+
6+
export default {
7+
key: "demandbase-company-lookup",
8+
name: "Company Lookup",
9+
description: "Build a list of company names along with company ID, city, state and country using rich filters.. [See the documentation](https://kb.demandbase.com/hc/en-us/articles/7273850579227--POST-Company-Lookup).",
10+
version: "0.0.1",
11+
type: "action",
12+
props: {
13+
app,
14+
agents: {
15+
type: "string[]",
16+
label: "Agents",
17+
description: "The agent IDs.",
18+
optional: true,
19+
options: Object.values(agents),
20+
},
21+
areaCodes: {
22+
type: "string[]",
23+
label: "Area Codes",
24+
description: "List of area codes.",
25+
optional: true,
26+
},
27+
businessTypes: {
28+
type: "string[]",
29+
label: "Business Types",
30+
description: "List of business types.",
31+
optional: true,
32+
options: [
33+
"public",
34+
"private",
35+
"school",
36+
"government",
37+
"organization",
38+
],
39+
},
40+
cities: {
41+
type: "string[]",
42+
label: "Cities",
43+
description: "List of cities.",
44+
optional: true,
45+
},
46+
companyStatus: {
47+
type: "string[]",
48+
label: "Company Status",
49+
description: "List of company statuses.",
50+
optional: true,
51+
options: [
52+
"operating",
53+
"subsidiary",
54+
"acquired",
55+
],
56+
},
57+
countries: {
58+
type: "string[]",
59+
label: "Countries",
60+
description: "List of country IDs.",
61+
propDefinition: [
62+
app,
63+
"countryId",
64+
],
65+
},
66+
fiscalYearEnd: {
67+
type: "string",
68+
label: "Fiscal Year End",
69+
description: "The fiscal year end. Eg. `january`.",
70+
optional: true,
71+
},
72+
fortuneRanking: {
73+
type: "string",
74+
label: "Fortune Ranking",
75+
description: "The fortune ranking.",
76+
optional: true,
77+
options: [
78+
"fortune500",
79+
"fortune1000",
80+
],
81+
},
82+
industries: {
83+
propDefinition: [
84+
app,
85+
"industries",
86+
],
87+
},
88+
subIndustries: {
89+
label: "Sub Industries",
90+
description: "List of sub industry IDs.",
91+
propDefinition: [
92+
app,
93+
"industries",
94+
({ industries: industryIds }) => ({
95+
listSubindustries: true,
96+
industryIds,
97+
}),
98+
],
99+
},
100+
keywords: {
101+
type: "string",
102+
label: "Keywords",
103+
description: "Keywords.",
104+
optional: true,
105+
},
106+
companyName: {
107+
type: "string",
108+
label: "Company Name",
109+
description: "Name of the company.",
110+
optional: true,
111+
},
112+
minEmployees: {
113+
type: "integer",
114+
label: "Min Employees",
115+
description: "Minimum number of employees.",
116+
optional: true,
117+
},
118+
maxEmployees: {
119+
type: "integer",
120+
label: "Max Employees",
121+
description: "Maximum number of employees.",
122+
optional: true,
123+
},
124+
minRevenue: {
125+
type: "integer",
126+
label: "Min Revenue",
127+
description: "Minimum revenue (Millions of $).",
128+
optional: true,
129+
},
130+
maxRevenue: {
131+
type: "integer",
132+
label: "Max Revenue",
133+
description: "Maximum revenue (Millions of $).",
134+
optional: true,
135+
},
136+
categoryIds: {
137+
propDefinition: [
138+
app,
139+
"categoryIds",
140+
],
141+
},
142+
hasPhone: {
143+
type: "boolean",
144+
label: "Has Phone",
145+
description: "View companies with a phone number.",
146+
optional: true,
147+
},
148+
regions: {
149+
type: "string[]",
150+
label: "Regions",
151+
description: "List of regions.",
152+
optional: true,
153+
options: [
154+
"Africa",
155+
"Asia",
156+
"Europe",
157+
"MiddleEast",
158+
"NorthAmerica",
159+
"Oceania",
160+
"SouthAmerica",
161+
],
162+
},
163+
street: {
164+
type: "string",
165+
label: "Street",
166+
description: "Street name.",
167+
optional: true,
168+
},
169+
state: {
170+
type: "string[]",
171+
label: "States",
172+
description: "List of state IDs.",
173+
optional: true,
174+
options: states,
175+
},
176+
zipCodes: {
177+
type: "string[]",
178+
label: "Zip Codes",
179+
description: "List of zip codes.",
180+
optional: true,
181+
},
182+
businessStructure: {
183+
type: "string",
184+
label: "Business Structure",
185+
description: "Business structure.",
186+
optional: true,
187+
options: [
188+
"globalParent",
189+
"uncategorized",
190+
"subsidiary",
191+
"group",
192+
"independent",
193+
],
194+
},
195+
sortBy: {
196+
type: "string",
197+
label: "Sort By",
198+
description: "Attributes used to sort the list of results.",
199+
optional: true,
200+
options: [
201+
"popularity",
202+
"revenue",
203+
"employee_count",
204+
"businessType",
205+
"location",
206+
],
207+
},
208+
sortOrder: {
209+
type: "string",
210+
label: "Sort Order",
211+
description: "Sort order.",
212+
optional: true,
213+
options: [
214+
"asc",
215+
"desc",
216+
],
217+
},
218+
},
219+
methods: {
220+
companyLookup(args = {}) {
221+
return this.app.post({
222+
path: "/target/company/lookup",
223+
...args,
224+
});
225+
},
226+
},
227+
async run({ $ }) {
228+
const {
229+
companyLookup,
230+
agents,
231+
areaCodes,
232+
businessTypes,
233+
cities,
234+
companyStatus,
235+
countries,
236+
fiscalYearEnd,
237+
fortuneRanking,
238+
industries,
239+
subIndustries,
240+
keywords,
241+
companyName,
242+
minEmployees,
243+
maxEmployees,
244+
minRevenue,
245+
maxRevenue,
246+
categoryIds,
247+
hasPhone,
248+
regions,
249+
street,
250+
state,
251+
zipCodes,
252+
sortBy,
253+
sortOrder,
254+
} = this;
255+
256+
const response = await companyLookup({
257+
$,
258+
headers: {
259+
"Content-Type": "application/x-www-form-urlencoded",
260+
},
261+
data: utils.getUrlEncodedData({
262+
agents,
263+
areaCodes,
264+
businessTypes,
265+
cities,
266+
companyStatus,
267+
countries,
268+
fiscalYearEnd,
269+
fortuneRanking,
270+
industries,
271+
subIndustries,
272+
keywords,
273+
companyName,
274+
minEmployees,
275+
maxEmployees,
276+
minRevenue,
277+
maxRevenue,
278+
categoryIds,
279+
hasPhone,
280+
regions,
281+
street,
282+
state,
283+
zipCodes,
284+
sortBy,
285+
sortOrder,
286+
}),
287+
});
288+
$.export("$summary", "Successfully built company list.");
289+
return response;
290+
},
291+
};

0 commit comments

Comments
 (0)