@getuserfeedback/sdk 0.15.2 → 0.16.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,7 +1,7 @@
1
1
  import { InlineFlow } from '@getuserfeedback/protocol/internal/inline-flow';
2
2
  export { InlineFlow } from '@getuserfeedback/protocol/internal/inline-flow';
3
3
  import { AppEventJsonValue, ListInstanceFeedbackMineRequest, ListInstanceFeedbackMineResponse, CaptureInstanceFeedbackRequest, CaptureInstanceFeedbackResponse } from '@getuserfeedback/protocol';
4
- import { TrackOptions, OpenRequestedDetail, ClientOptions, ResponseMetadataInput, FlowRenderState, WidgetLayoutTransitionPolicy, WidgetLayoutTimedTransitionPolicy, ContainerPolicy, ConfigureOptions, IdentifyOptions } from '@getuserfeedback/protocol/host';
4
+ import { TrackOptions, OpenRequestedDetail, ClientOptions, ResponseMetadataInput, FlowRenderState, WidgetLayoutTransitionPolicy, ContainerPolicy, ConfigureOptions, IdentifyOptions } from '@getuserfeedback/protocol/host';
5
5
 
6
6
  type EventProperties = Record<string, AppEventJsonValue>;
7
7
  type EventOptions = TrackOptions;
@@ -96,18 +96,6 @@ type SubscribeFlowStateOptions = {
96
96
  /** Auto-unsubscribe when the signal is aborted. */
97
97
  signal?: AbortSignal;
98
98
  };
99
- /** One timed geometry update emitted by the loader for a custom host. */
100
- type FlowLayoutUpdate = {
101
- width: number;
102
- height: number;
103
- transitionPolicy: WidgetLayoutTimedTransitionPolicy;
104
- };
105
- type FlowLayoutUpdateCallback = (update: FlowLayoutUpdate) => void;
106
- /** Options for subscribing to one-shot flow layout updates. */
107
- type SubscribeFlowLayoutUpdatesOptions = {
108
- /** Auto-unsubscribe when the signal is aborted. */
109
- signal?: AbortSignal;
110
- };
111
99
  /** Instance for a specific flow: open, prefetch, prerender, close, and subscribe to flow state. */
