@spotify/backstage-plugin-pulse-common 0.9.0 → 0.10.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/dist/index.d.ts CHANGED
@@ -81,13 +81,20 @@ interface Section {
81
81
  */
82
82
  display_logic?: string;
83
83
  /**
84
- * The questions in the section (all in one page)
84
+ * When set, the survey progress bar will not be shown during this section.
85
85
  */
86
- questions?: Question[];
86
+ hide_progress_bar?: boolean;
87
87
  /**
88
88
  * The questions in the section, split into pages
89
89
  */
90
- pages?: Page[];
90
+ pages: Page[];
91
+ }
92
+ /** @public */
93
+ interface Page {
94
+ /**
95
+ * The questions on the page
96
+ */
97
+ questions: Question[];
91
98
  }
92
99
  /** @public */
93
100
  interface Question {
@@ -111,10 +118,6 @@ interface Question {
111
118
  * A boolean expression with logic if this question should be displayed or not
112
119
  */
113
120
  display_logic?: string;
114
- /**
115
- * Similar to display_logic, but enables the question to appear on the same page as the depending question
116
- */
117
- display_logic_in_page?: string;
118
121
  /**
119
122
  * If the question is required to answer; request means you will get a warning if you skip it but you can.
120
123
  */
@@ -175,6 +178,12 @@ interface Question {
175
178
  randomization?: Randomization;
176
179
  }[];
177
180
  randomization?: Randomization;
181
+ configuration?: {
182
+ /**
183
+ * Size of the column with the choice descriptions in a matrix question
184
+ */
185
+ choice_column_width_pixels?: number;
186
+ };
178
187
  }
179
188
  /** @public */
180
189
  interface Statement {
@@ -235,13 +244,6 @@ interface Choice {
235
244
  */
236
245
  exclusive_answer?: boolean;
237
246
  }
238
- /** @public */
239
- interface Page {
240
- /**
241
- * The questions on the page
242
- */
243
- questions: Question[];
244
- }
245
247
 
246
248
  /** @public */
247
249
  declare const validateTemplate: (template: SurveyTemplate) => void;
@@ -264,9 +266,7 @@ declare enum LOCATOR_EXPRESSION {
264
266
  SELECTED_ENTERED_TEXT = "selected_entered_text",
265
267
  NOT_SELECTED = "not_selected",
266
268
  FOR_MATRIX_CHOICE = "for_matrix_choice",
267
- UNSELECTED_FOR_MATRIX_CHOICE = "unselected_for_matrix_choice",
268
- DISPLAYED = "displayed",
269
- NOT_DISPLAYED = "not_displayed"
269
+ UNSELECTED_FOR_MATRIX_CHOICE = "unselected_for_matrix_choice"
270
270
  }
271
271
  /** @public */
272
272
  type Locator = {
@@ -279,120 +279,6 @@ declare const validateLocator: (locatorExpression: string) => boolean;
279
279
  /** @public */
280
280
  declare const parseLocator: (locatorExpression: string) => Locator;
281
281
 
282
- /** @public */
283
- type Answer = {
284
- choiceId?: string | null;
285
- choiceValue?: number | null;
286
- text?: string | null;
287
- };
288
- /** @public */
289
- type SurveyQuestionResponse = {
290
- id: string;
291
- surveyId: string;
292
- questionId: string;
293
- surveyResponseId: string;
294
- /** The ID of the statement. Only set if question.type is MATRIX_SINGLE or MATRIX_MULTI. */
295
- statementId?: string | null;
296
- /** The selected choices for multiple answer questions (mc-multi, matrix-multi). */
297
- multipleAnswers?: readonly Answer[] | null;
298
- /** The selected choice for single answer questions (mc-single, matrix-single). */
299
- singleAnswer?: Answer | null;
300
- createdAt: Date;
301
- updatedAt: Date;
302
- };
303
- /** @public */
304
- type StatementWithGroupInfo = Statement & {
305
- groupId?: string;
306
- groupDisplay?: string;
307
- };
308
- /** @public */
309
- type ChoiceWithGroupInfo = Choice & {
310
- groupId?: string;
311
- groupDisplay?: string;
312
- };
313
-
314
- /** Refers to a specific choice in a specific question/statement
315
- * If statementId is defined, questionId.statementId is the full path
316
- * to this choice
317
- * @public */
318
- type ChoiceRef = {
319
- questionId: string;
320
- statementId?: string;
321
- choice: string | number;
322
- };
323
- /** Refers to a specific statement in a matrix
324
- * @public */
325
- type MatrixStatementRef = {
326
- questionId: string;
327
- statementId: string;
328
- };
329
- /** @public */
330
- declare const getAnswerValue: (answer: Answer) => string | number;
331
- /** @public */
332
- type TemplateContextEvaluatorOptions = {
333
- surveyId?: string;
334
- templateId?: string;
335
- surveyResponseId?: string;
336
- questions: Question[];
337
- questionResponses: SurveyQuestionResponse[];
338
- };
339
- /**
340
- * Provides useful methods for making template schema evaluations given a particular response context
341
- * @public */
342
- declare class TemplateContextEvaluator {
343
- #private;
344
- surveyId?: string;
345
- templateId?: string;
346
- surveyResponseId?: string;
347
- questions: Question[];
348
- questionResponses: SurveyQuestionResponse[];
349
- constructor(options: TemplateContextEvaluatorOptions);
350
- /**
351
- * Returns the relevant answers for a particular question. If a statement ID or choice
352
- * identifier is provided, answers will be filtered to those matching the specified
353
- * inputs.
354
- */
355
- getQuestionAnswers(questionId: string, statementId?: string | null, choiceIdOrValue?: string | number | null): Answer[];
356
- /**
357
- * Returns the list of choices or statements referenced by a locator taking into
358
- * account the current response context.
359
- */
360
- evaluateDynamicExpression<T extends Choice | Statement>(locator: Locator, target: 'choices' | 'statements'): T[];
361
- isStatementSelected(statement: MatrixStatementRef): boolean;
362
- isSelected(choice: ChoiceRef): boolean;
363
- isDisplayed(_: ChoiceRef): boolean;
364
- countSelected(questionId: string): number;
365
- countChoiceSelections(questionId: string, choice: number | string): number;
366
- textEntry(choice: ChoiceRef): string;
367
- }
368
- /**
369
- * Returns a context evaluator with no responses which effectively means most
370
- * display logic expressions would evaluate to false. This evaluator is useful when
371
- * there is no existing surver response such as when a user first begins taking a survey.
372
- * @public */
373
- declare const getBaseContextEvaluator: (questions?: Question[]) => TemplateContextEvaluator;
374
- /**
375
- * Evaluates a display logic expression using the given response context
376
- * @public */
377
- declare const evaluateDisplayLogic: (evaluator: TemplateContextEvaluator, expression?: string) => boolean;
378
- /**
379
- * Returns the question text with any dynamic expressions interpolated.
380
- * @public
381
- */
382
- declare const getQuestionText: (question: Question, evaluator?: TemplateContextEvaluator | null) => string;
383
- /**
384
- * Returns all choices that are valid for a particular question given a specific
385
- * response context. This takes into account choices that are in groups and
386
- * dynamic choices that may come from other questions.
387
- * @public */
388
- declare const getQuestionChoices: (question: Question, evaluator?: TemplateContextEvaluator | null) => ChoiceWithGroupInfo[];
389
- /**
390
- * Returns all statements that are valid for a particular question given a specific
391
- * response context. This takes into account statements that are in groups and
392
- * dynamic statements that may come from other questions.
393
- * @public */
394
- declare const getQuestionStatements: (question: Question, evaluator?: TemplateContextEvaluator | null) => StatementWithGroupInfo[];
395
-
396
282
  /** @public */
397
283
  declare const templateSchema: {
398
284
  $id: string;
@@ -504,12 +390,9 @@ declare const templateSchema: {
504
390
  type: string;
505
391
  description: string;
506
392
  };
507
- questions: {
393
+ hide_progress_bar: {
508
394
  type: string;
509
395
  description: string;
510
- items: {
511
- $ref: string;
512
- };
513
396
  };
514
397
  pages: {
515
398
  type: string;
@@ -521,9 +404,6 @@ declare const templateSchema: {
521
404
  };
522
405
  additionalProperties: boolean;
523
406
  required: string[];
524
- oneOf: {
525
- required: string[];
526
- }[];
527
407
  };
528
408
  page: {
529
409
  type: string;
@@ -565,10 +445,6 @@ declare const templateSchema: {
565
445
  type: string;
566
446
  description: string;
567
447
  };
568
- display_logic_in_page: {
569
- type: string;
570
- description: string;
571
- };
572
448
  required: {
573
449
  type: string;
574
450
  enum: string[];
@@ -676,6 +552,16 @@ declare const templateSchema: {
676
552
  randomization: {
677
553
  $ref: string;
678
554
  };
555
+ configuration: {
556
+ type: string;
557
+ properties: {
558
+ choice_column_width_pixels: {
559
+ type: string;
560
+ description: string;
561
+ };
562
+ };
563
+ additionalProperties: boolean;
564
+ };
679
565
  };
680
566
  additionalProperties: boolean;
681
567
  required: string[];
@@ -908,6 +794,28 @@ declare const templateSchema: {
908
794
  /** @public */
909
795
  declare const DEFAULT_TEMPLATE_ID = "pulse_default_alpha";
910
796
 
797
+ /** @public */
798
+ type Answer = {
799
+ choiceId?: string | null;
800
+ choiceValue?: number | null;
801
+ text?: string | null;
802
+ };
803
+ /** @public */
804
+ type SurveyQuestionResponse = {
805
+ id: string;
806
+ surveyId: string;
807
+ questionId: string;
808
+ surveyResponseId: string;
809
+ /** The ID of the statement. Only set if question.type is MATRIX_SINGLE or MATRIX_MULTI. */
810
+ statementId?: string | null;
811
+ /** The selected choices for multiple answer questions (mc-multi, matrix-multi). */
812
+ multipleAnswers?: readonly Answer[] | null;
813
+ /** The selected choice for single answer questions (mc-single, matrix-single). */
814
+ singleAnswer?: Answer | null;
815
+ createdAt: Date;
816
+ updatedAt: Date;
817
+ };
818
+
911
819
  /** @public */
912
820
  declare const permissions: {
913
821
  allPermissions: _backstage_plugin_permission_common.BasicPermission[];
@@ -915,4 +823,4 @@ declare const permissions: {
915
823
  surveyAdministerPermission: _backstage_plugin_permission_common.BasicPermission;
916
824
  };
917
825
 
918
- export { Answer, Choice, ChoiceRef, ChoiceWithGroupInfo, DEFAULT_TEMPLATE_ID, LOCATOR_EXPRESSION, Locator, MatrixStatementRef, Page, Question, Randomization, Section, Statement, StatementWithGroupInfo, SurveyQuestionResponse, SurveyTemplate, TemplateContextEvaluator, TemplateContextEvaluatorOptions, evaluateDisplayLogic, getAnswerValue, getBaseContextEvaluator, getQuestionChoices, getQuestionStatements, getQuestionText, interpolateTemplate, parseLocator, permissions, templateSchema, validateLocator, validateTemplate };
826
+ export { Answer, Choice, DEFAULT_TEMPLATE_ID, LOCATOR_EXPRESSION, Locator, Page, Question, Randomization, Section, Statement, SurveyQuestionResponse, SurveyTemplate, interpolateTemplate, parseLocator, permissions, templateSchema, validateLocator, validateTemplate };