@getuserfeedback/sdk 0.12.36 → 0.13.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.
@@ -0,0 +1,227 @@
1
+ import { InlineFlow } from '@getuserfeedback/protocol/internal/inline-flow';
2
+ export { InlineFlow } from '@getuserfeedback/protocol/internal/inline-flow';
3
+ import { ListInstanceFeedbackMineRequest, ListInstanceFeedbackMineResponse, CaptureInstanceFeedbackRequest, CaptureInstanceFeedbackResponse } from '@getuserfeedback/protocol';
4
+ import { OpenRequestedDetail, ClientOptions, ResponseMetadataInput, FlowRenderState, WidgetLayoutTransitionPolicy, WidgetLayoutTimedTransitionPolicy, ContainerPolicy, ConfigureOptions, IdentifyOptions, AppEventJsonValue, TrackOptions } from '@getuserfeedback/protocol/host';
5
+
6
+ type OpenRequestedPayload = OpenRequestedDetail;
7
+ type OpenRequestedSource = OpenRequestedPayload["source"];
8
+ type OpenRequestedEvent$1 = {
9
+ /**
10
+ * Origin of this open request.
11
+ * - `"command"`: requested by an explicit open command, e.g. when you call `client.flow(flowId).open()`.
12
+ * - `"targeting"`: requested by targeting plan evaluation.
13
+ */
14
+ readonly source: OpenRequestedSource;
15
+ /** Flow identifier that is about to be opened. */
16
+ readonly flowId: string;
17
+ readonly defaultPrevented: boolean;
18
+ preventDefault: () => void;
19
+ };
20
+
21
+ /** Feedback captured as an evaluation of the current app or a specific target. */
22
+ type FeedbackInput = CaptureInstanceFeedbackRequest;
23
+ /** Receipt returned after feedback has been accepted. */
24
+ type SubmitFeedbackResult = CaptureInstanceFeedbackResponse;
25
+ /** Selectors used to read the current authenticated user's feedback. */
26
+ type FetchFeedbackInput = ListInstanceFeedbackMineRequest;
27
+ /** Feedback matching each requested selector, in selector order. */
28
+ type FetchFeedbackResult = ListInstanceFeedbackMineResponse;
29
+ /** Operations for submitting and reading feedback through the current SDK client. */
30
+ type FeedbackOperations = {
31
+ /**
32
+ * Read feedback matching each selector for the JWT-authenticated user.
33
+ * Requires `auth.jwt` configuration; `identify()` alone does not authorize readback.
34
+ */
35
+ fetch: (input: FetchFeedbackInput) => Promise<FetchFeedbackResult>;
36
+ submit: (input: FeedbackInput) => Promise<SubmitFeedbackResult>;
37
+ };
38
+ /** One endpoint in a directed relationship observation. */
39
+ type GraphRelationshipRef = {
40
+ collection: string;
41
+ id: string;
42
+ };
43
+ /** A directed relationship observation recorded through the analytics pipeline. */
44
+ type GraphRelationship = {
45
+ from: GraphRelationshipRef;
46
+ to: GraphRelationshipRef;
47
+ };
48
+ /** Operations for recording relationship observations as product events. */
49
+ type GraphOperations = {
50
+ connect: (relationship: GraphRelationship) => Promise<void>;
51
+ disconnect: (relationship: GraphRelationship) => Promise<void>;
52
+ };
53
+
54
+ /** Durable state of a flow run (open/loading + dimensions when known). */
55
+ interface FlowState extends FlowRenderState {
56
+ /**
57
+ * @deprecated Stop reading this field. SDK state snapshots and subscriptions
58
+ * never populate it, and there is no replacement SDK state field.
59
+ */
60
+ transitionPolicy?: WidgetLayoutTransitionPolicy;
61
+ }
62
+ /** Callback invoked when flow state changes. */
63
+ type FlowStateCallback = (state: FlowState) => void;
64
+ type IdentifyTraits = Record<string, unknown>;
65
+ type TrackProperties = Record<string, AppEventJsonValue>;
66
+ type OpenRequestedEvent = OpenRequestedEvent$1;
67
+ type OpenRequestedCallback = (event: OpenRequestedEvent) => void;
68
+ /** Options for opening a flow run. */
69
+ type OpenFlowOptions = {
70
+ /** Host container used for this open request. Omit to use default floating mounting; pass null to wait for a custom container. */
71
+ container?: HTMLElement | null;
72
+ /**
73
+ * Optional response metadata to preserve with the eventual submission.
74
+ * These tags are attached when the flow is opened and do not affect prerendering.
75
+ */
76
+ metadata?: ResponseMetadataInput;
77
+ /**
78
+ * When `true`, the flow view does not show a close button.
79
+ * Useful for mobile or embedded contexts where the host handles dismissal (e.g. via a drawer or back gesture).
80
+ */
81
+ hideCloseButton?: boolean;
82
+ };
83
+ /** Options for prerendering a flow run. */
84
+ type PrerenderFlowOptions = {
85
+ /**
86
+ * When `true`, the prerendered view does not show a close button.
87
+ */
88
+ hideCloseButton?: boolean;
89
+ };
90
+ /** Options for subscribing to flow state updates. */
91
+ type SubscribeFlowStateOptions = {
92
+ /** Emit the current snapshot immediately. Default `true`. */
93
+ emitInitial?: boolean;
94
+ /** Auto-unsubscribe when the signal is aborted. */
95
+ signal?: AbortSignal;
96
+ };
97
+ /** One timed geometry update emitted by the loader for a custom host. */
98
+ type FlowLayoutUpdate = {
99
+ width: number;
100
+ height: number;
101
+ transitionPolicy: WidgetLayoutTimedTransitionPolicy;
102
+ };
103
+ type FlowLayoutUpdateCallback = (update: FlowLayoutUpdate) => void;
104
+ /** Options for subscribing to one-shot flow layout updates. */
105
+ type SubscribeFlowLayoutUpdatesOptions = {
106
+ /** Auto-unsubscribe when the signal is aborted. */
107
+ signal?: AbortSignal;
108
+ };
109
+ /** Instance for a specific flow: open, prefetch, prerender, close, and subscribe to flow state. */
110
+ type FlowRun = {
111
+ /** The flow/survey ID this instance refers to. */
112
+ flowId: string;
113
+ /** Open the flow (show the survey). */
114
+ open: (options?: OpenFlowOptions) => Promise<void>;
115
+ /** Prefetch the flow so it opens faster when you call `open()`. */
116
+ prefetch: () => Promise<void>;
117
+ /** Prerender the flow into a container (e.g. for a custom dialog). */
118
+ prerender: (options?: PrerenderFlowOptions) => Promise<void>;
119
+ /** Attach or detach this flow to a specific host container. */
120
+ setContainer: (element: HTMLElement | null) => void;
121
+ /** Close this flow. */
122
+ close: () => Promise<void>;
123
+ /** Return the latest known flow state snapshot. */
124
+ getFlowState: () => FlowState;
125
+ /** Subscribe to open/loading/dimensions; returns an unsubscribe function. */
126
+ subscribeFlowState: (callback: FlowStateCallback, options?: SubscribeFlowStateOptions) => () => void;
127
+ /** Subscribe to timed geometry updates without replaying durable state. */
128
+ subscribeLayoutUpdates: (callback: FlowLayoutUpdateCallback, options?: SubscribeFlowLayoutUpdatesOptions) => () => void;
129
+ };
130
+ /**
131
+ * getuserfeedback client for loading the widget, opening flows, configuring
132
+ * consent/auth, identifying users, and tracking events.
133
+ *
134
+ * @see https://getuserfeedback.com/docs/reference/javascript-sdk-reference
135
+ */
136
+ type Client = {
137
+ /** Load the widget script. Call when you created the client with `disableAutoLoad: true`. */
138
+ load: () => void;
139
+ /** Set how this instance should choose default containers for flows. */
140
+ setDefaultContainerPolicy: (policy: ContainerPolicy) => void;
141
+ /** Return the latest known instance-level flow state snapshot. */
142
+ getFlowState: () => FlowState;
143
+ /** Subscribe to instance-level flow state updates (eg targeting-triggered opens). */
144
+ subscribeFlowState: (callback: FlowStateCallback, options?: SubscribeFlowStateOptions) => () => void;
145
+ /** Return a flow instance; call .open(), .prefetch(), .prerender(), .close() on it. */
146
+ flow: (flowId: string) => FlowRun;
147
+ /** Close all open flows. */
148
+ close: () => Promise<void>;
149
+ /** Reset widget state and user identity. */
150
+ reset: () => Promise<void>;
151
+ /**
152
+ * Update color scheme, consent, or auth. Pass a fresh JWT here after login
153
+ * and whenever your auth provider refreshes the session token.
154
+ *
155
+ * @see https://getuserfeedback.com/docs/security-and-privacy/jwt-auth
156
+ */
157
+ configure: (updates: ConfigureOptions) => Promise<void>;
158
+ /**
159
+ * Associate the current user with a user ID, traits, and optional external IDs.
160
+ *
161
+ * Use `options.externalIds` for Segment-compatible identifiers from another
162
+ * system. Without a user ID, pass options as `client.identify(traits, options)`,
163
+ * or use `client.identify(traits, undefined, options)` when your call site needs
164
+ * the explicit three-argument form. Do not put Segment-shaped `externalIds` in
165
+ * traits.
166
+ *
167
+ * @see https://getuserfeedback.com/docs/guides/identity-resolution
168
+ */
169
+ identify: {
170
+ (userId: string, traits?: IdentifyTraits, options?: IdentifyOptions): Promise<void>;
171
+ (traits: IdentifyTraits, placeholder: undefined, options?: IdentifyOptions): Promise<void>;
172
+ (traits: IdentifyTraits, options?: IdentifyOptions): Promise<void>;
173
+ };
174
+ /**
175
+ * Track a product event from the browser.
176
+ *
177
+ * Use `options.externalIds` when the event carries a Segment-compatible
178
+ * identifier from another system. Do not put Segment-shaped `externalIds` in
179
+ * properties.
180
+ *
181
+ * @see https://getuserfeedback.com/docs/reference/events
182
+ */
183
+ track: (eventName: string, properties?: TrackProperties, options?: TrackOptions) => Promise<void>;
184
+ /** Record directed relationship observations through the analytics pipeline. */
185
+ graph: GraphOperations;
186
+ /** Submit feedback or read the authenticated user's matching feedback. */
187
+ feedback: FeedbackOperations;
188
+ /** Subscribe to open flow requests or suppress them — for example if you know the user should not be interrupted.
189
+ * For example, when the user is filling out a form, or is in the middle of a multi-step flow.
190
+ * The system will retry after a short delay with exponential backoff.
191
+ *
192
+ * @example — suppress open flow requests if the user is busy
193
+ * ```ts
194
+ * client.onOpenRequested((event) => {
195
+ * if (userIsBusy()) {
196
+ * event.preventDefault();
197
+ * }
198
+ * });
199
+ * ```
200
+ */
201
+ onOpenRequested: (callback: OpenRequestedCallback) => () => void;
202
+ };
203
+ /** Private runtime inputs for the deployment-owned bundled-docs client. */
204
+ type BundledDocsClientOptions = {
205
+ loaderUrl: string;
206
+ coreUrl: string;
207
+ colorScheme?: ClientOptions["colorScheme"];
208
+ disableAutoLoad?: boolean;
209
+ };
210
+ /**
211
+ * Build options that the public React provider can pass through to the SDK root
212
+ * without exposing local registration in the public options type.
213
+ * Pass the returned object intact; cloning or serializing it deliberately fails
214
+ * closed instead of falling back to persisted registration.
215
+ * See docs/specs/2026-08-02-flow-interaction-model.md.
216
+ */
217
+ declare const createBundledDocsClientOptions: (options: BundledDocsClientOptions) => ClientOptions;
218
+
219
+ /** Internal supplied-flow run using the normal Flow lifecycle. */
220
+ type InlineFlowRun = Omit<FlowRun, "flowId" | "open"> & {
221
+ open: (options?: Omit<OpenFlowOptions, "container">) => Promise<void>;
222
+ };
223
+ /** First-party supplied-flow entrypoint; intentionally absent from the public SDK root. */
224
+ declare const createInlineFlow: (client: Client, flow: InlineFlow) => InlineFlowRun;
225
+
226
+ export { createBundledDocsClientOptions, createInlineFlow };
227
+ export type { BundledDocsClientOptions, InlineFlowRun };
@@ -0,0 +1,4 @@
1
+ var n;function B(Q,W,X){function Y(A,L){if(!A._zod)Object.defineProperty(A,"_zod",{value:{def:L,constr:J,traits:new Set},enumerable:!1});if(A._zod.traits.has(Q))return;A._zod.traits.add(Q),W(A,L);let K=J.prototype,G=Object.keys(K);for(let N=0;N<G.length;N++){let E=G[N];if(!(E in A))A[E]=K[E].bind(A)}}let z=X?.Parent??Object;class q extends z{}Object.defineProperty(q,"name",{value:Q});function J(A){var L;let K=X?.Parent?new q:this;Y(K,A),(L=K._zod).deferred??(L.deferred=[]);for(let G of K._zod.deferred)G();return K}return Object.defineProperty(J,"init",{value:Y}),Object.defineProperty(J,Symbol.hasInstance,{value:(A)=>{if(X?.Parent&&A instanceof X.Parent)return!0;return A?._zod?.traits?.has(Q)}}),Object.defineProperty(J,"name",{value:Q}),J}var zQ=Symbol("zod_brand");class V extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}(n=globalThis).__zod_globalConfig??(n.__zod_globalConfig={});var m=globalThis.__zod_globalConfig;function w(Q){if(Q)Object.assign(m,Q);return m}function i(Q,W){if(typeof W==="bigint")return W.toString();return W}function t(Q){return{get value(){{let X=Q();return Object.defineProperty(this,"value",{value:X}),X}throw Error("cached value already set")}}}function s(Q){return Q===null||Q===void 0}function e(Q){let W=Q.startsWith("^")?1:0,X=Q.endsWith("$")?Q.length-1:Q.length;return Q.slice(W,X)}var d=Symbol("evaluating");function H(Q,W,X){let Y=void 0;Object.defineProperty(Q,W,{get(){if(Y===d)return;if(Y===void 0)Y=d,Y=X();return Y},set(z){Object.defineProperty(Q,W,{value:z})},configurable:!0})}var y="captureStackTrace"in Error?Error.captureStackTrace:(...Q)=>{};function a(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}function f(Q,W,X){let Y=new Q._zod.constr(W??Q._zod.def);if(!W||X?.parent)Y._zod.parent=Q;return Y}function $(Q){let W=Q;if(!W)return{};if(typeof W==="string")return{error:()=>W};if(W?.message!==void 0){if(W?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");W.error=W.message}if(delete W.message,typeof W.error==="string")return{...W,error:()=>W.error};return W}function Q1(Q){return Object.keys(Q).filter((W)=>{return Q[W]._zod.optin==="optional"&&Q[W]._zod.optout==="optional"})}var T1={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function I(Q,W=0){if(Q.aborted===!0)return!0;for(let X=W;X<Q.issues.length;X++)if(Q.issues[X]?.continue!==!0)return!0;return!1}function W1(Q,W=0){if(Q.aborted===!0)return!0;for(let X=W;X<Q.issues.length;X++)if(Q.issues[X]?.continue===!1)return!0;return!1}function o(Q,W){return W.map((X)=>{var Y;return(Y=X).path??(Y.path=[]),X.path.unshift(Q),X})}function C(Q){return typeof Q==="string"?Q:Q?.message}function F(Q,W,X){let Y=Q.message?Q.message:C(Q.inst?._zod.def?.error?.(Q))??C(W?.error?.(Q))??C(X.customError?.(Q))??C(X.localeError?.(Q))??"Invalid input",{inst:z,continue:q,input:J,...A}=Q;if(A.path??(A.path=[]),A.message=Y,W?.reportInput)A.input=J;return A}function X1(Q){if(Array.isArray(Q))return"array";if(typeof Q==="string")return"string";return"unknown"}var Y1=(Q,W)=>{Q.name="$ZodError",Object.defineProperty(Q,"_zod",{value:Q._zod,enumerable:!1}),Object.defineProperty(Q,"issues",{value:W,enumerable:!1}),Q.message=JSON.stringify(W,i,2),Object.defineProperty(Q,"toString",{value:()=>Q.message,enumerable:!1})},J1=B("$ZodError",Y1),R=B("$ZodError",Y1,{Parent:Error});var Z1=(Q)=>(W,X,Y,z)=>{let q=Y?{...Y,async:!1}:{async:!1},J=W._zod.run({value:X,issues:[]},q);if(J instanceof Promise)throw new V;if(J.issues.length){let A=new(z?.Err??Q)(J.issues.map((L)=>F(L,q,w())));throw y(A,z?.callee),A}return J.value},x=Z1(R),C1=(Q)=>async(W,X,Y,z)=>{let q=Y?{...Y,async:!0}:{async:!0},J=W._zod.run({value:X,issues:[]},q);if(J instanceof Promise)J=await J;if(J.issues.length){let A=new(z?.Err??Q)(J.issues.map((L)=>F(L,q,w())));throw y(A,z?.callee),A}return J.value},v=C1(R),x1=(Q)=>(W,X,Y)=>{let z=Y?{...Y,async:!1}:{async:!1},q=W._zod.run({value:X,issues:[]},z);if(q instanceof Promise)throw new V;return q.issues.length?{success:!1,error:new(Q??J1)(q.issues.map((J)=>F(J,z,w())))}:{success:!0,data:q.value}},M=x1(R),v1=(Q)=>async(W,X,Y)=>{let z=Y?{...Y,async:!0}:{async:!0},q=W._zod.run({value:X,issues:[]},z);if(q instanceof Promise)q=await q;return q.issues.length?{success:!1,error:new Q(q.issues.map((J)=>F(J,z,w())))}:{success:!0,data:q.value}},S=v1(R);var k1="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",g1=new RegExp(`^${k1}$`);var A1=(Q)=>{let W=Q?`[\\s\\S]{${Q?.minimum??0},${Q?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${W}$`)};var T=B("$ZodCheck",(Q,W)=>{var X;Q._zod??(Q._zod={}),Q._zod.def=W,(X=Q._zod).onattach??(X.onattach=[])});var q1=B("$ZodCheckMinLength",(Q,W)=>{var X;T.init(Q,W),(X=Q._zod.def).when??(X.when=(Y)=>{let z=Y.value;return!s(z)&&z.length!==void 0}),Q._zod.onattach.push((Y)=>{let z=Y._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(W.minimum>z)Y._zod.bag.minimum=W.minimum}),Q._zod.check=(Y)=>{let z=Y.value;if(z.length>=W.minimum)return;let J=X1(z);Y.issues.push({origin:J,code:"too_small",minimum:W.minimum,inclusive:!0,input:z,inst:Q,continue:!W.abort})}});var K1=B("$ZodCheckOverwrite",(Q,W)=>{T.init(Q,W),Q._zod.check=(X)=>{X.value=W.tx(X.value)}});var L1={major:4,minor:4,patch:3};var j=B("$ZodType",(Q,W)=>{var X;Q??(Q={}),Q._zod.def=W,Q._zod.bag=Q._zod.bag||{},Q._zod.version=L1;let Y=[...Q._zod.def.checks??[]];if(Q._zod.traits.has("$ZodCheck"))Y.unshift(Q);for(let z of Y)for(let q of z._zod.onattach)q(Q);if(Y.length===0)(X=Q._zod).deferred??(X.deferred=[]),Q._zod.deferred?.push(()=>{Q._zod.run=Q._zod.parse});else{let z=(J,A,L)=>{let K=I(J),G;for(let N of A){if(N._zod.def.when){if(W1(J))continue;if(!N._zod.def.when(J))continue}else if(K)continue;let E=J.issues.length,U=N._zod.check(J);if(U instanceof Promise&&L?.async===!1)throw new V;if(G||U instanceof Promise)G=(G??Promise.resolve()).then(async()=>{if(await U,J.issues.length===E)return;if(!K)K=I(J,E)});else{if(J.issues.length===E)continue;if(!K)K=I(J,E)}}if(G)return G.then(()=>{return J});return J},q=(J,A,L)=>{if(I(J))return J.aborted=!0,J;let K=z(A,Y,L);if(K instanceof Promise){if(L.async===!1)throw new V;return K.then((G)=>Q._zod.parse(G,L))}return Q._zod.parse(K,L)};Q._zod.run=(J,A)=>{if(A.skipChecks)return Q._zod.parse(J,A);if(A.direction==="backward"){let K=Q._zod.parse({value:J.value,issues:[]},{...A,skipChecks:!0});if(K instanceof Promise)return K.then((G)=>{return q(G,J,A)});return q(K,J,A)}let L=Q._zod.parse(J,A);if(L instanceof Promise){if(A.async===!1)throw new V;return L.then((K)=>z(K,Y,A))}return z(L,Y,A)}}H(Q,"~standard",()=>({validate:(z)=>{try{let q=M(Q,z);return q.success?{value:q.data}:{issues:q.error?.issues}}catch(q){return S(Q,z).then((J)=>J.success?{value:J.data}:{issues:J.error?.issues})}},vendor:"zod",version:1}))}),B1=B("$ZodString",(Q,W)=>{j.init(Q,W),Q._zod.pattern=[...Q?._zod.bag?.patterns??[]].pop()??A1(Q._zod.bag),Q._zod.parse=(X,Y)=>{if(W.coerce)try{X.value=String(X.value)}catch(z){}if(typeof X.value==="string")return X;return X.issues.push({expected:"string",code:"invalid_type",input:X.value,inst:Q}),X}});var E1=B("$ZodUnknown",(Q,W)=>{j.init(Q,W),Q._zod.parse=(X)=>X}),N1=B("$ZodNever",(Q,W)=>{j.init(Q,W),Q._zod.parse=(X,Y)=>{return X.issues.push({expected:"never",code:"invalid_type",input:X.value,inst:Q}),X}});function k(Q,W,X,Y,z,q){let J=X in Y;if(Q.issues.length){if(z&&q&&!J)return;W.issues.push(...o(X,Q.issues))}if(!J&&!z){if(!Q.issues.length)W.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[X]});return}if(Q.value===void 0){if(J)W.value[X]=void 0}else W.value[X]=Q.value}function m1(Q){let W=Object.keys(Q.shape);for(let Y of W)if(!Q.shape?.[Y]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${Y}": expected a Zod schema`);let X=Q1(Q.shape);return{...Q,keys:W,keySet:new Set(W),numKeys:W.length,optionalKeys:new Set(X)}}function u1(Q,W,X,Y,z,q){let J=[],A=z.keySet,L=z.catchall._zod,K=L.def.type,G=L.optin==="optional",N=L.optout==="optional";for(let E in W){if(E==="__proto__")continue;if(A.has(E))continue;if(K==="never"){J.push(E);continue}let U=L.run({value:W[E],issues:[]},Y);if(U instanceof Promise)Q.push(U.then((P)=>k(P,X,E,W,G,N)));else k(U,X,E,W,G,N)}if(J.length)X.issues.push({code:"unrecognized_keys",keys:J,input:W,inst:q});if(!Q.length)return X;return Promise.all(Q).then(()=>{return X})}var U1=B("$ZodObject",(Q,W)=>{if(j.init(Q,W),!Object.getOwnPropertyDescriptor(W,"shape")?.get){let A=W.shape;Object.defineProperty(W,"shape",{get:()=>{let L={...A};return Object.defineProperty(W,"shape",{value:L}),L}})}let Y=t(()=>m1(W));H(Q._zod,"propValues",()=>{let A=W.shape,L={};for(let K in A){let G=A[K]._zod;if(G.values){L[K]??(L[K]=new Set);for(let N of G.values)L[K].add(N)}}return L});let z=a,q=W.catchall,J;Q._zod.parse=(A,L)=>{J??(J=Y.value);let K=A.value;if(!z(K))return A.issues.push({expected:"object",code:"invalid_type",input:K,inst:Q}),A;A.value={};let G=[],N=J.shape;for(let E of J.keys){let U=N[E],P=U._zod.optin==="optional",l=U._zod.optout==="optional",c=U._zod.run({value:K[E],issues:[]},L);if(c instanceof Promise)G.push(c.then((S1)=>k(S1,A,E,K,P,l)));else k(c,A,E,K,P,l)}if(!q)return G.length?Promise.all(G).then(()=>A):A;return u1(G,K,A,L,Y.value,Q)}});function G1(Q,W){if(W===void 0&&(Q.issues.length||Q.fallback))return{issues:[],value:void 0};return Q}var D1=B("$ZodOptional",(Q,W)=>{j.init(Q,W),Q._zod.optin="optional",Q._zod.optout="optional",H(Q._zod,"values",()=>{return W.innerType._zod.values?new Set([...W.innerType._zod.values,void 0]):void 0}),H(Q._zod,"pattern",()=>{let X=W.innerType._zod.pattern;return X?new RegExp(`^(${e(X.source)})?$`):void 0}),Q._zod.parse=(X,Y)=>{if(W.innerType._zod.optin==="optional"){let z=X.value,q=W.innerType._zod.run(X,Y);if(q instanceof Promise)return q.then((J)=>G1(J,z));return G1(q,z)}if(X.value===void 0)return X;return W.innerType._zod.run(X,Y)}});function V1(Q,W){return new Q({type:"string",...$(W)})}function P1(Q){return new Q({type:"unknown"})}function H1(Q,W){return new Q({type:"never",...$(W)})}function g(Q,W){return new q1({check:"min_length",...$(W),minimum:Q})}function $1(Q){return new K1({check:"overwrite",tx:Q})}function b(){return $1((Q)=>Q.trim())}var _=B("ZodMiniType",(Q,W)=>{if(!Q._zod)throw Error("Uninitialized schema in ZodMiniType.");j.init(Q,W),Q.def=W,Q.type=W.type,Q.parse=(X,Y)=>x(Q,X,Y,{callee:Q.parse}),Q.safeParse=(X,Y)=>M(Q,X,Y),Q.parseAsync=async(X,Y)=>v(Q,X,Y,{callee:Q.parseAsync}),Q.safeParseAsync=async(X,Y)=>S(Q,X,Y),Q.check=(...X)=>{return Q.clone({...W,checks:[...W.checks??[],...X.map((Y)=>typeof Y==="function"?{_zod:{check:Y,def:{check:"custom"},onattach:[]}}:Y)]},{parent:!0})},Q.with=Q.check,Q.clone=(X,Y)=>f(Q,X,Y),Q.brand=()=>Q,Q.register=(X,Y)=>{return X.add(Q,Y),Q},Q.apply=(X)=>X(Q)}),o1=B("ZodMiniString",(Q,W)=>{B1.init(Q,W),_.init(Q,W)});function h(Q){return V1(o1,Q)}var r1=B("ZodMiniUnknown",(Q,W)=>{E1.init(Q,W),_.init(Q,W)});function j1(){return P1(r1)}var p1=B("ZodMiniNever",(Q,W)=>{N1.init(Q,W),_.init(Q,W)});function l1(Q){return H1(p1,Q)}var n1=B("ZodMiniObject",(Q,W)=>{U1.init(Q,W),_.init(Q,W),H(Q,"shape",()=>W.shape)});function r(Q,W){return new n1({type:"object",shape:Q,catchall:l1(),...$(W)})}var d1=B("ZodMiniOptional",(Q,W)=>{D1.init(Q,W),_.init(Q,W)});function Z(Q){return new d1({type:"optional",innerType:Q})}function w1(Q,W){let X=new T({check:"custom",...$(W)});return X._zod.check=Q,X}var F1=["id","organizationId","versionId","versionNumber"],s1=r({css:Z(h()),themeRuntimeArtifactId:Z(h().check(b(),g(1))),themeVersionId:Z(h().check(b(),g(1)))}),O1=r({definition:j1().check(w1((Q)=>{if(Q.value!==void 0)return;Q.issues.push({code:"custom",input:Q.value,message:"Inline flow definition is required.",continue:!1})})),theme:Z(s1)});var e1=Symbol.for("@getuserfeedback/sdk/internal/inline-flow-client-bridge/1");var I1=(Q)=>{let W=Reflect.get(Q,e1);if(typeof W!=="object"||W===null||!("createInlineFlowRun"in W)||typeof Reflect.get(W,"createInlineFlowRun")!=="function")throw Error("Inline flows require a compatible client created by @getuserfeedback/sdk.");return W};var KX=Symbol("operation-superseded");var LX={state:"resolved",fallback:null,promise:Promise.resolve(),resolve:()=>{},reject:()=>{}};var R1="0.13.1".trim(),a1=R1.length>0?R1:"0.0.0-local";var QQ=Symbol.for("@getuserfeedback/sdk/internal/supplied-only-local-client-options/1"),WQ="@getuserfeedback/internal/bundled-docs",XQ=(Q)=>{let W={apiKey:WQ,_loaderUrl:Q.loaderUrl,_coreUrl:Q.coreUrl,...Q.colorScheme===void 0?{}:{colorScheme:Q.colorScheme},...Q.disableAutoLoad===void 0?{}:{disableAutoLoad:Q.disableAutoLoad}};return Object.defineProperty(W,QQ,{configurable:!1,enumerable:!1,value:!0,writable:!1}),W};var YQ=/^(0|[1-9]\d*)$/,D=()=>{throw Error("Inline flow must contain only JSON values.")},p=(Q,W=new Set)=>{if(Q===null||typeof Q==="string"||typeof Q==="boolean")return Q;if(typeof Q==="number")return Number.isFinite(Q)?Q:D();if(typeof Q!=="object"||W.has(Q))return D();W.add(Q);try{if(Array.isArray(Q)){if(Object.getPrototypeOf(Q)!==Array.prototype)return D();let z=Reflect.ownKeys(Q);if(z.length!==Q.length+1||z.some((J)=>J!=="length"&&(typeof J!=="string"||!YQ.test(J)||Number(J)>=Q.length)))return D();let q=[];for(let J=0;J<Q.length;J+=1){let A=Object.getOwnPropertyDescriptor(Q,String(J));if(!A?.enumerable||!("value"in A))return D();q.push(p(A.value,W))}return q}let X=Object.getPrototypeOf(Q);if(X!==Object.prototype&&X!==null)return D();let Y={};for(let z of Reflect.ownKeys(Q)){if(typeof z!=="string"||z==="__proto__")return D();let q=Object.getOwnPropertyDescriptor(Q,z);if(!q?.enumerable||!("value"in q))return D();if(q.value===void 0)continue;Object.defineProperty(Y,z,{configurable:!0,enumerable:!0,value:p(q.value,W),writable:!0})}return Y}finally{W.delete(Q)}},JQ=(Q)=>{if(typeof Q!=="object"||Q===null||Array.isArray(Q)||Object.getPrototypeOf(Q)!==Object.prototype&&Object.getPrototypeOf(Q)!==null)return D();return p(Q)},M1=(Q)=>{if(typeof Q!=="object"||Q===null)return Q;for(let W of Object.values(Q))M1(W);return Object.freeze(Q)},AQ=(Q)=>{let W=O1.parse(JQ(Q)),X=W.definition;if(typeof X==="object"&&X!==null&&!Array.isArray(X)){let Y=F1.find((z)=>(z in X));if(Y)throw Error(`Inline flow definitions cannot include persisted field "${Y}".`)}return M1(W)},yX=(Q,W)=>I1(Q).createInlineFlowRun(AQ(W));export{yX as createInlineFlow,XQ as createBundledDocsClientOptions};
2
+
3
+ //# debugId=64332F63FE54284364756E2164756E21
4
+ //# sourceMappingURL=inline-flow.js.map