112
100
  type FlowRun = {
113
101
  /** The flow/survey ID this instance refers to. */
@@ -126,8 +114,6 @@ type FlowRun = {
126
114
  getFlowState: () => FlowState;
127
115
  /** Subscribe to open/loading/dimensions; returns an unsubscribe function. */
128
116
  subscribeFlowState: (callback: FlowStateCallback, options?: SubscribeFlowStateOptions) => () => void;
129
- /** Subscribe to timed geometry updates without replaying durable state. */
130
- subscribeLayoutUpdates: (callback: FlowLayoutUpdateCallback, options?: SubscribeFlowLayoutUpdatesOptions) => () => void;
131
117
  };
132
118
  /**
133
119
  * getuserfeedback client for loading the widget, opening flows, configuring
@@ -189,9 +175,10 @@ type Client = {
189
175
  graph: GraphOperations;
190
176
  /** Submit feedback or read the authenticated user's matching feedback. */
191
177
  feedback: FeedbackOperations;
192
- /** Subscribe to open flow requests or suppress them — for example if you know the user should not be interrupted.
178
+ /** Subscribe to explicit SDK and client-side targeting open requests, or suppress them — for example if you know the user should not be interrupted.
193
179
  * For example, when the user is filling out a form, or is in the middle of a multi-step flow.
194
- * The system will retry after a short delay with exponential backoff.
180
+ * Prevention applies only to that presentation attempt; it does not create a
181
+ * public retry schedule.
195
182
  *
196
183
  * @example — suppress open flow requests if the user is busy
197
184
  * ```ts
@@ -1,4 +1,4 @@
1
- var W;function d(e,t,n){function r(i,u){if(!i._zod)Object.defineProperty(i,"_zod",{value:{def:u,constr:o,traits:new Set},enumerable:!1});if(i._zod.traits.has(e))return;i._zod.traits.add(e),t(i,u);let a=o.prototype,l=Object.keys(a);for(let f=0;f<l.length;f++){let p=l[f];if(!(p in i))i[p]=a[p].bind(i)}}let s=n?.Parent??Object;class c extends s{}Object.defineProperty(c,"name",{value:e});function o(i){var u;let a=n?.Parent?new c:this;r(a,i),(u=a._zod).deferred??(u.deferred=[]);for(let l of a._zod.deferred)l();return a}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 ct=Symbol("zod_brand");class g extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}(W=globalThis).__zod_globalConfig??(W.__zod_globalConfig={});var N=globalThis.__zod_globalConfig;function y(e){if(e)Object.assign(N,e);return N}function J(e,t){if(typeof t==="bigint")return t.toString();return t}function Y(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw Error("cached value already set")}}}function X(e){return e===null||e===void 0}function Q(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}var K=Symbol("evaluating");function b(e,t,n){let r=void 0;Object.defineProperty(e,t,{get(){if(r===K)return;if(r===void 0)r=K,r=n();return r},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}var H="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ee(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 v(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 te(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 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 ne(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 re(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}var oe=(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,J,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ie=d("$ZodError",oe),I=d("$ZodError",oe,{Parent:Error});var Pe=(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((u)=>x(u,c,y())));throw H(i,s?.callee),i}return o.value},C=Pe(I),Oe=(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((u)=>x(u,c,y())));throw H(i,s?.callee),i}return o.value},A=Oe(I),Ce=(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??ie)(c.issues.map((o)=>x(o,s,y())))}:{success:!0,data:c.value}},S=Ce(I),Ae=(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}},E=Ae(I);var Fe="(?:(?:\\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])))",Te=new RegExp(`^${Fe}$`);var se=(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 ae=d("$ZodCheckMinLength",(e,t)=>{var n;Z.init(e,t),(n=e._zod.def).when??(n.when=(r)=>{let s=r.value;return!X(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=re(s);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}});var ue=d("$ZodCheckOverwrite",(e,t)=>{Z.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});var le={major:4,minor:4,patch:3};var w=d("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=le;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,u)=>{let a=k(o),l;for(let f of i){if(f._zod.def.when){if(ne(o))continue;if(!f._zod.def.when(o))continue}else if(a)continue;let p=o.issues.length,m=f._zod.check(o);if(m instanceof Promise&&u?.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(!a)a=k(o,p)});else{if(o.issues.length===p)continue;if(!a)a=k(o,p)}}if(l)return l.then(()=>o);return o},c=(o,i,u)=>{if(k(o))return o.aborted=!0,o;let a=s(i,r,u);if(a instanceof Promise){if(u.async===!1)throw new g;return a.then((l)=>e._zod.parse(l,u))}return e._zod.parse(a,u)};e._zod.run=(o,i)=>{if(i.skipChecks)return e._zod.parse(o,i);if(i.direction==="backward"){let a=e._zod.parse({value:o.value,issues:[]},{...i,skipChecks:!0});if(a instanceof Promise)return a.then((l)=>c(l,o,i));return c(a,o,i)}let u=e._zod.parse(o,i);if(u instanceof Promise){if(i.async===!1)throw new g;return u.then((a)=>s(a,r,i))}return s(u,r,i)}}b(e,"~standard",()=>({validate:(s)=>{try{let c=S(e,s);return c.success?{value:c.data}:{issues:c.error?.issues}}catch(c){return E(e,s).then((o)=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}))}),pe=d("$ZodString",(e,t)=>{w.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??se(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 fe=d("$ZodUnknown",(e,t)=>{w.init(e,t),e._zod.parse=(n)=>n}),me=d("$ZodNever",(e,t)=>{w.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 Ne(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=te(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function De(e,t,n,r,s,c){let o=[],i=s.keySet,u=s.catchall._zod,a=u.def.type,l=u.optin==="optional",f=u.optout==="optional";for(let p in t){if(p==="__proto__")continue;if(i.has(p))continue;if(a==="never"){o.push(p);continue}let m=u.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 he=d("$ZodObject",(e,t)=>{if(w.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let i=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...i};return Object.defineProperty(t,"shape",{value:u}),u}})}let r=Y(()=>Ne(t));b(e._zod,"propValues",()=>{let i=t.shape,u={};for(let a in i){let l=i[a]._zod;if(l.values){u[a]??(u[a]=new Set);for(let f of l.values)u[a].add(f)}}return u});let s=ee,c=t.catchall,o;e._zod.parse=(i,u)=>{o??(o=r.value);let a=i.value;if(!s(a))return i.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),i;i.value={};let l=[],f=o.shape;for(let p of o.keys){let m=f[p],_=m._zod.optin==="optional",G=m._zod.optout==="optional",M=m._zod.run({value:a[p],issues:[]},u);if(M instanceof Promise)l.push(M.then((Ee)=>F(Ee,i,p,a,_,G)));else F(M,i,p,a,_,G)}if(!c)return l.length?Promise.all(l).then(()=>i):i;return De(l,a,i,u,r.value,e)}});function de(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var ge=d("$ZodOptional",(e,t)=>{w.init(e,t),e._zod.optin="optional",e._zod.optout="optional",b(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),b(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${Q(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)=>de(o,s));return de(c,s)}if(n.value===void 0)return n;return t.innerType._zod.run(n,r)}});function _e(e,t){return new e({type:"string",...v(t)})}function be(e){return new e({type:"unknown"})}function ve(e,t){return new e({type:"never",...v(t)})}function T(e,t){return new ae({check:"min_length",...v(t),minimum:e})}function we(e){return new ue({check:"overwrite",tx:e})}function U(){return we((e)=>e.trim())}var R=d("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");w.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)=>S(e,n,r),e.parseAsync=async(n,r)=>A(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>E(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)}),qe=d("ZodMiniString",(e,t)=>{pe.init(e,t),R.init(e,t)});function L(e){return _e(qe,e)}var Be=d("ZodMiniUnknown",(e,t)=>{fe.init(e,t),R.init(e,t)});function ye(){return be(Be)}var Ve=d("ZodMiniNever",(e,t)=>{me.init(e,t),R.init(e,t)});function Ge(e){return ve(Ve,e)}var We=d("ZodMiniObject",(e,t)=>{he.init(e,t),R.init(e,t),b(e,"shape",()=>t.shape)});function B(e,t){return new We({type:"object",shape:e,catchall:Ge(),...v(t)})}var Ke=d("ZodMiniOptional",(e,t)=>{ge.init(e,t),R.init(e,t)});function P(e){return new Ke({type:"optional",innerType:e})}function xe(e,t){let n=new Z({check:"custom",...v(t)});return n._zod.check=e,n}var ze=["id","organizationId","versionId","versionNumber"],Xe=B({css:P(L()),themeRuntimeArtifactId:P(L().check(U(),T(1))),themeVersionId:P(L().check(U(),T(1)))}),$e=B({definition:ye().check(xe((e)=>{if(e.value!==void 0)return;e.issues.push({code:"custom",input:e.value,message:"Inline flow definition is required.",continue:!1})})),theme:P(Xe)});var Qe=Symbol.for("@getuserfeedback/sdk/internal/inline-flow-client-bridge/1");var ke=(e)=>{let t=Reflect.get(e,Qe);if(typeof t!=="object"||t===null||!("createInlineFlowRun"in t)||typeof Reflect.get(t,"createInlineFlowRun")!=="function")throw Error("Inline flows require a compatible client created by @getuserfeedback/sdk.");return t};var di=Symbol("operation-superseded");var pi={state:"resolved",fallback:null,promise:Promise.resolve(),resolve:()=>{},reject:()=>{}};var Ie="0.15.2".trim(),et=Ie.length>0?Ie:"0.0.0-local";var tt=Symbol.for("@getuserfeedback/sdk/internal/supplied-only-local-client-options/1"),nt="@getuserfeedback/internal/bundled-docs",rt=(e)=>{let t={apiKey:nt,_loaderUrl:e.loaderUrl,_coreUrl:e.coreUrl,...e.colorScheme===void 0?{}:{colorScheme:e.colorScheme},...e.disableAutoLoad===void 0?{}:{disableAutoLoad:e.disableAutoLoad}};return Object.defineProperty(t,tt,{configurable:!1,enumerable:!1,value:!0,writable:!1}),t};var ot=/^(0|[1-9]\d*)$/,h=()=>{throw Error("Inline flow must contain only JSON values.")},V=(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"||!ot.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(V(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:V(c.value,t),writable:!0})}return r}finally{t.delete(e)}},it=(e)=>{if(typeof e!=="object"||e===null||Array.isArray(e)||Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)return h();return V(e)},Se=(e)=>{if(typeof e!=="object"||e===null)return e;for(let t of Object.values(e))Se(t);return Object.freeze(e)},st=(e)=>{let t=$e.parse(it(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 Se(t)},Gi=(e,t)=>ke(e).createInlineFlowRun(st(t));export{rt as createBundledDocsClientOptions,Gi as createInlineFlow};
1
+ var W;function p(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 d=l[f];if(!(d in i))i[d]=u[d].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 ct=Symbol("zod_brand");class g extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}(W=globalThis).__zod_globalConfig??(W.__zod_globalConfig={});var L=globalThis.__zod_globalConfig;function y(e){if(e)Object.assign(L,e);return L}function J(e,t){if(typeof t==="bigint")return t.toString();return t}function Y(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw Error("cached value already set")}}}function X(e){return e===null||e===void 0}function Q(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}var K=Symbol("evaluating");function v(e,t,n){let r=void 0;Object.defineProperty(e,t,{get(){if(r===K)return;if(r===void 0)r=K,r=n();return r},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}var j="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ee(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function H(e,t,n){let r=new e._zod.constr(t??e._zod.def);if(!t||n?.parent)r._zod.parent=e;return r}function b(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 te(e){return Object.keys(e).filter((t)=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Re={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 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 ne(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 re(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}var oe=(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,J,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ie=p("$ZodError",oe),I=p("$ZodError",oe,{Parent:Error});var Pe=(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 j(i,s?.callee),i}return o.value},C=Pe(I),Oe=(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 j(i,s?.callee),i}return o.value},A=Oe(I),Ce=(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??ie)(c.issues.map((o)=>x(o,s,y())))}:{success:!0,data:c.value}},Z=Ce(I),Ae=(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}},E=Ae(I);var Fe="(?:(?:\\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])))",Te=new RegExp(`^${Fe}$`);var se=(e)=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var R=p("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])});var ue=p("$ZodCheckMinLength",(e,t)=>{var n;R.init(e,t),(n=e._zod.def).when??(n.when=(r)=>{let s=r.value;return!X(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=re(s);r.issues.push({origin:o,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}});var ae=p("$ZodCheckOverwrite",(e,t)=>{R.init(e,t),e._zod.check=(n)=>{n.value=t.tx(n.value)}});var le={major:4,minor:4,patch:3};var w=p("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=le;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=k(o),l;for(let f of i){if(f._zod.def.when){if(ne(o))continue;if(!f._zod.def.when(o))continue}else if(u)continue;let d=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===d)return;if(!u)u=k(o,d)});else{if(o.issues.length===d)continue;if(!u)u=k(o,d)}}if(l)return l.then(()=>o);return o},c=(o,i,a)=>{if(k(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=Z(e,s);return c.success?{value:c.data}:{issues:c.error?.issues}}catch(c){return E(e,s).then((o)=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}))}),de=p("$ZodString",(e,t)=>{w.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??se(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 fe=p("$ZodUnknown",(e,t)=>{w.init(e,t),e._zod.parse=(n)=>n}),me=p("$ZodNever",(e,t)=>{w.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 Le(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=te(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function De(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 d in t){if(d==="__proto__")continue;if(i.has(d))continue;if(u==="never"){o.push(d);continue}let m=a.run({value:t[d],issues:[]},r);if(m instanceof Promise)e.push(m.then((_)=>F(_,n,d,t,l,f)));else F(m,n,d,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 he=p("$ZodObject",(e,t)=>{if(w.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=Y(()=>Le(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=ee,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 d of o.keys){let m=f[d],_=m._zod.optin==="optional",G=m._zod.optout==="optional",N=m._zod.run({value:u[d],issues:[]},a);if(N instanceof Promise)l.push(N.then((Ee)=>F(Ee,i,d,u,_,G)));else F(N,i,d,u,_,G)}if(!c)return l.length?Promise.all(l).then(()=>i):i;return De(l,u,i,a,r.value,e)}});function pe(e,t){if(t===void 0&&(e.issues.length||e.fallback))return{issues:[],value:void 0};return e}var ge=p("$ZodOptional",(e,t)=>{w.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(`^(${Q(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)=>pe(o,s));return pe(c,s)}if(n.value===void 0)return n;return t.innerType._zod.run(n,r)}});function _e(e,t){return new e({type:"string",...b(t)})}function ve(e){return new e({type:"unknown"})}function be(e,t){return new e({type:"never",...b(t)})}function T(e,t){return new ue({check:"min_length",...b(t),minimum:e})}function we(e){return new ae({check:"overwrite",tx:e})}function M(){return we((e)=>e.trim())}var S=p("ZodMiniType",(e,t)=>{if(!e._zod)throw Error("Uninitialized schema in ZodMiniType.");w.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)=>Z(e,n,r),e.parseAsync=async(n,r)=>A(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>E(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)=>H(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e),e.apply=(n)=>n(e)}),qe=p("ZodMiniString",(e,t)=>{de.init(e,t),S.init(e,t)});function U(e){return _e(qe,e)}var Be=p("ZodMiniUnknown",(e,t)=>{fe.init(e,t),S.init(e,t)});function ye(){return ve(Be)}var Ve=p("ZodMiniNever",(e,t)=>{me.init(e,t),S.init(e,t)});function Ge(e){return be(Ve,e)}var We=p("ZodMiniObject",(e,t)=>{he.init(e,t),S.init(e,t),v(e,"shape",()=>t.shape)});function B(e,t){return new We({type:"object",shape:e,catchall:Ge(),...b(t)})}var Ke=p("ZodMiniOptional",(e,t)=>{ge.init(e,t),S.init(e,t)});function P(e){return new Ke({type:"optional",innerType:e})}function xe(e,t){let n=new R({check:"custom",...b(t)});return n._zod.check=e,n}var ze=["id","organizationId","versionId","versionNumber"],Xe=B({css:P(U()),themeRuntimeArtifactId:P(U().check(M(),T(1))),themeVersionId:P(U().check(M(),T(1)))}),$e=B({definition:ye().check(xe((e)=>{if(e.value!==void 0)return;e.issues.push({code:"custom",input:e.value,message:"Inline flow definition is required.",continue:!1})})),theme:P(Xe)});var Qe=Symbol.for("@getuserfeedback/sdk/internal/inline-flow-client-bridge/1");var ke=(e)=>{let t=Reflect.get(e,Qe);if(typeof t!=="object"||t===null||!("createInlineFlowRun"in t)||typeof Reflect.get(t,"createInlineFlowRun")!=="function")throw Error("Inline flows require a compatible client created by @getuserfeedback/sdk.");return t};var pi=Symbol("operation-superseded");var di={state:"resolved",fallback:null,promise:Promise.resolve(),resolve:()=>{},reject:()=>{}};var Ie="0.16.1".trim(),et=Ie.length>0?Ie:"0.0.0-local";var tt=Symbol.for("@getuserfeedback/sdk/internal/supplied-only-local-client-options/1"),nt="@getuserfeedback/internal/bundled-docs",rt=(e)=>{let t={apiKey:nt,_loaderUrl:e.loaderUrl,_coreUrl:e.coreUrl,...e.colorScheme===void 0?{}:{colorScheme:e.colorScheme},...e.disableAutoLoad===void 0?{}:{disableAutoLoad:e.disableAutoLoad}};return Object.defineProperty(t,tt,{configurable:!1,enumerable:!1,value:!0,writable:!1}),t};var ot=/^(0|[1-9]\d*)$/,h=()=>{throw Error("Inline flow must contain only JSON values.")},V=(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"||!ot.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(V(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:V(c.value,t),writable:!0})}return r}finally{t.delete(e)}},it=(e)=>{if(typeof e!=="object"||e===null||Array.isArray(e)||Object.getPrototypeOf(e)!==Object.prototype&&Object.getPrototypeOf(e)!==null)return h();return V(e)},Ze=(e)=>{if(typeof e!=="object"||e===null)return e;for(let t of Object.values(e))Ze(t);return Object.freeze(e)},st=(e)=>{let t=$e.parse(it(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 Ze(t)},Gi=(e,t)=>ke(e).createInlineFlowRun(st(t));export{rt as createBundledDocsClientOptions,Gi as createInlineFlow};
2
2
 
3
- //# debugId=94B6F4504E275D5064756E2164756E21
3
+ //# debugId=FBA84832ABCCEC4964756E2164756E21
4
4
  //# sourceMappingURL=inline-flow.js.map