@getuserfeedback/sdk 0.19.12 → 0.21.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.
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- import { AppEventJsonValue, 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
- export { ActionRegistration, ActionsConfig, AppEventCapability, AppEventFlag, AppEventFlagProvider, AppEventFlagValue, CapabilitiesInput, ClientOptions, ConfigureOptions, ContainerPolicy, FlagsInput, HostActionDefinition, InitOptions, LinkRequest, LinkRouter, LinksConfig, TrackOptions } from '@getuserfeedback/protocol/host';
4
+ export { ActionRegistration, ActionsConfig, AppEventCapability, AppEventFlag, AppEventFlagProvider, AppEventFlagValue, ClientOptions, ConfigureOptions, ContainerPolicy, HostActionDefinition, InitOptions, LinkRequest, LinkRouter, LinksConfig, RuntimeProperties, TrackOptions } from '@getuserfeedback/protocol/host';
5
5
 
6
- type EventProperties = Record<string, AppEventJsonValue>;
6
+ type EventProperties = Record<string, AppEventJsonInputValue>;
7
7
  type EventOptions = TrackOptions;
8
8
 
9
9
  type OpenRequestedPayload = OpenRequestedDetail;
@@ -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}`;
@@ -63,7 +46,7 @@ type GraphOperations = {
63
46
  disconnect: (relationship: GraphRelationship) => Promise<void>;
64
47
  };
65
48
 
66
- /** Durable state of a flow run (open/loading + dimensions when known). */
49
+ /** Current flow state (open/loading and dimensions when known). */
67
50
  interface FlowState extends FlowRenderState {
68
51
  /**
69
52
  * @deprecated Stop reading this field. SDK state snapshots and subscriptions
@@ -109,7 +92,7 @@ type SubscribeFlowStateOptions = {
109
92
  type FlowRun = {
110
93
  /** The flow/survey ID this instance refers to. */
111
94
  flowId: string;
112
- /** Open the flow (show the survey). */
95
+ /** Open the flow. Immediately reports loading until the open settles or close/reset clears its intent. */
113
96
  open: (options?: OpenFlowOptions) => Promise<void>;
114
97
  /** Prefetch the flow so it opens faster when you call `open()`. */
115
98
  prefetch: () => Promise<void>;
@@ -152,7 +135,7 @@ type Client = {
152
135
  *
153
136
  * When using `disableAutoLoad`, call `load()` first. Calls made before `load()`
154
137
  * resolve without applying the update. Provide the initial color scheme,
155
- * default consent, and capabilities to `createClient()`; configure auth after
138
+ * default consent, and properties to `createClient()`; configure auth after
156
139
  * `load()`.
157
140
  *
158
141
  * @see https://getuserfeedback.com/docs/security-and-privacy/jwt-auth
@@ -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: (content: 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
@@ -214,7 +235,7 @@ type Client = {
214
235
  };
215
236
  /**
216
237
  * Create a getuserfeedback client. Reuses an existing logical client for the
217
- * same `apiKey` and targeting context. Host-action definitions may change
238
+ * same `apiKey`. Host-action definitions may change
218
239
  * before loading starts; afterward, changing their canonical identities throws
219
240
  * while equivalent definitions refresh their handlers.
220
241
  */
@@ -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 };