traitify-widgets 1.12.22 → 3.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,15 +7,13 @@ The widgets can be installed through our CDN or npm. Usage through the CDN will
7
7
  ### CDN
8
8
 
9
9
  ```
10
- <script src="https://cdn.traitify.com/js/v2/traitify.js"></script>
10
+ <script src="https://cdn.traitify.com/js/v3/traitify.js"></script>
11
11
  <script>
12
- Traitify.setHost("your host url");
13
- Traitify.setPublicKey("your public key");
12
+ Traitify.http.authKey = "Your Traitify public key";
13
+ Traitify.http.host = "https://api.traitify.com";
14
14
 
15
- assessment = Traitify.ui.component();
16
- assessment.assessmentID("an assessment id you have generated via a server side client");
17
- assessment.target("#the-id-of-the-target-you-wish-to-render-to");
18
- assessment.render();
15
+ Traitify.options.assessmentID = "an assessment id you have generated via a server side client";
16
+ Traitify.render("#the-id-of-the-target-you-wish-to-render-to");
19
17
  </script>
20
18
  ```
21
19
 
@@ -32,209 +30,82 @@ npm i --save traitify-widgets
32
30
  ```
33
31
  import traitify from "traitify-widgets";
34
32
 
35
- assessment = traitify.ui.component();
36
- assessment.assessmentID("an assessment id you have generated via a server side client");
37
- assessment.target("#the-id-of-the-target-you-wish-to-render-to");
38
- assessment.render();
33
+ traitify.options.assessmentID = "an assessment id you have generated via a server side client";
34
+ traitify.render("#the-id-of-the-target-you-wish-to-render-to");
39
35
  ```
40
36
 
41
- [Click here](src/index.js) to view other classes available to import, such as the `TraitifyClient`.
37
+ [Click here](src/index.js) to view other classes available to import, such as the `Http`.
42
38
 
43
39
  ## Rendering Components
44
40
 
45
- ### All Decks
41
+ [Click here](src/components/index.js) to view available to components, such as the `Results.Personality.Type.List`.
46
42
 
47
- #### SlideDeck
43
+ #### Survey
48
44
 
49
45
  ```
50
- assessment.render("SlideDeck"); // Render just the SlideDeck in the target element
46
+ Traitify.render({Survey: "#dom-id"}); // Render just the Survey in the target element
51
47
  ```
52
48
 
53
49
  #### Results
54
50
 
55
51
  ```
56
- assessment.render("Results"); // Render just the Results in the target element
52
+ Traitify.render({Results: "#dom-id"}); // Render just the Results in the target element
57
53
  ```
58
54
 
59
- #### Personality Types/Dimensions
60
-
61
- ```
62
- assessment.render("PersonalityTypes"); // Render just the Type/Dimensions in the target element
63
- ```
64
-
65
- #### Personality Traits
66
-
67
- ```
68
- assessment.render("PersonalityTraits"); // Render just the Traits in the target element
69
- ```
70
-
71
- #### Personality Details
72
-
73
- ```
74
- assessment.render("PersonalityDetails"); // Render just the details in the target element
75
- ```
76
-
77
- ### Type Based Decks (ex. career-deck, core, heroes)
78
-
79
- #### Personality Blend
80
-
81
- ```
82
- assessment.render("PersonalityBlend"); // Render just the Blend in the target element
83
- ```
84
-
85
- ### Careers Deck Components (career-deck)
86
-
87
- #### Render All Career Components
88
-
89
- ```
90
- assessment.render("Careers"); // Render all the career components
91
- ```
92
-
93
- #### Specific Career Components
94
-
95
- #### Career Filter
96
-
97
- ```
98
- assessment.render("CareerFilter"); // Render the career filter
99
- ```
100
-
101
- #### Career Results
102
-
103
- ```
104
- assessment.render("CareerResults"); // Render the career list
105
- ```
106
-
107
- #### Career Modal
108
-
109
- ```
110
- assessment.render("CareerModal"); // Render the career modal
111
- ```
112
-
113
- ### Additional Career Component Customizations
114
-
115
- #### Add content to the Career Filter
116
-
117
- ```
118
- // Add content to the career filter
119
- Traitify.ui.on("CareerFilter.updated", function(context){
120
- context.customContent.appendChild(document.createTextNode("I am custom content"));
121
- });
122
- ```
123
-
124
- #### Add content to the Career Modal
125
-
126
- ```
127
- // Add content to the career modal
128
- Traitify.ui.on("CareerModal.updated", function(context){
129
- if(!context.customContent){ return; }
130
- context.customContent.appendChild(document.createTextNode("I am custom content"));
131
- });
132
- ```
133
-
134
- #### Trigger a refresh of the career results with different params
135
-
136
- ```
137
- // Update parameters and re-request careers
138
- Traitify.ui.trigger("Careers.mergeParams", this, {experienceLevels: [4, 5], page: 1});
139
- ```
55
+ ### Career Component Customizations
140
56
 
