@resconet/qp-bridge 0.0.1-alpha.6 → 0.0.1-alpha.7
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 +28 -0
- package/index.js +1 -1
- package/index.mjs +396 -364
- package/lib/qp-bridge-types.d.ts +87 -0
- package/lib/qp-bridge.d.ts +16 -1
- package/package.json +1 -1
package/lib/qp-bridge-types.d.ts
CHANGED
|
@@ -104,6 +104,32 @@ export declare const questionOptionalScheme: z.ZodObject<{
|
|
|
104
104
|
required?: boolean | undefined;
|
|
105
105
|
hidden?: boolean | undefined;
|
|
106
106
|
}>;
|
|
107
|
+
export declare const groupSchema: z.ZodObject<{
|
|
108
|
+
label: z.ZodString;
|
|
109
|
+
hidden: z.ZodBoolean;
|
|
110
|
+
collapsed: z.ZodBoolean;
|
|
111
|
+
}, "strip", z.ZodTypeAny, {
|
|
112
|
+
label: string;
|
|
113
|
+
hidden: boolean;
|
|
114
|
+
collapsed: boolean;
|
|
115
|
+
}, {
|
|
116
|
+
label: string;
|
|
117
|
+
hidden: boolean;
|
|
118
|
+
collapsed: boolean;
|
|
119
|
+
}>;
|
|
120
|
+
export declare const groupOptionalScheme: z.ZodObject<{
|
|
121
|
+
label: z.ZodOptional<z.ZodString>;
|
|
122
|
+
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
123
|
+
collapsed: z.ZodOptional<z.ZodBoolean>;
|
|
124
|
+
}, "strip", z.ZodTypeAny, {
|
|
125
|
+
label?: string | undefined;
|
|
126
|
+
hidden?: boolean | undefined;
|
|
127
|
+
collapsed?: boolean | undefined;
|
|
128
|
+
}, {
|
|
129
|
+
label?: string | undefined;
|
|
130
|
+
hidden?: boolean | undefined;
|
|
131
|
+
collapsed?: boolean | undefined;
|
|
132
|
+
}>;
|
|
107
133
|
export declare const getQuestionRequestMessageSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
108
134
|
type: z.ZodLiteral<"qp-bridge">;
|
|
109
135
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -229,6 +255,61 @@ export declare const setQuestionRequestMessageSchema: z.ZodObject<z.objectUtil.e
|
|
|
229
255
|
};
|
|
230
256
|
id?: string | undefined;
|
|
231
257
|
}>;
|
|
258
|
+
export declare const getGroupRequestMessageSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
259
|
+
type: z.ZodLiteral<"qp-bridge">;
|
|
260
|
+
id: z.ZodOptional<z.ZodString>;
|
|
261
|
+
}, {
|
|
262
|
+
action: z.ZodLiteral<"getGroup">;
|
|
263
|
+
group: z.ZodString;
|
|
264
|
+
}>, "strip", z.ZodTypeAny, {
|
|
265
|
+
type: "qp-bridge";
|
|
266
|
+
action: "getGroup";
|
|
267
|
+
group: string;
|
|
268
|
+
id?: string | undefined;
|
|
269
|
+
}, {
|
|
270
|
+
type: "qp-bridge";
|
|
271
|
+
action: "getGroup";
|
|
272
|
+
group: string;
|
|
273
|
+
id?: string | undefined;
|
|
274
|
+
}>;
|
|
275
|
+
export declare const getGroupSuccessResponseMessageSchema: z.ZodObject<z.objectUtil.extendShape<z.objectUtil.extendShape<{
|
|
276
|
+
type: z.ZodLiteral<"qp-bridge">;
|
|
277
|
+
id: z.ZodOptional<z.ZodString>;
|
|
278
|
+
}, {
|
|
279
|
+
status: z.ZodLiteral<"success">;
|
|
280
|
+
}>, {
|
|
281
|
+
group: z.ZodObject<{
|
|
282
|
+
label: z.ZodString;
|
|
283
|
+
hidden: z.ZodBoolean;
|
|
284
|
+
collapsed: z.ZodBoolean;
|
|
285
|
+
}, "strip", z.ZodTypeAny, {
|
|
286
|
+
label: string;
|
|
287
|
+
hidden: boolean;
|
|
288
|
+
collapsed: boolean;
|
|
289
|
+
}, {
|
|
290
|
+
label: string;
|
|
291
|
+
hidden: boolean;
|
|
292
|
+
collapsed: boolean;
|
|
293
|
+
}>;
|
|
294
|
+
}>, "strip", z.ZodTypeAny, {
|
|
295
|
+
type: "qp-bridge";
|
|
296
|
+
status: "success";
|
|
297
|
+
group: {
|
|
298
|
+
label: string;
|
|
299
|
+
hidden: boolean;
|
|
300
|
+
collapsed: boolean;
|
|
301
|
+
};
|
|
302
|
+
id?: string | undefined;
|
|
303
|
+
}, {
|
|
304
|
+
type: "qp-bridge";
|
|
305
|
+
status: "success";
|
|
306
|
+
group: {
|
|
307
|
+
label: string;
|
|
308
|
+
hidden: boolean;
|
|
309
|
+
collapsed: boolean;
|
|
310
|
+
};
|
|
311
|
+
id?: string | undefined;
|
|
312
|
+
}>;
|
|
232
313
|
export declare const setAnswerRequestMessageSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
233
314
|
type: z.ZodLiteral<"qp-bridge">;
|
|
234
315
|
id: z.ZodOptional<z.ZodString>;
|
|
@@ -254,10 +335,14 @@ export type ResponseSuccessMessage = z.infer<typeof responseSuccessMessageSchema
|
|
|
254
335
|
export type ResponseErrorMessage = z.infer<typeof responseErrorMessageSchema>;
|
|
255
336
|
export type Question = z.infer<typeof questionSchema>;
|
|
256
337
|
export type QuestionOptional = z.infer<typeof questionOptionalScheme>;
|
|
338
|
+
export type Group = z.infer<typeof groupSchema>;
|
|
339
|
+
export type GroupOptional = z.infer<typeof groupOptionalScheme>;
|
|
257
340
|
export type OnAnswerChangeMessage = z.infer<typeof onAnswerChangeMessageSchema>;
|
|
258
341
|
export type GetQuestionSuccessResponseMessage = z.infer<typeof getQuestionSuccessResponseMessageSchema>;
|
|
342
|
+
export type GetGroupSuccessResponseMessage = z.infer<typeof getGroupSuccessResponseMessageSchema>;
|
|
259
343
|
export type SetAnswerRequestMessage = z.infer<typeof setAnswerRequestMessageSchema>;
|
|
260
344
|
export type GetQuestionRequestMessage = z.infer<typeof getQuestionRequestMessageSchema>;
|
|
345
|
+
export type GetGroupRequestMessage = z.infer<typeof getGroupRequestMessageSchema>;
|
|
261
346
|
export type SetQuestionRequestMessage = z.infer<typeof setQuestionRequestMessageSchema>;
|
|
262
347
|
export declare function isOnAnswerChangeMessage(data: unknown): data is OnAnswerChangeMessage;
|
|
263
348
|
export declare function isQpBridgeMessage(data: unknown): data is QpBridgeMessage;
|
|
@@ -267,3 +352,5 @@ export declare function isGetQuestionRequestMessage(data: unknown): data is GetQ
|
|
|
267
352
|
export declare function isGetQuestionSuccessResponseMessage(data: unknown): data is GetQuestionSuccessResponseMessage;
|
|
268
353
|
export declare function isSetAnswerRequestMessage(data: unknown): data is SetAnswerRequestMessage;
|
|
269
354
|
export declare function isSetQuestionRequestMessage(data: unknown): data is SetQuestionRequestMessage;
|
|
355
|
+
export declare function isGetGroupRequestMessage(data: unknown): data is GetGroupRequestMessage;
|
|
356
|
+
export declare function isGetGroupSuccessResponseMessage(data: unknown): data is GetGroupSuccessResponseMessage;
|
package/lib/qp-bridge.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Question, QuestionOptional } from './qp-bridge-types';
|
|
1
|
+
import { Group, Question, QuestionOptional } from './qp-bridge-types';
|
|
2
2
|
/**
|
|
3
3
|
* Sets the answer for a specific question in the questionnaire.
|
|
4
4
|
*
|
|
@@ -39,6 +39,21 @@ export declare function getQuestion(name: string): Promise<Question>;
|
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
41
|
export declare function setQuestion(name: string, questionData: QuestionOptional): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Retrieves a group by its name from the questionnaire.
|
|
44
|
+
*
|
|
45
|
+
* @param {string} name - The name of the group to retrieve.
|
|
46
|
+
* @returns {Promise<Group>} A promise that resolves to the group object.
|
|
47
|
+
* @throws {Error} Throws if the message from the parent window indicates a failure.
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* const group = await getGroup('personalInfo');
|
|
51
|
+
* console.log(group.label); // Outputs the label of the group
|
|
52
|
+
* console.log(group.hidden); // Outputs whether the group is hidden
|
|
53
|
+
* console.log(group.collapsed); // Outputs whether the group is collapsed
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function getGroup(name: string): Promise<Group>;
|
|
42
57
|
/**
|
|
43
58
|
* Subscribes to changes in answers for questions.
|
|
44
59
|
* This function listens for messages from the parent window
|