Skip to content

Commit b598626

Browse files
authored
New Components - bloomerang (#16105)
* bloomerang init * [Components] bloomerang #16081 Sources - New Donation - New Constituent - New Interaction Actions - Create Donation - Create Constituent - Add Interaction * pnpm update * some adjusts * pnpm update * remove console.log * pnpm update
1 parent 0d5fd08 commit b598626

File tree

28 files changed

+1445
-31
lines changed

28 files changed

+1445
-31
lines changed

components/adyntel/adyntel.app.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export default {
88
console.log(Object.keys(this.$auth));
99
},
1010
},
11-
};
11+
};

components/agentset/agentset.app.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ export default {
88
console.log(Object.keys(this.$auth));
99
},
1010
},
11-
};
11+
};
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import bloomerang from "../../bloomerang.app.mjs";
2+
import {
3+
CHANNEL_OPTIONS, PURPOSE_OPTIONS,
4+
} from "../../common/constants.mjs";
5+
6+
export default {
7+
key: "bloomerang-add-interaction",
8+
name: "Add Interaction",
9+
description: "Adds an interaction to an existing constituent in Bloomerang. [See the documentation](https://bloomerang.co/product/integrations-data-management/api/rest-api/#/Interactions/post_interaction)",
10+
version: "0.0.1",
11+
type: "action",
12+
props: {
13+
bloomerang,
14+
constituentId: {
15+
propDefinition: [
16+
bloomerang,
17+
"constituentId",
18+
],
19+
},
20+
date: {
21+
type: "string",
22+
label: "Date",
23+
description: "The date of the interaction",
24+
},
25+
subject: {
26+
type: "string",
27+
label: "Subject",
28+
description: "The subject od the interation",
29+
},
30+
channel: {
31+
type: "string",
32+
label: "Channel",
33+
description: "The channel of the interation",
34+
options: CHANNEL_OPTIONS,
35+
},
36+
purpose: {
37+
type: "string",
38+
label: "Purpose",
39+
description: "The purpose of the interation",
40+
options: PURPOSE_OPTIONS,
41+
},
42+
note: {
43+
type: "string",
44+
label: "Note",
45+
description: "Note for the interaction",
46+
optional: true,
47+
},
48+
isInbound: {
49+
type: "boolean",
50+
label: "Is Inbound",
51+
description: "Was the interaction initiated by constituent?",
52+
optional: true,
53+
},
54+
},
55+
async run({ $ }) {
56+
const response = await this.bloomerang.createInteraction({
57+
$,
58+
data: {
59+
AccountId: this.constituentId,
60+
Date: this.date,
61+
Subject: this.subject,
62+
Channel: this.channel,
63+
Purpose: this.purpose,
64+
note: this.note,
65+
IsInbound: this.isInbound,
66+
},
67+
});
68+
69+
$.export("$summary", `Successfully added interaction with ID ${response.Id}`);
70+
return response;
71+
},
72+
};
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
import bloomerang from "../../bloomerang.app.mjs";
2+
import {
3+
COMMUNICATION_CHANNEL_OPTIONS,
4+
CONSTITUENT_GENDER_OPTIONS,
5+
CONSTITUENT_PREFIX_OPTIONS,
6+
CONSTITUENT_STATUS_OPTIONS,
7+
CONSTITUENT_SUFFIX_OPTIONS,
8+
CONSTITUENT_TYPE_OPTIONS,
9+
} from "../../common/constants.mjs";
10+
11+
export default {
12+
key: "bloomerang-create-constituent",
13+
name: "Create Constituent",
14+
description: "Creates a new constituent in Bloomerang. [See the documentation](https://bloomerang.co/product/integrations-data-management/api/rest-api/#/Constituents/post_constituent)",
15+
version: "0.0.1",
16+
type: "action",
17+
props: {
18+
bloomerang,
19+
type: {
20+
type: "string",
21+
label: "Constituent Type",
22+
description: "Filter constituents by type",
23+
options: CONSTITUENT_TYPE_OPTIONS,
24+
reloadProps: true,
25+
},
26+
status: {
27+
type: "string",
28+
label: "Status",
29+
description: "The status of the constituent",
30+
options: CONSTITUENT_STATUS_OPTIONS,
31+
optional: true,
32+
},
33+
fullName: {
34+
type: "string",
35+
label: "Organization Name",
36+
description: "The organization's name of the constituent",
37+
hidden: true,
38+
},
39+
firstName: {
40+
type: "string",
41+
label: "First Name",
42+
description: "The first name of the constituent",
43+
hidden: true,
44+
},
45+
lastName: {
46+
type: "string",
47+
label: "Last Name",
48+
description: "The last name of the constituent",
49+
hidden: true,
50+
},
51+
middleName: {
52+
type: "string",
53+
label: "Middle Name",
54+
description: "The middle name of the constituent",
55+
optional: true,
56+
},
57+
prefix: {
58+
type: "string",
59+
label: "Title",
60+
description: "The prefix of the constituent",
61+
options: CONSTITUENT_PREFIX_OPTIONS,
62+
optional: true,
63+
},
64+
suffix: {
65+
type: "string",
66+
label: "Suffix",
67+
description: "The suffix of the constituent",
68+
options: CONSTITUENT_SUFFIX_OPTIONS,
69+
optional: true,
70+
},
71+
jobTitle: {
72+
type: "string",
73+
label: "Job Title",
74+
description: "The job title of the constituent",
75+
optional: true,
76+
},
77+
gender: {
78+
type: "string",
79+
label: "Gender",
80+
description: "The gender of the constituent",
81+
options: CONSTITUENT_GENDER_OPTIONS,
82+
optional: true,
83+
},
84+
birthdate: {
85+
type: "string",
86+
label: "Birthdate",
87+
description: "The birth date of the constituent",
88+
optional: true,
89+
},
90+
employer: {
91+
type: "string",
92+
label: "Employer",
93+
description: "The employer of the constituent",
94+
optional: true,
95+
},
96+
website: {
97+
type: "string",
98+
label: "Website",
99+
description: "An website of the constituent",
100+
optional: true,
101+
},
102+
facebookId: {
103+
type: "string",
104+
label: "Facebook",
105+
description: "The constituent's facebook page",
106+
optional: true,
107+
},
108+
twitterId: {
109+
type: "string",
110+
label: "Twitter ID",
111+
description: "The constituent's twitter ID",
112+
optional: true,
113+
},
114+
linkedInId: {
115+
type: "string",
116+
label: "LinkedIn",
117+
description: "The constituent's linkedIn page",
118+
optional: true,
119+
},
120+
preferredCommunicationChannel: {
121+
type: "string",
122+
label: "Preferred Communication Channel",
123+
description: "The preferred comunication channel of the constituent",
124+
options: COMMUNICATION_CHANNEL_OPTIONS,
125+
optional: true,
126+
},
127+
},
128+
async additionalProps(props) {
129+
const isIndividual = this.type === "Individual";
130+
props.firstName.hidden = !isIndividual;
131+
props.lastName.hidden = !isIndividual;
132+
props.fullName.hidden = isIndividual;
133+
return {};
134+
},
135+
async run({ $ }) {
136+
const data = {
137+
Type: this.type,
138+
Status: this.status,
139+
Prefix: this.prefix,
140+
Suffix: this.suffix,
141+
JobTitle: this.jobTitle,
142+
Gender: this.gender,
143+
Birthdate: this.birthdate,
144+
Employer: this.employer,
145+
Website: this.website,
146+
FacebookId: this.facebookId,
147+
TwitterId: this.twitterId,
148+
LinkedInId: this.linkedInId,
149+
PreferredCommunicationChannel: this.preferredCommunicationChannel,
150+
};
151+
if (this.type === "Individual") {
152+
data.FirstName = this.firstName;
153+
data.LastName = this.lastName;
154+
data.MiddleName = this.middleName;
155+
} else {
156+
data.FullName = this.fullName;
157+
}
158+
159+
const response = await this.bloomerang.createConstituent({
160+
$,
161+
data,
162+
});
163+
164+
$.export("$summary", `Successfully created constituent with ID ${response.Id}`);
165+
return response;
166+
},
167+
};
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
import bloomerang from "../../bloomerang.app.mjs";
2+
import { PAYMENT_METHOD_OPTIONS } from "../../common/constants.mjs";
3+
4+
export default {
5+
key: "bloomerang-create-donation",
6+
name: "Create Donation",
7+
description: "Creates a new donation record in Bloomerang. [See the documentation](https://bloomerang.co/product/integrations-data-management/api/rest-api/)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
bloomerang,
12+
constituentId: {
13+
propDefinition: [
14+
bloomerang,
15+
"constituentId",
16+
],
17+
},
18+
date: {
19+
type: "string",
20+
label: "Date",
21+
description: "The date of the donation",
22+
},
23+
amount: {
24+
type: "string",
25+
label: "Amount",
26+
description: "The amount for the donation",
27+
},
28+
fundId: {
29+
propDefinition: [
30+
bloomerang,
31+
"fundId",
32+
],
33+
},
34+
paymentMethod: {
35+
type: "string",
36+
label: "Payment Method",
37+
description: "The method of payment",
38+
options: PAYMENT_METHOD_OPTIONS,
39+
},
40+
campaignId: {
41+
propDefinition: [
42+
bloomerang,
43+
"campaignId",
44+
],
45+
optional: true,
46+
},
47+
appealId: {
48+
propDefinition: [
49+
bloomerang,
50+
"appealId",
51+
],
52+
optional: true,
53+
},
54+
note: {
55+
type: "string",
56+
label: "Note",
57+
description: "A note for the donation",
58+
optional: true,
59+
},
60+
},
61+
async run({ $ }) {
62+
const response = await this.bloomerang.createDonation({
63+
$,
64+
data: {
65+
AccountId: this.constituentId,
66+
Date: this.date,
67+
Amount: this.amount,
68+
Method: this.paymentMethod,
69+
Designations: [
70+
{
71+
FundId: this.fundId,
72+
Amount: this.amount,
73+
Type: "Donation",
74+
CampaignId: this.campaignId,
75+
AppealId: this.appealId,
76+
Note: this.note,
77+
},
78+
],
79+
},
80+
});
81+
82+
$.export("$summary", `Successfully created donation with ID: ${response.Id}`);
83+
return response;
84+
},
85+
};

0 commit comments

Comments
 (0)