-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New Components - bloomerang #16105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
New Components - bloomerang #16105
Changes from 6 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d9f205f
bloomerang init
luancazarine 9a2c399
[Components] bloomerang #16081
luancazarine cb74c02
pnpm update
luancazarine 10d5968
Merge branch 'master' into issue-16081
luancazarine 9e5561b
some adjusts
luancazarine ebf4f07
pnpm update
luancazarine 657e5c1
remove console.log
luancazarine e7678c6
Merge branch 'master' into issue-16081
luancazarine 6a24324
pnpm update
luancazarine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
components/bloomerang/actions/add-interaction/add-interaction.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import bloomerang from "../../bloomerang.app.mjs"; | ||
import { | ||
CHANNEL_OPTIONS, PURPOSE_OPTIONS, | ||
} from "../../common/constants.mjs"; | ||
|
||
export default { | ||
key: "bloomerang-add-interaction", | ||
name: "Add Interaction", | ||
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)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
bloomerang, | ||
constituentId: { | ||
propDefinition: [ | ||
bloomerang, | ||
"constituentId", | ||
], | ||
}, | ||
date: { | ||
type: "string", | ||
label: "Date", | ||
description: "The date of the interaction", | ||
}, | ||
subject: { | ||
type: "string", | ||
label: "Subject", | ||
description: "The subject od the interation", | ||
}, | ||
channel: { | ||
type: "string", | ||
label: "Channel", | ||
description: "The channel of the interation", | ||
options: CHANNEL_OPTIONS, | ||
}, | ||
purpose: { | ||
type: "string", | ||
label: "Purpose", | ||
description: "The purpose of the interation", | ||
options: PURPOSE_OPTIONS, | ||
}, | ||
note: { | ||
type: "string", | ||
label: "Note", | ||
description: "Note for the interaction", | ||
optional: true, | ||
}, | ||
isInbound: { | ||
type: "boolean", | ||
label: "Is Inbound", | ||
description: "Was the interaction initiated by constituent?", | ||
optional: true, | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.bloomerang.createInteraction({ | ||
$, | ||
data: { | ||
AccountId: this.constituentId, | ||
Date: this.date, | ||
Subject: this.subject, | ||
Channel: this.channel, | ||
Purpose: this.purpose, | ||
note: this.note, | ||
IsInbound: this.isInbound, | ||
}, | ||
}); | ||
|
||
$.export("$summary", `Successfully added interaction with ID ${response.Id}`); | ||
return response; | ||
}, | ||
}; |
167 changes: 167 additions & 0 deletions
167
components/bloomerang/actions/create-constituent/create-constituent.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
import bloomerang from "../../bloomerang.app.mjs"; | ||
import { | ||
COMMUNICATION_CHANNEL_OPTIONS, | ||
CONSTITUENT_GENDER_OPTIONS, | ||
CONSTITUENT_PREFIX_OPTIONS, | ||
CONSTITUENT_STATUS_OPTIONS, | ||
CONSTITUENT_SUFFIX_OPTIONS, | ||
CONSTITUENT_TYPE_OPTIONS, | ||
} from "../../common/constants.mjs"; | ||
|
||
export default { | ||
key: "bloomerang-create-constituent", | ||
name: "Create Constituent", | ||
description: "Creates a new constituent in Bloomerang. [See the documentation](https://bloomerang.co/product/integrations-data-management/api/rest-api/#/Constituents/post_constituent)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
bloomerang, | ||
type: { | ||
type: "string", | ||
label: "Constituent Type", | ||
description: "Filter constituents by type", | ||
options: CONSTITUENT_TYPE_OPTIONS, | ||
reloadProps: true, | ||
}, | ||
status: { | ||
type: "string", | ||
label: "Status", | ||
description: "The status of the constituent", | ||
options: CONSTITUENT_STATUS_OPTIONS, | ||
optional: true, | ||
}, | ||
fullName: { | ||
type: "string", | ||
label: "Organization Name", | ||
description: "The organization's name of the constituent", | ||
hidden: true, | ||
}, | ||
firstName: { | ||
type: "string", | ||
label: "First Name", | ||
description: "The first name of the constituent", | ||
hidden: true, | ||
}, | ||
lastName: { | ||
type: "string", | ||
label: "Last Name", | ||
description: "The last name of the constituent", | ||
hidden: true, | ||
}, | ||
middleName: { | ||
type: "string", | ||
label: "Middle Name", | ||
description: "The middle name of the constituent", | ||
optional: true, | ||
}, | ||
prefix: { | ||
type: "string", | ||
label: "Title", | ||
description: "The prefix of the constituent", | ||
options: CONSTITUENT_PREFIX_OPTIONS, | ||
optional: true, | ||
}, | ||
suffix: { | ||
type: "string", | ||
label: "Suffix", | ||
description: "The suffix of the constituent", | ||
options: CONSTITUENT_SUFFIX_OPTIONS, | ||
optional: true, | ||
}, | ||
jobTitle: { | ||
type: "string", | ||
label: "Job Title", | ||
description: "The job title of the constituent", | ||
optional: true, | ||
}, | ||
gender: { | ||
type: "string", | ||
label: "Gender", | ||
description: "The gender of the constituent", | ||
options: CONSTITUENT_GENDER_OPTIONS, | ||
optional: true, | ||
}, | ||
birthdate: { | ||
type: "string", | ||
label: "Birthdate", | ||
description: "The birth date of the constituent", | ||
optional: true, | ||
}, | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
employer: { | ||
type: "string", | ||
label: "Employer", | ||
description: "The employer of the constituent", | ||
optional: true, | ||
}, | ||
website: { | ||
type: "string", | ||
label: "Website", | ||
description: "An website of the constituent", | ||
optional: true, | ||
}, | ||
facebookId: { | ||
type: "string", | ||
label: "Facebook", | ||
description: "The constituent's facebook page", | ||
optional: true, | ||
}, | ||
twitterId: { | ||
type: "string", | ||
label: "Twitter ID", | ||
description: "The constituent's twitter ID", | ||
optional: true, | ||
}, | ||
linkedInId: { | ||
type: "string", | ||
label: "LinkedIn", | ||
description: "The constituent's linkedIn page", | ||
optional: true, | ||
}, | ||
preferredCommunicationChannel: { | ||
type: "string", | ||
label: "Preferred Communication Channel", | ||
description: "The preferred comunication channel of the constituent", | ||
options: COMMUNICATION_CHANNEL_OPTIONS, | ||
optional: true, | ||
}, | ||
}, | ||
async additionalProps(props) { | ||
const isIndividual = this.type === "Individual"; | ||
props.firstName.hidden = !isIndividual; | ||
props.lastName.hidden = !isIndividual; | ||
props.fullName.hidden = isIndividual; | ||
return {}; | ||
}, | ||
async run({ $ }) { | ||
const data = { | ||
Type: this.type, | ||
Status: this.status, | ||
Prefix: this.prefix, | ||
Suffix: this.suffix, | ||
JobTitle: this.jobTitle, | ||
Gender: this.gender, | ||
Birthdate: this.birthdate, | ||
Employer: this.employer, | ||
Website: this.website, | ||
FacebookId: this.facebookId, | ||
TwitterId: this.twitterId, | ||
LinkedInId: this.linkedInId, | ||
PreferredCommunicationChannel: this.preferredCommunicationChannel, | ||
}; | ||
if (this.type === "Individual") { | ||
data.FirstName = this.firstName; | ||
data.LastName = this.lastName; | ||
data.MiddleName = this.middleName; | ||
} else { | ||
data.FullName = this.fullName; | ||
} | ||
|
||
const response = await this.bloomerang.createConstituent({ | ||
$, | ||
data, | ||
}); | ||
|
||
$.export("$summary", `Successfully created constituent with ID ${response.Id}`); | ||
return response; | ||
}, | ||
}; |
85 changes: 85 additions & 0 deletions
85
components/bloomerang/actions/create-donation/create-donation.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import bloomerang from "../../bloomerang.app.mjs"; | ||
import { PAYMENT_METHOD_OPTIONS } from "../../common/constants.mjs"; | ||
|
||
export default { | ||
key: "bloomerang-create-donation", | ||
name: "Create Donation", | ||
description: "Creates a new donation record in Bloomerang. [See the documentation](https://bloomerang.co/product/integrations-data-management/api/rest-api/)", | ||
version: "0.0.1", | ||
type: "action", | ||
props: { | ||
bloomerang, | ||
constituentId: { | ||
propDefinition: [ | ||
bloomerang, | ||
"constituentId", | ||
], | ||
}, | ||
date: { | ||
type: "string", | ||
label: "Date", | ||
description: "The date of the donation", | ||
}, | ||
amount: { | ||
type: "string", | ||
label: "Amount", | ||
description: "The amount for the donation", | ||
}, | ||
fundId: { | ||
propDefinition: [ | ||
bloomerang, | ||
"fundId", | ||
], | ||
}, | ||
paymentMethod: { | ||
type: "string", | ||
label: "Payment Method", | ||
description: "The method of payment", | ||
options: PAYMENT_METHOD_OPTIONS, | ||
}, | ||
campaignId: { | ||
propDefinition: [ | ||
bloomerang, | ||
"campaignId", | ||
], | ||
optional: true, | ||
}, | ||
appealId: { | ||
propDefinition: [ | ||
bloomerang, | ||
"appealId", | ||
], | ||
optional: true, | ||
}, | ||
note: { | ||
type: "string", | ||
label: "Note", | ||
description: "A note for the donation", | ||
optional: true, | ||
}, | ||
}, | ||
async run({ $ }) { | ||
const response = await this.bloomerang.createDonation({ | ||
$, | ||
data: { | ||
AccountId: this.constituentId, | ||
Date: this.date, | ||
Amount: this.amount, | ||
Method: this.paymentMethod, | ||
Designations: [ | ||
{ | ||
FundId: this.fundId, | ||
Amount: this.amount, | ||
Type: "Donation", | ||
CampaignId: this.campaignId, | ||
AppealId: this.appealId, | ||
Note: this.note, | ||
}, | ||
], | ||
}, | ||
}); | ||
|
||
$.export("$summary", `Successfully created donation with ID: ${response.Id}`); | ||
return response; | ||
}, | ||
}; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.