@spotify/backstage-plugin-pulse-common 0.8.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 {
@@ -98,11 +105,7 @@ interface Question {
98
105
  /**
99
106
  * The question description, in markdown
100
107
  */
101
- text?: string;
102
- /**
103
- * The question description, in HTML
104
- */
105
- text_html?: string;
108
+ text: string;
106
109
  /**
107
110
  * The type of question
108
111
  */
@@ -115,10 +118,6 @@ interface Question {
115
118
  * A boolean expression with logic if this question should be displayed or not
116
119
  */
117
120
  display_logic?: string;
118
- /**
119
- * Similar to display_logic, but enables the question to appear on the same page as the depending question
120
- */
121
- display_logic_in_page?: string;
122
121
  /**
123
122
  * If the question is required to answer; request means you will get a warning if you skip it but you can.
124
123
  */
@@ -146,7 +145,7 @@ interface Question {
146
145
  /**
147
146
  * The id of the group.
148
147
  */
149
- id?: string;
148
+ id: string;
150
149
  /**
151
150
  * The display name of the group
152
151
  */
@@ -167,7 +166,7 @@ interface Question {
167
166
  /**
168
167
  * The id of the group.
169
168
  */
170
- id?: string;
169
+ id: string;
171
170
  /**
172
171
  * The display name of the group
173
172
  */
@@ -179,6 +178,12 @@ interface Question {
179
178
  randomization?: Randomization;
180
179
  }[];
181
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
+ };
182
187
  }
183
188
  /** @public */
184
189
  interface Statement {
@@ -233,19 +238,12 @@ interface Choice {
233
238
  /**
234
239
  * If a textbox should appear next to the choice, and if it should be mandatory to fill it in if the choice is selected
235
240
  */
236
- text?: 'no' | 'optional' | 'forced';
241
+ text_input?: 'no' | 'optional' | 'forced';
237
242
  /**
238
243
  * If true, this choice can't be combined with other choices in this question
239
244
  */
240
245
  exclusive_answer?: boolean;
241
246
  }
242
- /** @public */
243
- interface Page {
244
- /**
245
- * The questions on the page
246
- */
247
- questions: Question[];
248
- }
249
247
 
250
248
  /** @public */
251
249
  declare const validateTemplate: (template: SurveyTemplate) => void;
@@ -260,32 +258,26 @@ declare const validateTemplate: (template: SurveyTemplate) => void;
260
258
  * @public */
261
259
  declare const interpolateTemplate: (template: SurveyTemplate) => SurveyTemplate;
262
260
 
263
- /** Refers to a specific choice in a specific question/statement
264
- * If statementId is defined, questionId.statementId is the full path
265
- * to this choice
266
- * @public */
267
- type ChoiceRef = {
268
- questionId: string;
269
- statementId?: string;
270
- choice: string | number;
271
- };
272
- /** Refers to a specific statement in a matrix
273
- * @public */
274
- type MatrixStatementRef = {
261
+ /** @public */
262
+ declare enum LOCATOR_EXPRESSION {
263
+ ALL = "all",
264
+ ALL_ENTERED_TEXT = "all_entered_text",
265
+ SELECTED = "selected",
266
+ SELECTED_ENTERED_TEXT = "selected_entered_text",
267
+ NOT_SELECTED = "not_selected",
268
+ FOR_MATRIX_CHOICE = "for_matrix_choice",
269
+ UNSELECTED_FOR_MATRIX_CHOICE = "unselected_for_matrix_choice"
270
+ }
271
+ /** @public */
272
+ type Locator = {
275
273
  questionId: string;
276
- statementId: string;
274
+ expression: LOCATOR_EXPRESSION;
275
+ identifier?: string | number;
277
276
  };
278
277
  /** @public */
279
- type LogicContextEvaluator = {
280
- surveyResponseId?: string;
281
- isSelected: (choice: ChoiceRef) => boolean;
282
- isDisplayed: (choice: ChoiceRef) => boolean;
283
- countSelected: (questionId: string) => number;
284
- countChoiceSelections: (questionId: string, choice: number | string) => number;
285
- textEntry: (choiceRef: ChoiceRef) => string;
286
- };
278
+ declare const validateLocator: (locatorExpression: string) => boolean;
287
279
  /** @public */
288
- declare function evaluateExpression(expression: string, contextEvaluator: LogicContextEvaluator): any;
280
+ declare const parseLocator: (locatorExpression: string) => Locator;
289
281
 
290
282
  /** @public */
291
283
  declare const templateSchema: {
@@ -297,7 +289,6 @@ declare const templateSchema: {
297
289
  template: {
298
290
  type: string;
299
291
  description: string;
300
- /** @public */
301
292
  properties: {
302
293
  id: {
303
294
  type: string;
@@ -399,12 +390,9 @@ declare const templateSchema: {
399
390
  type: string;
400
391
  description: string;
401
392
  };
402
- questions: {
393
+ hide_progress_bar: {
403
394
  type: string;
404
395
  description: string;
405
- items: {
406
- $ref: string;
407
- };
408
396
  };
409
397
  pages: {
410
398
  type: string;
@@ -416,9 +404,6 @@ declare const templateSchema: {
416
404
  };
417
405
  additionalProperties: boolean;
418
406
  required: string[];
419
- oneOf: {
420
- required: string[];
421
- }[];
422
407
  };
423
408
  page: {
424
409
  type: string;
@@ -446,10 +431,6 @@ declare const templateSchema: {
446
431
  type: string;
447
432
  description: string;
448
433
  };
449
- text_html: {
450
- type: string;
451
- description: string;
452
- };
453
434
  type: {
454
435
  type: string;
455
436
  enum: string[];
@@ -464,10 +445,6 @@ declare const templateSchema: {
464
445
  type: string;
465
446
  description: string;
466
447
  };
467
- display_logic_in_page: {
468
- type: string;
469
- description: string;
470
- };
471
448
  required: {
472
449
  type: string;
473
450
  enum: string[];
@@ -575,17 +552,22 @@ declare const templateSchema: {
575
552
  randomization: {
576
553
  $ref: string;
577
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
+ };
578
565
  };
579
566
  additionalProperties: boolean;
580
- allOf: ({
581
- oneOf: {
582
- required: string[];
583
- }[];
584
- } | {
585
- oneOf: {
586
- $ref: string;
587
- }[];
588
- })[];
567
+ required: string[];
568
+ oneOf: {
569
+ $ref: string;
570
+ }[];
589
571
  };
590
572
  "question-mc-horizontal": {
591
573
  type: string;
@@ -740,7 +722,7 @@ declare const templateSchema: {
740
722
  type: string;
741
723
  description: string;
742
724
  };
743
- text: {
725
+ text_input: {
744
726
  type: string;
745
727
  enum: string[];
746
728
  description: string;
@@ -812,6 +794,28 @@ declare const templateSchema: {
812
794
  /** @public */
813
795
  declare const DEFAULT_TEMPLATE_ID = "pulse_default_alpha";
814
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
+
815
819
  /** @public */
816
820
  declare const permissions: {
817
821
  allPermissions: _backstage_plugin_permission_common.BasicPermission[];
@@ -819,4 +823,4 @@ declare const permissions: {
819
823
  surveyAdministerPermission: _backstage_plugin_permission_common.BasicPermission;
820
824
  };
821
825
 
822
- export { Choice, ChoiceRef, DEFAULT_TEMPLATE_ID, LogicContextEvaluator, MatrixStatementRef, Page, Question, Randomization, Section, Statement, SurveyTemplate, evaluateExpression, interpolateTemplate, permissions, templateSchema, validateTemplate };
826
+ export { Answer, Choice, DEFAULT_TEMPLATE_ID, LOCATOR_EXPRESSION, Locator, Page, Question, Randomization, Section, Statement, SurveyQuestionResponse, SurveyTemplate, interpolateTemplate, parseLocator, permissions, templateSchema, validateLocator, validateTemplate };