From e37b0426e328ad926ec4d070025b4104de564701 Mon Sep 17 00:00:00 2001 From: Luan Cazarine Date: Wed, 3 Jul 2024 12:13:24 -0300 Subject: [PATCH 1/3] smartymeet init --- .../create-candidate/create-candidate.mjs | 50 +++++++ .../actions/create-job/create-job.mjs | 50 +++++++ .../get-job-candidate-analysis.mjs | 35 +++++ components/smartymeet/package.json | 2 +- components/smartymeet/smartymeet.app.mjs | 139 +++++++++++++++++- .../new-candidate-analysis-ready-instant.mjs | 108 ++++++++++++++ 6 files changed, 380 insertions(+), 4 deletions(-) create mode 100644 components/smartymeet/actions/create-candidate/create-candidate.mjs create mode 100644 components/smartymeet/actions/create-job/create-job.mjs create mode 100644 components/smartymeet/actions/get-job-candidate-analysis/get-job-candidate-analysis.mjs create mode 100644 components/smartymeet/sources/new-candidate-analysis-ready-instant/new-candidate-analysis-ready-instant.mjs diff --git a/components/smartymeet/actions/create-candidate/create-candidate.mjs b/components/smartymeet/actions/create-candidate/create-candidate.mjs new file mode 100644 index 0000000000000..66a4372bcc86f --- /dev/null +++ b/components/smartymeet/actions/create-candidate/create-candidate.mjs @@ -0,0 +1,50 @@ +import smartymeet from "../../smartymeet.app.mjs"; +import { axios } from "@pipedream/platform"; + +export default { + key: "smartymeet-create-candidate", + name: "Create Candidate", + description: "Creates a new candidate profile in SmartyMeet. [See the documentation](https://docs.smartymeet.com/category/smartymeet-versioned-api)", + version: "0.0.{{ts}}", + type: "action", + props: { + smartymeet, + candidateName: { + propDefinition: [ + smartymeet, + "candidateName", + ], + }, + candidateContacts: { + propDefinition: [ + smartymeet, + "candidateContacts", + ], + }, + candidateLinks: { + propDefinition: [ + smartymeet, + "candidateLinks", + ], + optional: true, + }, + candidateResume: { + propDefinition: [ + smartymeet, + "candidateResume", + ], + optional: true, + }, + }, + async run({ $ }) { + const response = await this.smartymeet.createNewCandidateProfile({ + candidateName: this.candidateName, + candidateContacts: this.candidateContacts, + candidateLinks: this.candidateLinks, + candidateResume: this.candidateResume, + }); + + $.export("$summary", `Successfully created candidate profile for ${this.candidateName}`); + return response; + }, +}; diff --git a/components/smartymeet/actions/create-job/create-job.mjs b/components/smartymeet/actions/create-job/create-job.mjs new file mode 100644 index 0000000000000..258d4fcfc3bde --- /dev/null +++ b/components/smartymeet/actions/create-job/create-job.mjs @@ -0,0 +1,50 @@ +import smartymeet from "../../smartymeet.app.mjs"; +import { axios } from "@pipedream/platform"; + +export default { + key: "smartymeet-create-job", + name: "Create Job", + description: "Generates a new job in the SmartyMeet system. [See the documentation](https://docs.smartymeet.com/smartymeet_versioned/jobs)", + version: "0.0.{{ts}}", + type: "action", + props: { + smartymeet, + jobTitle: { + propDefinition: [ + smartymeet, + "jobTitle", + ], + }, + jobDescription: { + propDefinition: [ + smartymeet, + "jobDescription", + ], + }, + jobLocation: { + propDefinition: [ + smartymeet, + "jobLocation", + ], + optional: true, + }, + jobSalary: { + propDefinition: [ + smartymeet, + "jobSalary", + ], + optional: true, + }, + }, + async run({ $ }) { + const response = await this.smartymeet.generateNewJob({ + jobTitle: this.jobTitle, + jobDescription: this.jobDescription, + jobLocation: this.jobLocation, + jobSalary: this.jobSalary, + }); + + $.export("$summary", `Successfully created job with title "${this.jobTitle}"`); + return response; + }, +}; diff --git a/components/smartymeet/actions/get-job-candidate-analysis/get-job-candidate-analysis.mjs b/components/smartymeet/actions/get-job-candidate-analysis/get-job-candidate-analysis.mjs new file mode 100644 index 0000000000000..fa161184e22ab --- /dev/null +++ b/components/smartymeet/actions/get-job-candidate-analysis/get-job-candidate-analysis.mjs @@ -0,0 +1,35 @@ +import smartymeet from "../../smartymeet.app.mjs"; +import { axios } from "@pipedream/platform"; + +export default { + key: "smartymeet-get-job-candidate-analysis", + name: "Get Job Candidate Analysis", + description: "Retrieves the analysis for a job candidate within SmartyMeet. [See the documentation](https://docs.smartymeet.com)", + version: "0.0.{{ts}}", + type: "action", + props: { + smartymeet, + candidateId: { + propDefinition: [ + smartymeet, + "candidateId", + ], + }, + analysisType: { + propDefinition: [ + smartymeet, + "analysisType", + ], + optional: true, + }, + }, + async run({ $ }) { + const response = await this.smartymeet.retrieveCandidateAnalysis({ + candidateId: this.candidateId, + analysisType: this.analysisType, + }); + + $.export("$summary", `Successfully retrieved analysis for candidate ID ${this.candidateId}`); + return response; + }, +}; diff --git a/components/smartymeet/package.json b/components/smartymeet/package.json index ae44f9e79c877..5de65bb78405a 100644 --- a/components/smartymeet/package.json +++ b/components/smartymeet/package.json @@ -12,4 +12,4 @@ "publishConfig": { "access": "public" } -} \ No newline at end of file +} diff --git a/components/smartymeet/smartymeet.app.mjs b/components/smartymeet/smartymeet.app.mjs index ddb8706af79bd..f66cc71601150 100644 --- a/components/smartymeet/smartymeet.app.mjs +++ b/components/smartymeet/smartymeet.app.mjs @@ -1,11 +1,144 @@ +import { axios } from "@pipedream/platform"; + export default { type: "app", app: "smartymeet", - propDefinitions: {}, + propDefinitions: { + candidateId: { + type: "string", + label: "Candidate ID", + description: "The ID of the candidate", + }, + reportType: { + type: "string", + label: "Report Type", + description: "The type of report", + optional: true, + }, + jobTitle: { + type: "string", + label: "Job Title", + description: "The title of the job", + }, + jobDescription: { + type: "string", + label: "Job Description", + description: "The description of the job", + }, + jobLocation: { + type: "string", + label: "Job Location", + description: "The location of the job", + optional: true, + }, + jobSalary: { + type: "string", + label: "Job Salary", + description: "The salary for the job", + optional: true, + }, + analysisType: { + type: "string", + label: "Analysis Type", + description: "The type of analysis", + optional: true, + }, + candidateName: { + type: "string", + label: "Candidate Name", + description: "The name of the candidate", + }, + candidateContacts: { + type: "string", + label: "Candidate Contacts", + description: "The contacts of the candidate", + }, + candidateLinks: { + type: "string", + label: "Candidate Links", + description: "Links related to the candidate", + optional: true, + }, + candidateResume: { + type: "string", + label: "Candidate Resume", + description: "The resume of the candidate", + optional: true, + }, + }, methods: { - // this.$auth contains connected account data authKeys() { console.log(Object.keys(this.$auth)); }, + _baseUrl() { + return "https://api.smartymeet.com"; + }, + async _makeRequest(opts = {}) { + const { + $ = this, method = "GET", path = "/", headers, ...otherOpts + } = opts; + return axios($, { + ...otherOpts, + method, + url: this._baseUrl() + path, + headers: { + ...headers, + Authorization: `Bearer ${this.$auth.api_token}`, + }, + }); + }, + async emitNewCandidateAnalysisReport({ + candidateId, reportType, + }) { + return this._makeRequest({ + method: "POST", + path: `/candidates/${candidateId}/reports`, + data: { + reportType, + }, + }); + }, + async generateNewJob({ + jobTitle, jobDescription, jobLocation, jobSalary, + }) { + return this._makeRequest({ + method: "POST", + path: "/jobs", + data: { + jobTitle, + jobDescription, + jobLocation, + jobSalary, + }, + }); + }, + async retrieveCandidateAnalysis({ + candidateId, analysisType, + }) { + return this._makeRequest({ + method: "GET", + path: `/candidates/${candidateId}/analysis`, + params: { + analysisType, + }, + }); + }, + async createNewCandidateProfile({ + candidateName, + candidateContacts, + candidateLinks, + candidateResume, + }) { + return this._makeRequest({ + method: "POST", + path: "/candidates", + data: { + candidateName, + candidateContacts, + candidateLinks, + candidateResume, + }, + }); + }, }, -}; \ No newline at end of file +}; diff --git a/components/smartymeet/sources/new-candidate-analysis-ready-instant/new-candidate-analysis-ready-instant.mjs b/components/smartymeet/sources/new-candidate-analysis-ready-instant/new-candidate-analysis-ready-instant.mjs new file mode 100644 index 0000000000000..ccb23c50ba65d --- /dev/null +++ b/components/smartymeet/sources/new-candidate-analysis-ready-instant/new-candidate-analysis-ready-instant.mjs @@ -0,0 +1,108 @@ +import smartymeet from "../../smartymeet.app.mjs"; +import crypto from "crypto"; +import { axios } from "@pipedream/platform"; + +export default { + key: "smartymeet-new-candidate-analysis-ready-instant", + name: "New Candidate Analysis Ready (Instant)", + description: "Emit new event every time a new candidate's analysis report becomes available. [See the documentation](https://docs.smartymeet.com/smartymeet_versioned/smartymeet-api)", + version: "0.0.{{ts}}", + type: "source", + dedupe: "unique", + props: { + smartymeet: { + type: "app", + app: "smartymeet", + }, + http: { + type: "$.interface.http", + customResponse: true, + }, + db: "$.service.db", + candidateId: { + propDefinition: [ + smartymeet, + "candidateId", + ], + }, + reportType: { + propDefinition: [ + smartymeet, + "reportType", + { + optional: true, + }, + ], + }, + }, + methods: { + _getWebhookId() { + return this.db.get("webhookId"); + }, + _setWebhookId(id) { + this.db.set("webhookId", id); + }, + }, + hooks: { + async deploy() { + const analyses = await this.smartymeet.retrieveCandidateAnalysis({ + candidateId: this.candidateId, + analysisType: this.reportType, + }); + for (const analysis of analyses) { + this.$emit(analysis, { + id: analysis.id, + summary: `New analysis report for candidate ${analysis.candidateId}`, + ts: Date.parse(analysis.createdAt), + }); + } + }, + async activate() { + const webhookSecret = crypto.randomBytes(16).toString("hex"); + this.db.set("webhookSecret", webhookSecret); + + const webhookId = await this.smartymeet.emitNewCandidateAnalysisReport({ + candidateId: this.candidateId, + reportType: this.reportType, + }); + this._setWebhookId(webhookId); + }, + async deactivate() { + const webhookId = this._getWebhookId(); + if (webhookId) { + await this.smartymeet._makeRequest({ + method: "DELETE", + path: `/webhooks/${webhookId}`, + }); + } + }, + }, + async run(event) { + const { + headers, body, + } = event; + const webhookSecret = this.db.get("webhookSecret"); + const computedSignature = crypto.createHmac("sha256", webhookSecret).update(body) + .digest("hex"); + + if (headers["x-smartymeet-signature"] !== computedSignature) { + this.http.respond({ + status: 401, + body: "Unauthorized", + }); + return; + } + + this.http.respond({ + status: 200, + body: "OK", + }); + + const analysisReport = JSON.parse(body); + this.$emit(analysisReport, { + id: analysisReport.id, + summary: `New analysis report for candidate ${analysisReport.candidateId}`, + ts: Date.parse(analysisReport.createdAt), + }); + }, +}; From 1dac664a24330653baebd50019b11c53712e7829 Mon Sep 17 00:00:00 2001 From: Luan Cazarine Date: Wed, 3 Jul 2024 18:28:12 -0300 Subject: [PATCH 2/3] Create actions v1 --- .../create-candidate/create-candidate.mjs | 76 +- .../actions/create-job/create-job.mjs | 142 +- .../get-job-candidate-analysis.mjs | 30 +- components/smartymeet/common/constants.mjs | 1634 +++++++++++++++++ components/smartymeet/common/utils.mjs | 24 + components/smartymeet/package.json | 5 +- components/smartymeet/smartymeet.app.mjs | 141 +- .../new-candidate-analysis-ready-instant.mjs | 3 +- 8 files changed, 1950 insertions(+), 105 deletions(-) create mode 100644 components/smartymeet/common/constants.mjs create mode 100644 components/smartymeet/common/utils.mjs diff --git a/components/smartymeet/actions/create-candidate/create-candidate.mjs b/components/smartymeet/actions/create-candidate/create-candidate.mjs index 66a4372bcc86f..5435369a429e3 100644 --- a/components/smartymeet/actions/create-candidate/create-candidate.mjs +++ b/components/smartymeet/actions/create-candidate/create-candidate.mjs @@ -1,5 +1,4 @@ import smartymeet from "../../smartymeet.app.mjs"; -import { axios } from "@pipedream/platform"; export default { key: "smartymeet-create-candidate", @@ -9,42 +8,73 @@ export default { type: "action", props: { smartymeet, - candidateName: { - propDefinition: [ - smartymeet, - "candidateName", - ], + name: { + type: "string", + label: "Name", + description: "The candidate's name.", }, - candidateContacts: { - propDefinition: [ - smartymeet, - "candidateContacts", + status: { + type: "string", + label: "Status", + description: "The candidate's status.", + options: [ + "active", + "rejected", + "archived", + "closed", ], + optional: true, }, - candidateLinks: { + phone: { + type: "string", + label: "Phone", + description: "The candidate's phone.", + optional: true, + }, + email: { + type: "string", + label: "Email", + description: "The candidate's email.", + optional: true, + }, + /* talentId: { propDefinition: [ smartymeet, - "candidateLinks", + "talentId", ], - optional: true, - }, - candidateResume: { + }, */ + jobId: { propDefinition: [ smartymeet, - "candidateResume", + "jobId", ], - optional: true, }, }, async run({ $ }) { - const response = await this.smartymeet.createNewCandidateProfile({ - candidateName: this.candidateName, - candidateContacts: this.candidateContacts, - candidateLinks: this.candidateLinks, - candidateResume: this.candidateResume, + const response = await this.smartymeet.createCandidate({ + $, + data: { + type: "candidates", + attributes: { + name: this.name, + status: this.status, + phone: this.phone, + email: this.email, + }, + relationships: { + /* talents: { + type: "talents", + id: this.talentId, + }, */ + jobs: { + type: "jobs", + id: this.jobId, + }, + }, + }, }); - $.export("$summary", `Successfully created candidate profile for ${this.candidateName}`); + $.export("$summary", `Successfully created candidate with Id: ${response.data.id}`); return response; }, }; diff --git a/components/smartymeet/actions/create-job/create-job.mjs b/components/smartymeet/actions/create-job/create-job.mjs index 258d4fcfc3bde..1377b38f17b63 100644 --- a/components/smartymeet/actions/create-job/create-job.mjs +++ b/components/smartymeet/actions/create-job/create-job.mjs @@ -1,5 +1,11 @@ +import { + CURRENCY_OPTIONS, EDUCATION_OPTIONS, EXPERIENCE_OPTIONS, INDUSTRY_OPTIONS, + JOB_FUNCTION_OPTIONS, + JOB_TYPE_OPTIONS, + STATUS_OPTIONS, WORKPLACE_OPTIONS, +} from "../../common/constants.mjs"; +import { parseObject } from "../../common/utils.mjs"; import smartymeet from "../../smartymeet.app.mjs"; -import { axios } from "@pipedream/platform"; export default { key: "smartymeet-create-job", @@ -9,39 +15,123 @@ export default { type: "action", props: { smartymeet, - jobTitle: { - propDefinition: [ - smartymeet, - "jobTitle", - ], + title: { + type: "string", + label: "Title", + description: "The job's title.", + optional: true, + }, + status: { + type: "string", + label: "Status", + description: "The Job's status.", + options: STATUS_OPTIONS, + optional: true, + }, + candidates: { + type: "integer", + label: "Candidates", + description: "The candidates' quantity.", + optional: true, + }, + workplace: { + type: "string", + label: "workplace", + description: "workplace", + options: WORKPLACE_OPTIONS, + optional: true, + }, + description: { + type: "string", + label: "Description", + description: "The job's description.", + optional: true, + }, + industry: { + type: "string", + label: "Industry", + description: "The company industry.", + options: INDUSTRY_OPTIONS, + optional: true, }, - jobDescription: { - propDefinition: [ - smartymeet, - "jobDescription", - ], + jobFunction: { + type: "string", + label: "Job Function", + description: "The job function title.", + options: JOB_FUNCTION_OPTIONS, + optional: true, + }, + jobType: { + type: "string", + label: "Job Type", + description: "The employment type.", + options: JOB_TYPE_OPTIONS, + optional: true, + }, + experience: { + type: "string", + label: "Experience", + description: "The expected candidate's experience.", + options: EXPERIENCE_OPTIONS, + optional: true, + }, + education: { + type: "string", + label: "Education", + description: "The expected candidate's education.", + options: EDUCATION_OPTIONS, + optional: true, + }, + salaryFrom: { + type: "string", + label: "Salary From", + description: "The minimum salary amount.", + optional: true, + }, + salaryTo: { + type: "string", + label: "Salary To", + description: "The maximum salary amount.", + optional: true, }, - jobLocation: { - propDefinition: [ - smartymeet, - "jobLocation", - ], + currency: { + type: "string", + label: "Currency", + description: "The salary currency.", + options: CURRENCY_OPTIONS, optional: true, }, - jobSalary: { - propDefinition: [ - smartymeet, - "jobSalary", - ], + keywords: { + type: "string[]", + label: "keywords", + description: "keywords", optional: true, }, }, async run({ $ }) { - const response = await this.smartymeet.generateNewJob({ - jobTitle: this.jobTitle, - jobDescription: this.jobDescription, - jobLocation: this.jobLocation, - jobSalary: this.jobSalary, + const response = await this.smartymeet.createJob({ + $, + data: { + type: "jobs", + attributes: { + title: this.title, + status: this.status, + candidates: this.candidates, + workplace: this.workplace, + description: this.description, + industry: this.industry, + jobFunction: this.jobFunction, + jobType: this.jobType, + experience: this.experience, + education: this.education, + salary: { + from: this.salaryFrom, + to: this.salaryTo, + }, + currency: this.currency, + keywords: parseObject(this.keywords), + }, + }, }); $.export("$summary", `Successfully created job with title "${this.jobTitle}"`); diff --git a/components/smartymeet/actions/get-job-candidate-analysis/get-job-candidate-analysis.mjs b/components/smartymeet/actions/get-job-candidate-analysis/get-job-candidate-analysis.mjs index fa161184e22ab..2253b682774e8 100644 --- a/components/smartymeet/actions/get-job-candidate-analysis/get-job-candidate-analysis.mjs +++ b/components/smartymeet/actions/get-job-candidate-analysis/get-job-candidate-analysis.mjs @@ -1,35 +1,41 @@ import smartymeet from "../../smartymeet.app.mjs"; -import { axios } from "@pipedream/platform"; export default { key: "smartymeet-get-job-candidate-analysis", name: "Get Job Candidate Analysis", description: "Retrieves the analysis for a job candidate within SmartyMeet. [See the documentation](https://docs.smartymeet.com)", - version: "0.0.{{ts}}", + version: "0.0.1", type: "action", props: { smartymeet, - candidateId: { + jobId: { propDefinition: [ smartymeet, - "candidateId", + "jobId", ], }, - analysisType: { + candidateId: { propDefinition: [ smartymeet, - "analysisType", + "candidateId", + ({ jobId }) => ({ + jobId, + }), ], - optional: true, }, }, async run({ $ }) { - const response = await this.smartymeet.retrieveCandidateAnalysis({ - candidateId: this.candidateId, - analysisType: this.analysisType, + const response = await this.smartymeet.listCandidates({ + $, + jobId: this.jobId, }); - $.export("$summary", `Successfully retrieved analysis for candidate ID ${this.candidateId}`); - return response; + const candidate = response.find((candidate) => `${candidate.shardId}:${candidate.contactId}` === this.candidateId); + + if (candidate) { + $.export("$summary", `Successfully retrieved analysis for candidate with Id: ${this.candidateId}`); + return candidate.jobs[0]; + } + $.export("$summary", `Candidate with Id: ${this.candidateId} not found.`); }, }; diff --git a/components/smartymeet/common/constants.mjs b/components/smartymeet/common/constants.mjs new file mode 100644 index 0000000000000..61200d1b01ca2 --- /dev/null +++ b/components/smartymeet/common/constants.mjs @@ -0,0 +1,1634 @@ +export const WORKPLACE_OPTIONS = [ + { + label: "On-site - Employees work from an office.", + value: "office", + }, + { + label: "Hybrid - Employees work from both office and home.", + value: "hybrid", + }, + { + label: "Remote - Employees work from home.", + value: "remote", + }, +]; + +export const CANDIDATE_STATUS_OPTIONS = [ + { + value: "sourced", + label: "Sourced", + }, + { + value: "applied", + label: "Applied", + }, + { + value: "initial", + label: "Initial Screen", + }, + { + value: "assessment", + label: "Assessment", + }, + { + value: "interview", + label: "Interview", + }, + { + value: "offer", + label: "Offer", + }, + { + value: "hire", + label: "Hired", + }, +]; + +export const STATUS_OPTIONS = [ + { + value: "published", + label: "Published", + }, + { + value: "draft", + label: "Draft", + }, + { + value: "archived", + label: "Archived", + }, + { + value: "closed", + label: "Closed", + }, +]; + +export const INDUSTRY_OPTIONS = [ + { + value: "marketing_and_advertising", + label: "Marketing and Advertising", + }, + { + value: "accounting", + label: "Accounting", + }, + { + value: "airlines/aviation", + label: "Airlines/Aviation", + }, + { + value: "alternative_dispute_resolution", + label: "Alternative Dispute Resolution", + }, + { + value: "alternative_medicine", + label: "Alternative Medicine", + }, + { + value: "animation", + label: "Animation", + }, + { + value: "apparel_&_fashion", + label: "Apparel & Fashion", + }, + { + value: "architecture_&_planning", + label: "Architecture & Planning", + }, + { + value: "arts_and_crafts", + label: "Arts and Crafts", + }, + { + value: "automotive", + label: "Automotive", + }, + { + value: "aviation_&_aerospace", + label: "Aviation & Aerospace", + }, + { + value: "banking", + label: "Banking", + }, + { + value: "biotechnology", + label: "Biotechnology", + }, + { + value: "broadcast_media", + label: "Broadcast Media", + }, + { + value: "building_materials", + label: "Building Materials", + }, + { + value: "business_supplies_and_equipment", + label: "Business Supplies and Equipment", + }, + { + value: "capital_markets", + label: "Capital Markets", + }, + { + value: "chemicals", + label: "Chemicals", + }, + { + value: "civic_&_social_organization", + label: "Civic & Social Organization", + }, + { + value: "civil_engineering", + label: "Civil Engineering", + }, + { + value: "commercial_real_estate", + label: "Commercial Real Estate", + }, + { + value: "computer_&_network_security", + label: "Computer & Network Security", + }, + { + value: "computer_games", + label: "Computer Games", + }, + { + value: "computer_hardware", + label: "Computer Hardware", + }, + { + value: "computer_networking", + label: "Computer Networking", + }, + { + value: "computer_software", + label: "Computer Software", + }, + { + value: "construction", + label: "Construction", + }, + { + value: "consumer_electronics", + label: "Consumer Electronics", + }, + { + value: "consumer_goods", + label: "Consumer Goods", + }, + { + value: "consumer_services", + label: "Consumer Services", + }, + { + value: "cosmetics", + label: "Cosmetics", + }, + { + value: "dairy", + label: "Dairy", + }, + { + value: "defense_&_space", + label: "Defense & Space", + }, + { + value: "design", + label: "Design", + }, + { + value: "education_management", + label: "Education Management", + }, + { + value: "e-learning", + label: "E-Learning", + }, + { + value: "electrical/electronic_manufacturing", + label: "Electrical/Electronic Manufacturing", + }, + { + value: "entertainment", + label: "Entertainment", + }, + { + value: "environmental_services", + label: "Environmental Services", + }, + { + value: "events_services", + label: "Events Services", + }, + { + value: "executive_office", + label: "Executive Office", + }, + { + value: "facilities_services", + label: "Facilities Services", + }, + { + value: "farming", + label: "Farming", + }, + { + value: "financial_services", + label: "Financial Services", + }, + { + value: "fine_art", + label: "Fine Art", + }, + { + value: "fishery", + label: "Fishery", + }, + { + value: "food_&_beverages", + label: "Food & Beverages", + }, + { + value: "food_production", + label: "Food Production", + }, + { + value: "fund-raising", + label: "Fund-Raising", + }, + { + value: "furniture", + label: "Furniture", + }, + { + value: "gambling_&_casinos", + label: "Gambling & Casinos", + }, + { + value: "glass,_ceramics_&_concrete", + label: "Glass, Ceramics & Concrete", + }, + { + value: "government_administration", + label: "Government Administration", + }, + { + value: "government_relations", + label: "Government Relations", + }, + { + value: "graphic_design", + label: "Graphic Design", + }, + { + value: "health,_wellness_and_fitness", + label: "Health, Wellness and Fitness", + }, + { + value: "higher_education", + label: "Higher Education", + }, + { + value: "hospital_&_health_care", + label: "Hospital & Health Care", + }, + { + value: "hospitality", + label: "Hospitality", + }, + { + value: "human_resources", + label: "Human Resources", + }, + { + value: "import_and_export", + label: "Import and Export", + }, + { + value: "individual_&_family_services", + label: "Individual & Family Services", + }, + { + value: "industrial_automation", + label: "Industrial Automation", + }, + { + value: "information_services", + label: "Information Services", + }, + { + value: "information_technology_and_services", + label: "Information Technology and Services", + }, + { + value: "insurance", + label: "Insurance", + }, + { + value: "international_affairs", + label: "International Affairs", + }, + { + value: "international_trade_and_development", + label: "International Trade and Development", + }, + { + value: "internet", + label: "Internet", + }, + { + value: "investment_banking", + label: "Investment Banking", + }, + { + value: "investment_management", + label: "Investment Management", + }, + { + value: "judiciary", + label: "Judiciary", + }, + { + value: "law_enforcement", + label: "Law Enforcement", + }, + { + value: "law_practice", + label: "Law Practice", + }, + { + value: "legal_services", + label: "Legal Services", + }, + { + value: "legislative_office", + label: "Legislative Office", + }, + { + value: "leisure,_travel_&_tourism", + label: "Leisure, Travel & Tourism", + }, + { + value: "libraries", + label: "Libraries", + }, + { + value: "logistics_and_supply_chain", + label: "Logistics and Supply Chain", + }, + { + value: "luxury_goods_&_jewelry", + label: "Luxury Goods & Jewelry", + }, + { + value: "machinery", + label: "Machinery", + }, + { + value: "management_consulting", + label: "Management Consulting", + }, + { + value: "maritime", + label: "Maritime", + }, + { + value: "market_research", + label: "Market Research", + }, + { + value: "mechanical_or_industrial_engineering", + label: "Mechanical or Industrial Engineering", + }, + { + value: "media_production", + label: "Media Production", + }, + { + value: "medical_devices", + label: "Medical Devices", + }, + { + value: "medical_practice", + label: "Medical Practice", + }, + { + value: "mental_health_care", + label: "Mental Health Care", + }, + { + value: "military", + label: "Military", + }, + { + value: "mining_&_metals", + label: "Mining & Metals", + }, + { + value: "motion_pictures_and_film", + label: "Motion Pictures and Film", + }, + { + value: "museums_and_institutions", + label: "Museums and Institutions", + }, + { + value: "music", + label: "Music", + }, + { + value: "nanotechnology", + label: "Nanotechnology", + }, + { + value: "newspapers", + label: "Newspapers", + }, + { + value: "nonprofit_organization_management", + label: "Nonprofit Organization Management", + }, + { + value: "oil_&_energy", + label: "Oil & Energy", + }, + { + value: "online_media", + label: "Online Media", + }, + { + value: "outsourcing/offshoring", + label: "Outsourcing/Offshoring", + }, + { + value: "package/freight_delivery", + label: "Package/Freight Delivery", + }, + { + value: "packaging_and_containers", + label: "Packaging and Containers", + }, + { + value: "paper_&_forest_products", + label: "Paper & Forest Products", + }, + { + value: "performing_arts", + label: "Performing Arts", + }, + { + value: "pharmaceuticals", + label: "Pharmaceuticals", + }, + { + value: "philanthropy", + label: "Philanthropy", + }, + { + value: "photography", + label: "Photography", + }, + { + value: "plastics", + label: "Plastics", + }, + { + value: "political_organization", + label: "Political Organization", + }, + { + value: "primary/secondary_education", + label: "Primary/Secondary Education", + }, + { + value: "printing", + label: "Printing", + }, + { + value: "professional_training_&_coaching", + label: "Professional Training & Coaching", + }, + { + value: "program_development", + label: "Program Development", + }, + { + value: "public_policy", + label: "Public Policy", + }, + { + value: "public_relations_and_communications", + label: "Public Relations and Communications", + }, + { + value: "public_safety", + label: "Public Safety", + }, + { + value: "publishing", + label: "Publishing", + }, + { + value: "railroad_manufacture", + label: "Railroad Manufacture", + }, + { + value: "ranching", + label: "Ranching", + }, + { + value: "real_estate", + label: "Real Estate", + }, + { + value: "recreational_facilities_and_services", + label: "Recreational Facilities and Services", + }, + { + value: "religious_institutions", + label: "Religious Institutions", + }, + { + value: "renewables_&_environment", + label: "Renewables & Environment", + }, + { + value: "research", + label: "Research", + }, + { + value: "restaurants", + label: "Restaurants", + }, + { + value: "retail", + label: "Retail", + }, + { + value: "security_and_investigations", + label: "Security and Investigations", + }, + { + value: "semiconductors", + label: "Semiconductors", + }, + { + value: "shipbuilding", + label: "Shipbuilding", + }, + { + value: "sporting_goods", + label: "Sporting Goods", + }, + { + value: "sports", + label: "Sports", + }, + { + value: "staffing_and_recruiting", + label: "Staffing and Recruiting", + }, + { + value: "supermarkets", + label: "Supermarkets", + }, + { + value: "telecommunications", + label: "Telecommunications", + }, + { + value: "textiles", + label: "Textiles", + }, + { + value: "think_tanks", + label: "Think Tanks", + }, + { + value: "tobacco", + label: "Tobacco", + }, + { + value: "translation_and_localization", + label: "Translation and Localization", + }, + { + value: "transportation/trucking/railroad", + label: "Transportation/Trucking/Railroad", + }, + { + value: "utilities", + label: "Utilities", + }, + { + value: "venture_capital_&_private_equity", + label: "Venture Capital & Private Equity", + }, + { + value: "veterinary", + label: "Veterinary", + }, + { + value: "warehousing", + label: "Warehousing", + }, + { + value: "wholesale", + label: "Wholesale", + }, + { + value: "wine_and_spirits", + label: "Wine and Spirits", + }, + { + value: "wireless", + label: "Wireless", + }, + { + value: "writing_and_editing", + label: "Writing and Editing", + }, +]; + +export const JOB_FUNCTION_OPTIONS = [ + { + value: "accounting/auditing", + label: "Accounting/Auditing", + }, + { + value: "administrative", + label: "Administrative", + }, + { + value: "advertising", + label: "Advertising", + }, + { + value: "business_analyst", + label: "Business Analyst", + }, + { + value: "financial_analyst", + label: "Financial Analyst", + }, + { + value: "data_analyst", + label: "Data Analyst", + }, + { + value: "art/creative", + label: "Art/Creative", + }, + { + value: "business_development", + label: "Business Development", + }, + { + value: "consulting", + label: "Consulting", + }, + { + value: "customer_service", + label: "Customer Service", + }, + { + value: "distribution", + label: "Distribution", + }, + { + value: "design", + label: "Design", + }, + { + value: "education", + label: "Education", + }, + { + value: "engineering", + label: "Engineering", + }, + { + value: "finance", + label: "Finance", + }, + { + value: "general_business", + label: "General Business", + }, + { + value: "health_care_provider", + label: "Health Care Provider", + }, + { + value: "human_resources", + label: "Human Resources", + }, + { + value: "information_technology", + label: "Information Technology", + }, + { + value: "legal", + label: "Legal", + }, + { + value: "management", + label: "Management", + }, + { + value: "manufacturing", + label: "Manufacturing", + }, + { + value: "marketing", + label: "Marketing", + }, + { + value: "other", + label: "Other", + }, + { + value: "public_relations", + label: "Public Relations", + }, + { + value: "purchasing", + label: "Purchasing", + }, + { + value: "product_management", + label: "Product Management", + }, + { + value: "project_management", + label: "Project Management", + }, + { + value: "production", + label: "Production", + }, + { + value: "quality_assurance", + label: "Quality Assurance", + }, + { + value: "research", + label: "Research", + }, + { + value: "sales", + label: "Sales", + }, + { + value: "science", + label: "Science", + }, + { + value: "strategy/planning", + label: "Strategy/Planning", + }, + { + value: "supply_chain", + label: "Supply Chain", + }, + { + value: "training", + label: "Training", + }, + { + value: "writing/editing", + label: "Writing/Editing", + }, +]; + +export const JOB_TYPE_OPTIONS = [ + { + value: "full_time", + label: "Full-time", + }, + { + value: "part_time", + label: "Part-time", + }, + { + value: "contract", + label: "Contract", + }, + { + value: "temporary", + label: "Temporary", + }, + { + value: "other", + label: "Other", + }, +]; + +export const EXPERIENCE_OPTIONS = [ + { + value: "not_applicable", + label: "Not Applicable", + }, + { + value: "internship", + label: "Internship", + }, + { + value: "entry_level", + label: "Entry level", + }, + { + value: "associate", + label: "Associate", + }, + { + value: "mid-senior_level", + label: "Mid-Senior level", + }, + { + value: "director", + label: "Director", + }, + { + value: "executive", + label: "Executive", + }, +]; + +export const EDUCATION_OPTIONS = [ + { + value: "unspecified", + label: "Unspecified", + }, + { + value: "high_school_or_equivalent", + label: "High School or equivalent", + }, + { + value: "certification", + label: "Certification", + }, + { + value: "vocational", + label: "Vocational", + }, + { + value: "associate_degree", + label: "Associate Degree", + }, + { + value: "bachelor's_degree", + label: "Bachelor's Degree", + }, + { + value: "master's_degree", + label: "Master's Degree", + }, + { + value: "doctorate", + label: "Doctorate", + }, + { + value: "professional", + label: "Professional", + }, + { + value: "some_college_coursework_completed", + label: "Some College Coursework Completed", + }, + { + value: "vocational_-_hs_diploma", + label: "Vocational - HS Diploma", + }, + { + value: "vocational_-_degree", + label: "Vocational - Degree", + }, + { + value: "some_high_school_coursework", + label: "Some High School Coursework", + }, +]; + +export const CURRENCY_OPTIONS = [ + { + value: "USD", + label: "United States Dollar (USD)", + }, + { + value: "EUR", + label: "Euro (EUR)", + }, + { + value: "GBP", + label: "British Pound (GBP)", + }, + { + value: "CAD", + label: "Canadian Dollar (CAD)", + }, + { + value: "AUD", + label: "Australian Dollar (AUD)", + }, + { + value: "INR", + label: "Indian Rupee (INR)", + }, + { + value: "AED", + label: "United Arab Emirates Dirham (AED)", + }, + { + value: "AFN", + label: "Afghan Afghani (AFN)", + }, + { + value: "ALL", + label: "Albanian Lek (ALL)", + }, + { + value: "AMD", + label: "Armenian Dram (AMD)", + }, + { + value: "ANG", + label: "Netherlands Antillean Gulden (ANG)", + }, + { + value: "AOA", + label: "Angolan Kwanza (AOA)", + }, + { + value: "ARS", + label: "Argentine Peso (ARS)", + }, + { + value: "AUD", + label: "Australian Dollar (AUD)", + }, + { + value: "AWG", + label: "Aruban Florin (AWG)", + }, + { + value: "AZN", + label: "Azerbaijani Manat (AZN)", + }, + { + value: "BAM", + label: "Bosnia and Herzegovina Convertible Mark (BAM)", + }, + { + value: "BBD", + label: "Barbadian Dollar (BBD)", + }, + { + value: "BDT", + label: "Bangladeshi Taka (BDT)", + }, + { + value: "BGN", + label: "Bulgarian Lev (BGN)", + }, + { + value: "BHD", + label: "Bahraini Dinar (BHD)", + }, + { + value: "BIF", + label: "Burundian Franc (BIF)", + }, + { + value: "BMD", + label: "Bermudian Dollar (BMD)", + }, + { + value: "BND", + label: "Brunei Dollar (BND)", + }, + { + value: "BOB", + label: "Bolivian Boliviano (BOB)", + }, + { + value: "BRL", + label: "Brazilian Real (BRL)", + }, + { + value: "BSD", + label: "Bahamian Dollar (BSD)", + }, + { + value: "BTN", + label: "Bhutanese Ngultrum (BTN)", + }, + { + value: "BWP", + label: "Botswana Pula (BWP)", + }, + { + value: "BYN", + label: "Belarusian Ruble (BYN)", + }, + { + value: "BZD", + label: "Belize Dollar (BZD)", + }, + { + value: "CAD", + label: "Canadian Dollar (CAD)", + }, + { + value: "CDF", + label: "Congolese Franc (CDF)", + }, + { + value: "CHF", + label: "Swiss Franc (CHF)", + }, + { + value: "CLF", + label: "Unidad de Fomento (CLF)", + }, + { + value: "CLP", + label: "Chilean Peso (CLP)", + }, + { + value: "CNY", + label: "Chinese Renminbi Yuan (CNY)", + }, + { + value: "COP", + label: "Colombian Peso (COP)", + }, + { + value: "CRC", + label: "Costa Rican Col\xf3n (CRC)", + }, + { + value: "CUC", + label: "Cuban Convertible Peso (CUC)", + }, + { + value: "CUP", + label: "Cuban Peso (CUP)", + }, + { + value: "CVE", + label: "Cape Verdean Escudo (CVE)", + }, + { + value: "CZK", + label: "Czech Koruna (CZK)", + }, + { + value: "DJF", + label: "Djiboutian Franc (DJF)", + }, + { + value: "DKK", + label: "Danish Krone (DKK)", + }, + { + value: "DOP", + label: "Dominican Peso (DOP)", + }, + { + value: "DZD", + label: "Algerian Dinar (DZD)", + }, + { + value: "EGP", + label: "Egyptian Pound (EGP)", + }, + { + value: "ERN", + label: "Eritrean Nakfa (ERN)", + }, + { + value: "ETB", + label: "Ethiopian Birr (ETB)", + }, + { + value: "FJD", + label: "Fijian Dollar (FJD)", + }, + { + value: "FKP", + label: "Falkland Pound (FKP)", + }, + { + value: "GBP", + label: "British Pound (GBP)", + }, + { + value: "GEL", + label: "Georgian Lari (GEL)", + }, + { + value: "GHS", + label: "Ghanaian Cedi (GHS)", + }, + { + value: "GIP", + label: "Gibraltar Pound (GIP)", + }, + { + value: "GMD", + label: "Gambian Dalasi (GMD)", + }, + { + value: "GNF", + label: "Guinean Franc (GNF)", + }, + { + value: "GTQ", + label: "Guatemalan Quetzal (GTQ)", + }, + { + value: "GYD", + label: "Guyanese Dollar (GYD)", + }, + { + value: "HKD", + label: "Hong Kong Dollar (HKD)", + }, + { + value: "HNL", + label: "Honduran Lempira (HNL)", + }, + { + value: "HTG", + label: "Haitian Gourde (HTG)", + }, + { + value: "HUF", + label: "Hungarian Forint (HUF)", + }, + { + value: "IDR", + label: "Indonesian Rupiah (IDR)", + }, + { + value: "ILS", + label: "Israeli New Sheqel (ILS)", + }, + { + value: "INR", + label: "Indian Rupee (INR)", + }, + { + value: "IQD", + label: "Iraqi Dinar (IQD)", + }, + { + value: "IRR", + label: "Iranian Rial (IRR)", + }, + { + value: "ISK", + label: "Icelandic Kr\xf3na (ISK)", + }, + { + value: "JMD", + label: "Jamaican Dollar (JMD)", + }, + { + value: "JOD", + label: "Jordanian Dinar (JOD)", + }, + { + value: "JPY", + label: "Japanese Yen (JPY)", + }, + { + value: "KES", + label: "Kenyan Shilling (KES)", + }, + { + value: "KGS", + label: "Kyrgyzstani Som (KGS)", + }, + { + value: "KHR", + label: "Cambodian Riel (KHR)", + }, + { + value: "KMF", + label: "Comorian Franc (KMF)", + }, + { + value: "KPW", + label: "North Korean Won (KPW)", + }, + { + value: "KRW", + label: "South Korean Won (KRW)", + }, + { + value: "KWD", + label: "Kuwaiti Dinar (KWD)", + }, + { + value: "KYD", + label: "Cayman Islands Dollar (KYD)", + }, + { + value: "KZT", + label: "Kazakhstani Tenge (KZT)", + }, + { + value: "LAK", + label: "Lao Kip (LAK)", + }, + { + value: "LBP", + label: "Lebanese Pound (LBP)", + }, + { + value: "LKR", + label: "Sri Lankan Rupee (LKR)", + }, + { + value: "LRD", + label: "Liberian Dollar (LRD)", + }, + { + value: "LSL", + label: "Lesotho Loti (LSL)", + }, + { + value: "LYD", + label: "Libyan Dinar (LYD)", + }, + { + value: "MAD", + label: "Moroccan Dirham (MAD)", + }, + { + value: "MDL", + label: "Moldovan Leu (MDL)", + }, + { + value: "MGA", + label: "Malagasy Ariary (MGA)", + }, + { + value: "MKD", + label: "Macedonian Denar (MKD)", + }, + { + value: "MMK", + label: "Myanmar Kyat (MMK)", + }, + { + value: "MNT", + label: "Mongolian T\xf6gr\xf6g (MNT)", + }, + { + value: "MOP", + label: "Macanese Pataca (MOP)", + }, + { + value: "MRU", + label: "Mauritanian Ouguiya (MRU)", + }, + { + value: "MUR", + label: "Mauritian Rupee (MUR)", + }, + { + value: "MVR", + label: "Maldivian Rufiyaa (MVR)", + }, + { + value: "MWK", + label: "Malawian Kwacha (MWK)", + }, + { + value: "MXN", + label: "Mexican Peso (MXN)", + }, + { + value: "MYR", + label: "Malaysian Ringgit (MYR)", + }, + { + value: "MZN", + label: "Mozambican Metical (MZN)", + }, + { + value: "NAD", + label: "Namibian Dollar (NAD)", + }, + { + value: "NGN", + label: "Nigerian Naira (NGN)", + }, + { + value: "NIO", + label: "Nicaraguan C\xf3rdoba (NIO)", + }, + { + value: "NOK", + label: "Norwegian Krone (NOK)", + }, + { + value: "NPR", + label: "Nepalese Rupee (NPR)", + }, + { + value: "NZD", + label: "New Zealand Dollar (NZD)", + }, + { + value: "OMR", + label: "Omani Rial (OMR)", + }, + { + value: "PAB", + label: "Panamanian Balboa (PAB)", + }, + { + value: "PEN", + label: "Peruvian Sol (PEN)", + }, + { + value: "PGK", + label: "Papua New Guinean Kina (PGK)", + }, + { + value: "PHP", + label: "Philippine Peso (PHP)", + }, + { + value: "PKR", + label: "Pakistani Rupee (PKR)", + }, + { + value: "PLN", + label: "Polish Z\u0142oty (PLN)", + }, + { + value: "PYG", + label: "Paraguayan Guaran\xed (PYG)", + }, + { + value: "QAR", + label: "Qatari Riyal (QAR)", + }, + { + value: "RON", + label: "Romanian Leu (RON)", + }, + { + value: "RSD", + label: "Serbian Dinar (RSD)", + }, + { + value: "RUB", + label: "Russian Ruble (RUB)", + }, + { + value: "RWF", + label: "Rwandan Franc (RWF)", + }, + { + value: "SAR", + label: "Saudi Riyal (SAR)", + }, + { + value: "SBD", + label: "Solomon Islands Dollar (SBD)", + }, + { + value: "SCR", + label: "Seychellois Rupee (SCR)", + }, + { + value: "SDG", + label: "Sudanese Pound (SDG)", + }, + { + value: "SEK", + label: "Swedish Krona (SEK)", + }, + { + value: "SGD", + label: "Singapore Dollar (SGD)", + }, + { + value: "SHP", + label: "Saint Helenian Pound (SHP)", + }, + { + value: "SKK", + label: "Slovak Koruna (SKK)", + }, + { + value: "SLL", + label: "Sierra Leonean Leone (SLL)", + }, + { + value: "SOS", + label: "Somali Shilling (SOS)", + }, + { + value: "SRD", + label: "Surinamese Dollar (SRD)", + }, + { + value: "SSP", + label: "South Sudanese Pound (SSP)", + }, + { + value: "STD", + label: "S\xe3o Tom\xe9 and Pr\xedncipe Dobra (STD)", + }, + { + value: "SVC", + label: "Salvadoran Col\xf3n (SVC)", + }, + { + value: "SYP", + label: "Syrian Pound (SYP)", + }, + { + value: "SZL", + label: "Swazi Lilangeni (SZL)", + }, + { + value: "THB", + label: "Thai Baht (THB)", + }, + { + value: "TJS", + label: "Tajikistani Somoni (TJS)", + }, + { + value: "TMT", + label: "Turkmenistani Manat (TMT)", + }, + { + value: "TND", + label: "Tunisian Dinar (TND)", + }, + { + value: "TOP", + label: "Tongan Pa\u02bbanga (TOP)", + }, + { + value: "TRY", + label: "Turkish Lira (TRY)", + }, + { + value: "TTD", + label: "Trinidad and Tobago Dollar (TTD)", + }, + { + value: "TWD", + label: "New Taiwan Dollar (TWD)", + }, + { + value: "TZS", + label: "Tanzanian Shilling (TZS)", + }, + { + value: "UAH", + label: "Ukrainian Hryvnia (UAH)", + }, + { + value: "UGX", + label: "Ugandan Shilling (UGX)", + }, + { + value: "USD", + label: "United States Dollar (USD)", + }, + { + value: "UYU", + label: "Uruguayan Peso (UYU)", + }, + { + value: "UZS", + label: "Uzbekistan Som (UZS)", + }, + { + value: "VES", + label: "Venezuelan Bol\xedvar Soberano (VES)", + }, + { + value: "VND", + label: "Vietnamese \u0110\u1ed3ng (VND)", + }, + { + value: "VUV", + label: "Vanuatu Vatu (VUV)", + }, + { + value: "WST", + label: "Samoan Tala (WST)", + }, + { + value: "XAF", + label: "Central African Cfa Franc (XAF)", + }, + { + value: "XAG", + label: "Silver (Troy Ounce) (XAG)", + }, + { + value: "XAU", + label: "Gold (Troy Ounce) (XAU)", + }, + { + value: "XBA", + label: "European Composite Unit (XBA)", + }, + { + value: "XBB", + label: "European Monetary Unit (XBB)", + }, + { + value: "XBC", + label: "European Unit of Account 9 (XBC)", + }, + { + value: "XBD", + label: "European Unit of Account 17 (XBD)", + }, + { + value: "XCD", + label: "East Caribbean Dollar (XCD)", + }, + { + value: "XDR", + label: "Special Drawing Rights (XDR)", + }, + { + value: "XOF", + label: "West African Cfa Franc (XOF)", + }, + { + value: "XPD", + label: "Palladium (XPD)", + }, + { + value: "XPF", + label: "Cfp Franc (XPF)", + }, + { + value: "XPT", + label: "Platinum (XPT)", + }, + { + value: "XTS", + label: "Codes specifically reserved for testing purposes (XTS)", + }, + { + value: "YER", + label: "Yemeni Rial (YER)", + }, + { + value: "ZAR", + label: "South African Rand (ZAR)", + }, + { + value: "ZMW", + label: "Zambian Kwacha (ZMW)", + }, + { + value: "EEK", + label: "Estonian Kroon (EEK)", + }, + { + value: "LTL", + label: "Lithuanian Litas (LTL)", + }, + { + value: "LVL", + label: "Latvian Lats (LVL)", + }, + { + value: "MRO", + label: "Mauritanian Ouguiya (MRO)", + }, + { + value: "MTL", + label: "Maltese Lira (MTL)", + }, + { + value: "ZWL", + label: "Zimbabwean Dollar (ZWL)", + }, + { + value: "VEF", + label: "Venezuelan Bol\xedvar (VEF)", + }, +]; diff --git a/components/smartymeet/common/utils.mjs b/components/smartymeet/common/utils.mjs new file mode 100644 index 0000000000000..dcc9cc61f6f41 --- /dev/null +++ b/components/smartymeet/common/utils.mjs @@ -0,0 +1,24 @@ +export const parseObject = (obj) => { + if (!obj) return undefined; + + 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; +}; diff --git a/components/smartymeet/package.json b/components/smartymeet/package.json index 5de65bb78405a..844bc56a64994 100644 --- a/components/smartymeet/package.json +++ b/components/smartymeet/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/smartymeet", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream SmartyMeet Components", "main": "smartymeet.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.0.0" } } diff --git a/components/smartymeet/smartymeet.app.mjs b/components/smartymeet/smartymeet.app.mjs index f66cc71601150..5c8596d6c8fb0 100644 --- a/components/smartymeet/smartymeet.app.mjs +++ b/components/smartymeet/smartymeet.app.mjs @@ -4,10 +4,65 @@ export default { type: "app", app: "smartymeet", propDefinitions: { + jobId: { + type: "string", + label: "Job Id", + description: "The Id of the job.", + async options({ page }) { + const data = await this.listJobs({ + params: { + pageNumber: page + 1, + }, + }); + + return data.map(({ + shardId, jobId, title: label, + }) => ({ + label, + value: `${shardId}:${jobId}`, + })); + }, + }, + talentId: { + type: "string", + label: "Talent Id", + description: "The Id of the talent.", + async options({ page }) { + const { data } = await this.listTalents({ + params: { + pageNumber: page + 1, + }, + }); + + return data.map(({ + id: value, attributes: { name: label }, + }) => ({ + label, + value, + })); + }, + }, candidateId: { type: "string", - label: "Candidate ID", - description: "The ID of the candidate", + label: "Candidate Id", + description: "The Id of the candidate.", + async options({ + page, jobId, + }) { + const data = await this.listCandidates({ + jobId, + params: { + pageNumber: page + 1, + }, + }); + + return data.map(({ + shardId, contactId, firstName, lastName, + }) => ({ + label: `${firstName} ${lastName}`, + value: `${shardId}:${contactId}`, + })); + }, }, reportType: { type: "string", @@ -67,27 +122,48 @@ export default { }, }, methods: { - authKeys() { - console.log(Object.keys(this.$auth)); - }, _baseUrl() { - return "https://api.smartymeet.com"; - }, - async _makeRequest(opts = {}) { - const { - $ = this, method = "GET", path = "/", headers, ...otherOpts - } = opts; - return axios($, { - ...otherOpts, - method, + return `${this.$auth.server}`; + }, + _headers() { + return { + Authorization: `${this.$auth.api_key}`, + }; + }, + _makeRequest({ + $ = this, path, ...opts + }) { + const config = { + ...opts, url: this._baseUrl() + path, - headers: { - ...headers, - Authorization: `Bearer ${this.$auth.api_token}`, - }, + headers: this._headers(), + }; + console.log("config: ", config); + + return axios($, config); + }, + listJobs(opts = {}) { + return this._makeRequest({ + path: "/jobs", + ...opts, }); }, - async emitNewCandidateAnalysisReport({ + listCandidates({ + jobId, ...opts + }) { + return this._makeRequest({ + path: `/jobs/${jobId}/candidates`, + ...opts, + }); + }, + listTalents(opts = {}) { + return this._makeRequest({ + path: "/talents", + ...opts, + }); + }, + + emitNewCandidateAnalysisReport({ candidateId, reportType, }) { return this._makeRequest({ @@ -98,21 +174,14 @@ export default { }, }); }, - async generateNewJob({ - jobTitle, jobDescription, jobLocation, jobSalary, - }) { + createJob(opts = {}) { return this._makeRequest({ method: "POST", path: "/jobs", - data: { - jobTitle, - jobDescription, - jobLocation, - jobSalary, - }, + ...opts, }); }, - async retrieveCandidateAnalysis({ + retrieveCandidateAnalysis({ candidateId, analysisType, }) { return this._makeRequest({ @@ -123,21 +192,11 @@ export default { }, }); }, - async createNewCandidateProfile({ - candidateName, - candidateContacts, - candidateLinks, - candidateResume, - }) { + createCandidate(opts = {}) { return this._makeRequest({ method: "POST", path: "/candidates", - data: { - candidateName, - candidateContacts, - candidateLinks, - candidateResume, - }, + ...opts, }); }, }, diff --git a/components/smartymeet/sources/new-candidate-analysis-ready-instant/new-candidate-analysis-ready-instant.mjs b/components/smartymeet/sources/new-candidate-analysis-ready-instant/new-candidate-analysis-ready-instant.mjs index ccb23c50ba65d..163700694debb 100644 --- a/components/smartymeet/sources/new-candidate-analysis-ready-instant/new-candidate-analysis-ready-instant.mjs +++ b/components/smartymeet/sources/new-candidate-analysis-ready-instant/new-candidate-analysis-ready-instant.mjs @@ -1,6 +1,5 @@ -import smartymeet from "../../smartymeet.app.mjs"; import crypto from "crypto"; -import { axios } from "@pipedream/platform"; +import smartymeet from "../../smartymeet.app.mjs"; export default { key: "smartymeet-new-candidate-analysis-ready-instant", From 8912a4414c20abaa9ba4c67442677c46bd7bba1b Mon Sep 17 00:00:00 2001 From: Luan Cazarine Date: Wed, 3 Jul 2024 18:29:48 -0300 Subject: [PATCH 3/3] pnpm update --- pnpm-lock.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 1accd6b50ab0e..4c66881862bb3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8396,7 +8396,10 @@ importers: specifiers: {} components/smartymeet: - specifiers: {} + specifiers: + '@pipedream/platform': ^3.0.0 + dependencies: + '@pipedream/platform': 3.0.0 components/smiirl: specifiers: @@ -16237,8 +16240,6 @@ packages: - debug dev: false -<<<<<<< HEAD -======= /@pipedream/snowflake-sdk/1.0.8_asn1.js@5.4.1: resolution: {integrity: sha512-/nLCQNjlSCz71MUnOUZqWmnjZTbEX7mie91mstPspb8uDG/GvaDk/RynLGhhYfgEP5d1KWj+OPaI71hmPSxReg==} dependencies: @@ -16250,7 +16251,6 @@ packages: - supports-color dev: false ->>>>>>> origin/master /@pipedream/types/0.0.5: resolution: {integrity: sha512-VVQB9j+94XG/EB7fzKA1t0McQcQIPhaireePeLRTlJIN4y5W59SJjERjW4h5l7zWIfTnwpLizk3qGholyiw1Vw==} dependencies: