@wix/auto_sdk_forms_interactive-form-sessions 1.0.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.
Files changed (39) hide show
  1. package/build/cjs/index.d.ts +56 -0
  2. package/build/cjs/index.js +538 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/index.typings.d.ts +1082 -0
  5. package/build/cjs/index.typings.js +489 -0
  6. package/build/cjs/index.typings.js.map +1 -0
  7. package/build/cjs/meta.d.ts +494 -0
  8. package/build/cjs/meta.js +357 -0
  9. package/build/cjs/meta.js.map +1 -0
  10. package/build/es/index.d.mts +56 -0
  11. package/build/es/index.mjs +505 -0
  12. package/build/es/index.mjs.map +1 -0
  13. package/build/es/index.typings.d.mts +1082 -0
  14. package/build/es/index.typings.mjs +456 -0
  15. package/build/es/index.typings.mjs.map +1 -0
  16. package/build/es/meta.d.mts +494 -0
  17. package/build/es/meta.mjs +326 -0
  18. package/build/es/meta.mjs.map +1 -0
  19. package/build/es/package.json +3 -0
  20. package/build/internal/cjs/index.d.ts +56 -0
  21. package/build/internal/cjs/index.js +538 -0
  22. package/build/internal/cjs/index.js.map +1 -0
  23. package/build/internal/cjs/index.typings.d.ts +1082 -0
  24. package/build/internal/cjs/index.typings.js +489 -0
  25. package/build/internal/cjs/index.typings.js.map +1 -0
  26. package/build/internal/cjs/meta.d.ts +494 -0
  27. package/build/internal/cjs/meta.js +357 -0
  28. package/build/internal/cjs/meta.js.map +1 -0
  29. package/build/internal/es/index.d.mts +56 -0
  30. package/build/internal/es/index.mjs +505 -0
  31. package/build/internal/es/index.mjs.map +1 -0
  32. package/build/internal/es/index.typings.d.mts +1082 -0
  33. package/build/internal/es/index.typings.mjs +456 -0
  34. package/build/internal/es/index.typings.mjs.map +1 -0
  35. package/build/internal/es/meta.d.mts +494 -0
  36. package/build/internal/es/meta.mjs +326 -0
  37. package/build/internal/es/meta.mjs.map +1 -0
  38. package/meta/package.json +3 -0
  39. package/package.json +54 -0
