@resconet/qp-bridge 1.3.2-alpha.3 → 1.3.2-alpha.4

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,4 +1,7 @@
1
1
  import { Entity, Group, GroupOptional, MediaItem, Question, QuestionOptional } from './qp-bridge-types';
2
+ export type QpBridgeOptions = {
3
+ instanceId?: string;
4
+ };
2
5
  /**
3
6
  * Creates a MediaItem from the provided parameters and content.
4
7
  *
@@ -79,7 +82,7 @@ export declare function removeOnSaveMessageHandler(): void;
79
82
  * ```
80
83
  * @see onAnswerChange
81
84
  */
82
- export declare function setAnswer(questionName: string, answer: unknown): Promise<void>;
85
+ export declare function setAnswer(questionName: string, answer: unknown, options?: QpBridgeOptions): Promise<void>;
83
86
  /**
84
87
  * Retrieves a question by its name from the questionnaire.
85
88
  *
@@ -92,7 +95,7 @@ export declare function setAnswer(questionName: string, answer: unknown): Promis
92
95
  * console.log(question.label); // Outputs the label of the question
93
96
  * ```
94
97
  */
95
- export declare function getQuestion(name: string): Promise<Question>;
98
+ export declare function getQuestion(name: string, options?: QpBridgeOptions): Promise<Question>;
96
99
  /**
97
100
  * Updates a question in the questionnaire.
98
101
  *
@@ -105,7 +108,7 @@ export declare function getQuestion(name: string): Promise<Question>;
105
108
  * await setQuestion('favoriteColor', { label: 'What is your favorite color?' });
106
109
  * ```
107
110
  */
108
- export declare function setQuestion(name: string, questionData: QuestionOptional): Promise<void>;
111
+ export declare function setQuestion(name: string, questionData: QuestionOptional, options?: QpBridgeOptions): Promise<void>;
109
112
  /**
110
113
  * Retrieves a group by its name from the questionnaire.
111
114
  *
@@ -120,7 +123,7 @@ export declare function setQuestion(name: string, questionData: QuestionOptional
120
123
  * console.log(group.collapsed); // Outputs whether the group is collapsed
121
124
  * ```
122
125
  */
123
- export declare function getGroup(name: string): Promise<Group>;
126
+ export declare function getGroup(name: string, options?: QpBridgeOptions): Promise<Group>;
124
127
  /**
125
128
  * Updates a group in the questionnaire.
126
129
  *
@@ -133,7 +136,7 @@ export declare function getGroup(name: string): Promise<Group>;
133
136
  * await setGroup('personalInfo', { label: 'Personal Information', hidden: false, collapsed: true });
134
137
  * ```
135
138
  */
136
- export declare function setGroup(name: string, groupData: GroupOptional): Promise<void>;
139
+ export declare function setGroup(name: string, groupData: GroupOptional, options?: QpBridgeOptions): Promise<void>;
137
140
  /**
138
141
  * Subscribes to changes in answers for questions.
139
142
  * Calls the provided listener whenever an answer changes in the questionnaire.
@@ -150,7 +153,7 @@ export declare function setGroup(name: string, groupData: GroupOptional): Promis
150
153
  * cancelSubscription();
151
154
  * ```
152
155
  **/
