@getuserfeedback/sdk 0.20.0 → 0.21.1

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
@@ -1,5 +1,5 @@
1
- import { AppEventJsonInputValue, ListInstanceFeedbackMineRequest, ListInstanceFeedbackMineResponse, CaptureInstanceFeedbackRequest, CaptureInstanceFeedbackResponse } from '@getuserfeedback/protocol';
2
- export { PublicCommandPayload } from '@getuserfeedback/protocol';
1
+ import { AppEventJsonInputValue, Answer, FeedbackOptions, FeedbackResult } from '@getuserfeedback/protocol';
2
+ export { Answer, FeedbackOptions, FeedbackResult, PublicCommandPayload } from '@getuserfeedback/protocol';
3
3
  import { TrackOptions, OpenRequestedDetail, ContainerPolicy, FlowRenderState, WidgetLayoutTransitionPolicy, ResponseMetadataInput, ConfigureOptions, IdentifyOptions, AppEventIdentity, ClientOptions } from '@getuserfeedback/protocol/host';
4
4
  export { ActionRegistration, ActionsConfig, AppEventCapability, AppEventFlag, AppEventFlagProvider, AppEventFlagValue, ClientOptions, ConfigureOptions, ContainerPolicy, HostActionDefinition, InitOptions, LinkRequest, LinkRouter, LinksConfig, RuntimeProperties, TrackOptions } from '@getuserfeedback/protocol/host';
5
5
 
@@ -21,23 +21,6 @@ type OpenRequestedEvent$1 = {
21
21
  preventDefault: () => void;
22
22
  };
23
23
 
24
- /** Feedback captured as an evaluation of the current app or a specific target. */
25
- type FeedbackInput = CaptureInstanceFeedbackRequest;
26
- /** Receipt returned after feedback has been accepted. */
27
- type SubmitFeedbackResult = CaptureInstanceFeedbackResponse;
28
- /** Selectors used to read the current authenticated user's feedback. */
29
- type FetchFeedbackInput = ListInstanceFeedbackMineRequest;
30
- /** Feedback matching each requested selector, in selector order. */
31
- type FetchFeedbackResult = ListInstanceFeedbackMineResponse;
32
- /** Operations for submitting and reading feedback through the current SDK client. */
33
- type FeedbackOperations = {
34
- /**
35
- * Read feedback matching each selector for the JWT-authenticated user.
36
- * Requires `auth.jwt` configuration; `identify()` alone does not authorize readback.
37
- */
38
- fetch: (input: FetchFeedbackInput) => Promise<FetchFeedbackResult>;
39
- submit: (input: FeedbackInput) => Promise<SubmitFeedbackResult>;
40
- };
41
24
  /** One endpoint in a directed relationship observation. Use `identities` for a user without a stable user ID. */
42
25
  type GraphEndpointIdentity = AppEventIdentity | {
43
26
  type: `externalId.users.none.${string}`;
@@ -192,10 +175,48 @@ type Client = {
192
175
  * failures reject the returned promise.
193
176
  */
194
177
  page: (name?: string, properties?: EventProperties, options?: EventOptions) => Promise<void>;
178
+ /**
179
+ * Submit feedback from your own UI.
180
+ *
181
+ * Resolves with `{ ok: true }` after capture; rejects if submission fails.
182
+ *
183
+ * @example
184
+ * Submit one text answer:
185
+ * ```ts
186
+ * await client.feedback("Love the app!");
187
+ * ```
188
+ *
189
+ * @example
190
+ * Add question definitions and app-supplied context:
191
+ * ```ts
192
+ * await client.feedback(
193
+ * [
194
+ * {
195
+ * value: "Search",
196
+ * question: { type: "text", text: "What should we improve?" },
197
+ * },
198
+ * {
199
+ * value: 4,
200
+ * question: { type: "scale", text: "How was setup?", min: 1, max: 5 },
201
+ * },
202
+ * ],
203
+ * { properties: { surface: "settings" } },
204
+ * );
205
+ * ```
206
+ *
207
+ * @example
208
+ * Associate feedback with a workspace using your configured Group key:
209
+ * ```ts
210
+ * await client.feedback("The workspace switcher was confusing.", {
211
+ * properties: { workspace_id: workspace.id },
212
+ * });
213
+ * ```
214
+ *
215
+ * @see https://getuserfeedback.com/docs/reference/javascript-sdk-reference#feedback
216
+ */
217
+ feedback: (answers: string | Answer | readonly Answer[], options?: FeedbackOptions) => Promise<FeedbackResult>;
195
218
  /** Record directed relationship observations through the analytics pipeline. */
196
219
  graph: GraphOperations;
197
- /** Submit feedback or read the authenticated user's matching feedback. */
198
- feedback: FeedbackOperations;
199
220
  /** Subscribe to explicit SDK and client-side targeting open requests, or suppress them — for example if you know the user should not be interrupted.
200
221
  * For example, when the user is filling out a form, or is in the middle of a multi-step flow.
201
222
  * Prevention applies only to that presentation attempt; it does not create a
@@ -223,4 +244,4 @@ declare const createClient: (options: ClientOptions) => Client;
223
244
  declare const SDK_VERSION: string;
224
245
 
225
246
  export { SDK_VERSION, createClient };
226
- export type { Client, EventOptions, EventProperties, FeedbackInput, FeedbackOperations, FetchFeedbackInput, FetchFeedbackResult, FlowRun, FlowState, FlowStateCallback, GraphEndpointIdentity, GraphOperations, GraphRelationship, GraphRelationshipRef, OpenFlowOptions, OpenRequestedCallback, OpenRequestedEvent, PrerenderFlowOptions, SubmitFeedbackResult, SubscribeFlowStateOptions };
247
+ export type { Client, EventOptions, EventProperties, FlowRun, FlowState, FlowStateCallback, GraphEndpointIdentity, GraphOperations, GraphRelationship, GraphRelationshipRef, OpenFlowOptions, OpenRequestedCallback, OpenRequestedEvent, PrerenderFlowOptions, SubscribeFlowStateOptions };