141
57
  #### Get your careers from a different endpoint
142
58
 
143
59
  This is useful if you want to get the career results server side and modify the data returned or just want to proxy through your own server.
144
60
 
145
61
  ```
146
- Traitify.ui.options.careerOptions.path = "/my-career-endpoint";
62
+ Traitify.options.career.path = "/my-career-endpoint";
147
63
  ```
148
64
 
149
65
  #### Change which experience levels are in the filter
150
66
 
151
67
  ```
152
- Traitify.ui.options.careerOptions.experienceLevels = [4, 5];
68
+ Traitify.options.career.experienceLevels = [4, 5];
153
69
  ```
154
70
 
155
71
  #### Change how many results to show per page
156
72
 
157
73
  ```
158
- Traitify.ui.options.careerOptions.perPage = 10;
159
- ```
160
-
161
- ### Dimension Based Decks (big-five)
162
-
163
- #### Radar Graph
164
-
165
- ```
166
- assessment.render("Radar"); // Render just the Radar graph in the target element
167
- ```
168
-
169
- #### Personality Heading
170
-
171
- ```
172
- assessment.render("PersonalityHeading"); // Render just the archetype in the target element
173
- ```
174
-
175
- ### Interview Guide
176
-
177
- #### Interview questions for big-five assessments
178
-
179
- ```
180
- assessment.render("Guide"); // Given an assessmentID with results, render just the Interview in the target element
74
+ Traitify.options.career.perPage = 10;
181
75
  ```
182
76
 
183
77
  ### Render multiple components in specific elements
184
78
 
185
79
  ```
186
- assessment.targets({
187
- "SlideDeck": "#slide-deck",
188
- "PersonalityTypes": "#personality-types",
189
- "PersonalityTraits": "#personality-traits",
80
+ Traitify.render({
81
+ "Survey": "#survey",
190
82
  "Results": "#results",
191
- "Careers": "#careers",
192
- "Guide": "#guide",
83
+ "Results.Career.Container": "#careers",
84
+ "Results.Guide": "#guide",
85
+ "Results.Personality.Type.List": "#personality-types",
86
+ "Results.Personality.Trait.List": "#personality-traits"
193
87
  });
194
-
195
- assessment.render();
196
88
  ```
197
89
 
198
90
  ## Events
199
91
 
200
- ```
201
- // Event handlers must be set before the render command, or they will not be called.
202
- assessment.on("SlideDeck.Finished", function(){
203
- console.log("SlideDeck.Finished");
204
- });
205
-
206
- assessment.on("SlideDeck.Initialized", function(){
207
- console.log("SlideDeck.Initialized");
208
- });
209
-
210
- assessment.on("SlideDeck.IsReady", function(){
211
- console.log("SlideDeck.IsReady");
212
- });
213
-
214
- assessment.on("SlideDeck.UpdateSlide", function(event, slideResponse){
215
- console.log("SlideDeck.UpdateSlide");
216
- console.log(slideResponse);
217
- });
218
-
219
- assessment.on("SlideDeck.BackSlide", function(){
220
- console.log("SlideDeck.BackSlide");
221
- });
92
+ Most components trigger an initialized and updated event. Some components offer additional events. Event handlers must be set before the render command, or they will not be called.
222
93
 
223
- assessment.on("SlideDeck.Fullscreen", function(event, isFullScreen){
224
- console.log("SlideDeck.Fullscreen");
225
- console.log(isFullScreen);
94
+ ```
95
+ Traitify.listener.on("Survey.initialized", () => {
96
+ console.log("Survey.initialized");
226
97
  });
227
98
 
