This page is not yet translated into this language.

SDK

Esta es la forma más sencilla de añadir D’Anchiano a tu plataforma, solo tendrás que incluir unas cuantas líneas de código y configurar en tu panel de administración de la API el dominio desde el que harás la integración.

Terminal
$npm i danchiano-sdk
JSX
1import { useEffect } from 'react' 2import { renderMarket } from 'danchiano-sdk' 3 4export default function Market() { 5 useEffect(() => { 6 renderMarket({ 7 selector: '#danchiano-sdk', 8 clientId: 'CLIENT_ID', 9 appUrl: 'URL_FRONTEND',10 })11 }, [])12 13 return <div id="danchiano-sdk" />14}

Métodos disponibles

A la derecha listamos los métodos disponibles del SDK.

Debajo listamos los parámetros y los métodos que les puedes pasar.

ParámetroDescripción
clientIdId del cliente
userTokenToken de acceso del profesional o empresa
localeIdioma es-ES, ca-ES, en-US, pt-BR, it-IT
selectorSelector donde se renderizará la interfaz de D’Anchiano
customizeOpciones para personalizar la interfaz
applicantData renderApplicantDatos del profesional a crear
companyData renderCompanyDatos de la empresa a crear
jobData renderJobDatos del puesto a crear
profilesPerfiles a mostrar en el informe
callbackFunción a ejecutar cuando ocurra una determinada acción (creación de un profesional, carga de un informe, entre otros). Más detalles
JavaScript
1init: ({ clientId, userToken, locale }) 2render: ({ selector, customize, callback }) 3renderApplicant: ({ selector, applicantData, profiles, customize, callback }) 4renderCompany: ({ selector, companyData, customize, callback }) 5renderJob: ({ selector, jobId = null, jobData, customize, callback }) 6renderReport: ({ selector, profiles, customize, callback }) 7renderMarket: ({ selector, profiles, customize, callback })

Objeto customize

JavaScript
1{ 2 accentColor: '#3ca', 3 primaryFont: 'Montserrat, sans-serif', 4 secondaryFont: 'Lato, sans-serif', 5 loginUrl: null, 6 blockLogo: false, 7 blockReportDescription: false, 8 defaultReportPage: 'detailed', // resume | detailed 9 darkMode: false, // true | false | null (null = autodetects from browser)10 taskColor: '#0bd',11 peopleColor: '#9c5',12 contextColor: '#fc4',13 compareColor: '#f60',14 positioningColor: '#4b9faa',15 primaryErrorColor: '#e42',16 secondaryErrorColor: '#EC5990',17 tourColor: '#357cf0',18 doneColor: '#25C133',19}

Objeto applicantData

JavaScript
1{ 2 // Register info 3 email: string().email().required(), 4 password: string(), 5 peopleInCharge: boolean(), 6 // Personal info 7 image: string(), 8 firstname: string(), 9 lastname: string(),10 birthdate: string(),11 sex: string().matches(/male|female|neutral/),12 country: string(),13 province: string(),14 city: string(),15 cp: string().nullable(),16 // Job info17 company: string(),18 job: string(),19 employees: number().integer().min(0).max(8),20 educationalLevel: number().integer().min(0).max(6),21 level: number().integer().min(0).max(5),22 function: number().integer().min(0).max(34),23 sector: number().integer().min(0).max(147),24}

Objeto companyData

JavaScript
1{ 2 // Register info 3 email: string().email().required(), 4 password: string(), 5 // Company info 6 image: string(), 7 name: string(), 8 nif: string(), 9 employees: number().integer().min(0).max(8),10 sector: number().integer().min(0).max(147),11 country: string(),12 province: string(),13 city: string(),14 cp: string().nullable(),15 address: string(),16 // Contact info17 contactFirstname: string(),18 contactLastname: string(),19 contactPhone: string(),20}

Objeto jobData

JavaScript
1{ 2 name: string(), 3 educationalLevel: number().integer().min(0).max(6), 4 level: number().integer().min(0).max(5), 5 function: number().integer().min(0).max(34), 6 sector: number().integer().min(0).max(147), 7 country: string(), 8 province: string(), 9 city: string(),10 cp: string().nullable(),11 peopleInCharge: boolean(),12 // Infer profile (for external profiles):13 site: string().matches(/universal|linkedin|infojobs|buscojobs|manpower|randstad|tecnoempleo|talentclue/),14 name: string(),15 levelText: string(),16 functionText: string(),17 sectorText: string(),18}

Objeto profiles

JavaScript
1{ 2 first: { 3 id: number().integer(), 4 type: string().matches(/market|market_applicant|market_job|applicant|job|team/), 5 sex: string().matches(/male|female|neutral/), 6 ageMin: number().integer().min(0).max(120), 7 ageMax: number().integer().min(0).max(120), 8 peopleInCharge: boolean(), 9 level: array().of(number().integer().min(0).max(5)),10 function: array().of(number().integer().min(0).max(34)),11 sector: array().of(number().integer().min(0).max(147)),12 employees: array().of(number().integer().min(0).max(8)),13 educationalLevel: array().of(number().integer().min(0).max(6)),14 country: array().of(string()),15 // Infer profile (for external profiles):16 site: string().matches(/universal|linkedin|infojobs|buscojobs|manpower|randstad|tecnoempleo|talentclue/),17 name: string(),18 levelText: string(),19 functionText: string(),20 sectorText: string(),21 },22 second: {23 id: number().integer(),24 type: string().matches(/market|market_applicant|market_job|applicant|job|team/),25 sex: string().matches(/male|female|neutral/),26 ageMin: number().integer().min(0).max(120),27 ageMax: number().integer().min(0).max(120),28 peopleInCharge: boolean(),29 level: array().of(number().integer().min(0).max(5)),30 function: array().of(number().integer().min(0).max(34)),31 sector: array().of(number().integer().min(0).max(147)),32 employees: array().of(number().integer().min(0).max(8)),33 educationalLevel: array().of(number().integer().min(0).max(6)),34 country: array().of(string()),35 // Infer profile (for external profiles):36 site: string().matches(/universal|linkedin|infojobs|buscojobs|manpower|randstad|tecnoempleo|talentclue/),37 name: string(),38 levelText: string(),39 functionText: string(),40 sectorText: string(),41 },42 selected: string().matches(/first|second|compare/).default('first'),43 type: string().matches(/competences|values|personality/).default('competences'),44}

Tipos de callback

ts
1type Callback = { 2 action: 'registerApplicant' | 'registerCompany' | 'companyPostJob' | 'getReport' 3 applicantId?: number 4 companyId?: number 5 jobId?: number 6 profiles?: Profiles 7}

Obtener token del usuario

Terminal
$curl URL_API/api/v1/users/APPLICANT_ID/token \> -u CLIENT_SECRET

Este token te permitirá iniciar la sesión de un usuario en la SDK. Si el token no existe o ha expirado generará uno nuevo. Expira en 24 horas.

Puedes forzar la generación de nuevo token añadiendo ?refresh a la petición.

Last updated on Jan 4, 2020.