@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.
@@ -1,6 +1,6 @@
1
1
  import { InlineFlow } from '@getuserfeedback/protocol/internal/inline-flow';
2
2
  export { InlineFlow } from '@getuserfeedback/protocol/internal/inline-flow';
3
- import { AppEventJsonInputValue, ListInstanceFeedbackMineRequest, ListInstanceFeedbackMineResponse, CaptureInstanceFeedbackRequest, CaptureInstanceFeedbackResponse } from '@getuserfeedback/protocol';
3
+ import { AppEventJsonInputValue, Answer, FeedbackOptions, FeedbackResult } from '@getuserfeedback/protocol';
4
4
  import { TrackOptions, OpenRequestedDetail, ClientOptions, ResponseMetadataInput, FlowRenderState, WidgetLayoutTransitionPolicy, ContainerPolicy, ConfigureOptions, IdentifyOptions, AppEventIdentity } from '@getuserfeedback/protocol/host';
5
5
 
6
6
  type EventProperties = Record<string, AppEventJsonInputValue>;
@@ -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
@@ -1,4 +1,4 @@
1
- var J;function d(e,t,n){function r(i,a){if(!i._zod)Object.defineProperty(i,"_zod",{value:{def:a,constr:o,traits:new Set},enumerable:!1});if(i._zod.traits.has(e))return;i._zod.traits.add(e),t(i,a);let u=o.prototype,l=Object.keys(u);for(let f=0;f<l.length;f++){let p=l[f];if(!(p in i))i[p]=u[p].bind(i)}}let s=n?.Parent??Object;class c extends s{}Object.defineProperty(c,"name",{value:e});function o(i){var a;let u=n?.Parent?new c:this;r(u,i),(a=u._zod).deferred??(a.deferred=[]);for(let l of u._zod.deferred)l();return u}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:(i)=>{if(n?.Parent&&i instanceof n.Parent)return!0;return i?._zod?.traits?.has(e)}}),Object.defineProperty(o,"name",{value:e}),o}var ut=Symbol("zod_brand");class g extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}(J=globalThis).__zod_globalConfig??(J.__zod_globalConfig={});var N=globalThis.__zod_globalConfig;function y(e){if(e)Object.assign(N,e);return N}function X(e,t){if(typeof t==="bigint")return t.toString();return t}function Q(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw Error("cached value already set")}}}function ee(e){return e===null||e===void 0}function te(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}var Y=Symbol("evaluating");function v(e,t,n){let r=void 0;Object.defineProperty(e,t,{get(){if(r===Y)return;if(r===void 0)r=Y,r=n();return r},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}var H="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ne(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function j(e,t,n){let r=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)r._zod.parent=e;return r}function w(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function re(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Ze={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(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function oe(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function q(e,t){return t.map((n)=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function O(e){return typeof e==="string"?e:e?.message}function x(e,t,n){let r=e.message?e.message:O(e.inst?._zod.def?.error?.(e))??O(t?.error?.(e))??O(n.customError?.(e))??O(n.localeError?.(e))??"Invalid input",{inst:s,continue:c,input:o,...i}=e;if(i.path??(i.path=[]),i.message=r,t?.reportInput)i.input=o;return i}function ie(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}var se=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,X,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ce=d("$ZodError",se),R=d("$ZodError",se,{Parent:Error});var Oe=(e)=>(t,n,r,s)=>{let c=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},c);if(o instanceof Promise)throw new g;if(o.issues.length){let i=new(s?.Err??e)(o.issues.map((a)=>x(a,c,y())));throw H(i,s?.callee),i}return o.value},C=Oe(R),Ce=(e)=>async(t,n,r,s)=>{let c=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},c);if(o instanceof Promise)o=await o;if(o.issues.length){let i=new(s?.Err??e)(o.issues.map((a)=>x(a,c,y())));throw H(i,s?.callee),i}return o.value},A=Ce(R),Ae=(e)=>(t,n,r)=>{let s=r?{...r,async:!1}:{async:!1},c=t._zod.run({value:n,issues:[]},s);if(c instanceof Promise)throw new g;return c.issues.length?{success:!1,error:new(e??ce)(c.issues.map((o)=>x(o,s,y())))}:{success:!0,data:c.value}},E=Ae(R),Fe=(e)=>async(t,n,r)=>{let s=r?{...r,async:!0}:{async:!0},c=t._zod.run({value:n,issues:[]},s);if(c instanceof Promise)c=await c;return c.issues.length?{success:!1,error:new e(c.issues.map((o)=>x(o,s,y())))}:{success:!0,data:c.value}},S=Fe(R);var Te="(?:(?:\\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])))",Le=new RegExp(`^${Te}$`);var ue=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var Z=d("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])});var le=d("$ZodCheckMinLength",(e,t)=>{var n;Z.init(e,t),(n=e._zod.def).when??(n.when=(r)=>{let s=r.value;return!ee(s)&&s.length!==void 0}),e._zod.onattach.push((r)=>{let s=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;if(t.minimum>s)r._zod.bag.minimum=t.minimum}),e._zod.check=(r)=>{let s=r.value;if(s.length>=t.minimum)return;let o=ie(s);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}});var de=d("$ZodCheckOverwrite",(e,t)=>{Z.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});var pe={major:4,minor:4,patch:3};var b=d("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=pe;let r=[...e._zod.def.checks??[]];if(e._zod.traits.has("$ZodCheck"))r.unshift(e);for(let s of r)for(let c of s._zod.onattach)c(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(o,i,a)=>{let u=I(o),l;for(let f of i){if(f._zod.def.when){if(oe(o))continue;if(!f._zod.def.when(o))continue}else if(u)continue;let p=o.issues.length,m=f._zod.check(o);if(m instanceof Promise&&a?.async===!1)throw new g;if(l||m instanceof Promise)l=(l??Promise.resolve()).then(async()=>{if(await m,o.issues.length===p)return;if(!u)u=I(o,p)});else{if(o.issues.length===p)continue;if(!u)u=I(o,p)}}if(l)return l.then(()=>o);return o},c=(o,i,a)=>{if(I(o))return o.aborted=!0,o;let u=s(i,r,a);if(u instanceof Promise){if(a.async===!1)throw new g;return u.then((l)=>e._zod.parse(l,a))}return e._zod.parse(u,a)};e._zod.run=(o,i)=>{if(i.skipChecks)return e._zod.parse(o,i);if(i.direction==="backward"){let u=e._zod.parse({value:o.value,issues:[]},{...i,skipChecks:!0});if(u instanceof Promise)return u.then((l)=>c(l,o,i));return c(u,o,i)}let a=e._zod.parse(o,i);if(a instanceof Promise){if(i.async===!1)throw new g;return a.then((u)=>s(u,r,i))}return s(a,r,i)}}v(e,"~standard",()=>({validate:(s)=>{try{let c=E(e,s);return c.success?{value:c.data}:{issues:c.error?.issues}}catch(c){return S(e,s).then((o)=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}))}),me=d("$ZodString",(e,t)=>{b.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ue(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(s){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}});var he=d("$ZodUnknown",(e,t)=>{b.init(e,t),e._zod.parse=(n)=>n}),ge=d("$ZodNever",(e,t)=>{b.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function F(e,t,n,r,s,c){let o=n in r;if(e.issues.length){if(s&&c&&!o)return;t.issues.push(...q(n,e.issues))}if(!o&&!s){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}if(e.value===void 0){if(o)t.value[n]=void 0}else t.value[n]=e.value}function De(e){let t=Object.keys(e.shape);for(let r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${r}": expected a Zod schema`);let n=re(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function He(e,t,n,r,s,c){let o=[],i=s.keySet,a=s.catchall._zod,u=a.def.type,l=a.optin==="optional",f=a.optout==="optional";for(let p in t){if(p==="__proto__")continue;if(i.has(p))continue;if(u==="never"){o.push(p);continue}let m=a.run({value:t[p],issues:[]},r);if(m instanceof Promise)e.push(m.then((_)=>F(_,n,p,t,l,f)));else F(m,n,p,t,l,f)}if(o.length)n.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:c});if(!e.length)return n;return Promise.all(e).then(()=>n)}var _e=d("$ZodObject",(e,t)=>{if(b.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let i=t.shape;Object.defineProperty(t,"shape",{get:()=>{let a={...i};return Object.defineProperty(t,"shape",{value:a}),a}})}let r=Q(()=>De(t));v(e._zod,"propValues",()=>{let i=t.shape,a={};for(let u in i){let l=i[u]._zod;if(l.values){a[u]??(a[u]=new Set);for(let f of l.values)a[u].add(f)}}return a});let s=ne,c=t.catchall,o;e._zod.parse=(i,a)=>{o??(o=r.value);let u=i.value;if(!s(u))return i.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),i;i.value={};let l=[],f=o.shape;for(let p of o.keys){let m=f[p],_=m._zod.optin==="optional",W=m._zod.optout==="optional",M=m._zod.run({value:u[p],issues:[]},a);if(M instanceof Promise)l.push(M.then((Se)=>F(Se,i,p,u,_,W)));else F(M,i,p,u,_,W)}if(!c)return l.length?Promise.all(l).then(()=>i):i;return He(l,u,i,a,r.value,e)}});function fe(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var ve=d("$ZodOptional",(e,t)=>{b.init(e,t),e._zod.optin="optional",e._zod.optout="optional",v(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),v(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${te(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){let s=n.value,c=t.innerType._zod.run(n,r);if(c instanceof Promise)return c.then((o)=>fe(o,s));return fe(c,s)}if(n.value===void 0)return n;return t.innerType._zod.run(n,r)}});function we(e,t){return new e({type:"string",...w(t)})}function be(e){return new e({type:"unknown"})}function ye(e,t){return new e({type:"never",...w(t)})}function T(e,t){return new le({check:"min_length",...w(t),minimum:e})}function xe(e){return new de({check:"overwrite",tx:e})}function L(){return xe((e)=>e.trim())}var P=d("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");b.init(e,t),e.def=t,e.type=t.type,e.parse=(n,r)=>C(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>E(e,n,r),e.parseAsync=async(n,r)=>A(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>S(e,n,r),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]},{parent:!0}),e.with=e.check,e.clone=(n,r)=>j(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.apply=(n)=>n(e)}),Be=d("ZodMiniString",(e,t)=>{me.init(e,t),P.init(e,t)});function U(e){return we(Be,e)}var Ve=d("ZodMiniUnknown",(e,t)=>{he.init(e,t),P.init(e,t)});function B(){return be(Ve)}var Ge=d("ZodMiniNever",(e,t)=>{ge.init(e,t),P.init(e,t)});function Ke(e){return ye(Ge,e)}var We=d("ZodMiniObject",(e,t)=>{_e.init(e,t),P.init(e,t),v(e,"shape",()=>t.shape)});function V(e,t){return new We({type:"object",shape:e,catchall:Ke(),...w(t)})}var Je=d("ZodMiniOptional",(e,t)=>{ve.init(e,t),P.init(e,t)});function k(e){return new Je({type:"optional",innerType:e})}function G(e,t){let n=new Z({check:"custom",...w(t)});return n._zod.check=e,n}var ze=["id","organizationId","versionId","versionNumber"],Qe=V({css:k(U()),themePayload:k(B()),themeRuntimeArtifactId:k(U().check(L(),T(1))),themeVersionId:k(U().check(L(),T(1)))}).check(G((e)=>{if("themePayload"in e.value&&e.value.css!==void 0)e.issues.push({code:"custom",input:e.value,message:"Inline themes cannot mix CSS and a complete payload.",continue:!1})})),$e=V({definition:B().check(G((e)=>{if(e.value!==void 0)return;e.issues.push({code:"custom",input:e.value,message:"Inline flow definition is required.",continue:!1})})),theme:k(Qe)});var ke=Symbol.for("@getuserfeedback/sdk/internal/inline-flow-client-bridge/1"),et=(e)=>typeof e==="object"&&e!==null&&("createInlineFlowRun"in e)&&typeof e.createInlineFlowRun==="function";var Ie=(e)=>{let t=ke in e?e[ke]:void 0;if(!et(t))throw Error("Inline flows require a compatible client created by @getuserfeedback/sdk.");return t};var pi=Symbol("operation-superseded");var fi={state:"resolved",fallback:null,promise:Promise.resolve(),resolve:()=>{},reject:()=>{}};var Re="0.20.0".trim(),tt=Re.length>0?Re:"0.0.0-local";var nt=Symbol.for("@getuserfeedback/sdk/internal/supplied-only-local-client-options/1"),rt="@getuserfeedback/internal/bundled-docs",ot=(e)=>{let t={apiKey:rt,_loaderUrl:e.loaderUrl,_coreUrl:e.coreUrl};if(e.colorScheme!==void 0)t.colorScheme=e.colorScheme;if(e.disableAutoLoad!==void 0)t.disableAutoLoad=e.disableAutoLoad;return Object.defineProperty(t,nt,{configurable:!1,enumerable:!1,value:!0,writable:!1}),t};var it=/^(0|[1-9]\d*)$/,h=()=>{throw Error("Inline flow must contain only JSON values.")},K=(e,t=new Set)=>{if(e===null||typeof e==="string"||typeof e==="boolean")return e;if(typeof e==="number")return Number.isFinite(e)?e:h();if(typeof e!=="object"||t.has(e))return h();t.add(e);try{if(Array.isArray(e)){if(Object.getPrototypeOf(e)!==Array.prototype)return h();let s=Reflect.ownKeys(e);if(s.length!==e.length+1||s.some((o)=>o!=="length"&&(typeof o!=="string"||!it.test(o)||Number(o)>=e.length)))return h();let c=[];for(let o=0;o<e.length;o+=1){let i=Object.getOwnPropertyDescriptor(e,String(o));if(!i?.enumerable||!("value"in i))return h();c.push(K(i.value,t))}return c}let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)return h();let r={};for(let s of Reflect.ownKeys(e)){if(typeof s!=="string"||s==="__proto__")return h();let c=Object.getOwnPropertyDescriptor(e,s);if(!c?.enumerable||!("value"in c))return h();if(c.value===void 0)continue;Object.defineProperty(r,s,{configurable:!0,enumerable:!0,value:K(c.value,t),writable:!0})}return r}finally{t.delete(e)}},st=(e)=>{if(typeof e!=="object"||e===null||Array.isArray(e)||Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)return h();let t=K(e);if(t===null||Array.isArray(t)||typeof t!=="object")return h();return t},Ee=(e)=>{if(typeof e!=="object"||e===null)return e;for(let t of Object.values(e))Ee(t);return Object.freeze(e)},ct=(e)=>{let t=$e.parse(st(e)),n=t.definition;if(typeof n==="object"&&n!==null&&!Array.isArray(n)){let r=ze.find((s)=>(s in n));if(r)throw Error(`Inline flow definitions cannot include persisted field "${r}".`)}return Ee(t)},os=(e,t)=>Ie(e).createInlineFlowRun(ct(t));export{ot as createBundledDocsClientOptions,os as createInlineFlow};
1
+ function ce(e,t){if(typeof t==="bigint")return t.toString();return t}class ue{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function ae(e){return new ue(e)}function le(e){return e===null||e===void 0}function de(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function pe(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}var q="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function fe(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function L(e,t,n){let r=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)r._zod.parent=e;return r}function z(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function me(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}function k(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function he(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function V(e,t){return t.map((n)=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function E(e){return typeof e==="string"?e:e?.message}function G(e,t,n){var r;for(let o=t;o<e.length;o++)(r=e[o]).schema??(r.schema=n)}function S(e,t,n){var r;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(r=e).schema??(r.schema=e.inst);else e.schema=e.inst;let s=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,u=e.message?e.message:E(e.inst?._zod.def?.error?.(e))??E(s?.(e))??E(t?.error?.(e))??E(n.customError?.(e))??E(n.localeError?.(e))??"Invalid input",i={};for(let a of Object.keys(e)){if(a==="inst"||a==="schema"||a==="continue"||a==="input"||a==="__proto__")continue;i[a]=e[a]}if(i.path??(i.path=[]),i.message=u,t?.reportInput)i.input=e.input;return i}var Ke=/[\uD800-\uDBFF]/;function ge(e){let t=e.length;if(!Ke.test(e))return t;let n=t;for(let r=0;r<t-1;r++)if((e.charCodeAt(r)&64512)===55296&&(e.charCodeAt(r+1)&64512)===56320)n--,r++;return n}function _e(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function ve(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);if(r.get)Object.defineProperty(e,n,{...r,enumerable:!1});else We(e,n,r.value)}}function x(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function K(e,t,n){return x(e,t,n,!1)}function We(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:x(this,t,n.bind(this))},set(r){x(this,t,r)}})}function Je(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var B,b=!1,Xe={configurable:!0,get(){b=!0;return}};function Z(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&B!==e._zod){B=void 0;return}B=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Xe);let o=b;b=!1;try{let s=n(this);if(b)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:s});return b=b||o,s}catch(s){throw delete this[t],b=b||o,s}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function we(e,t,n,r){let o=Je(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let s={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,s),s.value=n(this),Object.defineProperty(this,t,s),s.value},set(s){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:s})}})}var be;var W={value:void 0,enumerable:!1},ye="captureStackTrace"in Error?Error:null;function Ye(e){let t=ye;if(t){let n=t.stackTraceLimit;if(typeof n==="number"){try{t.stackTraceLimit=0}catch{return ye=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function g(e,t,n,r){let o={};function s(l){this.def=l,this.constr=p,this.traits=new Set}s.prototype=o;let u=n,i=u&&new WeakSet;function a(l,f){if(!l._zod){W.value=new s(f);try{Object.defineProperty(l,"_zod",W)}finally{W.value=void 0}}else if(l._zod.traits.has(e))return;if(l._zod.traits.add(e),t(l,f),i){let h=Object.getPrototypeOf(l),_=l._zod.constr.prototype,w=h;while(w&&w!==_)w=Object.getPrototypeOf(w);let R=w??h;if(!i.has(R))i.add(R),ve(R,u)}let m=p.prototype;for(let h in m){if(!Object.prototype.hasOwnProperty.call(m,h))continue;if(!(h in l))l[h]=m[h].bind(l)}}let c=r?.Parent??Object;class d extends c{}Object.defineProperty(d,"name",{value:e});function p(l){let f=r?.Parent?Ye(d):this;a(f,l);let m=f._zod.deferred;if(m){for(let _ of m)_();f._zod.deferred=void 0}let h=globalThis.__zod_globalConfig?.postProcessor;if(h)h(f);return f}return Object.defineProperty(p,"init",{value:a}),Object.defineProperty(p,Symbol.hasInstance,{value:(l)=>{if(r?.Parent&&l instanceof r.Parent)return!0;return l?._zod?.traits?.has(e)}}),Object.defineProperty(p,"name",{value:e}),p}class y extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}(be=globalThis).__zod_globalConfig??(be.__zod_globalConfig={});var D=globalThis.__zod_globalConfig;function O(e){if(e)Object.assign(D,e);return D}function Qe(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,ce,2)),e.message}function et(e){this._zod.message=e}var tt={get:Qe,set:et,enumerable:!0,configurable:!0},X={value:void 0,enumerable:!1},xe=new WeakSet([Object.prototype,Error.prototype]),$e=(e,t)=>{e.name="$ZodError",X.value=t,Object.defineProperty(e,"issues",X),X.value=void 0,Object.defineProperty(e,"message",tt);let n=Object.getPrototypeOf(e);if(!xe.has(n))xe.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let r=()=>this.message;return Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0}),r},set(r){Object.defineProperty(this,"toString",{value:r,configurable:!0,writable:!0})}})},Dt=g("$ZodError",$e),A=g("$ZodError",$e,void 0,{Parent:Error});var rt=(e)=>{let t=(n,r,o,s)=>{let u=o?{...o,async:!1}:{async:!1},i=n._zod.run({value:r,issues:[]},u);if(i instanceof Promise)throw new y;if(i.issues.length){let a=new(s?.Err??e)(i.issues.map((c)=>S(c,u,O())));throw q(a,s?.callee??t),a}return i.value};return t},Y=rt(A),ot=(e)=>{let t=async(n,r,o,s)=>{let u=o?{...o,async:!0}:{async:!0},i=n._zod.run({value:r,issues:[]},u);if(i instanceof Promise)i=await i;if(i.issues.length){let a=new(s?.Err??e)(i.issues.map((c)=>S(c,u,O())));throw q(a,s?.callee??t),a}return i.value};return t},Q=ot(A),it=(e)=>(t,n,r)=>{let o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new y;return s.issues.length?ze(e,s.issues,o):{success:!0,data:s.value}},ee=it(A);function ze(e,t,n){let r;return{success:!1,get error(){if(!r)r=new e(t.map((o)=>S(o,n,O()))),t=void 0,n=void 0;return r},set error(o){r=o,t=void 0,n=void 0}}}var st=(e)=>async(t,n,r)=>{let o=r?{...r,async:!0}:{async:!0},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)s=await s;return s.issues.length?ze(e,s.issues,o):{success:!0,data:s.value}},te=st(A);var ke=/^[\s\S]{0,}$/;var F=g("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])});var ut=(e)=>{let t=e.value;return!le(t)&&t.length!==void 0};var Ie=g("$ZodCheckMinLength",(e,t)=>{var n;F.init(e,t),(n=e._zod.def).when??(n.when=ut),e._zod.check=(r)=>{let o=r.value,s=o.length;if((typeof o==="string"&&s>=t.minimum&&s<t.minimum*2?ge(o):s)>=t.minimum)return;let i=_e(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}});var Re=g("$ZodCheckOverwrite",(e,t)=>{F.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});var Se={major:4,minor:6,patch:7};var I=g("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Se;let r=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...r??[]]:r?.length?[...r]:[];for(let s of o)for(let u of s._zod.onattach)u(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let s=(i,a,c)=>{if(i.memo)return i;let d=k(i),p;for(let l of a){if(l._zod.def.when){if(he(i))continue;if(!l._zod.def.when(i))continue}else if(d)continue;let f=i.issues.length,m=l._zod.check(i);if(m instanceof Promise&&c?.async===!1)throw new y;if(p||m instanceof Promise)p=(p??Promise.resolve()).then(async()=>{if(await m,i.issues.length===f)return;if(G(i.issues,f,e),!d)d=k(i,f)});else{if(i.issues.length===f)continue;if(G(i.issues,f,e),!d)d=k(i,f)}}if(p)return p.then(()=>i);return i},u=(i,a,c)=>{if(k(i))return i.aborted=!0,i;let d=s(a,o,c);if(d instanceof Promise){if(c.async===!1)throw new y;return d.then((p)=>e._zod.parse(p,c))}return e._zod.parse(d,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){let d=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});if(d instanceof Promise)return d.then((p)=>u(p,i,a));return u(d,i,a)}let c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new y;return c.then((d)=>s(d,o,a))}return s(c,o,a)}}},{get "~standard"(){return K(this,"~standard",pt(this))},set "~standard"(e){x(this,"~standard",e)}}),Ce=(e,t)=>e.issues.length?{issues:e.issues.map((n)=>S(n,t,O()))}:{value:e.value};async function dt(e,t){let n={async:!0};return Ce(await e._zod.run({value:t,issues:[]},n),n)}function pt(e){return{validate:(t)=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Ce(r,n)}catch(r){}return dt(e,t)},vendor:"zod",version:1}}var Ee=g("$ZodString",(e,t)=>{I.init(e,t),e._zod.pattern=t.pattern??ke,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch(o){}if(typeof n.value==="string")return n;return n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}});var Ze=g("$ZodUnknown",(e,t)=>{I.init(e,t),e._zod.parse=(n)=>n}),Ae=g("$ZodNever",(e,t)=>{I.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function M(e,t,n,r,o,s){let u=n in r,i=s==="optional";if(!u&&i&&o==="optional")return;if(e.issues.length){if(o!==void 0&&i&&!u)return;t.issues.push(...V(n,e.issues))}if(!u&&o===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}if(e.value===void 0){if(u||o==="defaulted"&&!i)t.value[n]=void 0}else t.value[n]=e.value}var ft=[];function mt(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:ft,o=r.length?[...t,...r]:t;for(let u of o)if(!e.shape?.[u]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(u)}": expected a Zod schema`);let s=me(e.shape);return{...e,allKeys:o,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(s)}}function ht(e,t,n,r,o,s,u){let i=[],a=o.keySet,c=o.catchall._zod,d=c.def.type,{optin:p,optout:l}=c,f=0;for(let m in t){if(u&&n.issues.length!==f){if(k(n,f))break;f=n.issues.length}if(a.has(m))continue;if(m==="__proto__"){if(d==="never")i.push(m);continue}if(d==="never"){i.push(m);continue}let h=c.run({value:t[m],issues:[]},r);if(h instanceof Promise)e.push(h.then((_)=>M(_,n,m,t,p,l)));else M(h,n,m,t,p,l)}if(i.length)n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s,continue:!0});if(!e.length)return n;return Promise.all(e).then(()=>n)}var Fe=g("$ZodObject",(e,t)=>{I.init(e,t);let n=Object.getOwnPropertyDescriptor(t,"shape"),r=n?.get?n.get.raw:t.shape??{};if(r){let c=()=>{let d={...r};return Object.defineProperty(t,"shape",{value:d}),c.raw=d,d};c.raw=r,Object.defineProperty(t,"shape",{get:c})}let o=ae(()=>mt(t));Z(e,"propValues",(c)=>{let d=c.def.shape,p={};for(let l in d){let f=d[l]._zod;if(f.values){if(!Object.prototype.hasOwnProperty.call(p,l))pe(p,l,new Set);for(let m of f.values)p[l].add(m);if(f.optin!==void 0)p[l].add(void 0)}}return p});let s=fe,u=t.catchall,i,a=D.memoizer;a?.attach(e),e._zod.parse=(c,d)=>{i??(i=o.value);let p=c.value;if(!s(p))return c.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),c;c.value=a?a.alloc(e,c,{},d):{};let l=[],f=i.shape,m=d?.abortEarly,h=c.issues.length;for(let _ of i.allKeys){if(m&&c.issues.length!==h){if(k(c,h))break;h=c.issues.length}if(_==="__proto__")continue;let w=f[_],R=w._zod.optin,se=w._zod.optout,H=w._zod.run({value:p[_],issues:[]},d);if(H instanceof Promise)l.push(H.then((Ge)=>M(Ge,c,_,p,R,se)));else M(H,c,_,p,R,se)}if(!u)return l.length?Promise.all(l).then(()=>c):c;return ht(l,p,c,d,o.value,e,m===!0)}});function Oe(e,t){return e.value=t.issues.length?void 0:t.value,e}var Te=g("$ZodOptional",(e,t)=>{I.init(e,t),Z(e,"optin",(n)=>n.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",Z(e,"values",(n)=>{let r=n.def.innerType._zod.values;return r?new Set([...r,void 0]):void 0}),Z(e,"pattern",(n)=>{let r=n.def.innerType._zod.pattern;return r?new RegExp(`^(${de(r.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(n.value===void 0){if(t.innerType._zod.optin!=="defaulted")return n;let o=t.innerType._zod.run({value:n.value,issues:[]},r);if(o instanceof Promise)return o.then((s)=>Oe(n,s));return Oe(n,o)}return t.innerType._zod.run(n,r)}});function _t(e){if(e.checks)e.checks=[...e.checks];return e}function Le(e,t){return new e(_t({type:"string",...z(t)}))}function De(e){return new e({type:"unknown"})}function Me(e,t){return new e({type:"never",...z(t)})}function U(e,t){return new Ie({check:"min_length",...z(t),minimum:e})}function Ue(e){return new Re({check:"overwrite",tx:e})}function N(){return Ue((e)=>e.trim())}var T=g("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");I.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){x(this,"with",e)},parse(e,t){return Y(this,e,t,{callee:this.parse})},parseAsync(e,t){return Q(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return ee(this,e,t)},safeParseAsync(e,t){return te(this,e,t)},check(...e){let t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map((n)=>typeof n==="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0})},clone(e,t){return L(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return t.length===0?e(this):e(this,...t)}}),wt=g("ZodMiniString",(e,t)=>{Ee.init(e,t),T.init(e,t)});function j(e){return Le(wt,e)}var bt=g("ZodMiniUnknown",(e,t)=>{Ze.init(e,t),T.init(e,t)});function ne(){return De(bt)}var yt=g("ZodMiniNever",(e,t)=>{Ae.init(e,t),T.init(e,t)});function xt(e){return Me(yt,e)}var $t=g("ZodMiniObject",(e,t)=>{Fe.init(e,t),T.init(e,t),we(e,"shape",(n)=>n._zod.def.shape,!1)});function re(e,t){return new $t({type:"object",shape:e,catchall:xt(),...z(t)})}var zt=g("ZodMiniOptional",(e,t)=>{Te.init(e,t),T.init(e,t)});function C(e){return new zt({type:"optional",innerType:e})}function oe(e,t){let n=new F({check:"custom",...z(t)});return n._zod.check=e,n}var Ne=["id","organizationId","versionId","versionNumber"],It=re({css:C(j()),themePayload:C(ne()),themeRuntimeArtifactId:C(j().check(N(),U(1))),themeVersionId:C(j().check(N(),U(1)))}).check(oe((e)=>{if("themePayload"in e.value&&e.value.css!==void 0)e.issues.push({code:"custom",input:e.value,message:"Inline themes cannot mix CSS and a complete payload.",continue:!1})})),je=re({definition:ne().check(oe((e)=>{if(e.value!==void 0)return;e.issues.push({code:"custom",input:e.value,message:"Inline flow definition is required.",continue:!1})})),theme:C(It)});var He=Symbol.for("@getuserfeedback/sdk/internal/inline-flow-client-bridge/1"),Rt=(e)=>typeof e==="object"&&e!==null&&("createInlineFlowRun"in e)&&typeof e.createInlineFlowRun==="function";var Be=(e)=>{let t=He in e?e[He]:void 0;if(!Rt(t))throw Error("Inline flows require a compatible client created by @getuserfeedback/sdk.");return t};var is=Symbol("operation-superseded");var ss={state:"resolved",fallback:null,promise:Promise.resolve(),resolve:()=>{},reject:()=>{}};var qe="0.21.1".trim(),St=qe.length>0?qe:"0.0.0-local";var Ot=Symbol.for("@getuserfeedback/sdk/internal/supplied-only-local-client-options/1"),Ct="@getuserfeedback/internal/bundled-docs",Et=(e)=>{let t={apiKey:Ct,_loaderUrl:e.loaderUrl,_coreUrl:e.coreUrl};if(e.colorScheme!==void 0)t.colorScheme=e.colorScheme;if(e.disableAutoLoad!==void 0)t.disableAutoLoad=e.disableAutoLoad;return Object.defineProperty(t,Ot,{configurable:!1,enumerable:!1,value:!0,writable:!1}),t};var Zt=/^(0|[1-9]\d*)$/,v=()=>{throw Error("Inline flow must contain only JSON values.")},ie=(e,t=new Set)=>{if(e===null||typeof e==="string"||typeof e==="boolean")return e;if(typeof e==="number")return Number.isFinite(e)?e:v();if(typeof e!=="object"||t.has(e))return v();t.add(e);try{if(Array.isArray(e)){if(Object.getPrototypeOf(e)!==Array.prototype)return v();let o=Reflect.ownKeys(e);if(o.length!==e.length+1||o.some((u)=>u!=="length"&&(typeof u!=="string"||!Zt.test(u)||Number(u)>=e.length)))return v();let s=[];for(let u=0;u<e.length;u+=1){let i=Object.getOwnPropertyDescriptor(e,String(u));if(!i?.enumerable||!("value"in i))return v();s.push(ie(i.value,t))}return s}let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)return v();let r={};for(let o of Reflect.ownKeys(e)){if(typeof o!=="string"||o==="__proto__")return v();let s=Object.getOwnPropertyDescriptor(e,o);if(!s?.enumerable||!("value"in s))return v();if(s.value===void 0)continue;Object.defineProperty(r,o,{configurable:!0,enumerable:!0,value:ie(s.value,t),writable:!0})}return r}finally{t.delete(e)}},At=(e)=>{if(typeof e!=="object"||e===null||Array.isArray(e)||Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)return v();let t=ie(e);if(t===null||Array.isArray(t)||typeof t!=="object")return v();return t},Ve=(e)=>{if(typeof e!=="object"||e===null)return e;for(let t of Object.values(e))Ve(t);return Object.freeze(e)},Ft=(e)=>{let t=je.parse(At(e)),n=t.definition;if(typeof n==="object"&&n!==null&&!Array.isArray(n)){let r=Ne.find((o)=>(o in n));if(r)throw Error(`Inline flow definitions cannot include persisted field "${r}".`)}return Ve(t)},ec=(e,t)=>Be(e).createInlineFlowRun(Ft(t));export{Et as createBundledDocsClientOptions,ec as createInlineFlow};
2
2
 
3
- //# debugId=C9092F56A91DB85364756E2164756E21
3
+ //# debugId=811AFDD8AC9958E164756E2164756E21
4
4
  //# sourceMappingURL=inline-flow.js.map