@wix/auto_sdk_online-programs_quizzes 1.0.26 → 1.0.28

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.
@@ -1,56 +1,90 @@
1
1
  import { HttpClient, NonNullablePaths, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
2
- import { Quiz, CloneQuizResponse, BulkCreateQuizzesOptions, BulkCreateQuizzesResponse, DeleteQuizResponse, BulkDeleteQuizzesResponse } from './index.typings.js';
2
+ import { Quiz, CreateQuizApplicationErrors, CloneQuizResponse, CloneQuizApplicationErrors, BulkCreateQuizzesOptions, BulkCreateQuizzesResponse, BulkCreateQuizzesApplicationErrors, GetQuizApplicationErrors, DeleteQuizResponse, DeleteQuizApplicationErrors, BulkDeleteQuizzesResponse } from './index.typings.js';
3
3
  export { AccountInfo, ActionEvent, ApplicationError, BulkActionMetadata, BulkCloneQuizzesRequest, BulkCloneQuizzesResponse, BulkCreateQuizzesRequest, BulkCreateQuizzesResponseBulkQuizResult, BulkDeleteQuizzesRequest, BulkDeleteQuizzesResponseBulkQuizResult, BulkQuizResult, CloneQuizRequest, CreateQuizRequest, CreateQuizResponse, DeleteQuizRequest, DomainEvent, DomainEventBodyOneOf, EntityCreatedEvent, EntityDeletedEvent, EntityUpdatedEvent, FileUploadField, FileUploadFormat, FileUploadFormatWithLiterals, GetQuizRequest, GetQuizResponse, IdentificationData, IdentificationDataIdOneOf, ItemMetadata, LongTextField, MessageEnvelope, MultiChoiceField, NumericField, QuizField, QuizFieldFieldTypeOneOf, QuizSettings, RestoreInfo, ShortTextField, SingleChoiceField, WebhookIdentityType, WebhookIdentityTypeWithLiterals } from './index.typings.js';
4
4
 
5
5
  declare function createQuiz$1(httpClient: HttpClient): CreateQuizSignature;
6
6
  interface CreateQuizSignature {
7
7
  /**
8
- * Creates quiz
9
- * @param - Quiz to created
10
- * @returns Created quiz
8
+ * Creates a detached quiz definition with at least one question.
9
+ *
10
+ * To use the quiz in an Online Program, pass the returned quiz ID as `step.quizOptions.id` when calling the Steps API's `CreateStep` or `BulkCreateSteps` method.
11
+ * @param - Quiz definition to create. Generate a stable unique GUID for every `quiz.fields.id` value.
12
+ * @returns Created quiz definition. Assign its `id` to `step.quizOptions.id` to create an Online Programs quiz step.
11
13
  */
12
- (quiz: NonNullablePaths<Quiz, `fields` | `fields.${number}._id` | `fields.${number}.multiChoice.options` | `fields.${number}.question` | `fields.${number}.singleChoice.options` | `fields.${number}.target`, 3>): Promise<NonNullablePaths<Quiz, `fields` | `fields.${number}._id`, 2>>;
14
+ (quiz: NonNullablePaths<Quiz, `fields` | `fields.${number}._id` | `fields.${number}.multiChoice.options` | `fields.${number}.question` | `fields.${number}.singleChoice.options` | `fields.${number}.target`, 3>): Promise<NonNullablePaths<Quiz, `fields` | `fields.${number}._id`, 2> & {
15
+ __applicationErrorsType?: CreateQuizApplicationErrors;
16
+ }>;
13
17
  }
14
18
  declare function cloneQuiz$1(httpClient: HttpClient): CloneQuizSignature;
15
19
  interface CloneQuizSignature {
16
20
  /**
17
- * Clones quiz
18
- * @param - ID of the quiz to be cloned
21
+ * Clones a quiz definition and returns a new quiz ID.
22
+ *
23
+ * Checks the source before cloning. An existing definition found to have no active questions is rejected with INVALID_QUIZ before cloning. Source checks aren't atomic with cloning.
24
+ *
25
+ * This operation copies the question and settings definition only. It doesn't copy Online Programs step associations or quiz submissions. Attach the returned ID to a step separately when needed.
26
+ * @param - ID of the quiz definition to clone.
19
27
  */
20
- (quizId: string): Promise<NonNullablePaths<CloneQuizResponse, `quiz.fields` | `quiz.fields.${number}._id`, 3>>;
28
+ (quizId: string): Promise<NonNullablePaths<CloneQuizResponse, `quiz.fields` | `quiz.fields.${number}._id`, 3> & {
29
+ __applicationErrorsType?: CloneQuizApplicationErrors;
30
+ }>;
21
31
  }
22
32
  declare function bulkCreateQuizzes$1(httpClient: HttpClient): BulkCreateQuizzesSignature;
23
33
  interface BulkCreateQuizzesSignature {
24
34
  /**
25
- * Creates up to 30 quiz definitions in a single API call.
35
+ * Creates up to 30 detached quiz definitions in a single API call. Each definition must contain at least one question.
36
+ *
37
+ * Quiz IDs, revisions, and creation and update timestamps are assigned by the server. Client-supplied values for these read-only fields are ignored. Question IDs (`quizzes.fields.id`) must be supplied by the caller.
38
+ *
39
+ * Invalid quiz definitions fail the entire request before any quizzes are created.
40
+ *
41
+ * Individual item failures don't fail the bulk request. For each failed item, `results.itemMetadata.error` contains the original application error from the Wix Forms operation.
42
+ *
43
+ * To use the quizzes in an Online Program, pass the returned quiz IDs as `step.quizOptions.id` values when calling the Steps API's `CreateStep` or `BulkCreateSteps` method.
26
44
  * @param - Quiz definitions to create.
27
45
  */
28
- (quizzes: NonNullablePaths<Quiz, `fields` | `fields.${number}._id` | `fields.${number}.multiChoice.options` | `fields.${number}.question` | `fields.${number}.singleChoice.options` | `fields.${number}.target`, 3>[], options?: BulkCreateQuizzesOptions): Promise<NonNullablePaths<BulkCreateQuizzesResponse, `results` | `results.${number}.itemMetadata.originalIndex` | `results.${number}.itemMetadata.success` | `results.${number}.itemMetadata.error.code` | `results.${number}.itemMetadata.error.description` | `bulkActionMetadata.totalSuccesses` | `bulkActionMetadata.totalFailures` | `bulkActionMetadata.undetailedFailures`, 4>>;
46
+ (quizzes: NonNullablePaths<Quiz, `fields` | `fields.${number}._id` | `fields.${number}.multiChoice.options` | `fields.${number}.question` | `fields.${number}.singleChoice.options` | `fields.${number}.target`, 3>[], options?: BulkCreateQuizzesOptions): Promise<NonNullablePaths<BulkCreateQuizzesResponse, `results` | `results.${number}.itemMetadata.originalIndex` | `results.${number}.itemMetadata.success` | `results.${number}.itemMetadata.error.code` | `results.${number}.itemMetadata.error.description` | `bulkActionMetadata.totalSuccesses` | `bulkActionMetadata.totalFailures` | `bulkActionMetadata.undetailedFailures`, 4> & {
47
+ __applicationErrorsType?: BulkCreateQuizzesApplicationErrors;
48
+ }>;
29
49
  }
30
50
  declare function getQuiz$1(httpClient: HttpClient): GetQuizSignature;
31
51
  interface GetQuizSignature {
32
52
  /**
33
- * Reads quiz by ID
34
- * @param - ID of the quiz
35
- * @returns Requested quiz
53
+ * Retrieves a quiz definition by ID. A stored definition whose questions have all been deleted can be returned with no active questions.
54
+ *
55
+ * To discover a quiz ID, query or retrieve its quiz-type Online Programs step and read `step.quizOptions.id`.
56
+ * @param - Quiz ID, available from `step.quizOptions.id` on a quiz-type Online Programs step.
57
+ * @returns Requested quiz definition.
36
58
  */
37
- (quizId: string): Promise<NonNullablePaths<Quiz, `fields` | `fields.${number}._id`, 2>>;
59
+ (quizId: string): Promise<NonNullablePaths<Quiz, `fields` | `fields.${number}._id`, 2> & {
60
+ __applicationErrorsType?: GetQuizApplicationErrors;
61
+ }>;
38
62
  }
39
63
  declare function deleteQuiz$1(httpClient: HttpClient): DeleteQuizSignature;
40
64
  interface DeleteQuizSignature {
41
65
  /**
42
- * Deletes quiz
43
- * @param - ID of quiz
66
+ * Permanently deletes a quiz definition.
67
+ *
68
+ * This operation doesn't check whether Online Programs steps reference the quiz. Coordinate deletion with the Steps API and remove known step references first. Otherwise, steps can retain dangling quiz references.
69
+ *
70
+ * NOT-PRECEDENT: This caller-responsibility behavior is retained as a production v1 compatibility exception. New delete APIs should provide an authoritative server-side reference safeguard.
71
+ * @param - ID of the quiz definition to permanently delete.
44
72
  */
45
- (quizId: string): Promise<NonNullablePaths<DeleteQuizResponse, `quiz.fields` | `quiz.fields.${number}._id`, 3>>;
73
+ (quizId: string): Promise<NonNullablePaths<DeleteQuizResponse, `quiz.fields` | `quiz.fields.${number}._id`, 3> & {
74
+ __applicationErrorsType?: DeleteQuizApplicationErrors;
75
+ }>;
46
76
  }
47
77
  declare function bulkDeleteQuizzes$1(httpClient: HttpClient): BulkDeleteQuizzesSignature;
48
78
  interface BulkDeleteQuizzesSignature {
49
79
  /**
50
80
  * Permanently deletes up to 100 quiz definitions.
51
81
  *
52
- * This operation doesn't check whether Online Programs steps reference the quizzes. Callers must remove or verify those references before deleting.
53
- * @param - IDs of the quizzes to delete.
82
+ * Individual item failures don't fail the bulk request. For each failed item, `results.itemMetadata.error` contains the original application error from the Wix Forms operation.
83
+ *
84
+ * This operation doesn't check whether Online Programs steps reference the quizzes. Coordinate deletion with the Steps API and remove known step references first. Otherwise, steps can retain dangling quiz references.
85
+ *
86
+ * NOT-PRECEDENT: This caller-responsibility behavior is retained as a production v1 compatibility exception. New bulk-delete APIs should provide an authoritative server-side reference safeguard.
87
+ * @param - IDs of the quiz definitions to permanently delete. Coordinate deletion with the Steps API and remove known step references first.
54
88
  */
55
89
  (quizIds: string[]): Promise<NonNullablePaths<BulkDeleteQuizzesResponse, `results` | `results.${number}.itemMetadata.originalIndex` | `results.${number}.itemMetadata.success` | `results.${number}.itemMetadata.error.code` | `results.${number}.itemMetadata.error.description` | `bulkActionMetadata.totalSuccesses` | `bulkActionMetadata.totalFailures` | `bulkActionMetadata.undetailedFailures`, 4>>;
56
90
  }
@@ -62,4 +96,4 @@ declare const getQuiz: MaybeContext<BuildRESTFunction<typeof getQuiz$1> & typeof
62
96
  declare const deleteQuiz: MaybeContext<BuildRESTFunction<typeof deleteQuiz$1> & typeof deleteQuiz$1>;
63
97
  declare const bulkDeleteQuizzes: MaybeContext<BuildRESTFunction<typeof bulkDeleteQuizzes$1> & typeof bulkDeleteQuizzes$1>;
64
98
 
65
- export { BulkCreateQuizzesOptions, BulkCreateQuizzesResponse, BulkDeleteQuizzesResponse, CloneQuizResponse, DeleteQuizResponse, Quiz, bulkCreateQuizzes, bulkDeleteQuizzes, cloneQuiz, createQuiz, deleteQuiz, getQuiz };
99
+ export { BulkCreateQuizzesApplicationErrors, BulkCreateQuizzesOptions, BulkCreateQuizzesResponse, BulkDeleteQuizzesResponse, CloneQuizApplicationErrors, CloneQuizResponse, CreateQuizApplicationErrors, DeleteQuizApplicationErrors, DeleteQuizResponse, GetQuizApplicationErrors, Quiz, bulkCreateQuizzes, bulkDeleteQuizzes, cloneQuiz, createQuiz, deleteQuiz, getQuiz };
@@ -1,31 +1,42 @@
1
1
  import { NonNullablePaths } from '@wix/sdk-types';
2
2
 
3
+ /**
4
+ * A quiz definition used by an Online Programs quiz step.
5
+ *
6
+ * Create or clone a quiz, then assign the returned quiz ID to `step.quizOptions.id` when creating an Online Programs step. Quiz IDs are intentionally discovered through quiz-type steps rather than through a Quiz list or query method.
7
+ *
8
+ * New submissions are evaluated against the quiz definition that exists when the submission is created. Previously stored submissions retain their recorded grades and answer evaluations if the definition changes later.
9
+ *
10
+ * NOT-PRECEDENT: The production v1 entity retains its legacy `wix.achievements.quizzes.v1.quiz` identity for compatibility. The Online Programs placement and workflow described here provide its public product context.
11
+ */
3
12
  interface Quiz {
4
13
  /**
5
- * ID of the quiz
14
+ * Quiz ID.
6
15
  * @format GUID
7
16
  * @readonly
8
17
  */
9
18
  _id?: string | null;
10
- /** Quiz settings */
19
+ /** Quiz title, passing grade, and attempt limit. New submissions use the current settings; stored submissions retain their recorded grade data. */
11
20
  settings?: QuizSettings;
12
21
  /**
13
- * Represents the current state of the quiz. Each time the it is modified, its `revision` changes. For an update operation to succeed, you MUST pass the latest revision
22
+ * Current revision of the stored quiz definition. The revision changes when the definition changes. The public Quiz API doesn't currently provide an update method.
14
23
  * @readonly
15
24
  */
16
25
  revision?: string | null;
17
26
  /**
18
- * The time this quiz was created
27
+ * Date and time the quiz was created.
19
28
  * @readonly
20
29
  */
21
30
  _createdDate?: Date | null;
22
31
  /**
23
- * The time this quiz was last updated
32
+ * Date and time the quiz was last updated.
24
33
  * @readonly
25
34
  */
26
35
  _updatedDate?: Date | null;
27
36
  /**
28
- * Quiz fields
37
+ * Active questions in the quiz. Each `QuizField` defines one question and its answer input. Creating a quiz requires at least one question. An existing definition can have no active questions after its questions are deleted through another supported workflow; retrieving that definition doesn't fail solely because this list is empty.
38
+ *
39
+ * New submissions use the current questions; stored submissions retain their recorded answer evaluations. Reading an empty definition doesn't imply that it can be used to create a new quiz or accept submissions.
29
40
  * @minSize 1
30
41
  * @maxSize 200
31
42
  */
@@ -33,119 +44,130 @@ interface Quiz {
33
44
  }
34
45
  interface QuizSettings {
35
46
  /**
36
- * Minimal grade to pass the quiz
47
+ * Minimum unweighted integer percentage required to pass, from `0` through `100`. The earned grade is calculated as `floor((correct answer count / submitted answer count) * 100)`; question `score` values don't weight it. Non-evaluable answers count as correct. If omitted, the submission has no earned or passing grade and its status is COMPLETED, even if an individual evaluated answer is incorrect.
37
48
  * @max 100
38
49
  */
39
50
  passingGrade?: number | null;
40
51
  /**
41
- * Quiz title
52
+ * Quiz title.
42
53
  * @maxLength 200
43
54
  */
44
55
  title?: string | null;
45
56
  /**
46
- * Maximal number of submission attempts
57
+ * Maximum number of submissions allowed per submitter. If omitted, no attempt-limit check is applied. With `groupId`, the count uses group ID and submitter ID without filtering by quiz ID; otherwise, it uses quiz ID and submitter ID. Reusing a group ID across quizzes shares their attempt count.
47
58
  * @min 1
48
59
  */
49
60
  attempts?: number | null;
50
61
  }
62
+ /** Defines one quiz question and its answer input. */
51
63
  interface QuizField extends QuizFieldFieldTypeOneOf {
52
- /** Type for numeric input */
64
+ /** Numeric input. */
53
65
  numeric?: NumericField;
54
- /** Type for text input */
66
+ /** Short-text input. */
55
67
  shortText?: ShortTextField;
56
- /** Type for long text input */
68
+ /** Long-text input. Set this to an empty object (`{}`) to select it. */
57
69
  longText?: LongTextField;
58
- /** Type for input with predefined options where only one can be selected */
70
+ /** Input with predefined options where only one option can be selected. */
59
71
  singleChoice?: SingleChoiceField;
60
- /** Type for input with predefined options where multiple can be selected */
72
+ /** Input with predefined options where multiple options can be selected. */
61
73
  multiChoice?: MultiChoiceField;
62
- /** Type for file input */
74
+ /** File-upload input. */
63
75
  fileUpload?: FileUploadField;
64
76
  /**
65
- * Field ID
77
+ * Caller-generated GUID that identifies this question. Use a stable value that is unique within the quiz. Submission answer evaluations use this ID to identify the question.
66
78
  * @format GUID
67
79
  * @immutable
68
80
  */
69
81
  _id?: string;
70
82
  /**
71
- * Key used in submission
83
+ * Stable key used to match a submitted answer to this question. Use a value that is unique within the quiz and don't change or reuse it for another question.
72
84
  * @maxLength 200
73
85
  * @immutable
74
86
  */
75
87
  target?: string | null;
76
88
  /**
77
- * Question
89
+ * Question text.
78
90
  * @minLength 1
79
91
  * @maxLength 350
80
92
  */
81
93
  question?: string | null;
82
- /** Score of the question when answered right */
94
+ /** Score returned for evaluable answers, whether correct or incorrect. Omitted from non-evaluable answer evaluations. This value doesn't weight the submission's unweighted `earnedGrade` percentage. */
83
95
  score?: number | null;
84
96
  /**
85
- * Message shown for right answer
97
+ * Feedback returned when an evaluable submitted answer is correct. Omitted for non-evaluable answers.
86
98
  * @maxLength 350
87
99
  */
88
100
  rightMessage?: string | null;
89
101
  /**
90
- * Message shown for wrong answer
102
+ * Feedback returned when an evaluable submitted answer is incorrect. Omitted for non-evaluable answers.
91
103
  * @maxLength 350
92
104
  */
93
105
  wrongMessage?: string | null;
94
106
  }
95
107
  /** @oneof */
96
108
  interface QuizFieldFieldTypeOneOf {
97
- /** Type for numeric input */
109
+ /** Numeric input. */
98
110
  numeric?: NumericField;
99
- /** Type for text input */
111
+ /** Short-text input. */
100
112
  shortText?: ShortTextField;
101
- /** Type for long text input */
113
+ /** Long-text input. Set this to an empty object (`{}`) to select it. */
102
114
  longText?: LongTextField;
103
- /** Type for input with predefined options where only one can be selected */
115
+ /** Input with predefined options where only one option can be selected. */
104
116
  singleChoice?: SingleChoiceField;
105
- /** Type for input with predefined options where multiple can be selected */
117
+ /** Input with predefined options where multiple options can be selected. */
106
118
  multiChoice?: MultiChoiceField;
107
- /** Type for file input */
119
+ /** File-upload input. */
108
120
  fileUpload?: FileUploadField;
109
121
  }
122
+ /** File categories used by Wix Forms. Categories don't define a custom extension or MIME-type allowlist; accepted file types are controlled by Wix Forms. See [About form fields](https://dev.wix.com/docs/api-reference/crm/forms/form-schemas/about-form-fields). */
110
123
  declare enum FileUploadFormat {
111
- /** Image files. */
124
+ /** Image-file category. */
112
125
  IMAGE = "IMAGE",
113
- /** Video files. */
126
+ /** Video-file category. */
114
127
  VIDEO = "VIDEO",
115
- /** Audio files. */
128
+ /** Audio-file category. */
116
129
  AUDIO = "AUDIO",
117
- /** Document files. */
130
+ /** Document-file category. */
118
131
  DOCUMENT = "DOCUMENT",
119
- /** Archive files. */
132
+ /** Archive-file category. */
120
133
  ARCHIVE = "ARCHIVE",
121
- /** 3D model files. */
134
+ /** 3D-model-file category. */
122
135
  MODEL_3D = "MODEL_3D"
123
136
  }
124
137
  /** @enumType */
125
138
  type FileUploadFormatWithLiterals = FileUploadFormat | 'IMAGE' | 'VIDEO' | 'AUDIO' | 'DOCUMENT' | 'ARCHIVE' | 'MODEL_3D';
126
139
  interface NumericField {
127
- /** Right answer */
140
+ /**
141
+ * Correct numeric value. Matching is exact. If no correct value is stored for this question, its submitted answer is non-evaluable and counts as correct when calculating the earned grade.
142
+ *
143
+ * Omitted from responses when the caller lacks achievements:quizzes:v1:quiz:read_sensitive_fields permission. Response filtering doesn't remove the stored key or change grading; an absent response value doesn't mean no correct value is stored.
144
+ */
128
145
  rightAnswer?: number | null;
129
146
  }
130
147
  interface ShortTextField {
131
148
  /**
132
- * Right answer
149
+ * Correct text. Matching trims leading and trailing whitespace and is case-insensitive. If no correct text is stored for this question, its submitted answer is non-evaluable and counts as correct when calculating the earned grade.
150
+ *
151
+ * Omitted from responses when the caller lacks achievements:quizzes:v1:quiz:read_sensitive_fields permission. Response filtering doesn't remove the stored key or change grading; an absent response value doesn't mean no correct text is stored.
133
152
  * @minLength 1
134
153
  * @maxLength 200
135
154
  */
136
155
  rightAnswer?: string | null;
137
156
  }
157
+ /** Long-text input settings. Set `longText` to an empty object (`{}`) to select this input. Long-text answers aren't evaluated and count as correct when calculating the earned grade. */
138
158
  interface LongTextField {
139
159
  }
140
160
  interface SingleChoiceField {
141
161
  /**
142
- * Right answer
162
+ * Correct option. When supplied, it must exactly match an entry in `options`; otherwise, creation fails with INVALID_QUIZ. Matching submitted answers is exact. If no correct option is stored for this question, its submitted answer is non-evaluable and counts as correct when calculating the earned grade.
163
+ *
164
+ * Omitted from responses when the caller lacks achievements:quizzes:v1:quiz:read_sensitive_fields permission. Response filtering doesn't remove the stored key or change grading; an absent response value doesn't mean no correct option is stored.
143
165
  * @minLength 1
144
166
  * @maxLength 350
145
167
  */
146
168
  rightAnswer?: string | null;
147
169
  /**
148
- * Answer options
170
+ * Options available to the participant. Labels must be unique; comparison is case-sensitive. Duplicate labels are rejected with INVALID_QUIZ before creation.
149
171
  * @minSize 1
150
172
  * @maxSize 90
151
173
  * @minLength 1
@@ -153,17 +175,19 @@ interface SingleChoiceField {
153
175
  */
154
176
  options?: string[] | null;
155
177
  }
178
+ /** Multiple-choice input settings. Existing Wix Forms image-choice questions are also returned in this shape, even when their original settings allow only one selection. Image-choice-specific settings aren't exposed by the Quiz API. */
156
179
  interface MultiChoiceField {
157
180
  /**
158
- * Returned only with achievements:quizzes:v1:quiz:read_sensitive_fields permission.
159
- * Repeated fields cannot use conditional annotations; the service redacts this field.
181
+ * Correct options. Every supplied value must exactly match an entry in `options`; otherwise, creation fails with INVALID_QUIZ. Matching submitted answers ignores option order but doesn't ignore duplicate values. If no correct options are stored for this question, its submitted answer is non-evaluable and counts as correct when calculating the earned grade.
182
+ *
183
+ * Empty in responses when the caller lacks achievements:quizzes:v1:quiz:read_sensitive_fields permission. Response filtering doesn't remove stored keys or change grading; an empty response list doesn't mean no correct options are stored.
160
184
  * @maxSize 90
161
185
  * @minLength 1
162
186
  * @maxLength 350
163
187
  */
164
188
  rightAnswer?: string[] | null;
165
189
  /**
166
- * Answer options
190
+ * Options available to the participant.
167
191
  * @minSize 1
168
192
  * @maxSize 90
169
193
  * @minLength 1
@@ -173,42 +197,42 @@ interface MultiChoiceField {
173
197
  }
174
198
  interface FileUploadField {
175
199
  /**
176
- * Text for upload button
200
+ * Text displayed on the upload button. Default: `Upload`.
177
201
  * @minLength 1
178
202
  * @maxLength 100
179
203
  */
180
204
  buttonText?: string | null;
181
205
  /**
182
- * Limit of upload items
206
+ * Maximum number of files a participant can upload for this question, from `1` through `10`. Default: `10`.
183
207
  * @min 1
184
208
  * @max 10
185
209
  */
186
210
  itemsLimit?: number | null;
187
211
  /**
188
- * Formats of files that can be uploaded.
212
+ * Wix Forms file categories that participants can upload.
189
213
  *
190
- * Specify at least one format. `UNKNOWN_FILE_UPLOAD_FORMAT` isn't supported as a format selection.
214
+ * Specify at least one format. `UNKNOWN_FILE_UPLOAD_FORMAT` isn't supported as a format selection. File-upload answers aren't evaluated and count as correct when calculating the earned grade.
191
215
  * @maxSize 6
192
216
  */
193
217
  fileUploadFormats?: FileUploadFormatWithLiterals[];
194
218
  }
195
219
  interface CreateQuizRequest {
196
- /** Quiz to created */
220
+ /** Quiz definition to create. Generate a stable unique GUID for every `quiz.fields.id` value. */
197
221
  quiz: Quiz;
198
222
  }
199
223
  interface CreateQuizResponse {
200
- /** Created quiz */
224
+ /** Created quiz definition. Assign its `id` to `step.quizOptions.id` to create an Online Programs quiz step. */
201
225
  quiz?: Quiz;
202
226
  }
203
227
  interface CloneQuizRequest {
204
228
  /**
205
- * ID of the quiz to be cloned
229
+ * ID of the quiz definition to clone.
206
230
  * @format GUID
207
231
  */
208
232
  quizId: string;
209
233
  }
210
234
  interface CloneQuizResponse {
211
- /** Cloned quiz */
235
+ /** Cloned quiz definition with a new ID. Step associations and submissions aren't cloned. */
212
236
  quiz?: Quiz;
213
237
  }
214
238
  interface BulkCreateQuizzesRequest {
@@ -254,7 +278,7 @@ interface ApplicationError {
254
278
  data?: Record<string, any> | null;
255
279
  }
256
280
  interface BulkCreateQuizzesResponseBulkQuizResult {
257
- /** Metadata for the individual create operation. */
281
+ /** Metadata for the individual create operation. When the operation fails, `error` contains the original Wix Forms application error. */
258
282
  itemMetadata?: ItemMetadata;
259
283
  /** Created quiz. Empty when `return_entity` is `false`. */
260
284
  item?: Quiz;
@@ -296,29 +320,29 @@ interface BulkQuizResult {
296
320
  }
297
321
  interface GetQuizRequest {
298
322
  /**
299
- * ID of the quiz
323
+ * Quiz ID, available from `step.quizOptions.id` on a quiz-type Online Programs step.
300
324
  * @format GUID
301
325
  */
302
326
  quizId: string;
303
327
  }
304
328
  interface GetQuizResponse {
305
- /** Requested quiz */
329
+ /** Requested quiz definition. */
306
330
  quiz?: Quiz;
307
331
  }
308
332
  interface DeleteQuizRequest {
309
333
  /**
310
- * ID of quiz
334
+ * ID of the quiz definition to permanently delete.
311
335
  * @format GUID
312
336
  */
313
337
  quizId: string;
314
338
  }
315
339
  interface DeleteQuizResponse {
316
- /** Deleted quiz */
340
+ /** Permanently deleted quiz definition. */
317
341
  quiz?: Quiz;
318
342
  }
319
343
  interface BulkDeleteQuizzesRequest {
320
344
  /**
321
- * IDs of the quizzes to delete.
345
+ * IDs of the quiz definitions to permanently delete. Coordinate deletion with the Steps API and remove known step references first.
322
346
  * @minSize 1
323
347
  * @maxSize 100
324
348
  * @format GUID
@@ -336,7 +360,7 @@ interface BulkDeleteQuizzesResponse {
336
360
  bulkActionMetadata?: BulkActionMetadata;
337
361
  }
338
362
  interface BulkDeleteQuizzesResponseBulkQuizResult {
339
- /** Metadata for the individual delete operation. */
363
+ /** Metadata for the individual delete operation. When the operation fails, `error` contains the original Wix Forms application error. */
340
364
  itemMetadata?: ItemMetadata;
341
365
  }
342
366
  interface DomainEvent extends DomainEventBodyOneOf {
@@ -492,9 +516,57 @@ interface AccountInfo {
492
516
  */
493
517
  siteId?: string | null;
494
518
  }
519
+ /** @docsIgnore */
520
+ type CreateQuizApplicationErrors = {
521
+ code?: 'INVALID_QUIZ';
522
+ description?: string;
523
+ data?: Record<string, any>;
524
+ } | {
525
+ code?: 'QUIZ_CONFLICT';
526
+ description?: string;
527
+ data?: Record<string, any>;
528
+ };
529
+ /** @docsIgnore */
530
+ type CloneQuizApplicationErrors = {
531
+ code?: 'INVALID_QUIZ';
532
+ description?: string;
533
+ data?: Record<string, any>;
534
+ } | {
535
+ code?: 'QUIZ_NOT_FOUND';
536
+ description?: string;
537
+ data?: Record<string, any>;
538
+ } | {
539
+ code?: 'QUIZ_CONFLICT';
540
+ description?: string;
541
+ data?: Record<string, any>;
542
+ };
543
+ /** @docsIgnore */
544
+ type BulkCreateQuizzesApplicationErrors = {
545
+ code?: 'INVALID_QUIZ';
546
+ description?: string;
547
+ data?: Record<string, any>;
548
+ };
549
+ /** @docsIgnore */
550
+ type GetQuizApplicationErrors = {
551
+ code?: 'QUIZ_NOT_FOUND';
552
+ description?: string;
553
+ data?: Record<string, any>;
554
+ };
555
+ /** @docsIgnore */
556
+ type DeleteQuizApplicationErrors = {
557
+ code?: 'QUIZ_NOT_FOUND';
558
+ description?: string;
559
+ data?: Record<string, any>;
560
+ } | {
561
+ code?: 'QUIZ_CONFLICT';
562
+ description?: string;
563
+ data?: Record<string, any>;
564
+ };
495
565
  /**
496
- * Creates quiz
497
- * @param quiz - Quiz to created
566
+ * Creates a detached quiz definition with at least one question.
567
+ *
568
+ * To use the quiz in an Online Program, pass the returned quiz ID as `step.quizOptions.id` when calling the Steps API's `CreateStep` or `BulkCreateSteps` method.
569
+ * @param quiz - Quiz definition to create. Generate a stable unique GUID for every `quiz.fields.id` value.
498
570
  * @public
499
571
  * @requiredField quiz
500
572
  * @requiredField quiz.fields
@@ -506,22 +578,38 @@ interface AccountInfo {
506
578
  * @requiredField quiz.fields.target
507
579
  * @permissionId QUIZZES.CREATE_QUIZ
508
580
  * @applicableIdentity APP
509
- * @returns Created quiz
581
+ * @returns Created quiz definition. Assign its `id` to `step.quizOptions.id` to create an Online Programs quiz step.
510
582
  * @fqn wix.achievements.quizzes.v1.QuizService.CreateQuiz
511
583
  */
512
- declare function createQuiz(quiz: NonNullablePaths<Quiz, `fields` | `fields.${number}._id` | `fields.${number}.multiChoice.options` | `fields.${number}.question` | `fields.${number}.singleChoice.options` | `fields.${number}.target`, 3>): Promise<NonNullablePaths<Quiz, `fields` | `fields.${number}._id`, 2>>;
584
+ declare function createQuiz(quiz: NonNullablePaths<Quiz, `fields` | `fields.${number}._id` | `fields.${number}.multiChoice.options` | `fields.${number}.question` | `fields.${number}.singleChoice.options` | `fields.${number}.target`, 3>): Promise<NonNullablePaths<Quiz, `fields` | `fields.${number}._id`, 2> & {
585
+ __applicationErrorsType?: CreateQuizApplicationErrors;
586
+ }>;
513
587
  /**
514
- * Clones quiz
515
- * @param quizId - ID of the quiz to be cloned
588
+ * Clones a quiz definition and returns a new quiz ID.
589
+ *
590
+ * Checks the source before cloning. An existing definition found to have no active questions is rejected with INVALID_QUIZ before cloning. Source checks aren't atomic with cloning.
591
+ *
592
+ * This operation copies the question and settings definition only. It doesn't copy Online Programs step associations or quiz submissions. Attach the returned ID to a step separately when needed.
593
+ * @param quizId - ID of the quiz definition to clone.
516
594
  * @public
517
595
  * @requiredField quizId
518
596
  * @permissionId QUIZZES.CREATE_QUIZ
519
597
  * @applicableIdentity APP
520
598
  * @fqn wix.achievements.quizzes.v1.QuizService.CloneQuiz
521
599
  */
522
- declare function cloneQuiz(quizId: string): Promise<NonNullablePaths<CloneQuizResponse, `quiz.fields` | `quiz.fields.${number}._id`, 3>>;
600
+ declare function cloneQuiz(quizId: string): Promise<NonNullablePaths<CloneQuizResponse, `quiz.fields` | `quiz.fields.${number}._id`, 3> & {
601
+ __applicationErrorsType?: CloneQuizApplicationErrors;
602
+ }>;
523
603
  /**
524
- * Creates up to 30 quiz definitions in a single API call.
604
+ * Creates up to 30 detached quiz definitions in a single API call. Each definition must contain at least one question.
605
+ *
606
+ * Quiz IDs, revisions, and creation and update timestamps are assigned by the server. Client-supplied values for these read-only fields are ignored. Question IDs (`quizzes.fields.id`) must be supplied by the caller.
607
+ *
608
+ * Invalid quiz definitions fail the entire request before any quizzes are created.
609
+ *
610
+ * Individual item failures don't fail the bulk request. For each failed item, `results.itemMetadata.error` contains the original application error from the Wix Forms operation.
611
+ *
612
+ * To use the quizzes in an Online Program, pass the returned quiz IDs as `step.quizOptions.id` values when calling the Steps API's `CreateStep` or `BulkCreateSteps` method.
525
613
  * @param quizzes - Quiz definitions to create.
526
614
  * @public
527
615
  * @documentationMaturity preview
@@ -537,7 +625,9 @@ declare function cloneQuiz(quizId: string): Promise<NonNullablePaths<CloneQuizRe
537
625
  * @applicableIdentity APP
538
626
  * @fqn wix.achievements.quizzes.v1.QuizService.BulkCreateQuizzes
539
627
  */
540
- declare function bulkCreateQuizzes(quizzes: NonNullablePaths<Quiz, `fields` | `fields.${number}._id` | `fields.${number}.multiChoice.options` | `fields.${number}.question` | `fields.${number}.singleChoice.options` | `fields.${number}.target`, 3>[], options?: BulkCreateQuizzesOptions): Promise<NonNullablePaths<BulkCreateQuizzesResponse, `results` | `results.${number}.itemMetadata.originalIndex` | `results.${number}.itemMetadata.success` | `results.${number}.itemMetadata.error.code` | `results.${number}.itemMetadata.error.description` | `bulkActionMetadata.totalSuccesses` | `bulkActionMetadata.totalFailures` | `bulkActionMetadata.undetailedFailures`, 4>>;
628
+ declare function bulkCreateQuizzes(quizzes: NonNullablePaths<Quiz, `fields` | `fields.${number}._id` | `fields.${number}.multiChoice.options` | `fields.${number}.question` | `fields.${number}.singleChoice.options` | `fields.${number}.target`, 3>[], options?: BulkCreateQuizzesOptions): Promise<NonNullablePaths<BulkCreateQuizzesResponse, `results` | `results.${number}.itemMetadata.originalIndex` | `results.${number}.itemMetadata.success` | `results.${number}.itemMetadata.error.code` | `results.${number}.itemMetadata.error.description` | `bulkActionMetadata.totalSuccesses` | `bulkActionMetadata.totalFailures` | `bulkActionMetadata.undetailedFailures`, 4> & {
629
+ __applicationErrorsType?: BulkCreateQuizzesApplicationErrors;
630
+ }>;
541
631
  interface BulkCreateQuizzesOptions {
542
632
  /**
543
633
  * Whether to return the created quizzes in the response.
@@ -547,31 +637,45 @@ interface BulkCreateQuizzesOptions {
547
637
  returnEntity?: boolean;
548
638
  }
549
639
  /**
550
- * Reads quiz by ID
551
- * @param quizId - ID of the quiz
640
+ * Retrieves a quiz definition by ID. A stored definition whose questions have all been deleted can be returned with no active questions.
641
+ *
642
+ * To discover a quiz ID, query or retrieve its quiz-type Online Programs step and read `step.quizOptions.id`.
643
+ * @param quizId - Quiz ID, available from `step.quizOptions.id` on a quiz-type Online Programs step.
552
644
  * @public
553
645
  * @requiredField quizId
554
646
  * @permissionId achievements:quizzes:v1:quiz:get_quiz
555
647
  * @applicableIdentity APP
556
- * @returns Requested quiz
648
+ * @returns Requested quiz definition.
557
649
  * @fqn wix.achievements.quizzes.v1.QuizService.GetQuiz
558
650
  */
559
- declare function getQuiz(quizId: string): Promise<NonNullablePaths<Quiz, `fields` | `fields.${number}._id`, 2>>;
651
+ declare function getQuiz(quizId: string): Promise<NonNullablePaths<Quiz, `fields` | `fields.${number}._id`, 2> & {
652
+ __applicationErrorsType?: GetQuizApplicationErrors;
653
+ }>;
560
654
  /**
561
- * Deletes quiz
562
- * @param quizId - ID of quiz
655
+ * Permanently deletes a quiz definition.
656
+ *
657
+ * This operation doesn't check whether Online Programs steps reference the quiz. Coordinate deletion with the Steps API and remove known step references first. Otherwise, steps can retain dangling quiz references.
658
+ *
659
+ * NOT-PRECEDENT: This caller-responsibility behavior is retained as a production v1 compatibility exception. New delete APIs should provide an authoritative server-side reference safeguard.
660
+ * @param quizId - ID of the quiz definition to permanently delete.
563
661
  * @public
564
662
  * @requiredField quizId
565
663
  * @permissionId QUIZZES.DELETE_QUIZ
566
664
  * @applicableIdentity APP
567
665
  * @fqn wix.achievements.quizzes.v1.QuizService.DeleteQuiz
568
666
  */
569
- declare function deleteQuiz(quizId: string): Promise<NonNullablePaths<DeleteQuizResponse, `quiz.fields` | `quiz.fields.${number}._id`, 3>>;
667
+ declare function deleteQuiz(quizId: string): Promise<NonNullablePaths<DeleteQuizResponse, `quiz.fields` | `quiz.fields.${number}._id`, 3> & {
668
+ __applicationErrorsType?: DeleteQuizApplicationErrors;
669
+ }>;
570
670
  /**
571
671
  * Permanently deletes up to 100 quiz definitions.
572
672
  *
573
- * This operation doesn't check whether Online Programs steps reference the quizzes. Callers must remove or verify those references before deleting.
574
- * @param quizIds - IDs of the quizzes to delete.
673
+ * Individual item failures don't fail the bulk request. For each failed item, `results.itemMetadata.error` contains the original application error from the Wix Forms operation.
674
+ *
675
+ * This operation doesn't check whether Online Programs steps reference the quizzes. Coordinate deletion with the Steps API and remove known step references first. Otherwise, steps can retain dangling quiz references.
676
+ *
677
+ * NOT-PRECEDENT: This caller-responsibility behavior is retained as a production v1 compatibility exception. New bulk-delete APIs should provide an authoritative server-side reference safeguard.
678
+ * @param quizIds - IDs of the quiz definitions to permanently delete. Coordinate deletion with the Steps API and remove known step references first.
575
679
  * @public
576
680
  * @documentationMaturity preview
577
681
  * @requiredField quizIds
@@ -581,4 +685,4 @@ declare function deleteQuiz(quizId: string): Promise<NonNullablePaths<DeleteQuiz
581
685
  */
582
686
  declare function bulkDeleteQuizzes(quizIds: string[]): Promise<NonNullablePaths<BulkDeleteQuizzesResponse, `results` | `results.${number}.itemMetadata.originalIndex` | `results.${number}.itemMetadata.success` | `results.${number}.itemMetadata.error.code` | `results.${number}.itemMetadata.error.description` | `bulkActionMetadata.totalSuccesses` | `bulkActionMetadata.totalFailures` | `bulkActionMetadata.undetailedFailures`, 4>>;
583
687
 
584
- export { type AccountInfo, type ActionEvent, type ApplicationError, type BulkActionMetadata, type BulkCloneQuizzesRequest, type BulkCloneQuizzesResponse, type BulkCreateQuizzesOptions, type BulkCreateQuizzesRequest, type BulkCreateQuizzesResponse, type BulkCreateQuizzesResponseBulkQuizResult, type BulkDeleteQuizzesRequest, type BulkDeleteQuizzesResponse, type BulkDeleteQuizzesResponseBulkQuizResult, type BulkQuizResult, type CloneQuizRequest, type CloneQuizResponse, type CreateQuizRequest, type CreateQuizResponse, type DeleteQuizRequest, type DeleteQuizResponse, type DomainEvent, type DomainEventBodyOneOf, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type FileUploadField, FileUploadFormat, type FileUploadFormatWithLiterals, type GetQuizRequest, type GetQuizResponse, type IdentificationData, type IdentificationDataIdOneOf, type ItemMetadata, type LongTextField, type MessageEnvelope, type MultiChoiceField, type NumericField, type Quiz, type QuizField, type QuizFieldFieldTypeOneOf, type QuizSettings, type RestoreInfo, type ShortTextField, type SingleChoiceField, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, bulkCreateQuizzes, bulkDeleteQuizzes, cloneQuiz, createQuiz, deleteQuiz, getQuiz };
688
+ export { type AccountInfo, type ActionEvent, type ApplicationError, type BulkActionMetadata, type BulkCloneQuizzesRequest, type BulkCloneQuizzesResponse, type BulkCreateQuizzesApplicationErrors, type BulkCreateQuizzesOptions, type BulkCreateQuizzesRequest, type BulkCreateQuizzesResponse, type BulkCreateQuizzesResponseBulkQuizResult, type BulkDeleteQuizzesRequest, type BulkDeleteQuizzesResponse, type BulkDeleteQuizzesResponseBulkQuizResult, type BulkQuizResult, type CloneQuizApplicationErrors, type CloneQuizRequest, type CloneQuizResponse, type CreateQuizApplicationErrors, type CreateQuizRequest, type CreateQuizResponse, type DeleteQuizApplicationErrors, type DeleteQuizRequest, type DeleteQuizResponse, type DomainEvent, type DomainEventBodyOneOf, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent, type FileUploadField, FileUploadFormat, type FileUploadFormatWithLiterals, type GetQuizApplicationErrors, type GetQuizRequest, type GetQuizResponse, type IdentificationData, type IdentificationDataIdOneOf, type ItemMetadata, type LongTextField, type MessageEnvelope, type MultiChoiceField, type NumericField, type Quiz, type QuizField, type QuizFieldFieldTypeOneOf, type QuizSettings, type RestoreInfo, type ShortTextField, type SingleChoiceField, WebhookIdentityType, type WebhookIdentityTypeWithLiterals, bulkCreateQuizzes, bulkDeleteQuizzes, cloneQuiz, createQuiz, deleteQuiz, getQuiz };