-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - gem #15763
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 - gem #15763
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ceca95f
gem init
luancazarine d9002fb
[Components] gem #15752
luancazarine 4c59ee9
pnpm update
luancazarine c46e779
pnpm update
luancazarine 0a024a5
Merge branch 'master' into issue-15752
luancazarine f64ac07
pnpm update
luancazarine dac06df
some adjusts
luancazarine e042186
fix field name
luancazarine 78a8c1a
some adjusts
luancazarine d9127f6
some adjusts
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
296 changes: 296 additions & 0 deletions
296
components/gem/actions/create-candidate/create-candidate.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,296 @@ | ||
| import { SOURCED_FROM } from "../../common/constants.mjs"; | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
| import gem from "../../gem.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "gem-create-candidate", | ||
| name: "Create Candidate", | ||
| description: "Creates a new candidate in Gem. [See the documentation](https://api.gem.com/v0/reference#tag/Candidates/paths/~1v0~1candidates/post)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| gem, | ||
| createdBy: { | ||
| propDefinition: [ | ||
| gem, | ||
| "createdBy", | ||
| ], | ||
| }, | ||
| firstName: { | ||
| type: "string", | ||
| label: "First Name", | ||
| description: "Candidate's first name", | ||
| optional: true, | ||
| }, | ||
| lastName: { | ||
| type: "string", | ||
| label: "Last Name", | ||
| description: "Candidate's last name", | ||
| optional: true, | ||
| }, | ||
| nickname: { | ||
| type: "string", | ||
| label: "Nickname", | ||
| description: "Candidate's nickname", | ||
| optional: true, | ||
| }, | ||
| primaryEmail: { | ||
| type: "string", | ||
| label: "Primary Email Address", | ||
| description: "Candidate's primary email address", | ||
| }, | ||
| additionalEmails: { | ||
| type: "string[]", | ||
| label: "Email Addresses", | ||
| description: "List of candidate's additional email addresses", | ||
| optional: true, | ||
| }, | ||
| linkedInHandle: { | ||
| type: "string", | ||
| label: "LinkedIn Handle", | ||
| description: "Enter your candidate's unique LinkedIn identifier (e.g., \"satyanadella\"). This helps the system check for duplicates before creating a new candidate entry.", | ||
| optional: true, | ||
| }, | ||
| title: { | ||
| type: "string", | ||
| label: "Title", | ||
| description: "Candidate's job title", | ||
| optional: true, | ||
| }, | ||
| company: { | ||
| type: "string", | ||
| label: "Company", | ||
| description: "Candidate's company name", | ||
| optional: true, | ||
| }, | ||
| location: { | ||
| type: "string", | ||
| label: "Location", | ||
| description: "Candidate's location", | ||
| optional: true, | ||
| }, | ||
| school: { | ||
| type: "string", | ||
| label: "School", | ||
| description: "Candidate's school", | ||
| optional: true, | ||
| }, | ||
| educationInfoNumber: { | ||
| type: "integer", | ||
| label: "Education Info Quantity", | ||
| description: "The number of education info objects to be created", | ||
| reloadProps: true, | ||
| optional: true, | ||
| }, | ||
| workInfoNumber: { | ||
| type: "integer", | ||
| label: "Work Info Quantity", | ||
| description: "The number of work info objects to be created", | ||
| reloadProps: true, | ||
| optional: true, | ||
| }, | ||
| profileUrls: { | ||
| type: "string[]", | ||
| label: "Profile URLs", | ||
| description: "If `Profile URLs` is provided with an array of urls, social `profiles` will be generated based on the provided urls and attached to the candidate", | ||
| optional: true, | ||
| }, | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| phoneNumber: { | ||
| type: "string", | ||
| label: "Phone Number", | ||
| description: "Candidate's phone number", | ||
| optional: true, | ||
| }, | ||
| projectIds: { | ||
| propDefinition: [ | ||
| gem, | ||
| "projectIds", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| customFields: { | ||
| type: "object", | ||
| label: "Custom Fields", | ||
| description: "An object containing new custom field values. Only custom fields specified are updated. **Format: {\"custom_field_id\": \"value\"}**. [See the documentation](https://api.gem.com/v0/reference#tag/Candidates/paths/~1v0~1candidates/post) for further details.", | ||
| optional: true, | ||
| }, | ||
| sourcedFrom: { | ||
| type: "string", | ||
| label: "Sourced From", | ||
| description: "Where the candidate was sourced from", | ||
| options: SOURCED_FROM, | ||
| optional: true, | ||
| }, | ||
| autofill: { | ||
| type: "boolean", | ||
| label: "Autofill", | ||
| description: "Requires `Linked In Handle` to be non-null. Attempts to fill in any missing fields.", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async additionalProps() { | ||
| const props = {}; | ||
| if (this.educationInfoNumber) { | ||
| for (let i = 1; i <= this.educationInfoNumber; i++) { | ||
| props[`educationInfo${i}School`] = { | ||
| type: "string", | ||
| label: `Education Info ${i} - School`, | ||
| description: `Education info ${i} school of the candidate`, | ||
| optional: true, | ||
| }; | ||
| props[`educationInfo${i}University`] = { | ||
| type: "string", | ||
| label: `Education Info ${i} - University`, | ||
| description: `Education info ${i} university of the candidate`, | ||
| optional: true, | ||
| }; | ||
| props[`educationInfo${i}StartDate`] = { | ||
| type: "string", | ||
| label: `Education Info ${i} - Start Date`, | ||
| description: `Education info ${i} start date of the candidate`, | ||
| optional: true, | ||
| }; | ||
| props[`educationInfo${i}EndDate`] = { | ||
| type: "string", | ||
| label: `Education Info ${i} - End Date`, | ||
| description: `Education info ${i} end date of the candidate`, | ||
| optional: true, | ||
| }; | ||
| props[`educationInfo${i}FieldOfSchool`] = { | ||
| type: "string", | ||
| label: `Education Info ${i} - Field Of School`, | ||
| description: `Education info ${i} field of school of the candidate`, | ||
| optional: true, | ||
| }; | ||
| props[`educationInfo${i}Major1`] = { | ||
| type: "string", | ||
| label: `Education Info ${i} - Major 1`, | ||
| description: `Education info ${i} major 1 of the candidate`, | ||
| optional: true, | ||
| }; | ||
| props[`educationInfo${i}Major2`] = { | ||
| type: "string", | ||
| label: `Education Info ${i} - Major 2`, | ||
| description: `Education info ${i} major 2 of the candidate`, | ||
| optional: true, | ||
| }; | ||
| props[`educationInfo${i}Degree`] = { | ||
| type: "string", | ||
| label: `Education Info ${i} - Degree`, | ||
| description: `Education info ${i} degree of the candidate`, | ||
| optional: true, | ||
| }; | ||
| } | ||
| } | ||
| if (this.workInfoNumber) { | ||
| for (let i = 1; i <= this.workInfoNumber; i++) { | ||
| props[`WorkInfo${i}Company`] = { | ||
| type: "string", | ||
| label: `Work Info ${i} - Company`, | ||
| description: `Work info ${i} company of the candidate`, | ||
| optional: true, | ||
| }; | ||
| props[`WorkInfo${i}Title`] = { | ||
| type: "string", | ||
| label: `Work Info ${i} - Title`, | ||
| description: `Work info ${i} title of the candidate`, | ||
| optional: true, | ||
| }; | ||
| props[`WorkInfo${i}WorkStartDate`] = { | ||
| type: "string", | ||
| label: `Work Info ${i} - Work Start Date`, | ||
| description: `Work info ${i} work start date of the candidate`, | ||
| optional: true, | ||
| }; | ||
| props[`WorkInfo${i}WorkEndDate`] = { | ||
| type: "string", | ||
| label: `Work Info ${i} - Work End Date`, | ||
| description: `Work info ${i} work end date of the candidate`, | ||
| optional: true, | ||
| }; | ||
| props[`WorkInfo${i}IsCurrent`] = { | ||
| type: "boolean", | ||
| label: `Work Info ${i} - Is Current`, | ||
| description: `Work info ${i} is Current of the candidate`, | ||
| optional: true, | ||
| }; | ||
| } | ||
| } | ||
|
|
||
| return props; | ||
| }, | ||
| async run({ $ }) { | ||
| const educationInfo = []; | ||
| const workInfo = []; | ||
| for (var i = 1; i <= this.educationInfoNumber; i++) { | ||
| educationInfo.push({ | ||
| school: this[`educationInfo${i}School`], | ||
| parsed_university: this[`educationInfo${i}University`], | ||
| start_date: this[`educationInfo${i}StartDate`], | ||
| end_date: this[`educationInfo${i}EndDate`], | ||
| field_of_study: this[`educationInfo${i}FieldOfSchool`], | ||
| parsed_major_1: this[`educationInfo${i}Major1`], | ||
| parsed_major_2: this[`educationInfo${i}Major2`], | ||
| degree: this[`educationInfo${i}Degree`], | ||
| }); | ||
| } | ||
|
|
||
| for (var j = 1; j <= this.workInfoNumber; j++) { | ||
| workInfo.push({ | ||
| company: this[`WorkInfo${j}Company`], | ||
| title: this[`WorkInfo${j}Title`], | ||
| work_start_date: this[`WorkInfo${j}WorkStartDate`], | ||
| work_end_date: this[`WorkInfo${j}WorkEndDate`], | ||
| is_current: this[`WorkInfo${j}IsCurrent`], | ||
| }); | ||
| } | ||
|
|
||
| const emails = [ | ||
| { | ||
| email_address: this.primaryEmail, | ||
| is_primary: true, | ||
| }, | ||
| ]; | ||
| if (this.additionalEmails) emails.push(...parseObject(this.additionalEmails).map((email) => ({ | ||
| email_address: email, | ||
| is_primary: false, | ||
| }))); | ||
|
|
||
| if (emails.length === 0) { | ||
| throw new Error("Primary Email Address is required"); | ||
| } | ||
| const candidate = await this.gem.createCandidate({ | ||
| $, | ||
| data: { | ||
| created_by: this.createdBy, | ||
| first_name: this.firstName, | ||
| last_name: this.lastName, | ||
| nickname: this.nickname, | ||
| emails, | ||
| linked_in_handle: this.linkedInHandle, | ||
| title: this.title, | ||
| company: this.company, | ||
| location: this.location, | ||
| school: this.school, | ||
| education_info: educationInfo, | ||
| work_info: workInfo, | ||
| profile_urls: parseObject(this.profileUrls), | ||
| phone_number: this.phoneNumber, | ||
| project_ids: parseObject(this.projectIds), | ||
| custom_fields: Object.entries(parseObject(this.customFields))?.map(([ | ||
| key, | ||
| value, | ||
| ]) => ({ | ||
| custom_field_id: key, | ||
| value, | ||
| })), | ||
| sourced_from: this.sourcedFrom, | ||
| autofill: this.autofill, | ||
| }, | ||
| }); | ||
| $.export( | ||
| "$summary", `Created candidate ${candidate.first_name} ${candidate.last_name} with ID: ${candidate.id}`, | ||
| ); | ||
| return candidate; | ||
| }, | ||
| }; | ||
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,9 @@ | ||
| export const LIMIT = 100; | ||
|
|
||
| export const SOURCED_FROM = [ | ||
| "SeekOut", | ||
| "hireEZ", | ||
| "Starcircle", | ||
| "Censia", | ||
| "Consider", | ||
| ]; |
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,24 @@ | ||
| export const parseObject = (obj) => { | ||
| if (!obj) return []; | ||
|
|
||
| if (Array.isArray(obj)) { | ||
| return obj.map((item) => { | ||
| if (typeof item === "string") { | ||
| try { | ||
| return JSON.parse(item); | ||
| } catch (e) { | ||
| return item; | ||
| } | ||
| } | ||
| return item; | ||
| }); | ||
| } | ||
| if (typeof obj === "string") { | ||
| try { | ||
| return JSON.parse(obj); | ||
| } catch (e) { | ||
| return obj; | ||
| } | ||
| } | ||
| return obj; | ||
| }; |
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.