228
- assessment.on("Results.Initialized", function(){
229
- console.log("Results.Initialized");
99
+ Traitify.listener.on("Survey.updated", () => {
100
+ console.log("Survey.updated");
230
101
  });
231
102
 
232
- assessment.on("PersonalityTypes.Initialized", function(){
233
- console.log("PersonalityTypes.Initialized");
103
+ Traitify.listener.on("Survey.updateSlide", ({response}) => {
104
+ console.log("Survey.finished", response);
234
105
  });
235
106
 
236
- assessment.on("PersonalityTraits.Initialized", function(){
237
- console.log("PersonalityTraits.Initialized");
107
+ Traitify.listener.on("Survey.finished", ({response}) => {
108
+ console.log("Survey.finished", response);
238
109
  });
239
110
  ```
240
111
 
@@ -243,15 +114,7 @@ assessment.on("PersonalityTraits.Initialized", function(){
243
114
  ### Internationalization Options
244
115
 
245
116
  ```
246
- // Set globally
247
- Traitify.ui.setLocale("es-us");
248
- ```
249
-
250
- or
251
-
252
- ```
253
- // Set just for the instance of the widget
254
- assessment.locale("nl-nl");
117
+ Traitify.options.locale = "en-us";
255
118
  ```
256
119
 
257
120
  Here is a list of the available locales (`en-us` is the default):
@@ -271,19 +134,19 @@ Here is a list of the available locales (`en-us` is the default):
271
134
  ### Render a back button to allow users to change answers during the test
272
135
 
273
136
  ```
274
- assessment.allowBack();
137
+ Traitify.options.survey.allowBack = true;
275
138
  ```
276
139
 
277
140
  ### Allow the user to click a button to go full screen
278
141
 
279
142
  ```
280
- assessment.allowFullscreen();
143
+ Traitify.options.survey.allowFullscreen = true;
281
144
  ```
282
145
 
283
146
  ### Allow the user to view section results section headers
284
147
 
285
148
  ```
286
- assessment.allowHeaders();
149
+ Traitify.options.showHeaders = true;
287
150
  ```
288
151
 
289
152
  ### Render results using specific perspective
@@ -291,56 +154,53 @@ assessment.allowHeaders();
291
154
  \* currently only the `big-five` assessment has perspective content
292
155
 
293
156
  ```
294
- assessment.perspective("firstPerson");
157
+ Traitify.options.perspective = "firstPerson";
295
158
 
296
159
  OR
297
160
 
298
- assessment.perspective("thirdPerson");
161
+ Traitify.options.perspective = "thirdPerson";
299
162
  ```
300
163
 
301
164
  ## Reports
302
165
 
303
- Set the perspective and view options to display our Big Five Personality Reports.
304
-
305
166
  ### Big Five Hiring Manager Report
306
167
 
307
168
  ```
308
- assessment.perspective("thirdPerson");
309
- assessment.view("manager");
169
+ Traitify.options.report = "manager";
310
170
  ```
311
171
 
312
172
  This report also makes use of a benchmark/recommendation. It will default to the benchmark used to create an assessment. To use a different benchmark, you can pass the ID as an option.
313
173
 
314
174
  ```
315
- assessment.benchmarkID(benchmarkID);
175
+ Traitify.options.benchmarkID = benchmarkID;
316
176
  ```
317
177
 
318
178
  ### Big Five Candidate Report
319
179
 
320
180
  ```
321
- assessment.perspective("firstPerson");
322
- assessment.view("candidate");
181
+ Traitify.options.report = "candidate";
323
182
  ```
324
183
 
325
184
  ### Engage Employee Report
326
185
 
327
186
  ```
328
- assessment.perspective("thirdPerson");
329
- assessment.view("employee");
187
+ Traitify.options.report = "employee";
330
188
  ```
331
189
 
332
- ## Traitify Client
190
+ ## Traitify HTTP
333
191
 
334
192
  We expose our JavaScript api client that you can use to make additional calls to our API from the client side. We make available `get`, `put`, and `post` functions. These methods will use the api key and url you configured when you initialized the Traitify library. Here is an example that returns career matches for a `career-deck` assessment. Further documentation on the API methods available can be found at https://app.traitify.com/developer/documentation.
335
193
 
336
194
  ```
337
- <script src="https://cdn.traitify.com/js/v2/traitify.js"></script>
195
+ <script src="https://cdn.traitify.com/js/v3/traitify.js"></script>
338
196
  <script>
339
- Traitify.setHost("your host url");
340
- Traitify.setPublicKey("your public key");
341
- var assessmentId = "an assessment id you have generated via a server side client";
342
- Traitify.get("/assessments/" + assessmentId + "/matches/careers").then(function(career_matches){
343
- console.log(career_matches);
197
+ Traitify.http.authKey = "Your Traitify public key";
198
+ Traitify.http.host = "https://api.traitify.com";
199
+
200
+ const assessmentID = "an assessment id you have generated via a server side client";
201
+
202
+ Traitify.http.get(`/assessments/${assessmentID}/matches/careers`).then((matches) => {
203
+ console.log(matches);
344
204
  });
345
205
  </script>
346
206
  ```