153
- export declare function onAnswerChange(listener: (question: string, answer: unknown) => void): {
156
+ export declare function onAnswerChange(listener: (question: string, answer: unknown) => void, options?: QpBridgeOptions): {
154
157
  cancelSubscription: () => void;
155
158
  };
156
159
  /**
@@ -171,7 +174,7 @@ export declare function onAnswerChange(listener: (question: string, answer: unkn
171
174
  * console.log(result); // 'done'
172
175
  * ```
173
176
  */
174
- export declare function withBusyIndicator<T>(action: () => Promise<T>): Promise<T>;
177
+ export declare function withBusyIndicator<T>(action: () => Promise<T>, options?: QpBridgeOptions): Promise<T>;
175
178
  /**
176
179
  * Saves the current questionnaire state.
177
180
  * Triggers a save operation for the questionnaire data.
@@ -184,7 +187,7 @@ export declare function withBusyIndicator<T>(action: () => Promise<T>): Promise<
184
187
  * console.log('Questionnaire saved successfully');
185
188
  * ```
186
189
  */
187
- export declare function saveQuestionnaire(): Promise<void>;
190
+ export declare function saveQuestionnaire(options?: QpBridgeOptions): Promise<void>;
188
191
  /**
189
192
  * Completes and closes the current questionnaire.
190
193
  * Triggers the complete and close operation for the questionnaire.
@@ -197,7 +200,7 @@ export declare function saveQuestionnaire(): Promise<void>;
197
200
  * console.log('Questionnaire completed and closed successfully');
198
201
  * ```
199
202
  */
200
- export declare function completeAndCloseQuestionnaire(): Promise<void>;
203
+ export declare function completeAndCloseQuestionnaire(options?: QpBridgeOptions): Promise<void>;
201
204
  /**
202
205
  * Executes a custom command by its name.
203
206
  * Triggers the execution of any user-defined command in the questionnaire.
@@ -211,7 +214,7 @@ export declare function completeAndCloseQuestionnaire(): Promise<void>;
211
214
  * console.log('Custom command executed successfully');
212
215
  * ```
213
216
  */
214
- export declare function executeCustomCommand(commandName: string): Promise<void>;
217
+ export declare function executeCustomCommand(commandName: string, options?: QpBridgeOptions): Promise<void>;
215
218
  type Validator = () => Promise<boolean>;
216
219
  /**
217
220
  * Registers a handler function to be called when the questionnaire is fully loaded.
@@ -230,7 +233,7 @@ type Validator = () => Promise<boolean>;
230
233
  * cancelSubscription();
231
234
  * ```
232
235
  */
233
- export declare function onQuestionnaireLoaded(handler: () => void): {
236
+ export declare function onQuestionnaireLoaded(handler: () => void, options?: QpBridgeOptions): {
234
237
  cancelSubscription: () => void;
235
238
  };
236
239
  /**
@@ -250,7 +253,7 @@ export declare function onQuestionnaireLoaded(handler: () => void): {
250
253
  * cancelSubscription();
251
254
  * ```
252
255
  */
253
- export declare function onCommandExecuted(handler: (commandName: string) => void): {
256
+ export declare function onCommandExecuted(handler: (commandName: string) => void, options?: QpBridgeOptions): {
254
257
  cancelSubscription: () => void;
255
258
  };
256
259
  /**
@@ -271,7 +274,7 @@ export declare function onCommandExecuted(handler: (commandName: string) => void
271
274
  * cancelSubscription();
272
275
  * ```
273
276
  */
274
- export declare function onSave(validator: Validator): {
277
+ export declare function onSave(validator: Validator, options?: QpBridgeOptions): {
275
278
  cancelSubscription: () => void;
276
279
  };
277
280
  /**
@@ -292,7 +295,7 @@ export declare function onSave(validator: Validator): {
292
295
  * console.log(entities); // Array of contact entities
293
296
  * ```
294
297
  */
295
- export declare function fetchEntities(fetchXml: string): Promise<Entity[]>;
298
+ export declare function fetchEntities(fetchXml: string, options?: QpBridgeOptions): Promise<Entity[]>;
296
299
  /**
297
300
  * Retrieves a single entity by its name and ID from the CRM system.
298
301
  *
@@ -306,7 +309,7 @@ export declare function fetchEntities(fetchXml: string): Promise<Entity[]>;
306
309
  * console.log(contact.attributes.firstname); // Entity firstname attribute
307
310
  * ```
308
311
  */
309
- export declare function getEntityById(entityName: string, id: string): Promise<Entity>;
312
+ export declare function getEntityById(entityName: string, id: string, options?: QpBridgeOptions): Promise<Entity>;
310
313
  /**
311
314
  * Creates a new entity marker that can be enriched before saving.
312
315
  * The returned entity is flagged with `isNew` so the host can distinguish new records.
@@ -316,7 +319,7 @@ export declare function createNewEntity(): Entity;
316
319
  * Persists an entity through the bridge. Supports both new and existing entities.
317
320
  * @param entity - Entity payload; include `isNew` for newly created entities.
318
321
  */
319
- export declare function saveEntity(entity: Entity): Promise<void>;
322
+ export declare function saveEntity(entity: Entity, options?: QpBridgeOptions): Promise<void>;
320
323
  /**
321
324
  * Repeats a specific group within a repeatable group by creating a copy of the group at the specified index.
322
325
  * The parent group must be a repeatable group and the index must refer to an existing group instance.
@@ -331,7 +334,7 @@ export declare function saveEntity(entity: Entity): Promise<void>;
331
334
  * console.log('Group repeated successfully');
332
335
  * ```
333
336
  */
334
- export declare function repeatGroup(repeatableGroupName: string, groupIndex: number): Promise<void>;
337
+ export declare function repeatGroup(repeatableGroupName: string, groupIndex: number, options?: QpBridgeOptions): Promise<void>;
335
338
  /**
336
339
  * Adds a new group instance to a repeatable group.
337
340
  * The specified name must refer to a repeatable group.
@@ -345,7 +348,7 @@ export declare function repeatGroup(repeatableGroupName: string, groupIndex: num
345
348
  * console.log('New group added successfully');
346
349
  * ```
347
350
  */
348
- export declare function addNewGroup(repeatableGroupName: string): Promise<void>;
351
+ export declare function addNewGroup(repeatableGroupName: string, options?: QpBridgeOptions): Promise<void>;
349
352
  /**
350
353
  * Deletes a specific group instance from a repeatable group by index.
351
354
  * The parent group must be a repeatable group and the index must refer to an existing group instance.
@@ -360,5 +363,5 @@ export declare function addNewGroup(repeatableGroupName: string): Promise<void>;
360
363
  * console.log('Group deleted successfully');
361
364
  * ```
362
365
  */
363
- export declare function deleteGroup(repeatableGroupName: string, groupIndex: number): Promise<void>;
366
+ export declare function deleteGroup(repeatableGroupName: string, groupIndex: number, options?: QpBridgeOptions): Promise<void>;
364
367
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resconet/qp-bridge",
3
- "version": "1.3.2-alpha.3",
3
+ "version": "1.3.2-alpha.4",
4
4
  "main": "./index.js",
5
5
  "module": "./index.mjs",
6
6
  "typings": "./index.d.ts",