This first section is what Paradox most likely needs to update. The "Version 2 to Version 3" section is the full reference guide.
Updates are still being made, so this command may need to be run again later
yarn upgrade traitify-widgets@alpha
// Old
Traitify.setHost("https://api.traitify.com");
Traitify.setPubliCKey("Your Traitify public key");
// New
Traitify.http.authKey = "Your Traitify public key";
Traitify.http.host = "https://api.traitify.com";
// Old
assessment = traitify.ui.component();
assessment.assessmentID("an assessment id you have generated via a server side client");
assessment.target("#the-id-of-the-target-you-wish-to-render-to");
assessment.render();
// New
Traitify.options.assessmentID = "your-assessment-id";
Traitify.render("#the-id-of-the-target-you-wish-to-render-to");
When using a benchmark
Traitify.options.benchmarkID = "your-benchmark-id";
Traitify.options.profileID = "your-profile-id";
// Old
assessment.locale("es-us");
Traitify.ui.setLocale("es-us");
// New
Traitify.options.locale = "es-us";
Traitify.updateLocale("es-us"); // Needed if widget is already rendered
// Old
assessment.perspective("thirdPerson");
assessment.view("manager");
// New
Traitify.options.report = "manager";
- Remove
.theme("paradox")
- Options have changed from functions (
benchmarkID(id)
) to an object (.options.benchmarkID = id
) - Some options have been rename from allow* to show*
- allow is for actions (back, fullscreen)
- show is for content (headers, instructions)
- SlideDeck has been renamed Survey
- Guide has been split into Guide.Client and Guide.Personality
- Various helper objects have been exposed
- Components
- GraphQL
- http
- hooks
- i18n
- listener
<!-- Old -->
<script src="https://cdn.traitify.com/js/v2/traitify.js"></script>
<!-- New -->
<script src="https://cdn.traitify.com/js/v3/traitify.js"></script>
npm i --save traitify-widgets@latest
npm i --save traitify-widgets@2 // To continue to use the old version
npm i --save traitify-widgets@alpha
// Old
Traitify.setHost("https://api.traitify.com");
Traitify.setPubliCKey("Your Traitify public key");
// New
Traitify.http.authKey = "Your Traitify public key";
Traitify.http.host = "https://api.traitify.com";
- Components used directly must be wrapped by a new Container component
- The Container will manage the options and state as well as fetch data
- The Container can wrap multiple components
- Container accepts these props
- assessmentID
- authKey
- benchmarkID
- graphql
- host
- locale
- options
- profileID
- version
// Old
import {Components} from "traitify-widgets";
export default function Personality({id}) {
return <Components.Results assessmentID={id} />;
}
// New
import {Components} from "traitify-widgets";
export default function Personality({id}) {
return (
<Components.Container assessmentID={id}>
<Components.Results />
</Components.Container>
);
}
// Old
assessment = traitify.ui.component();
assessment.assessmentID("an assessment id you have generated via a server side client");
assessment.target("#the-id-of-the-target-you-wish-to-render-to");
assessment.render();
// New
Traitify.options.assessmentID = "an assessment id you have generated via a server side client";
Traitify.render("#the-id-of-the-target-you-wish-to-render-to");
Some disabled components have been changed/renamed
// Old
Traitify.ui.options.disabledComponents = [
"InterviewGuide",
"PersonalityDimensionColumns"
];
// New
Traitify.options.disabledComponents = [
"Guide",
"PersonalityDimensionChart"
];
// Old
assessment.locale("nl-nl");
Traitify.ui.setLocale("es-us");
// New
Traitify.options.locale = "es-us";
Traitify.updateLocale("en-us");
// Old
Traitify.ui.options.careerOptions = {};
Traitify.ui.options.slideDeck = {};
// New
Traitify.options.career = {};
Traitify.options.survey = {};
// Old
assessment.perspective("thirdPerson");
assessment.view("manager");
// New
Traitify.options.report = "manager";
Components are now nested. Most will be found under Results.Personality
// Old
assessment.targets({
"Careers": "#careers",
"Guide": "#guide",
"SlideDeck": "#slide-deck",
"PersonalityTraits": "#personality-traits",
"PersonalityTypes": "#personality-types",
"Results": "#results"
});
assessment.render();
// New
Traitify.render({
"Careers": "#careers",
"Results": "#results",
"Results.Career.Container": "#careers",
"Results.Guide.Personality": "#guide",
"Results.Personality.Type.List": "#personality-types",
"Results.Personality.Trait.List": "#personality-traits",
"Survey": "#survey"
});
// Old
assessment.on("SlideDeck.Initialized", function(){
console.log("SlideDeck.Initialized");
});
assessment.on("SlideDeck.UpdateSlide", function(event, slideResponse){
console.log("SlideDeck.UpdateSlide", slideResponse);
});
assessment.on("SlideDeck.Finished", function(){
console.log("SlideDeck.Finished");
});
// New
Traitify.listener.on("Survey.initialized", () => {
console.log("Survey.initialized");
});
Traitify.listener.on("Survey.updated", () => {
console.log("Survey.updated");
});
Traitify.listener.on("Survey.updateSlide", ({response}) => {
console.log("Survey.finished", response);
});
Traitify.listener.on("Surveys.finished", (surveys) => {
console.log("Surveys.finished", surveys);
});
- callback having context.customContent (was available for career components)
- Traitify.options.theme => paradox is now the only theme
- Traitify.ui (use Traitify directly)