@@ -0,0 +1,494 @@
1
+ import { CreateInteractiveFormSessionRequest as CreateInteractiveFormSessionRequest$1, CreateInteractiveFormSessionResponse as CreateInteractiveFormSessionResponse$1, CreateInteractiveFormSessionStreamedRequest as CreateInteractiveFormSessionStreamedRequest$1, CreateInteractiveFormSessionStreamedResponse as CreateInteractiveFormSessionStreamedResponse$1, SendUserMessageRequest as SendUserMessageRequest$1, SendUserMessageResponse as SendUserMessageResponse$1, SendUserMessageStreamedRequest as SendUserMessageStreamedRequest$1, SendUserMessageStreamedResponse as SendUserMessageStreamedResponse$1, ReportConversationRequest as ReportConversationRequest$1, ReportConversationResponse as ReportConversationResponse$1 } from './index.typings.js';
2
+ import '@wix/sdk-types';
3
+
4
+ interface InteractiveFormSession {
5
+ /**
6
+ * Form completion id
7
+ * @format GUID
8
+ * @readonly
9
+ */
10
+ id?: string;
11
+ /**
12
+ * Form id to complete
13
+ * @format GUID
14
+ */
15
+ formId?: string;
16
+ }
17
+ interface CreateInteractiveFormSessionRequest {
18
+ /**
19
+ * Interactive form session to be created.
20
+ * @format GUID
21
+ */
22
+ formId: string;
23
+ /**
24
+ * ID of the prompt to use.
25
+ * @format GUID
26
+ */
27
+ promptId?: string | null;
28
+ /**
29
+ * Sets current values for the form fields, used to pre-fill the form (e.g. when switching from classic form to chat form).
30
+ * These values are merged with existing values in the session.
31
+ * For example, if user has already filled field "Name" and then sends a message with current_values containing
32
+ * "LastName" field, "Name" will remain unchanged. If user sends a message with current_values containing "Name" field,
33
+ * it will override the existing value.
34
+ */
35
+ currentValues?: Record<string, any> | null;
36
+ /**
37
+ * Dry run mode. The completion will not conduct submission if set to true. Intended for preview mode.
38
+ * @immutable
39
+ */
40
+ dryRun?: boolean;
41
+ /**
42
+ * Current date-time string with user's timezone offset in ISO 8601 format (e.g. "2023-10-01T12:00:00+03:00").
43
+ * @minLength 1
44
+ * @maxLength 200
45
+ */
46
+ currentTime?: string | null;
47
+ /** Current date-time of api client */
48
+ clientTime?: ClientTime;
49
+ }
50
+ interface ClientTime {
51
+ /**
52
+ * Current date-time string UTC in ISO 8601 format (e.g. "2023-10-01T12:00:00Z).
53
+ * @minLength 1
54
+ * @maxLength 200
55
+ */
56
+ currentTime?: string | null;
57
+ /**
58
+ * Current time zone in format like: "Europe/Vilnius".
59
+ * @minLength 1
60
+ * @maxLength 50
61
+ */
62
+ timeZone?: string | null;
63
+ }
64
+ interface CreateInteractiveFormSessionResponse {
65
+ /** Interactive form session created */
66
+ interactiveFormSession?: InteractiveFormSession;
67
+ /** Assistant response chunks for the session */
68
+ responseChunks?: InteractiveFormSessionResponseChunk[];
69
+ }
70
+ interface InteractiveFormSessionResponseChunk extends InteractiveFormSessionResponseChunkOfOneOf {
71
+ /** Text chunk to display to the user */
72
+ textDetails?: TextDetails;
73
+ /** Data chunk which was extracted from the user input */
74
+ textDataDetails?: TextDataDetails;
75
+ /** Multi-select input chunk to display to the user */
76
+ multiSelectInputDetails?: MultiSelectInputDetails;
77
+ /** Number input chunk to display to the user */
78
+ numberInputDetails?: NumberInputDetails;
79
+ /** Separator chunk (e.g. paragraph break) */
80
+ separatorDetails?: SeparatorDetails;
81
+ /** Single-select input chunk to display to the user */
82
+ singleSelectInputDetails?: SingleSelectInputDetails;
83
+ /** Exception happened during processing, contains error message and details */
84
+ errorDetails?: ErrorDetails;
85
+ /** Form submission event acknowledgment chunk, contains submission id and checkout id if applicable */
86
+ submissionDetails?: SubmissionDetails;
87
+ /** Important information which might be used to derive TEXT_DATA */
88
+ importantTextDetails?: ImportantTextDetails;
89
+ /** Debug information, what tools were called, what was the input, etc. */
90
+ debugDetails?: DebugDetails;
91
+ /** End of chunk stream, indicates that no more chunks will be sent */
92
+ endOfResponseDetails?: EndOfResponseDetails;
93
+ /** Multi-select input chunk to display to the user */
94
+ fileUploadDetails?: FileUploadDetails;
95
+ /** Multi-select input chunk to display to the user */
96
+ signatureDetails?: SignatureDetails;
97
+ /** Type of the chunk */
98
+ chunkType?: ChunkTypeWithLiterals;
99
+ /** Marks which part of the original user input deemed meaningful by the assistant for extracting the answer. */
100
+ meaningfulInput?: MeaningfulInput;
101
+ }
102
+ /** @oneof */
103
+ interface InteractiveFormSessionResponseChunkOfOneOf {
104
+ /** Text chunk to display to the user */
105
+ textDetails?: TextDetails;
106
+ /** Data chunk which was extracted from the user input */
107
+ textDataDetails?: TextDataDetails;
108
+ /** Multi-select input chunk to display to the user */
109
+ multiSelectInputDetails?: MultiSelectInputDetails;
110
+ /** Number input chunk to display to the user */
111
+ numberInputDetails?: NumberInputDetails;
112
+ /** Separator chunk (e.g. paragraph break) */
113
+ separatorDetails?: SeparatorDetails;
114
+ /** Single-select input chunk to display to the user */
115
+ singleSelectInputDetails?: SingleSelectInputDetails;
116
+ /** Exception happened during processing, contains error message and details */
117
+ errorDetails?: ErrorDetails;
118
+ /** Form submission event acknowledgment chunk, contains submission id and checkout id if applicable */
119
+ submissionDetails?: SubmissionDetails;
120
+ /** Important information which might be used to derive TEXT_DATA */
121
+ importantTextDetails?: ImportantTextDetails;
122
+ /** Debug information, what tools were called, what was the input, etc. */
123
+ debugDetails?: DebugDetails;
124
+ /** End of chunk stream, indicates that no more chunks will be sent */
125
+ endOfResponseDetails?: EndOfResponseDetails;
126
+ /** Multi-select input chunk to display to the user */
127
+ fileUploadDetails?: FileUploadDetails;
128
+ /** Multi-select input chunk to display to the user */
129
+ signatureDetails?: SignatureDetails;
130
+ }
131
+ declare enum ChunkType {
132
+ UNKNOWN_CHUNK_TYPE = "UNKNOWN_CHUNK_TYPE",
133
+ /** Text chunk to display to the user */
134
+ TEXT = "TEXT",
135
+ /** Data chunk which was extracted from the user input */
136
+ TEXT_DATA = "TEXT_DATA",
137
+ /** Multi-select input chunk to display to the user */
138
+ MULTI_SELECT_INPUT = "MULTI_SELECT_INPUT",
139
+ /** Number input chunk to display to the user */
140
+ NUMBER_INPUT = "NUMBER_INPUT",
141
+ SEPARATOR = "SEPARATOR",
142
+ /** Single-select input chunk to display to the user */
143
+ SINGLE_SELECT_INPUT = "SINGLE_SELECT_INPUT",
144
+ /** Exception happened during processing, contains error message and details */
145
+ ERROR = "ERROR",
146
+ /** Form submission event acknowledgment chunk, contains submission id and checkout id if applicable */
147
+ SUBMISSION = "SUBMISSION",
148
+ /** Important information which might be used to derive TEXT_DATA */
149
+ IMPORTANT_TEXT = "IMPORTANT_TEXT",
150
+ /** Debug information, what tools were called, what was the input, etc. */
151
+ DEBUG = "DEBUG",
152
+ /** End of chunk stream, indicates that no more chunks will be sent */
153
+ END_OF_RESPONSE = "END_OF_RESPONSE",
154
+ /** File Upload input chunk to display to the user */
155
+ FILE_UPLOAD = "FILE_UPLOAD",
156
+ /** Signature input chunk to display to the user */
157
+ SIGNATURE = "SIGNATURE"
158
+ }
159
+ /** @enumType */
160
+ type ChunkTypeWithLiterals = ChunkType | 'UNKNOWN_CHUNK_TYPE' | 'TEXT' | 'TEXT_DATA' | 'MULTI_SELECT_INPUT' | 'NUMBER_INPUT' | 'SEPARATOR' | 'SINGLE_SELECT_INPUT' | 'ERROR' | 'SUBMISSION' | 'IMPORTANT_TEXT' | 'DEBUG' | 'END_OF_RESPONSE' | 'FILE_UPLOAD' | 'SIGNATURE';
161
+ interface TextDetails {
162
+ /**
163
+ * Text content to display
164
+ * @minLength 1
165
+ * @maxLength 10000
166
+ */
167
+ text?: string;
168
+ /** Style of the text (e.g. normal, bold) */
169
+ style?: StyleWithLiterals;
170
+ }
171
+ declare enum Style {
172
+ UNKNOWN_STYLE = "UNKNOWN_STYLE",
173
+ NORMAL = "NORMAL",
174
+ BOLD = "BOLD"
175
+ }
176
+ /** @enumType */
177
+ type StyleWithLiterals = Style | 'UNKNOWN_STYLE' | 'NORMAL' | 'BOLD';
178
+ interface TextDataDetails {
179
+ /**
180
+ * Target field key for the data
181
+ * @minLength 1
182
+ * @maxLength 200
183
+ */
184
+ fieldTarget?: string;
185
+ /**
186
+ * Text content to display
187
+ * @minLength 1
188
+ * @maxLength 10000
189
+ */
190
+ text?: string;
191
+ /** "Technical" value used for the form submission, e.g. if it's boolean, value will be `true` or `false` */
192
+ value?: any;
193
+ /**
194
+ * User friendly string to display user's submitted value, e.g. if it's boolean, value will be "Yes" or "No"
195
+ * @minLength 1
196
+ * @maxLength 10000
197
+ */
198
+ displayValue?: string;
199
+ }
200
+ interface MultiSelectInputDetails {
201
+ /**
202
+ * Field id for the multi-select input
203
+ * @minLength 1
204
+ * @maxLength 200
205
+ */
206
+ fieldTarget?: string;
207
+ /**
208
+ * Options available for selection
209
+ * @minSize 1
210
+ * @maxSize 100
211
+ */
212
+ options?: Option[];
213
+ /** If present, then user is allowed to provide custom values */
214
+ allowedCustomValue?: CustomValue;
215
+ }
216
+ interface Option {
217
+ /**
218
+ * Value to be submitted for the option
219
+ * @minLength 1
220
+ * @maxLength 10000
221
+ */
222
+ value?: string;
223
+ /**
224
+ * Label to display for the option
225
+ * @minLength 1
226
+ * @maxLength 10000
227
+ */
228
+ label?: string;
229
+ }
230
+ interface CustomValue {
231
+ /**
232
+ * Description of expected custom value
233
+ * @maxLength 10000
234
+ */
235
+ description?: string;
236
+ }
237
+ interface NumberInputDetails {
238
+ /**
239
+ * Field id for the number input
240
+ * @minLength 1
241
+ * @maxLength 200
242
+ */
243
+ fieldTarget?: string;
244
+ /** Limit min and max range for the input */
245
+ rangeLimit?: NumberRangeLimit;
246
+ /** If provided, only multiples of this value are accepted */
247
+ multipleOf?: number | null;
248
+ }
249
+ interface NumberRangeLimit extends NumberRangeLimitEndOneOf {
250
+ /** Maximum value of the range (inclusive) */
251
+ maxInclusiveValue?: number | null;
252
+ /** Maximum value of the range (exclusive) */
253
+ maxExclusiveValue?: number | null;
254
+ /** Minimum value of the range (inclusive) */
255
+ minInclusiveValue?: number | null;
256
+ }
257
+ /** @oneof */
258
+ interface NumberRangeLimitEndOneOf {
259
+ /** Maximum value of the range (inclusive) */
260
+ maxInclusiveValue?: number | null;
261
+ /** Maximum value of the range (exclusive) */
262
+ maxExclusiveValue?: number | null;
263
+ }
264
+ interface SeparatorDetails {
265
+ /** Type of separator (e.g. paragraph) */
266
+ type?: TypeWithLiterals;
267
+ }
268
+ declare enum Type {
269
+ UNKNOWN_TYPE = "UNKNOWN_TYPE",
270
+ PARAGRAPH = "PARAGRAPH"
271
+ }
272
+ /** @enumType */
273
+ type TypeWithLiterals = Type | 'UNKNOWN_TYPE' | 'PARAGRAPH';
274
+ interface SingleSelectInputDetails {
275
+ /**
276
+ * Field id for the single-select input
277
+ * @minLength 1
278
+ * @maxLength 200
279
+ */
280
+ fieldTarget?: string;
281
+ /**
282
+ * Options available for selection
283
+ * @minSize 1
284
+ * @maxSize 100
285
+ */
286
+ options?: Option[];
287
+ /** If present, then user is allowed to provide custom values */
288
+ allowedCustomValue?: CustomValue;
289
+ }
290
+ interface ErrorDetails {
291
+ /**
292
+ * Error message text
293
+ * @minLength 1
294
+ * @maxLength 1000
295
+ */
296
+ messageText?: string;
297
+ }
298
+ interface SubmissionDetails {
299
+ /**
300
+ * Created submission id
301
+ * @format GUID
302
+ */
303
+ submissionId?: string;
304
+ /**
305
+ * ID of the ecom checkout related to submission (only applicable if a form has payments).
306
+ * @format GUID
307
+ * @readonly
308
+ */
309
+ checkoutId?: string | null;
310
+ }
311
+ interface ImportantTextDetails {
312
+ /**
313
+ * Target field key for the important text
314
+ * @minLength 1
315
+ * @maxLength 200
316
+ */
317
+ fieldTarget?: string;
318
+ /**
319
+ * Important text content to display
320
+ * @minLength 1
321
+ * @maxLength 10000
322
+ */
323
+ text?: string;
324
+ }
325
+ interface DebugDetails {
326
+ /** Debug data for troubleshooting */
327
+ data?: Record<string, any> | null;
328
+ }
329
+ interface EndOfResponseDetails {
330
+ /** If the response was successful */
331
+ success?: boolean;
332
+ }
333
+ interface FileUploadDetails {
334
+ /**
335
+ * Field id for the file upload input
336
+ * @minLength 1
337
+ * @maxLength 200
338
+ */
339
+ fieldTarget?: string;
340
+ }
341
+ interface SignatureDetails {
342
+ /**
343
+ * Field id for the signature input
344
+ * @minLength 1
345
+ * @maxLength 200
346
+ */
347
+ fieldTarget?: string;
348
+ }
349
+ interface MeaningfulInput {
350
+ /**
351
+ * Character offset (0-indexed) from the start of the user input to where the meaningful text starts
352
+ * @max 10000
353
+ */
354
+ startOffset?: number;
355
+ /**
356
+ * Length of the meaningful text in characters
357
+ * @max 10000
358
+ */
359
+ length?: number;
360
+ }
361
+ interface CreateInteractiveFormSessionStreamedRequest {
362
+ /**
363
+ * Interactive form session to be created.
364
+ * @format GUID
365
+ */
366
+ formId: string;
367
+ /**
368
+ * ID of the prompt to use.
369
+ * @format GUID
370
+ */
371
+ promptId?: string | null;
372
+ /** Sets current values for the form fields, used to pre-fill the form (e.g. when switching from classic form to chat form). */
373
+ currentValues?: Record<string, any> | null;
374
+ /**
375
+ * Dry run mode. The completion will not conduct submission if set to true. Intended for preview mode.
376
+ * @immutable
377
+ */
378
+ dryRun?: boolean;
379
+ /**
380
+ * Current date-time string with user's timezone offset in ISO 8601 format (e.g. "2023-10-01T12:00:00+03:00").
381
+ * @minLength 1
382
+ * @maxLength 200
383
+ */
384
+ currentTime?: string | null;
385
+ /** Current date-time of api client */
386
+ clientTime?: ClientTime;
387
+ }
388
+ interface CreateInteractiveFormSessionStreamedResponse {
389
+ /** Assistant response chunk */
390
+ responseChunk?: InteractiveFormSessionResponseChunk;
391
+ /** Interactive form session. Only returned on the 1st chunk of the stream. */
392
+ interactiveFormSession?: InteractiveFormSession;
393
+ }
394
+ interface SendUserMessageRequest {
395
+ /**
396
+ * Interactive form session id
397
+ * @format GUID
398
+ */
399
+ interactiveFormSessionId: string;
400
+ /**
401
+ * User input to add to the session
402
+ * @maxLength 10000
403
+ */
404
+ input?: string | null;
405
+ /**
406
+ * Sets current values for the form fields, used to pre-fill the form (e.g. when switching from classic form to chat form).
407
+ * These values are merged with existing values in the session.
408
+ * For example, if user has already filled field "Name" and then sends a message with current_values containing
409
+ * "LastName" field, "Name" will remain unchanged. If user sends a message with current_values containing "Name" field,
410
+ * it will override the existing value.
411
+ */
412
+ currentValues?: Record<string, any> | null;
413
+ }
414
+ interface SendUserMessageResponse {
415
+ /** Interactive form session after input is added */
416
+ interactiveFormSession?: InteractiveFormSession;
417
+ /** Assistant response chunks for the input */
418
+ responseChunks?: InteractiveFormSessionResponseChunk[];
419
+ }
420
+ interface SendUserMessageStreamedRequest {
421
+ /**
422
+ * Interactive form session id
423
+ * @format GUID
424
+ */
425
+ interactiveFormSessionId: string;
426
+ /**
427
+ * User input to add to the session
428
+ * @maxLength 10000
429
+ */
430
+ input?: string | null;
431
+ /**
432
+ * Sets current values for the form fields, used to pre-fill the form (e.g. when switching from classic form to chat form).
433
+ * These values are merged with existing values in the session.
434
+ * For example, if user has already filled field "Name" and then sends a message with current_values containing
435
+ * "LastName" field, "Name" will remain unchanged. If user sends a message with current_values containing "Name" field,
436
+ * it will override the existing value.
437
+ */
438
+ currentValues?: Record<string, any> | null;
439
+ }
440
+ interface SendUserMessageStreamedResponse {
441
+ /** Assistant response chunk for the streamed input */
442
+ responseChunk?: InteractiveFormSessionResponseChunk;
443
+ /** Interactive form session after input is added */
444
+ interactiveFormSession?: InteractiveFormSession;
445
+ }
446
+ interface ReportConversationRequest {
447
+ /**
448
+ * Interactive form session id
449
+ * @format GUID
450
+ */
451
+ interactiveFormSessionId?: string;
452
+ /**
453
+ * Report description
454
+ * @minLength 1
455
+ * @maxLength 10000
456
+ */
457
+ description?: string;
458
+ /**
459
+ * Viewer debug URL of the conversation
460
+ * @format WEB_URL
461
+ */
462
+ viewerDebugUrl?: string;
463
+ }
464
+ interface ReportConversationResponse {
465
+ /** If the report was successfully created */
466
+ success?: boolean | null;
467
+ /**
468
+ * Error message if the report creation failed
469
+ * @maxLength 10000
470
+ */
471
+ errorMessage?: string | null;
472
+ }
473
+
474
+ type __PublicMethodMetaInfo<K = string, M = unknown, T = unknown, S = unknown, Q = unknown, R = unknown> = {
475
+ getUrl: (context: any) => string;
476
+ httpMethod: K;
477
+ path: string;
478
+ pathParams: M;
479
+ __requestType: T;
480
+ __originalRequestType: S;
481
+ __responseType: Q;
482
+ __originalResponseType: R;
483
+ };
484
+ declare function createInteractiveFormSession(): __PublicMethodMetaInfo<'POST', {}, CreateInteractiveFormSessionRequest$1, CreateInteractiveFormSessionRequest, CreateInteractiveFormSessionResponse$1, CreateInteractiveFormSessionResponse>;
485
+ declare function createInteractiveFormSessionStreamed(): __PublicMethodMetaInfo<'POST', {}, CreateInteractiveFormSessionStreamedRequest$1, CreateInteractiveFormSessionStreamedRequest, CreateInteractiveFormSessionStreamedResponse$1, CreateInteractiveFormSessionStreamedResponse>;
486
+ declare function sendUserMessage(): __PublicMethodMetaInfo<'POST', {
487
+ interactiveFormSessionId: string;
488
+ }, SendUserMessageRequest$1, SendUserMessageRequest, SendUserMessageResponse$1, SendUserMessageResponse>;
489
+ declare function sendUserMessageStreamed(): __PublicMethodMetaInfo<'POST', {
490
+ interactiveFormSessionId: string;
491
+ }, SendUserMessageStreamedRequest$1, SendUserMessageStreamedRequest, SendUserMessageStreamedResponse$1, SendUserMessageStreamedResponse>;
492
+ declare function reportConversation(): __PublicMethodMetaInfo<'POST', {}, ReportConversationRequest$1, ReportConversationRequest, ReportConversationResponse$1, ReportConversationResponse>;
493
+
494
+ export { type __PublicMethodMetaInfo, createInteractiveFormSession, createInteractiveFormSessionStreamed, reportConversation, sendUserMessage, sendUserMessageStreamed };