@hailer/app-sdk 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/app-sdk.js CHANGED
@@ -1,2 +1,2 @@
1
- var Z=Object.create;var W=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var tt=Object.getOwnPropertyNames;var et=Object.getPrototypeOf,rt=Object.prototype.hasOwnProperty;var B=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports);var it=(o,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of tt(t))!rt.call(o,r)&&r!==e&&W(o,r,{get:()=>t[r],enumerable:!(i=$(t,r))||i.enumerable});return o};var st=(o,t,e)=>(e=o!=null?Z(et(o)):{},it(t||!o||!o.__esModule?W(e,"default",{value:o,enumerable:!0}):e,o));var K=B(d=>{"use strict";var nt=d&&d.__awaiter||function(o,t,e,i){function r(s){return s instanceof e?s:new e(function(a){a(s)})}return new(e||(e=Promise))(function(s,a){function l(c){try{p(i.next(c))}catch(L){a(L)}}function h(c){try{p(i.throw(c))}catch(L){a(L)}}function p(c){c.done?s(c.value):r(c.value).then(l,h)}p((i=i.apply(o,t||[])).next())})};Object.defineProperty(d,"__esModule",{value:!0});d.Client=void 0;var M=class{constructor(t,e){this.write=t,this.requests={},this.id=0,this.mtu=65535,e&&e.mtu&&(this.mtu=e.mtu)}destroy(){this.requests=null,this.write=null}messageReceived(t){let e=!!(t.err||t.ack||t.fin),i=t.ack||t.err||t.sig||t.fin,r=this.requests[i],s;if(r&&typeof r.cb=="function"){let a;t.fin?r.cb.call(r.context,null,null,!0):r.canceled?console.log("This request is canceled. Not calling the callback."):(a=t.err?t.data:null,s=r.cb.call(r.context,a,t.data,e))}return e&&delete this.requests[i],s}requestAsync(t,e){return nt(this,void 0,void 0,function*(){return new Promise((i,r)=>{this.request(t,e,(s,a)=>{if(s)return r(a);i(a)})})})}request(t,e,i){this.id++;let r={op:t};return Array.isArray(e)&&(r.args=e),i&&(r.id=this.id,this.requests[r.id]={cb:i,context:{id:r.id,cancel:()=>{setTimeout((s=>()=>{this.requests[s]&&console.log("rpc-client.js: timeout, the request has not been removed while it was canceled",s,this.requests[s])})(r.id),1500),this.requests[r.id].canceled=!0,this.write({end:r.id})},emit:s=>this.write({sig:r.id,data:s})}}),this.write(r),r.id||null}send(t,e){this.write({push:t,data:e})}end(t){this.write({end:t})}};d.Client=M});var J=B(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.Server=void 0;var f=console.log,N=class{constructor(t){this.modules={},this.methods={},this.requests={},this.clientIdCounter=0,this.requestId=0,this.invokeId=0,t&&this.insertMethods(t)}destroy(){for(let t in this.requests){for(let e in this.requests[t])typeof this.requests[t][e].end=="function"&&this.requests[t][e].end();delete this.requests[t]}}insertMethods(t){this.addMethods("",t)}addMethods(t,e){let i=t?t+".":"";for(let r in e)if(r!=="_"){if(r.substring(0,1)!=="_"&&e["_"+r])if(typeof e[r]=="function"){let s=e["_"+r].name||r;e["_"+r].fullname=i+s;try{this.modules[i+s]=e["_"+r],this.methods[i+s]=e[r]}catch(a){console.log("Kaboom! ",a)}}else typeof e[r]=="object"&&this.addMethods(i+r,e[r])}}listMethods(t,e,i){let r={};function s(l,h){let p={};for(let c in l)h[c]||(p[c]=l[c]);return p}let a={fullname:!0};for(let l in this.modules)r[l]=s(this.modules[l],a);i(null,r)}clientOffline(t){for(let e in this.requests[t])typeof this.requests[t][e].end=="function"&&this.requests[t][e].end(),delete this.requests[t][e]}closeAll(){for(let t in this.requests)for(let e in this.requests[t])typeof this.requests[t][e].end=="function"&&this.requests[t][e].end(),delete this.requests[t][e]}parse(t,e,i,r){if(typeof r=="number")try{if(t.push){this.requests[r]&&this.requests[r][t.push]&&this.invokeRaw(t,e,this.requests[r][t.push].context,r);return}if(t.sig){this.requests[r]&&this.requests[r][t.sig]&&this.invokeRaw(t,e,this.requests[r][t.sig].context,r);return}if(t.end){let s=t.end;if(this.requests[r]&&this.requests[r][s]){typeof this.requests[r][s].end=="function"&&this.requests[r][s].end(),e({fin:s}),delete this.requests[r][s];return}if(!this.requests[r][s])return;typeof this.requests[r][s].end=="function"&&this.requests[s].end();return}if(t.op==="methods"){this.listMethods(t.args,i,function(s,a){e({ack:t.id,data:a})});return}if(typeof this.methods[t.op]>"u"){e({err:t.id,data:{code:300,msg:"No method found: "+t.op}});return}this.invokeRaw(t,e,i,r)}catch(s){f("Dynamic RPC failed to execute ",t.op,s,s.stack);try{console.log("RPC caught error",s.stack),e({ack:t.id,err:t.id,data:"caught error in "+t.op+": "+s.toString(),debug:s.stack})}catch(a){e({err:t.id,data:"rpc",errmsg:a.toString()})}}}emit(t,e){for(let i in this.requests)if(this.requests[i]){for(let r in this.requests[i])if(this.requests[i][r].op===t){let{send:s}=this.requests[i][r];s({sig:r,data:e})}}}invokeRaw(t,e,i,r){if(++this.requestId,!this.requests[r])return console.log("Session not opened for client. Use Server.open() first");if(t.push){let s=this.requests[r][t.push];if(t.data===null){console.log("msg.data is null:",t);return}s.data(t.data);return}if(t.sig){let s=this.requests[r][t.sig];try{this.methods[s.op].call(this.requests[r][t.sig],t.data,{send:a=>{typeof s.end=="function"&&s.end(),this.requests[r][t.sig]&&delete this.requests[r][t.sig],e({ack:t.sig,data:a})},emit:a=>(this.requests[r][t.sig]||typeof s.end=="function"&&s.end(),e({sig:t.sig,data:a})),error:a=>{typeof s.end=="function"&&s.end(),delete this.requests[r][t.sig],e({err:t.sig,data:a})},close:a=>{typeof s.end=="function"&&s.end(),delete this.requests[r][t.sig],e({fin:t.sig})}},i)}catch(a){console.log("Calling the method in RPC failed:",t.op,t.args,a.stack),delete this.requests[r][t.sig],e({err:t.sig,data:{msg:"rpc failed during execution of "+t.op,code:578}})}return}if(typeof t.id>"u"){let s={};this.methods[t.op].call(s,{args:t.args},{send:()=>{f("Trying to send response to event ("+t.op+"). Dropping.")},emit:()=>{f("Trying to emit response to event ("+t.op+"). Dropping.")},error:()=>{f("Trying to respond with error to event ("+t.op+"). Dropping.")},close:()=>{f("Trying to close event ("+t.op+"). Dropping.")}},i)}else{let s={id:t.id,op:t.op,args:t.args,context:i,end:null,send:e};this.requests[r]||(this.requests[r]={}),this.requests[r][t.id]&&(console.log("Serious warning. There is already a request by that id, we'll kill it off! This session is likely not clean. clientId:",r,"msg",t,"stack trace:",new Error().stack),typeof this.requests[r][t.id].end=="function"&&this.requests[r][t.id].end(),delete this.requests[r][t.id],console.log("Removed old request by same id from same client...")),this.requests[r][t.id]=s;try{this.methods[t.op].call(s,{args:t.args},{send:a=>{typeof s.end=="function"&&s.end(),this.requests[r][t.id]&&delete this.requests[r][t.id],e({ack:t.id,data:a})},emit:a=>(this.requests[r][t.id]||typeof s.end=="function"&&s.end(),e({sig:t.id,data:a})),error:a=>{typeof s.end=="function"&&s.end(),delete this.requests[r][t.id],e({err:t.id,data:a})},close:a=>{typeof s.end=="function"&&s.end(),delete this.requests[r][t.id],e({fin:t.id})}},i)}catch(a){console.log("Calling the method in RPC failed:",t.op,t.args,a.stack),delete this.requests[r][t.id],e({err:t.id,data:{msg:"rpc failed during execution of "+t.op,code:578}})}}}close(t){for(let e in this.requests[t])typeof this.requests[t][e].end=="function"&&this.requests[t][e].end(),delete this.requests[t][e];delete this.requests[t]}open(){let t=++this.clientIdCounter;return this.requests[t]={},t}};y.Server=N});var G=B(u=>{"use strict";var ot=u&&u.__createBinding||(Object.create?function(o,t,e,i){i===void 0&&(i=e),Object.defineProperty(o,i,{enumerable:!0,get:function(){return t[e]}})}:function(o,t,e,i){i===void 0&&(i=e),o[i]=t[e]}),z=u&&u.__exportStar||function(o,t){for(var e in o)e!=="default"&&!Object.prototype.hasOwnProperty.call(t,e)&&ot(t,o,e)};Object.defineProperty(u,"__esModule",{value:!0});z(K(),u);z(J(),u)});var Y=st(G(),1);var n=class o extends Error{constructor(t){super(),this.code=t.code,this.msg=t.msg,this.debug=t.debug,Object.setPrototypeOf(this,o.prototype)}};var m=class{constructor(t){this.client=t}async get(t){try{return await this.client.requestAsync("v1.user.get",[t])}catch(e){throw new n(e)}}async current(){try{return await this.client.requestAsync("v1.user.current",[])}catch(t){throw new n(t)}}async list(){try{return await this.client.requestAsync("v1.user.list",[])}catch(t){throw new n(t)}}};var w=class{constructor(t){this.client=t}async list(t,e){try{return await this.client.requestAsync("v1.activity.kanban.list",[t,...e?[e]:[]])}catch(i){throw new n(i)}}async load(t){try{return await this.client.requestAsync("v1.activity.kanban.load",[t])}catch(e){throw new n(e)}}async updatePriority(t,e){try{return await this.client.requestAsync("v1.activity.kanban.updatePriority",[{activityId:t,priority:e}])}catch(i){throw new n(i)}}};var b=class{constructor(t){this.client=t;this.kanban=new w(t)}async list(t,e,i){try{return(await this.client.requestAsync("v1.activity.list",[t,e,i])).activities}catch(r){throw new n(r)}}async get(t){try{return await this.client.requestAsync("v1.activity.get",[t])}catch(e){throw new n(e)}}async create(t,e,i){try{return await this.client.requestAsync("v1.activity.create",[t,e,...i?[i]:[]])}catch(r){throw new n(r)}}async update(t,e){try{return await this.client.requestAsync("v1.activity.update",[t,...e?[e]:[]])}catch(i){throw new n(i)}}async remove(t){try{return await this.client.requestAsync("v1.activity.remove",[t])}catch(e){throw new n(e)}}};var v=class{constructor(t){this.client=t}async current(){try{return await this.client.requestAsync("v1.workspace.current",[])}catch(t){throw new n(t)}}async list(){try{return await this.client.requestAsync("v1.workspace.list",[])}catch(t){throw new n(t)}}};var P=class{constructor(t){this.client=t}async open(t,e){await this.client.requestAsync("v1.ui.activity.open",[t,...e?[e]:[]])}async create(t,e){return await this.client.requestAsync("v1.ui.activity.create",[t,...e?[e]:[]])}async editMultiple(t){return await this.client.requestAsync("v1.ui.activity.editMultiple",[t])}};var q=class{constructor(t){this.client=t}async open(t,e,i){await this.client.requestAsync("v1.ui.snackbar.open",[t,e,i])}};var A=class{constructor(t){this.client=t}async uploadFile(t,e,i){return await this.client.requestAsync("v1.ui.file.upload",[await this.toBase64(t),e,!!i?.isPublic])}toBase64(t){return new Promise((e,i)=>{let r=new FileReader;r.readAsDataURL(t),r.onload=()=>e(r.result??""),r.onerror=i})}};var k=class{constructor(t){this.client=t;this.activity=new P(t),this.snackbar=new q(t),this.insight={create:async e=>{await t.requestAsync("v1.ui.insight.create",[e])},edit:async e=>{await t.requestAsync("v1.ui.insight.edit",[e])},delete:async e=>{await t.requestAsync("v1.ui.insight.delete",[e])},permission:async e=>{await t.requestAsync("v1.ui.insight.permission",[e])}},this.files=new A(t)}};var x=class{constructor(t){this.client=t}async list(){try{return await this.client.requestAsync("v1.process.list",[])}catch(t){throw new n(t)}}async get(t){try{return await this.client.requestAsync("v1.process.get",[t])}catch(e){throw new n(e)}}async getFieldIdByName(t,e){try{return Object.values((await this.get(t))?.fields||{}).find(i=>i.label.toLowerCase()===e)?._id}catch(i){throw new n(i)}}};var Q=["https://app.hailer.com","https://next.hailer.com","https://testapp.hailer.biz","https://app.hailer.biz","https://localhost:9443"],g="https://api.hailer.com",X={"https://app.hailer.com":g,"https://next.hailer.com":g,"https://app.hailer.biz":"https://api.hailer.biz","https://testapp.hailer.biz":"https://testapi.hailer.biz","https://localhost:9443":"http://localhost:1337"};var O=class{constructor(t){this.options=t}async config(){let t="manifest.json",e=window.location.origin+window.location.pathname,i=e+t;e.endsWith("/index.html")&&(i=e.slice(0,-10)+t);let r=await(await fetch(i)).text(),a=JSON.parse(r).appId;return await(await fetch(this.options.publicBackendUrl+"/api/v3/app/public",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([a])})).json()}};var C=class{constructor(t){this.options=t}async data(t){let e=await fetch(this.options.publicBackendUrl+"/api/v2/forms/process/get",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([t])});if(!e.ok)throw new n(await e.json());return await e.json()}async submit(t,e){let i=await fetch(this.options.publicBackendUrl+"/api/v2/forms/activity/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([t,e])});if(!i.ok)throw new n(await i.json());return await i.json()}};var S=class{constructor(t){this.options=t}async data(t){let e=await fetch(this.options.publicBackendUrl+"/api/v3/insight/public",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([t])});if(!e.ok)throw new n(await e.json());return await e.json()}async dataAsObject(t){let i=(await this.data(t)).data,r=[];return i.rows.forEach(s=>{let a={};i.headers.forEach((l,h)=>{a[l]=s[h]}),r.push(a)}),r}};var _=class{constructor(t){this.options=t}async list(t,e){let i=await fetch(this.options.publicBackendUrl+"/api/v3/product/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([t,e])});if(!i.ok)throw new n(await i.json());return await i.json()}async get(t){let e=await fetch(this.options.publicBackendUrl+"/api/v3/product/get",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([t])});if(!e.ok)throw new n(await e.json());return await e.json()}};var U=class{constructor(t){this.options=t}async get(t){let e=await fetch(this.options.publicBackendUrl+"/api/v3/productVersion/get",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([t])});if(!e.ok)throw new n(await e.json());return await e.json()}};var T=class{constructor(t){this.insight=new S(t),this.form=new C(t),this.app=new O(t),this.product=new _(t),this.productVersion=new U(t)}};var R=class{constructor(t){this.client=t}async list(){try{return await this.client.requestAsync("v1.workflow.list",[])}catch(t){throw new n(t)}}async get(t){try{return await this.client.requestAsync("v1.workflow.get",[t])}catch(e){throw new n(e)}}};var j=class{constructor(t){this.client=t;this.config={update:async(t,e)=>{try{return await this.client.requestAsync("v1.app.config.update",[t,e])}catch(i){throw console.log("Errorasd ",i),new n(i)}}}}};var I=class{constructor(t){this.client=t}async data(t,e){try{return await this.client.requestAsync("v1.insight.data",[t,...e?[e]:[]])}catch(i){throw new n(i)}}async list(){try{return await this.client.requestAsync("v1.insight.list",[])}catch(t){throw new n(t)}}async update(t,e){try{return await this.client.requestAsync("v1.insight.update",[t,e])}catch(i){throw new n(i)}}};var H=class{constructor(t){this.client=t;this.map=async()=>{try{return await this.client.requestAsync("v1.permission.map",[])}catch(t){throw console.log("Failed to read permissions from Hailer, error:",t),new n(t)}}}};var E=class{constructor(t){this.client=t}async list(t,e){try{return await this.client.requestAsync("v1.product.list",[t,e])}catch(i){throw new n(i)}}async get(t){try{return await this.client.requestAsync("v1.product.get",[t])}catch(e){throw new n(e)}}async create(t){try{return await this.client.requestAsync("v1.product.create",[t])}catch(e){throw new n(e)}}async update(t,e){try{return await this.client.requestAsync("v1.product.update",[t,e])}catch(i){throw new n(i)}}async remove(t){try{return await this.client.requestAsync("v1.product.remove",[t])}catch(e){throw new n(e)}}async install(t){try{return await this.client.requestAsync("v1.product.install",[t])}catch(e){throw new n(e)}}async setPublic(t,e){try{return await this.client.requestAsync("v1.product.setPublic",[t,e])}catch(i){throw new n(i)}}};var D=class{constructor(t){this.client=t}async get(t){try{return await this.client.requestAsync("v1.productVersion.get",[t])}catch(e){throw new n(e)}}async publishTemplate(t){try{return await this.client.requestAsync("v1.productVersion.publishTemplate",[t])}catch(e){throw new n(e)}}};var F=class{constructor(t){this.client=t}async list(t){try{return await this.client.requestAsync("v1.productInstalled.list",[t])}catch(e){throw new n(e)}}async get(t){try{return await this.client.requestAsync("v1.productInstalled.get",[t])}catch(e){throw new n(e)}}async remove(t){try{return await this.client.requestAsync("v1.productInstalled.remove",[t])}catch(e){throw new n(e)}}};var V=class{constructor(t={}){this.options=t;this.outside=null;let e=t.allowedUrls??Q;this.apiVersion=t.apiVersion??1,this.subscribedSignals=t.subscribedSignals||[],this.client=new Y.Client(r=>{this.hostUrl&&parent.postMessage(JSON.stringify(r),this.hostUrl)}),this.user=new m(this.client),this.app=new j(this.client),this.activity=new b(this.client),this.insight=new I(this.client),this.workspace=new v(this.client),this.process=new x(this.client),this.workflow=new R(this.client),this.permission=new H(this.client),this.public=new T(this.options),this.ui=new k(this.client),this.product=new E(this.client),this.productVersion=new D(this.client),this.productInstalled=new F(this.client);let i=JSON.stringify({op:"register",args:[]});window.location===window.parent.location?(this.options.publicBackendUrl||(this.options.publicBackendUrl=g),this.public.app.config().then(r=>{this.outside=!0,this.options.outside?.(r)}).catch(r=>{this.options.error?.(r),console.error("Failed to get app configuration in Public App.",r)})):(e.forEach(r=>parent.postMessage(i,r)),this.timer=setTimeout(()=>{this.outside=!0,this.options.outside?.()},100)),this.createEventListener()}createEventListener(){window.addEventListener("message",async t=>{let e=t.data;try{let i=JSON.parse(e);if(i.op==="register"){if(this.appId){console.error("App Id is already set...! Are you using hot-reload?");return}clearTimeout(this.timer),this.appId=i.data.appId,this.workspaceId=i.data.workspaceId,this.hostUrl=t.origin,this.options.publicBackendUrl||(this.options.publicBackendUrl=X[this.hostUrl]||g),this.client.request("v1.ui.settings",[],(r,s,a)=>{if(r){console.log("ui.settings error:",r,s);return}this.options.settings?.(s)}),this.client.request("v1.config",[],(r,s,a)=>{if(r){console.log("config error:",r,s);return}this.options.config?.(s)}),this.subscribedSignals&&this.client.request("v1.signals",[this.subscribedSignals],(r,s,a)=>{if(r){console.log("signals error:",r,s);return}s&&this.options.signals?.(s)}),this.outside=!1,this.options.connected?.();return}if(!this.appId)return;this.client.messageReceived(i)}catch{console.log("Dropped invalid JSON message")}})}info(){return{hostUrl:this.hostUrl,config:this.config,outside:this.outside,workspaceId:this.workspaceId}}async request(t,e){return await this.client.requestAsync(t,e)}};export{V as HailerApi,n as HailerError};
1
+ var Q=Object.create;var V=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,$=Object.prototype.hasOwnProperty;var E=(o,t)=>()=>(t||o((t={exports:{}}).exports,t),t.exports);var tt=(o,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Y(t))!$.call(o,i)&&i!==e&&V(o,i,{get:()=>t[i],enumerable:!(r=X(t,i))||r.enumerable});return o};var et=(o,t,e)=>(e=o!=null?Q(Z(o)):{},tt(t||!o||!o.__esModule?V(e,"default",{value:o,enumerable:!0}):e,o));var B=E(d=>{"use strict";var it=d&&d.__awaiter||function(o,t,e,r){function i(s){return s instanceof e?s:new e(function(a){a(s)})}return new(e||(e=Promise))(function(s,a){function l(c){try{p(r.next(c))}catch(D){a(D)}}function h(c){try{p(r.throw(c))}catch(D){a(D)}}function p(c){c.done?s(c.value):i(c.value).then(l,h)}p((r=r.apply(o,t||[])).next())})};Object.defineProperty(d,"__esModule",{value:!0});d.Client=void 0;var F=class{constructor(t,e){this.write=t,this.requests={},this.id=0,this.mtu=65535,e&&e.mtu&&(this.mtu=e.mtu)}destroy(){this.requests=null,this.write=null}messageReceived(t){let e=!!(t.err||t.ack||t.fin),r=t.ack||t.err||t.sig||t.fin,i=this.requests[r],s;if(i&&typeof i.cb=="function"){let a;t.fin?i.cb.call(i.context,null,null,!0):i.canceled?console.log("This request is canceled. Not calling the callback."):(a=t.err?t.data:null,s=i.cb.call(i.context,a,t.data,e))}return e&&delete this.requests[r],s}requestAsync(t,e){return it(this,void 0,void 0,function*(){return new Promise((r,i)=>{this.request(t,e,(s,a)=>{if(s)return i(a);r(a)})})})}request(t,e,r){this.id++;let i={op:t};return Array.isArray(e)&&(i.args=e),r&&(i.id=this.id,this.requests[i.id]={cb:r,context:{id:i.id,cancel:()=>{setTimeout((s=>()=>{this.requests[s]&&console.log("rpc-client.js: timeout, the request has not been removed while it was canceled",s,this.requests[s])})(i.id),1500),this.requests[i.id].canceled=!0,this.write({end:i.id})},emit:s=>this.write({sig:i.id,data:s})}}),this.write(i),i.id||null}send(t,e){this.write({push:t,data:e})}end(t){this.write({end:t})}};d.Client=F});var N=E(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.Server=void 0;var g=console.log,M=class{constructor(t){this.modules={},this.methods={},this.requests={},this.clientIdCounter=0,this.requestId=0,this.invokeId=0,t&&this.insertMethods(t)}destroy(){for(let t in this.requests){for(let e in this.requests[t])typeof this.requests[t][e].end=="function"&&this.requests[t][e].end();delete this.requests[t]}}insertMethods(t){this.addMethods("",t)}addMethods(t,e){let r=t?t+".":"";for(let i in e)if(i!=="_"){if(i.substring(0,1)!=="_"&&e["_"+i])if(typeof e[i]=="function"){let s=e["_"+i].name||i;e["_"+i].fullname=r+s;try{this.modules[r+s]=e["_"+i],this.methods[r+s]=e[i]}catch(a){console.log("Kaboom! ",a)}}else typeof e[i]=="object"&&this.addMethods(r+i,e[i])}}listMethods(t,e,r){let i={};function s(l,h){let p={};for(let c in l)h[c]||(p[c]=l[c]);return p}let a={fullname:!0};for(let l in this.modules)i[l]=s(this.modules[l],a);r(null,i)}clientOffline(t){for(let e in this.requests[t])typeof this.requests[t][e].end=="function"&&this.requests[t][e].end(),delete this.requests[t][e]}closeAll(){for(let t in this.requests)for(let e in this.requests[t])typeof this.requests[t][e].end=="function"&&this.requests[t][e].end(),delete this.requests[t][e]}parse(t,e,r,i){if(typeof i=="number")try{if(t.push){this.requests[i]&&this.requests[i][t.push]&&this.invokeRaw(t,e,this.requests[i][t.push].context,i);return}if(t.sig){this.requests[i]&&this.requests[i][t.sig]&&this.invokeRaw(t,e,this.requests[i][t.sig].context,i);return}if(t.end){let s=t.end;if(this.requests[i]&&this.requests[i][s]){typeof this.requests[i][s].end=="function"&&this.requests[i][s].end(),e({fin:s}),delete this.requests[i][s];return}if(!this.requests[i][s])return;typeof this.requests[i][s].end=="function"&&this.requests[s].end();return}if(t.op==="methods"){this.listMethods(t.args,r,function(s,a){e({ack:t.id,data:a})});return}if(typeof this.methods[t.op]>"u"){e({err:t.id,data:{code:300,msg:"No method found: "+t.op}});return}this.invokeRaw(t,e,r,i)}catch(s){g("Dynamic RPC failed to execute ",t.op,s,s.stack);try{console.log("RPC caught error",s.stack),e({ack:t.id,err:t.id,data:"caught error in "+t.op+": "+s.toString(),debug:s.stack})}catch(a){e({err:t.id,data:"rpc",errmsg:a.toString()})}}}emit(t,e){for(let r in this.requests)if(this.requests[r]){for(let i in this.requests[r])if(this.requests[r][i].op===t){let{send:s}=this.requests[r][i];s({sig:i,data:e})}}}invokeRaw(t,e,r,i){if(++this.requestId,!this.requests[i])return console.log("Session not opened for client. Use Server.open() first");if(t.push){let s=this.requests[i][t.push];if(t.data===null){console.log("msg.data is null:",t);return}s.data(t.data);return}if(t.sig){let s=this.requests[i][t.sig];try{this.methods[s.op].call(this.requests[i][t.sig],t.data,{send:a=>{typeof s.end=="function"&&s.end(),this.requests[i][t.sig]&&delete this.requests[i][t.sig],e({ack:t.sig,data:a})},emit:a=>(this.requests[i][t.sig]||typeof s.end=="function"&&s.end(),e({sig:t.sig,data:a})),error:a=>{typeof s.end=="function"&&s.end(),delete this.requests[i][t.sig],e({err:t.sig,data:a})},close:a=>{typeof s.end=="function"&&s.end(),delete this.requests[i][t.sig],e({fin:t.sig})}},r)}catch(a){console.log("Calling the method in RPC failed:",t.op,t.args,a.stack),delete this.requests[i][t.sig],e({err:t.sig,data:{msg:"rpc failed during execution of "+t.op,code:578}})}return}if(typeof t.id>"u"){let s={};this.methods[t.op].call(s,{args:t.args},{send:()=>{g("Trying to send response to event ("+t.op+"). Dropping.")},emit:()=>{g("Trying to emit response to event ("+t.op+"). Dropping.")},error:()=>{g("Trying to respond with error to event ("+t.op+"). Dropping.")},close:()=>{g("Trying to close event ("+t.op+"). Dropping.")}},r)}else{let s={id:t.id,op:t.op,args:t.args,context:r,end:null,send:e};this.requests[i]||(this.requests[i]={}),this.requests[i][t.id]&&(console.log("Serious warning. There is already a request by that id, we'll kill it off! This session is likely not clean. clientId:",i,"msg",t,"stack trace:",new Error().stack),typeof this.requests[i][t.id].end=="function"&&this.requests[i][t.id].end(),delete this.requests[i][t.id],console.log("Removed old request by same id from same client...")),this.requests[i][t.id]=s;try{this.methods[t.op].call(s,{args:t.args},{send:a=>{typeof s.end=="function"&&s.end(),this.requests[i][t.id]&&delete this.requests[i][t.id],e({ack:t.id,data:a})},emit:a=>(this.requests[i][t.id]||typeof s.end=="function"&&s.end(),e({sig:t.id,data:a})),error:a=>{typeof s.end=="function"&&s.end(),delete this.requests[i][t.id],e({err:t.id,data:a})},close:a=>{typeof s.end=="function"&&s.end(),delete this.requests[i][t.id],e({fin:t.id})}},r)}catch(a){console.log("Calling the method in RPC failed:",t.op,t.args,a.stack),delete this.requests[i][t.id],e({err:t.id,data:{msg:"rpc failed during execution of "+t.op,code:578}})}}}close(t){for(let e in this.requests[t])typeof this.requests[t][e].end=="function"&&this.requests[t][e].end(),delete this.requests[t][e];delete this.requests[t]}open(){let t=++this.clientIdCounter;return this.requests[t]={},t}};y.Server=M});var K=E(u=>{"use strict";var rt=u&&u.__createBinding||(Object.create?function(o,t,e,r){r===void 0&&(r=e),Object.defineProperty(o,r,{enumerable:!0,get:function(){return t[e]}})}:function(o,t,e,r){r===void 0&&(r=e),o[r]=t[e]}),W=u&&u.__exportStar||function(o,t){for(var e in o)e!=="default"&&!Object.prototype.hasOwnProperty.call(t,e)&&rt(t,o,e)};Object.defineProperty(u,"__esModule",{value:!0});W(B(),u);W(N(),u)});var G=et(K(),1);var n=class o extends Error{constructor(t){super(),this.code=t.code,this.msg=t.msg,this.debug=t.debug,Object.setPrototypeOf(this,o.prototype)}};var m=class{constructor(t){this.client=t}async get(t){try{return await this.client.requestAsync("v1.user.get",[t])}catch(e){throw new n(e)}}async current(){try{return await this.client.requestAsync("v1.user.current",[])}catch(t){throw new n(t)}}async list(){try{return await this.client.requestAsync("v1.user.list",[])}catch(t){throw new n(t)}}};var b=class{constructor(t){this.client=t}async list(t,e){try{return await this.client.requestAsync("v1.activity.kanban.list",[t,...e?[e]:[]])}catch(r){throw new n(r)}}async load(t){try{return await this.client.requestAsync("v1.activity.kanban.load",[t])}catch(e){throw new n(e)}}async updatePriority(t,e){try{return await this.client.requestAsync("v1.activity.kanban.updatePriority",[{activityId:t,priority:e}])}catch(r){throw new n(r)}}};var w=class{constructor(t){this.client=t;this.kanban=new b(t)}async list(t,e,r){try{return(await this.client.requestAsync("v1.activity.list",[t,e,r])).activities}catch(i){throw new n(i)}}async get(t){try{return await this.client.requestAsync("v1.activity.get",[t])}catch(e){throw new n(e)}}async create(t,e,r){try{return await this.client.requestAsync("v1.activity.create",[t,e,...r?[r]:[]])}catch(i){throw new n(i)}}async update(t,e){try{return await this.client.requestAsync("v1.activity.update",[t,...e?[e]:[]])}catch(r){throw new n(r)}}async remove(t){try{return await this.client.requestAsync("v1.activity.remove",[t])}catch(e){throw new n(e)}}};var v=class{constructor(t){this.client=t;this.product={publishTemplate:this.publishTemplate.bind(this),isProductInstalled:this.isProductInstalled.bind(this),get:this.get.bind(this),install:this.install.bind(this),getManifest:this.getManifest.bind(this)}}async current(){try{return await this.client.requestAsync("v1.workspace.current",[])}catch(t){throw new n(t)}}async list(){try{return await this.client.requestAsync("v1.workspace.list",[])}catch(t){throw new n(t)}}async publishTemplate(t){try{return await this.client.requestAsync("v1.workspace.product.publishTemplate",[t])}catch(e){throw new n(e)}}async isProductInstalled(t){try{return await this.client.requestAsync("v1.workspace.product.isProductInstalled",[t])}catch(e){throw new n(e)}}async get(t){try{return await this.client.requestAsync("v1.workspace.product.get",[t])}catch(e){throw new n(e)}}async install(t){try{return await this.client.requestAsync("v1.workspace.product.install",[t])}catch(e){throw new n(e)}}async getManifest(t){try{return await this.client.requestAsync("v1.workspace.product.getManifest",[t])}catch(e){throw new n(e)}}};var P=class{constructor(t){this.client=t}async open(t,e){await this.client.requestAsync("v1.ui.activity.open",[t,...e?[e]:[]])}async create(t,e){return await this.client.requestAsync("v1.ui.activity.create",[t,...e?[e]:[]])}async editMultiple(t){return await this.client.requestAsync("v1.ui.activity.editMultiple",[t])}};var q=class{constructor(t){this.client=t}async open(t,e,r){await this.client.requestAsync("v1.ui.snackbar.open",[t,e,r])}};var A=class{constructor(t){this.client=t}async uploadFile(t,e,r){return await this.client.requestAsync("v1.ui.file.upload",[await this.toBase64(t),e,!!r?.isPublic])}toBase64(t){return new Promise((e,r)=>{let i=new FileReader;i.readAsDataURL(t),i.onload=()=>e(i.result??""),i.onerror=r})}};var k=class{constructor(t){this.client=t;this.activity=new P(t),this.snackbar=new q(t),this.insight={create:async e=>{await t.requestAsync("v1.ui.insight.create",[e])},edit:async e=>{await t.requestAsync("v1.ui.insight.edit",[e])},delete:async e=>{await t.requestAsync("v1.ui.insight.delete",[e])},permission:async e=>{await t.requestAsync("v1.ui.insight.permission",[e])}},this.files=new A(t)}};var x=class{constructor(t){this.client=t}async list(){try{return await this.client.requestAsync("v1.process.list",[])}catch(t){throw new n(t)}}async get(t){try{return await this.client.requestAsync("v1.process.get",[t])}catch(e){throw new n(e)}}async getFieldIdByName(t,e){try{return Object.values((await this.get(t))?.fields||{}).find(r=>r.label.toLowerCase()===e)?._id}catch(r){throw new n(r)}}};var J=["https://app.hailer.com","https://next.hailer.com","https://testapp.hailer.biz","https://app.hailer.biz","https://localhost:9443"],f="https://api.hailer.com",z={"https://app.hailer.com":f,"https://next.hailer.com":f,"https://app.hailer.biz":"https://api.hailer.biz","https://testapp.hailer.biz":"https://testapi.hailer.biz","https://localhost:9443":"http://localhost:1337"};var O=class{constructor(t){this.options=t}async config(){let t="manifest.json",e=window.location.origin+window.location.pathname,r=e+t;e.endsWith("/index.html")&&(r=e.slice(0,-10)+t);let i=await(await fetch(r)).text(),a=JSON.parse(i).appId;return await(await fetch(this.options.publicBackendUrl+"/api/v3/app/public",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([a])})).json()}};var C=class{constructor(t){this.options=t}async data(t){let e=await fetch(this.options.publicBackendUrl+"/api/v2/forms/process/get",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([t])});if(!e.ok)throw new n(await e.json());return await e.json()}async submit(t,e){let r=await fetch(this.options.publicBackendUrl+"/api/v2/forms/activity/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([t,e])});if(!r.ok)throw new n(await r.json());return await r.json()}};var S=class{constructor(t){this.options=t}async data(t){let e=await fetch(this.options.publicBackendUrl+"/api/v3/insight/public",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([t])});if(!e.ok)throw new n(await e.json());return await e.json()}async dataAsObject(t){let r=(await this.data(t)).data,i=[];return r.rows.forEach(s=>{let a={};r.headers.forEach((l,h)=>{a[l]=s[h]}),i.push(a)}),i}};var _=class{constructor(t){this.options=t}async list(t,e){let r=await fetch(this.options.publicBackendUrl+"/api/v3/product/list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([t,e])});if(!r.ok)throw new n(await r.json());return await r.json()}async get(t){let e=await fetch(this.options.publicBackendUrl+"/api/v3/product/get",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify([t])});if(!e.ok)throw new n(await e.json());return await e.json()}};var U=class{constructor(t){this.insight=new S(t),this.form=new C(t),this.app=new O(t),this.product=new _(t)}};var T=class{constructor(t){this.client=t}async list(){try{return await this.client.requestAsync("v1.workflow.list",[])}catch(t){throw new n(t)}}async get(t){try{return await this.client.requestAsync("v1.workflow.get",[t])}catch(e){throw new n(e)}}};var I=class{constructor(t){this.client=t;this.config={update:async(t,e)=>{try{return await this.client.requestAsync("v1.app.config.update",[t,e])}catch(r){throw console.log("Errorasd ",r),new n(r)}}};this.product={isProductInstalled:this.isProductInstalled.bind(this),get:this.get.bind(this),install:this.install.bind(this),getInstalledVersion:this.getInstalledVersion.bind(this),getManifest:this.getManifest.bind(this)}}async isProductInstalled(t){try{return await this.client.requestAsync("v1.app.product.isProductInstalled",[t])}catch(e){throw new n(e)}}async get(t){try{return await this.client.requestAsync("v1.app.product.get",[t])}catch(e){throw new n(e)}}async install(t){try{return await this.client.requestAsync("v1.app.product.install",[t])}catch(e){throw new n(e)}}async getInstalledVersion(t){try{return await this.client.requestAsync("v1.app.product.getInstalledVersion",[t])}catch(e){throw new n(e)}}async getManifest(t){try{return await this.client.requestAsync("v1.app.product.getManifest",[t])}catch(e){throw new n(e)}}};var R=class{constructor(t){this.client=t}async data(t,e){try{return await this.client.requestAsync("v1.insight.data",[t,...e?[e]:[]])}catch(r){throw new n(r)}}async list(){try{return await this.client.requestAsync("v1.insight.list",[])}catch(t){throw new n(t)}}async update(t,e){try{return await this.client.requestAsync("v1.insight.update",[t,e])}catch(r){throw new n(r)}}};var j=class{constructor(t){this.client=t;this.map=async()=>{try{return await this.client.requestAsync("v1.permission.map",[])}catch(t){throw console.log("Failed to read permissions from Hailer, error:",t),new n(t)}}}};var H=class{constructor(t){this.client=t}async list(t,e){try{return await this.client.requestAsync("v1.product.list",[t,e])}catch(r){throw new n(r)}}async get(t){try{return await this.client.requestAsync("v1.product.get",[t])}catch(e){throw new n(e)}}async create(t){try{return await this.client.requestAsync("v1.product.create",[t])}catch(e){throw new n(e)}}async update(t,e){try{return await this.client.requestAsync("v1.product.update",[t,e])}catch(r){throw new n(r)}}async remove(t){try{return await this.client.requestAsync("v1.product.remove",[t])}catch(e){throw new n(e)}}async setPublic(t,e){try{return await this.client.requestAsync("v1.product.setPublic",[t,e])}catch(r){throw new n(r)}}};var L=class{constructor(t={}){this.options=t;this.outside=null;let e=t.allowedUrls??J;this.apiVersion=t.apiVersion??1,this.subscribedSignals=t.subscribedSignals||[],this.client=new G.Client(i=>{this.hostUrl&&parent.postMessage(JSON.stringify(i),this.hostUrl)}),this.user=new m(this.client),this.app=new I(this.client),this.activity=new w(this.client),this.insight=new R(this.client),this.workspace=new v(this.client),this.process=new x(this.client),this.workflow=new T(this.client),this.permission=new j(this.client),this.public=new U(this.options),this.ui=new k(this.client),this.product=new H(this.client);let r=JSON.stringify({op:"register",args:[]});window.location===window.parent.location?(this.options.publicBackendUrl||(this.options.publicBackendUrl=f),this.public.app.config().then(i=>{this.outside=!0,this.options.outside?.(i)}).catch(i=>{this.options.error?.(i),console.error("Failed to get app configuration in Public App.",i)})):(e.forEach(i=>parent.postMessage(r,i)),this.timer=setTimeout(()=>{this.outside=!0,this.options.outside?.()},100)),this.createEventListener()}createEventListener(){window.addEventListener("message",async t=>{let e=t.data;try{let r=JSON.parse(e);if(r.op==="register"){if(this.appId){console.error("App Id is already set...! Are you using hot-reload?");return}clearTimeout(this.timer),this.appId=r.data.appId,this.workspaceId=r.data.workspaceId,this.hostUrl=t.origin,this.options.publicBackendUrl||(this.options.publicBackendUrl=z[this.hostUrl]||f),this.client.request("v1.ui.settings",[],(i,s,a)=>{if(i){console.log("ui.settings error:",i,s);return}this.options.settings?.(s)}),this.client.request("v1.config",[],(i,s,a)=>{if(i){console.log("config error:",i,s);return}this.options.config?.(s)}),this.subscribedSignals&&this.client.request("v1.signals",[this.subscribedSignals],(i,s,a)=>{if(i){console.log("signals error:",i,s);return}s&&this.options.signals?.(s)}),this.outside=!1,this.options.connected?.();return}if(!this.appId)return;this.client.messageReceived(r)}catch{console.log("Dropped invalid JSON message")}})}info(){return{hostUrl:this.hostUrl,config:this.config,outside:this.outside,workspaceId:this.workspaceId}}async request(t,e){return await this.client.requestAsync(t,e)}};export{L as HailerApi,n as HailerError};
2
2
  //# sourceMappingURL=app-sdk.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../node_modules/@wishcore/wish-rpc/src/rpc-client.ts", "../node_modules/@wishcore/wish-rpc/src/rpc-server.ts", "../node_modules/@wishcore/wish-rpc/src/index.ts", "../src/hailer-api.ts", "../src/types.ts", "../src/modules/user.ts", "../src/modules/activity/kanban.ts", "../src/modules/activity.ts", "../src/modules/workspace.ts", "../src/modules/ui/activity.ts", "../src/modules/ui/snackbar.ts", "../src/modules/ui/files.ts", "../src/modules/ui.ts", "../src/modules/process.ts", "../src/constants.ts", "../src/modules/public/app.ts", "../src/modules/public/form.ts", "../src/modules/public/insight.ts", "../src/modules/public/product.ts", "../src/modules/public/product-version.ts", "../src/modules/public.ts", "../src/modules/workflow.ts", "../src/modules/app.ts", "../src/modules/insight.ts", "../src/modules/permission.ts", "../src/modules/product.ts", "../src/modules/product-version.ts", "../src/modules/product-installed.ts"],
4
- "sourcesContent": [null, null, null, "import { Client } from '@wishcore/wish-rpc';\nimport { UserApi } from './modules/user';\nimport { ActivityApi } from './modules/activity';\nimport { WorkspaceApi } from './modules/workspace';\nimport { HailerApiInfo, HailerAppConfig, HailerSettings, HailerSignal } from './types';\nimport { Ui } from './modules/ui';\nimport { Process } from './modules/process';\nimport { DEFAULT_ALLOWED_URLS, DEFAULT_API_VERSION, DEFAULT_BACKEND_URL, publicBackendMap } from './constants';\nimport { HailerPublicApi } from './modules/public';\nimport { WorkflowApi } from './modules/workflow';\nimport { AppApi } from './modules/app';\nimport { InsightApi } from './modules/insight';\nimport { PermissionApi } from './modules/permission';\nimport { ProductApi } from './modules/product';\nimport { ProductVersionApi } from './modules/product-version';\nimport { ProductInstalledApi } from './modules/product-installed';\n\nexport interface Options {\n /** When connected is called the host is ready to receive calls */\n connected?: () => void;\n /** Callback when app is determined to be outside of Hailer, as a standalone app */\n outside?: (config?: any) => void;\n /** Callback on errors, defaults to printing errors in console */\n error?: (error: Error) => void;\n /** Callback called on app init and when permissions have changed */\n permissions?: () => void;\n /** Callback called on app init and when settings have changed */\n settings?: (data: HailerSettings) => void;\n /** Callback called on app init and when config has changed */\n config?: (config: any) => void;\n /** Will be called each time a subscribed signal is emitted from Hailer frontend. To subscribe to signals, add them to options.subscribedSignals[] */\n signals?: (signal: HailerSignal) => void;\n /** Urls the sdk is allowed to connect to. Defaults to all Hailer instances*/\n allowedUrls?: string[];\n /**\n * Optional signal filter, passes all signals by default\n * \n * Example:\n * \n * subscribedSignals: ['activity.create', 'activity.update']\n */\n subscribedSignals?: string[];\n /** Api version to be used in the app by default */\n apiVersion?: 1;\n /** Public backend Api url. Defaults to https://api.hailer.com */\n publicBackendUrl?: string;\n}\n\nexport class HailerApi {\n public user: UserApi;\n public app: AppApi;\n public activity: ActivityApi;\n public insight: InsightApi;\n public workspace: WorkspaceApi;\n public process: Process;\n public workflow: WorkflowApi;\n public permission: PermissionApi;\n public product: ProductApi;\n public productVersion: ProductVersionApi;\n public productInstalled: ProductInstalledApi;\n /** All public endpoints, which can be accessed while not logged in to Hailer. */\n public public: HailerPublicApi;\n /** User interface commands */\n public ui: Ui;\n /** Url of the Hailer instance hosting the API */\n private hostUrl?: string;\n\n private appId?: string;\n /** If set it indicates that app is locked to a specific workspaceId */\n private workspaceId?: string;\n private client: Client;\n private apiVersion: 1;\n private settings?: HailerSettings;\n private config?: HailerAppConfig;\n private subscribedSignals?: string[];\n private timer?: NodeJS.Timeout;\n /**\n * Hailer API state\n * \n * ```\n * true // outside hailer\n * false // logged into hailer\n * null // state not yet detected\n * ``` \n */\n private outside: boolean | null = null;\n\n /**\n * Create a Hailer API client for inteacting with Hailer. **NOTE** This only works when inside Hailer.\n *\n * This should be run after window is initialized for example in ***onMount*** in Svelte or in ***useEffect*** in React\n */\n constructor(\n public options: Options = {}\n ) {\n const allowedUrls = options.allowedUrls ?? DEFAULT_ALLOWED_URLS;\n this.apiVersion = options.apiVersion ?? DEFAULT_API_VERSION;\n this.subscribedSignals = options.subscribedSignals || [];\n \n this.client = new Client(msg => {\n if (this.hostUrl){\n parent.postMessage(JSON.stringify(msg), this.hostUrl)\n }\n })\n\n this.user = new UserApi(this.client);\n this.app = new AppApi(this.client);\n this.activity = new ActivityApi(this.client);\n this.insight = new InsightApi(this.client);\n this.workspace = new WorkspaceApi(this.client);\n this.process = new Process(this.client);\n this.workflow = new WorkflowApi(this.client);\n this.permission = new PermissionApi(this.client);\n this.public = new HailerPublicApi(this.options);\n this.ui = new Ui(this.client);\n this.product = new ProductApi(this.client);\n this.productVersion = new ProductVersionApi(this.client);\n this.productInstalled = new ProductInstalledApi(this.client);\n\n const registerMessage = JSON.stringify({ op: 'register', args: [] });\n\n // If we are not in Iframe set location to outside, else wait 100ms for response to register to check if we are in Hailer\n if (window.location === window.parent.location) {\n // Pick a backend to use for public requests, unless it is set\n if (!this.options.publicBackendUrl) {\n this.options.publicBackendUrl = DEFAULT_BACKEND_URL;\n }\n\n this.public.app.config().then(config => {\n // CSM app assumes we are inside hailer when config is called... breaks the thing...\n // this.options.config?.(config);\n\n this.outside = true;\n this.options.outside?.(config);\n }).catch(error => {\n this.options.error?.(error);\n console.error('Failed to get app configuration in Public App.', error);\n });\n } else {\n // if in a frame, try register to Hailer by sending register to all allowed urls\n allowedUrls.forEach(url => parent.postMessage(registerMessage, url));\n this.timer = setTimeout(() => {\n this.outside = true;\n this.options.outside?.()\n }, 100);\n }\n\n this.createEventListener();\n }\n\n private createEventListener() {\n window.addEventListener('message', async event => {\n const data = event.data;\n\n try {\n const msg = JSON.parse(data);\n if (msg.op === 'register') {\n if (this.appId) {\n console.error('App Id is already set...! Are you using hot-reload?');\n return;\n }\n\n clearTimeout(this.timer);\n\n this.appId = msg.data.appId;\n this.workspaceId = msg.data.workspaceId;\n\n // Set host url now that we have a response\n this.hostUrl = event.origin;\n\n // Pick a backend to use for public requests, unless it is set\n if (!this.options.publicBackendUrl) {\n this.options.publicBackendUrl = publicBackendMap[this.hostUrl] || DEFAULT_BACKEND_URL;\n }\n\n // Register listeners for config and settings\n this.client.request('v1.ui.settings', [], (error: any, data: HailerSettings, end: boolean) => {\n if (error) {\n console.log('ui.settings error:', error, data);\n return;\n }\n\n this.options.settings?.(data);\n });\n\n this.client.request('v1.config', [], (error: any, data: any, end: boolean) => {\n if (error) {\n console.log('config error:', error, data);\n return;\n }\n this.options.config?.(data)\n })\n\n // Register subscribed signals\n if (this.subscribedSignals) {\n this.client.request('v1.signals', [this.subscribedSignals], (error: any, data: any, end: boolean) => {\n if (error) {\n console.log('signals error:', error, data);\n return;\n }\n\n if (data) {\n this.options.signals?.(data);\n }\n });\n }\n\n this.outside = false;\n // Call connected callback\n this.options.connected?.();\n return;\n }\n\n // bail out unless appId is set, as the app is not properly registered\n if (!this.appId) {\n return;\n }\n\n this.client.messageReceived(msg);\n } catch (error) {\n console.log('Dropped invalid JSON message');\n }\n });\n }\n\n info(): HailerApiInfo {\n return {\n hostUrl: this.hostUrl,\n config: this.config,\n outside: this.outside,\n workspaceId: this.workspaceId,\n }\n }\n\n // TODO: This is here for development and debugging, might be removed later\n async request(op: string, args: any[]) {\n return await this.client.requestAsync(op, args);\n }\n}\n", "export interface User {\n _id: string;\n firstname: string;\n lastname: string;\n email: string;\n lastSeen: number;\n status?: string;\n managedUser?: boolean;\n removed?: number;\n defaultProfilepic: string;\n}\n\n/* export interface Workspace {\n _id: string;\n name: string;\n members: string[];\n settings: {\n isolatedTeams?: boolean;\n defaultView: string;\n functionFieldVersion?: 1 | 2;\n color?: string;\n allowPublicCopy?: boolean;\n };\n license: object;\n invoicing?: any;\n propertyFields?: {\n [section: string]: {\n [field: string]: any;\n };\n };\n} */\nexport interface Workspace {\n _id: string;\n name: string;\n}\n\nexport interface Activity {\n _id: string;\n process: string;\n teamAccount: TeamAccount // TODO: Convert in frontend\n created: number;\n uid: string;\n cid: string;\n discussion: string;\n currentPhase: string;\n active?: boolean;\n history?: any[];\n name?: string;\n followers?: string[];\n completePhases?: string[];\n location?: {\n type: 'point' | 'area' | 'polyline',\n label: string | null\n data: {\n lat: number\n lng: number\n }[]\n };\n fields?: any;\n files?: any[];\n updated?: number;\n updatedBy?: string;\n priority?: number;\n sequence?: number\n}\n\nexport interface TeamAccount {\n account: string;\n team: string;\n}\n\nexport interface FormsData {\n files: string[];\n history: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n 0: {\n [fieldId: string]: {\n value: any;\n };\n };\n };\n name: string;\n location?: boolean;\n uid?: string;\n}\nexport interface FormsResponse {\n name: string;\n description?: string;\n enableUnlinkedMode: boolean;\n enableAttachments: boolean;\n enableMapLocation: boolean;\n locationRequired: 1;\n phases: {\n _id: string;\n followers: [];\n name: string;\n description: string;\n uid: string;\n created: number;\n fields: string[];\n announcementFields: [];\n announcementRecipients: [];\n announcementFieldsOrder: [];\n isEndpoint: boolean;\n }[];\n phasesOrder: string[];\n fields: {\n [id: string]: {\n data: [];\n label: string;\n required: boolean;\n type: string;\n inviteToDiscussionOnChange: boolean;\n _id: string;\n created: number;\n updated: number;\n uid: string;\n functionEnabled: boolean;\n };\n };\n enableMessenger: boolean;\n publicForm: {\n enableMessaging: boolean;\n };\n fieldsOrder: [];\n}\n\nexport interface FormCreateResponse {\n key: string,\n creator: string,\n followers: string,\n active: boolean,\n enableMessaging: boolean,\n allowRead: boolean\n}\n\nexport interface InsightResponse {\n insight: {\n name: string\n },\n data: InsightResponseData\n}\n\nexport interface InsightResponseData {\n headers: string[],\n rows: [],\n time: number\n}\n\nexport interface HailerAppConfig {\n fields?: {\n [fieldName: string]: {\n type: string;\n value?: string | number | boolean;\n };\n };\n}\n\nexport type HailerProcess = Workflow;\n\nexport interface Workflow {\n _id: string;\n cid: string;\n name: string;\n description?: string;\n fields: { [fieldId: string]: any };\n phases: { [phase_id: string]: WorkflowPhase };\n phasesOrder: string[];\n enablePredefinedName?: boolean;\n nameFunctionEnabled?: boolean;\n nameEditable?: boolean;\n productInstalledId: string;\n\n /*\n defaultView: 'table' | 'kanban' | 'map' | 'calendar';\n fields: { [fieldId: string]: any };\n fieldsOrder: string[];\n phasesRemoved: string[];\n members: any;\n updated: number;\n coverImage?: string;\n createNewLabel?: string;\n enableAddedField: boolean;\n enableLinkedAnnouncements?: boolean;\n enableMapLocation?: boolean;\n enableUnlinkedMode?: boolean;\n enableMessenger?: boolean;\n allowGuests?: boolean;\n enableGuestEditing?: boolean;\n enableModifiedField?: boolean;\n enableOwnerField?: boolean;\n enableOwnerTeamField?: boolean;\n ownerTeamFieldTitle?: string;\n enableUniqueName?: boolean;\n enablePreselectedTeam?: boolean;\n initPhaseDescription?: string;\n locationRequired?: boolean;\n nameColumnText?: string;\n nameFunction?: string;\n nameFunctionVariables?: any;\n personInCharge?: string;\n personInChargeLabel?: string;\n publicForm?: {\n key: string;\n active: boolean;\n creator: string;\n team_account: TeamAccount;\n followers: string;\n allowRead: boolean;\n enableMessaging?: boolean;\n }\n predefinedNamePrefix?: string;\n preselectedTeam?: TeamAccount;\n enableAttachments: boolean;\n nameFieldPlaceHolderText: string;\n order?: number;\n allowMultipleTags?: boolean;\n allowCustomTags?: boolean;\n requireFileTag?: boolean;\n documentTemplates?: any;\n color?: string;\n starred?: string[];\n isStarred?: boolean;\n createdActivities?: number;\n */\n}\n\nexport interface WorkflowPhase {\n _id: string;\n name: string;\n description?: string;\n fields?: string[];\n /*\n followers: string[];\n created: number;\n uid?: string;\n members?: any[]\n enableAnnouncement?: boolean,\n announcementFields?: string[];\n announcementRecipients?: string[];\n announcementFieldsOrder?: string[];\n announcementToOwner?: boolean;\n announcementToOwnerTeam?: boolean;\n isEndPoint?: boolean;\n possibleNextPhase?: string[];\n possibleNextPhaseSettings?: any;\n fieldOptions?: any;\n primaryNumericField?: string;\n webhooksEnabled?: boolean;\n webhookAdded?: boolean;\n webhookUpdated?: boolean;\n primaryDateField?: string | null | any;\n removed?: number;\n removedBy?: string;\n color?: string | null;\n */\n}\n\nexport type PermissionType = 'admin' | 'own' | 'ownteam' | 'any' | 'edit';\n\nexport interface Member {\n id: string;\n info: { [key: string]: string | number | boolean | null };\n permissions: PermissionType[];\n}\n\nexport interface InsightWorkflowSource {\n name: string;\n workflowId: string;\n fields: {\n name: string;\n fieldId?: string;\n /** Used for phaseLastMove meta */\n phaseId?: string;\n /** Activity information, like _id, created, phaseId etc. */\n meta?: string;\n }[];\n}\nexport interface InsightDoc {\n _id: string;\n name: string;\n sources: InsightWorkflowSource[];\n cid: string;\n /** User id of creator */\n uid: string;\n members: Member[];\n updated: number;\n public: boolean;\n /** Key for accessing Insight when set to public */\n publicKey?: string;\n /** sandboxed javascript with access to all activities in given workflows */\n function?: string;\n /** To be used with SQLite if we want to.... */\n query?: string;\n presets: {\n version: 1;\n name: string | 'default';\n options: any;\n }[];\n}\n\nexport type InsightPublic = Omit<InsightDoc, '_id'>;\n\n// These are separate so we can do different configs if necessary without it being a breaking change\nexport interface InsightData {\n headers: string[];\n rows: (string | number | null)[][];\n time: number;\n}\n\nexport interface InsightResponseAsObjectItem {\n [key: string]: any\n}\nexport type InsightResponseAsObjects = InsightResponseAsObjectItem[]\n\nexport interface KanbanListResponse {\n map: {\n [phaseId: string]: {\n activities: {\n _id: string,\n followers: string[],\n name: string,\n fields: { [key: string]: any }\n files: string[],\n primaryDateField: number,\n priority: number,\n }[]\n meta: {\n count: number,\n totalPrimaryNumericValue: number,\n primaryNumericFieldUnit: string | null\n }\n }\n }\n}\n\nexport interface KanbanLoadResponse {\n activity: {\n _id: string,\n followers: string[],\n name: string,\n fields: { [key: string]: any },\n files: string[],\n primaryDateField: number | null,\n priority: number,\n linkedFromCount: number\n },\n process: string,\n phase: string\n}\nexport interface ActivityListOptions {\n sortBy?: 'name' | 'created' | 'updated' | 'following' | 'owner' | 'team' | 'completedOn' | 'priority',\n sortOrder?: 'asc' | 'desc',\n limit?: number,\n skip?: number,\n includeUsers?: boolean,\n includeTeams?: boolean,\n includeHistory?: boolean\n filters?: any\n}\nexport interface ActivityCreateOptions {\n teamId?: string;\n fileIds?: string[];\n followerIds?: string[];\n location?: {\n label?: string;\n type: 'area' | 'point' | 'polyline';\n data: [{ lat: number, lng: number }];\n };\n discussionId?: string;\n phaseId?: string;\n returnDocument?: boolean;\n}\nexport interface ActivityKanbanListOptions {\n filter: {\n user?: {\n uid: string;\n field: string;\n },\n account?: string;\n team?: string;\n dates?: {\n field: string;\n start: number;\n end: number;\n };\n },\n search?: string;\n limit?: number;\n skip?: number;\n phase?: string;\n includeUsers?: boolean;\n includeTeams?: boolean;\n}\n\nexport interface HailerSettings {\n theme: 'light' | 'dark'\n preferredLanguages: string[];\n}\n\nexport interface HailerError {\n code: number,\n msg: string, \n debug: object\n}\n\nexport interface HailerApiInfo {\n /** Url of the Hailer instance hosting the API */\n hostUrl?: string;\n config?: HailerAppConfig;\n outside: boolean | null;\n workspaceId?: string;\n}\n\nexport class HailerError extends Error {\n public code: number\n public msg: string\n public debug: object\n constructor(error: {code: number, msg: string, debug: object}) {\n super()\n\n this.code = error.code\n this.msg = error.msg\n this.debug = error.debug\n \n Object.setPrototypeOf(this, HailerError.prototype);\n }\n}\n\nexport interface HailerSignal {\n sig: string;\n meta: any;\n}\n\nexport interface Product extends ProductType {\n _id: string;\n versionId: string;\n name: string;\n description?: string;\n icon?: string;\n images?: string[];\n externalUrl?: string;\n publisher?: string;\n /** Available or not in app store */\n public?: boolean;\n cid?: string;\n}\n\nexport interface ProductSearchOption {\n limit?: number,\n skip?: number,\n search?: string,\n reverse?: boolean,\n sortBy?: 'name' | 'created' | 'updated' | 'type',\n sortOrder?: 'asc' | 'desc'\n}\n\nexport interface ProductSearchFilter extends ProductType {\n public?: boolean,\n cid?: string,\n uid?: string,\n}\n\nexport interface ProductType {\n type?: 'app' | 'template' | 'document-template',\n}\n\nexport interface ProductVersion {\n _id: string;\n name: string;\n versions?: {\n version: string,\n description: string,\n packageHash: string,\n created: number;\n }[];\n cid?: string;\n}\n\nexport interface ProductInstalled {\n _id: string;\n productId: string;\n versionId: string;\n version: string;\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, User } from '../types';\n\nexport class UserApi {\n constructor(private client: Client) {}\n\n /** \n * Returns the specified user\n * \n * @param userId id of the Hailer user\n *\n * @returns Hailer user information\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(userId: string): Promise<User> {\n try {\n const res = await this.client.requestAsync('v1.user.get', [userId]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Returns the current user\n *\n * \n * @returns the current Hailer user information\n *\n * @throws {HailerError} if request is incorrect\n */\n async current(): Promise<User> {\n try {\n const res = await this.client.requestAsync('v1.user.current', []);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Lists all Hailer users from a workspace\n * \n * \n * @returns list of Hailer users in the workspace the app user is currently in\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<{ [key: string]: User }> {\n try {\n const users = await this.client.requestAsync('v1.user.list', []);\n return users;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { ActivityKanbanListOptions, HailerError, KanbanListResponse, KanbanLoadResponse } from '../../types';\n\nexport class Kanban {\n constructor(private client: Client) { }\n \n /** \n * Lists all activities in a kanban grouped by phases\n * \n * @param processId the id of the process the kanban relates to\n * @param options ActivityKanbanListOptions\n *\n * @returns activities in kanban list format\n *\n * @throws {HailerError} if request fails\n */\n async list(processId: string, options?: ActivityKanbanListOptions): Promise<KanbanListResponse> {\n try {\n const res = await this.client.requestAsync('v1.activity.kanban.list', [processId, ...options ? [options] : []]);\n return res;\n } catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Loads a single activity in kanban format\n * \n * @param activityId activityId of the wanted activity\n *\n * @returns activity in kanban format\n * \n * @throws {HailerError} if request is incorrect\n */\n async load(activityId: string): Promise<KanbanLoadResponse> {\n try {\n const res = await this.client.requestAsync('v1.activity.kanban.load', [activityId]);\n return res;\n } catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Updates priority of activities in kanban\n * \n * @param activityId activityId of the wanted activity\n * @param priority new priority for the activity\n *\n * @throws {HailerError} if request is incorrect\n */\n async updatePriority(activityId: string, priority: number): Promise<void> {\n try {\n const res = await this.client.requestAsync('v1.activity.kanban.updatePriority', [{activityId, priority}]);\n return res;\n } catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { ActivityCreateOptions, ActivityListOptions, Activity, HailerError } from '../types';\nimport { Kanban } from './activity/kanban';\n\nexport class ActivityApi {\n public kanban: Kanban\n constructor(private client: Client) {\n this.kanban = new Kanban(client)\n }\n\n /** \n * Lists all activities from the specified process and phase\n *\n * @param processId process from current network\n * @param phaseId phase in the process specified in processId\n * @param options ActivityListOptions\n *\n * @returns List of Hailer activities from process and phase filtered with supplied options\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(processId: string, phaseId: string, options?: ActivityListOptions): Promise<Activity[]> {\n try {\n const res = await this.client.requestAsync('v1.activity.list', [processId, phaseId, options]);\n return res.activities;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets single activity\n *\n * @param activityId activity Id of the process specified in processId\n * @param processId Process where the activityId is\n * @param phaseId Phase where the activityId is in process specified by processId\n * @param options options containing apiVersion\n *\n * @returns Hailer activity information or undefined if no activity is found\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(activityId: string): Promise<Activity | undefined> {\n try {\n // Uses the same endpoint as getAll but only returns the activity in question\n return await this.client.requestAsync('v1.activity.get', [activityId]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Creates activities\n * \n * @param processId The process where the activity is created\n * @param activities new activities as objects\n * @param activities.name name of the activity\n * @param activities.fields fields of the activity\n * @param options ActivityCreateOptions\n *\n * @throws {HailerError} if request is incorrect\n */\n async create(processId: string, activities: { name: string; fields?: { [id: string]: string | number } }[], options?: ActivityCreateOptions ): Promise<Activity[]> {\n try {\n const res = await this.client.requestAsync('v1.activity.create', [processId, activities, ...options ? [options] : []]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Updates activites\n *\n * Each activity has the following parameters \n * @param activities updated activity objects of an activity to edit\n * @param activities.name New name of the activity\n * @param activities.fields change values of fields, null removes current value\n * @param activities.phaseId New phase of the activity\n * @param options \n *\n * @returns The number of updated activities\n *\n * @throws {HailerError} if request is incorrect\n */\n async update(\n activities: { _id: string, name?: string, fields?: { [id: string]: string | number | null }, phaseId?: string }[],\n options: any\n ): Promise<number> {\n try {\n const res = await this.client.requestAsync('v1.activity.update', [activities, ...options ? [options] : []]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Removes activities\n *\n * @param activities Ids of activities to be removed\n * @param options options containing apiVersion\n *\n * @returns The number of removed activities\n *\n * @throws {HailerError} if request is incorrect\n */\n async remove(activities: string[]): Promise<number> {\n try {\n const res = await this.client.requestAsync('v1.activity.remove', [activities]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, Workspace } from '../types';\n\nexport class WorkspaceApi {\n constructor(private client: Client) {}\n\n /** \n * Returns the current network\n *\n * @returns the Hailer Workspace information the user is currently in\n *\n * @throws {HailerError} if request is incorrect\n */\n async current(): Promise<Workspace> {\n try {\n const res = await this.client.requestAsync('v1.workspace.current', []);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /**\n * Returns all workspaces for user if personal app\n * If not personal app it returns only the current workspace\n * @returns the Hailer Workspaces information for the user\n * \n * * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<Workspace[]> {\n try {\n const res = await this.client.requestAsync('v1.workspace.list', []);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\n\nexport type ActivityTabTypes =\n 'detail' |\n 'discussion' |\n 'files' |\n 'location' |\n 'linkedFrom' |\n 'options';\n\nexport class Activity {\n constructor(private client: Client) {}\n\n /** Opens an activity in Hailer sidebar */\n async open(\n /** Hailer Activity Id */\n activityId: string,\n options?: {\n /** Which tab to open in activity aside */\n tab?: ActivityTabTypes\n },\n ): Promise<void> {\n await this.client.requestAsync('v1.ui.activity.open', [activityId, ...options ? [options] : []]);\n }\n\n /** Opens activity creation view in Hailer sidebar */\n async create(\n processId: string,\n options?: {\n /** Activity name/title */\n name?: string,\n /** Prepopulate fields */\n fields?: {\n [fieldId: string]: number | string | { start: number, end: number },\n }\n }\n ): Promise<{ _id: string, name: string } | null> {\n return await this.client.requestAsync('v1.ui.activity.create', [processId, ...options ? [options] : []]);\n }\n\n /** Opens multiple activity edit view in Hailer sidebar */\n async editMultiple(\n activityIds: string[]\n ) {\n return await this.client.requestAsync('v1.ui.activity.editMultiple', [activityIds]);\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\n\nexport class Snackbar {\n constructor(private client: Client) {}\n\n /** \n * Opens a snackbar in Hailer\n * @param text the text displayed on the snackbar\n * @param buttonLabel the label for the button on the snackbar, for example 'OK'\n * @param duration the time the snackbar is visible in ms\n */\n async open(\n /** The text displayed on the snackbar */\n text: string,\n /** The label for the button on the snackbar, for example 'OK' */\n buttonLabel: string,\n /** The time the snackbar is visible in ms */\n duration?: number,\n ): Promise<void> {\n await this.client.requestAsync('v1.ui.snackbar.open', [text, buttonLabel, duration]);\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\n\nexport class Files {\n constructor(private client: Client) {}\n\n /**\n * Uploads a file to Hailer\n *\n * @param file file to be uploaded\n * @param publicFile is the file accessible outside of Hailer\n * @param options if file is public\n *\n * @returns File ID in Hailer as string\n */\n public async uploadFile(file: File, filename: string, options: { isPublic?: boolean }): Promise<string> {\n return await this.client.requestAsync('v1.ui.file.upload', [await this.toBase64(file), filename, !!options?.isPublic]);\n }\n\n private toBase64(file: File): Promise<string | ArrayBuffer> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.readAsDataURL(file);\n reader.onload = () => resolve(reader.result ?? '');\n reader.onerror = reject;\n });\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { Activity } from './ui/activity';\nimport { Snackbar } from './ui/snackbar';\nimport { Files } from './ui/files';\n\n\nexport class Ui {\n public activity;\n public snackbar;\n public files;\n public insight;\n\n constructor(private client: Client) {\n this.activity = new Activity(client);\n this.snackbar = new Snackbar(client);\n\n this.insight = {\n create: async (\n /** Defaults to App workspace */\n workspaceId?: string\n ): Promise<void> => {\n await client.requestAsync('v1.ui.insight.create', [workspaceId]);\n },\n edit: async (\n insightId: string\n ): Promise<void> => {\n await client.requestAsync('v1.ui.insight.edit', [insightId]);\n },\n delete: async (\n insightId: string\n ): Promise<void> => {\n await client.requestAsync('v1.ui.insight.delete', [insightId]);\n },\n permission: async (\n insightId: string\n ): Promise<void> => {\n await client.requestAsync('v1.ui.insight.permission', [insightId]);\n }\n };\n\n this.files = new Files(client);\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, HailerProcess } from '../types';\n\n/** @deprecated Use Workflow instead */\nexport class Process {\n constructor(private client: Client) {}\n \n /** \n * Lists all processes from a workspace\n *\n * @returns all Hailer processes in the workspace the app user is currently in \n *\n * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<{ [key: string]: HailerProcess }> {\n try {\n const processes = await this.client.requestAsync('v1.process.list', []);\n return processes;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets a single process from a workspace\n * \n * @param processId the id of the process in question\n * \n * @returns the specified Hailer process\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(processId: string): Promise<HailerProcess> {\n try {\n const process = await this.client.requestAsync('v1.process.get', [processId]);\n return process;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /**\n * Gets an id of a field in a process by its name\n *\n * @param processId the id of the process in question\n * @param fieldName name of the field\n *\n * @returns the field id as string\n *\n * @throws {HailerError} if request is incorrect\n */\n async getFieldIdByName(processId: string, fieldName: string): Promise<string> {\n try {\n return Object.values((await this.get(processId))?.fields || {}).find(\n (field) => field.label.toLowerCase() === fieldName\n )?._id;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n}\n", "// Changing this will be a breaking change\nexport const DEFAULT_API_VERSION = 1;\n\nexport const DEFAULT_ALLOWED_URLS = ['https://app.hailer.com', 'https://next.hailer.com', 'https://testapp.hailer.biz', 'https://app.hailer.biz', 'https://localhost:9443'];\n\nexport const DEFAULT_BACKEND_URL = 'https://api.hailer.com';\n\n/** Map of which backend to use depending on which frontend is hosting the app frame, be sure to fall back to production backend if no match */\nexport const publicBackendMap: { [host: string]: string } = {\n 'https://app.hailer.com': DEFAULT_BACKEND_URL,\n 'https://next.hailer.com': DEFAULT_BACKEND_URL,\n 'https://app.hailer.biz': 'https://api.hailer.biz',\n 'https://testapp.hailer.biz': 'https://testapi.hailer.biz',\n 'https://localhost:9443': 'http://localhost:1337',\n}\n", "import { Options } from '../../hailer-api';\nimport { HailerAppConfig } from '../../types';\n\nexport class App {\n constructor(private options: Options) {}\n\n /** \n * Read data from app API\n *\n * @param appId key of a specific insight\n *\n * @returns App manifest\n *\n * @throws {HailerError} if there is something wrong with the request or insight cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async config(): Promise<HailerAppConfig> {\n const manifestFile = 'manifest.json';\n const location = window.location.origin + window.location.pathname;\n let manifestUrl = location + manifestFile;\n\n if (location.endsWith('/index.html')) {\n manifestUrl = location.slice(0, -10) + manifestFile;\n }\n\n const manifestContent = await (await fetch(manifestUrl)).text();\n\n const manifest = JSON.parse(manifestContent);\n\n const appId = manifest.appId;\n\n const res = await fetch(this.options.publicBackendUrl + '/api/v3/app/public', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([appId])\n });\n\n return await res.json();\n }\n\n}\n", "import { Options } from '../../hailer-api';\nimport { FormCreateResponse, FormsData, FormsResponse, HailerError } from '../../types';\n\nexport class Form {\n constructor(private options: Options) {}\n\n /** \n * Read data from forms\n *\n * @param formsKey key of a form\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v2/forms\n *\n * @returns forms data as object or null if form could not be found\n *\n * @throws {HailerError} if there is something wrong with the request or form cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async data(formsKey: string): Promise<FormsResponse> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v2/forms/process/get', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([formsKey])\n });\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n\n /** \n * Submits form to specified process\n *\n * @param formsKey key of a form\n * @param formsData Data to be sent to form endpoint\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v2/forms\n *\n * @returns form creation data or null if form could not be created\n *\n * @throws {HailerError} if there is something wrong with the request or form cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async submit(formsKey: string, formsData: FormsData): Promise<FormCreateResponse> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v2/forms/activity/create', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([formsKey, formsData])\n });\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n}\n", "import { Options } from '../../hailer-api';\nimport { HailerError, InsightResponse, InsightResponseAsObjects, InsightResponseData } from '../../types';\n\nexport class InsightPublicApi {\n constructor(private options: Options) {}\n\n /** \n * Read data from insight API\n *\n * @param insightKey key of a specific insight\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v3/insight/public\n *\n * @returns Insight data as object\n *\n * @throws {HailerError} if there is something wrong with the request or insight cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async data(insightKey: string): Promise<InsightResponse> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v3/insight/public', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([insightKey])\n }\n );\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n\n /** \n * Read data from insight API and return in an array of JavaScript objects\n *\n * @param insightKey key of a specific insight\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v3/insight/public\n *\n * @returns Insight data as array of JavaScript objects\n *\n * @throws {HailerError} if there is something wrong with the request or insight cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async dataAsObject(insightKey: string): Promise<InsightResponseAsObjects> {\n const res = await this.data(insightKey);\n\n const input: InsightResponseData = res.data;\n const data: InsightResponseAsObjects = [];\n \n input.rows.forEach((row) => {\n // The object keys are constructed dynamically, so any is necessary\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const object: any = {};\n input.headers.forEach((header, headerIndex) => {\n object[header] = row[headerIndex];\n });\n data.push(object);\n });\n return data;\n }\n}\n", "import { Options } from '../../hailer-api';\nimport { HailerError, Product, ProductSearchFilter, ProductSearchOption, ProductType } from '../../types';\n\nexport class ProductPublicApi {\n constructor(private options: Options) {}\n\n /** \n * Lists products from Hailer market\n *\n * @param filter ProductSearchFilter\n * @param options ProductSearchOption\n *\n * @returns List of products in Hailer market filtered with supplied options\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(\n filter?: ProductSearchFilter, \n options?: ProductSearchOption): Promise<Product[]> {\n \n const res = await fetch(this.options.publicBackendUrl + '/api/v3/product/list', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([filter, options])\n });\n\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n\n /** \n * Gets single product from Hailer market\n *\n * @param id Product Id\n *\n * @returns Single product from Hailer market or undefined if no product found\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(id: string): Promise<Product | undefined> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v3/product/get', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([id])\n });\n\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n}\n", "import { Options } from '../../hailer-api';\nimport { HailerError, ProductVersion } from '../../types';\n\nexport class ProductVersionPublicApi {\n constructor(private options: Options) {}\n\n /** \n * Gets single version from Hailer market\n *\n * @param id Version Id\n *\n * @returns Single version from Hailer market or undefined if no version found\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(id: string): Promise<ProductVersion | undefined> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v3/productVersion/get', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([id])\n });\n\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n}\n", "import { Options } from '../hailer-api';\nimport { Product } from '../types';\nimport { App } from './public/app';\nimport { Form } from './public/form';\nimport { InsightPublicApi } from './public/insight';\nimport { ProductPublicApi } from './public/product';\nimport { ProductVersionPublicApi } from './public/product-version';\n\n/**\n * This class is used to access Hailer public API even when the app is outside of Hailer\n */\nexport class HailerPublicApi {\n /** Allows accessing public insight methods. Used for reading data from Hailer even when app is outside of Hailer */\n public insight: InsightPublicApi;\n /** Allows accessing public forms methods. Used for sending data to Hailer even when app is outside of Hailer */\n public form: Form;\n /** Access public App information */\n public app: App;\n /** Access public Product information */\n public product: ProductPublicApi;\n /** Access public Version information */\n public productVersion: ProductVersionPublicApi;\n\n constructor(options: Options) {\n this.insight = new InsightPublicApi(options);\n this.form = new Form(options);\n this.app = new App(options);\n this.product = new ProductPublicApi(options);\n this.productVersion = new ProductVersionPublicApi(options);\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, Workflow } from '../types';\n\nexport class WorkflowApi {\n constructor(private client: Client) {}\n \n /** \n * Lists all processes from a workspace\n *\n * @returns all Hailer processes in the workspace the app user is currently in \n *\n * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<Workflow[]> {\n try {\n const processes = await this.client.requestAsync('v1.workflow.list', []);\n return processes;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets a single process from a workspace\n * \n * @param processId the id of the process in question\n * \n * @returns the specified Hailer process\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(processId: string): Promise<Workflow> {\n try {\n const process = await this.client.requestAsync('v1.workflow.get', [processId]);\n return process;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerAppConfig, HailerError } from '../types';\n\n/**\n * This class is used to access Hailer public API even when the app is outside of Hailer\n */\nexport class AppApi {\n\n constructor(private client: Client) {\n }\n\n config = {\n update: async (appId: string | undefined, config: HailerAppConfig): Promise<void> => {\n try {\n return await this.client.requestAsync('v1.app.config.update', [appId, config]);\n } catch (error: any) {\n console.log('Errorasd ', error);\n throw new HailerError(error);\n }\n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, InsightData, InsightDoc } from '../types';\n\nexport class InsightApi {\n constructor(private client: Client) {}\n\n /** \n * Get Insight data \n * \n * @param insightId the id of the Insight the data is fetched from\n * \n * @returns data from the Insight\n *\n * @throws {HailerError} if request is incorrect\n */\n async data(insightId: string, options: { update?: true }): Promise<InsightData> {\n\n\n try {\n return await this.client.requestAsync('v1.insight.data', [insightId, ...options ? [options] : []]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get Insight data \n * \n * \n * @returns data from the Insight\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<InsightDoc[]> {\n try {\n return await this.client.requestAsync('v1.insight.list', []);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get Insight data \n * \n * \n * @returns data from the Insight\n *\n * @throws {HailerError} if request is incorrect\n */\n async update(insightId: string, update: Partial<InsightDoc>): Promise<InsightDoc[]> {\n try {\n return await this.client.requestAsync('v1.insight.update', [insightId, update]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n } \n}\n\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError } from '../types';\n\n/**\n * This class is used to access Hailer public API even when the app is outside of Hailer\n */\nexport class PermissionApi {\n\n constructor(private client: Client) {}\n\n map = async (): Promise<void> => {\n try {\n return await this.client.requestAsync('v1.permission.map', []);\n } catch (error: any) {\n console.log('Failed to read permissions from Hailer, error:', error);\n throw new HailerError(error);\n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, Product, ProductSearchOption, ProductSearchFilter } from '../types';\n\nexport class ProductApi {\n constructor(private client: Client) {}\n\n /** \n * Lists products from Hailer market\n *\n * @param filter ProductSearchFilter\n * @param options ProductSearchOption\n *\n * @returns List of products in Hailer market filtered with supplied options\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(\n filter?: ProductSearchFilter, \n options?: ProductSearchOption): Promise<Product[]> {\n try {\n const res = await this.client.requestAsync('v1.product.list', [filter, options]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets single product from Hailer market\n *\n * @param id Product Id\n *\n * @returns Single product from Hailer market or undefined if no product found\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(id: string): Promise<Product | undefined> {\n try {\n return await this.client.requestAsync('v1.product.get', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Creates product in Hailer market\n * \n * @param versionId link to version\n * @param name Name of the product\n * @param description Description what this product is doing\n * @param icon Icon id for the product\n * @param images List of fileIds for showing pictures of the product\n * @param externalUrl Public URL for creator to show more information about the product\n * @param publisher Publisher (author)\n * @param type App, template, music etc.\n * \n * @returns Created product in Hailer market\n *\n * @throws {HailerError} if request is incorrect\n */\n async create(\n product: {\n versionId: string,\n name: string,\n description?: string,\n icon?: string,\n images?: string[],\n externalUrl?: string,\n publisher?: string,\n type?: string\n }\n ): Promise<Product> {\n try {\n const result = await this.client.requestAsync('v1.product.create', [product]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Updates product in Hailer market\n *\n * @param id Id of product in Hailer market\n * @param name Name of the product\n * @param description Description what this product is doing\n * @param icon Icon id for the product\n * @param images List of fileIds for showing pictures of the product\n * @param externalUrl Public URL for creator to show more information about the product\n * @param publisher Publisher (Author)\n * @param public: Visible or not in Hailer market\n * @param type App, template, music etc.\n *\n * @returns Updated product in Hailer market\n *\n * @throws {HailerError} if request is incorrect\n */\n async update(\n id: string,\n product: {\n name?: string,\n description?: string,\n icon?: string,\n images?: string[],\n externalUrl?: string,\n publisher?: string,\n public?: boolean,\n type?: string\n }\n ): Promise<Product> {\n try {\n const result = await this.client.requestAsync('v1.product.update', [id, product]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Remove product from Hailer market\n *\n * @param id Id of product in Hailer market\n *\n * @returns true, if removed\n *\n * @throws {HailerError} if request is incorrect\n */\n async remove(id: string): Promise<boolean> {\n try {\n const result = await this.client.requestAsync('v1.product.remove', [id]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Install something from Hailer market\n *\n * @param id Id of product in Hailer market\n *\n * @returns true, if installed else error\n *\n * @throws {HailerError} if request is incorrect\n */\n async install(id: string): Promise<boolean> {\n try {\n const result = await this.client.requestAsync('v1.product.install', [id]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Set product as public or not (visible) in Hailer market\n *\n * @param id Id of product in Hailer market\n * @param isPublic Visible or not in Hailer market\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n async setPublic(\n id: string,\n isPublic: boolean\n ): Promise<boolean> {\n try {\n return await this.client.requestAsync('v1.product.setPublic', [id, isPublic]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, ProductVersion } from '../types';\n\nexport class ProductVersionApi {\n constructor(private client: Client) {}\n\n /** \n * Gets single version from Hailer market\n *\n * @param id Version Id\n *\n * @returns Single version from Hailer market or undefined if no version found\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(id: string): Promise<ProductVersion | undefined> {\n try {\n return await this.client.requestAsync('v1.productVersion.get', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Publish template in Hailer market\n * \n * @param workspaceId Id of workspace\n * @param versionId link to version (empty if first publish)\n * @param version Version number\n * @param versionDescription Version description\n * @param title\n * @param description\n * \n * @returns Created version in Hailer market\n *\n * @throws {HailerError} if request is incorrect\n */\n async publishTemplate(\n template: {\n workspaceId?: string,\n versionId?: string,\n version: string,\n versionDescription: string,\n title: string,\n description: string\n }\n ): Promise<ProductVersion> {\n try {\n const result = await this.client.requestAsync('v1.productVersion.publishTemplate', [template]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, ProductInstalled } from '../types';\n\nexport class ProductInstalledApi {\n constructor(private client: Client) {}\n\n /** \n * Lists products from Hailer market\n *\n * @param cid WorkspaceId\n * @param productId productId\n *\n * @returns List of installed products in Hailer market\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(\n productInstalled: {\n cid: string, \n productId: string\n }\n ): Promise<ProductInstalled[]> {\n try {\n const res = await this.client.requestAsync('v1.productInstalled.list', [productInstalled]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets installed product from Hailer market\n *\n * @param id Product Installed Id\n *\n * @returns Single installed product from Hailer market or undefined if no installed product found\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(id: string): Promise<ProductInstalled | undefined> {\n try {\n return await this.client.requestAsync('v1.productInstalled.get', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Remove installed product from Hailer market\n *\n * @param id Id of installed product in Hailer market\n *\n * @returns true, if removed\n *\n * @throws {HailerError} if request is incorrect\n */\n async remove(id: string): Promise<boolean> {\n try {\n const result = await this.client.requestAsync('v1.productInstalled.remove', [id]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n"],
5
- "mappings": "i7BAMA,IAAaA,EAAb,KAAmB,CAKf,YAAoBC,EAAuCC,EAAsB,CAA7D,KAAA,MAAAD,EAJZ,KAAA,SAAuB,CAAA,EACvB,KAAA,GAAK,EACL,KAAA,IAAM,MAGPC,GAAQA,EAAK,MACZ,KAAK,IAAMA,EAAK,IAExB,CAEA,SAAO,CACH,KAAK,SAAW,KAChB,KAAK,MAAQ,IACjB,CAEA,gBAAgBC,EAAG,CAEf,IAAMC,EAAM,CAAC,EAAED,EAAI,KAAOA,EAAI,KAAOA,EAAI,KAEnCE,EAAKF,EAAI,KAAOA,EAAI,KAAOA,EAAI,KAAOA,EAAI,IAE1CG,EAAU,KAAK,SAASD,CAAE,EAC5BE,EAEJ,GAAGD,GAAW,OAAOA,EAAQ,IAAO,WAAY,CAC5C,IAAIE,EACDL,EAAI,IAEHG,EAAQ,GAAG,KAAKA,EAAQ,QAAS,KAAM,KAAM,EAAI,EAE9CA,EAAQ,SACP,QAAQ,IAAI,qDAAqD,GAGjEE,EAAML,EAAI,IAAMA,EAAI,KAAO,KAC3BI,EAASD,EAAQ,GAAG,KAAKA,EAAQ,QAASE,EAAKL,EAAI,KAAMC,CAAG,GAKxE,OAAGA,GAEC,OAAO,KAAK,SAASC,CAAE,EAGpBE,CACX,CAEM,aAAaE,EAAYC,EA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AK,QAAQ,WAAWA,CAAI,CAChC,CAAC,EAED,KAAK,OAAO,QAAQ,YAAa,CAAC,EAAG,CAACH,EAAYG,EAAWE,IAAiB,CAC1E,GAAIL,EAAO,CACP,QAAQ,IAAI,gBAAiBA,EAAOG,CAAI,EACxC,MACJ,CACA,KAAK,QAAQ,SAASA,CAAI,CAC9B,CAAC,EAGG,KAAK,mBACL,KAAK,OAAO,QAAQ,aAAc,CAAC,KAAK,iBAAiB,EAAG,CAACH,EAAYG,EAAWE,IAAiB,CACjG,GAAIL,EAAO,CACP,QAAQ,IAAI,iBAAkBA,EAAOG,CAAI,EACzC,MACJ,CAEIA,GACA,KAAK,QAAQ,UAAUA,CAAI,CAEnC,CAAC,EAGL,KAAK,QAAU,GAEf,KAAK,QAAQ,YAAY,EACzB,MACJ,CAGA,GAAI,CAAC,KAAK,MACN,OAGJ,KAAK,OAAO,gBAAgBpB,CAAG,CACnC,MAAgB,CACZ,QAAQ,IAAI,8BAA8B,CAC9C,CACJ,CAAC,CACL,CAEA,MAAsB,CAClB,MAAO,CACH,QAAS,KAAK,QACd,OAAQ,KAAK,OACb,QAAS,KAAK,QACd,YAAa,KAAK,WACtB,CACJ,CAGA,MAAM,QAAQuB,EAAYC,EAAa,CACnC,OAAO,MAAM,KAAK,OAAO,aAAaD,EAAIC,CAAI,CAClD,CACJ",
6
- "names": ["Client", "write", "opts", "msg", "end", "id", "request", "retval", "err", "op", "args", "resolve", "reject", "data", "cb", "exports", "debug", "Server", "methods", "i", "j", "o", "path", "prefix", "ip", "e", "args", "context", "cb", "result", "copy", "s", "filter", "d", "clientId", "msg", "respond", "id", "err", "data", "op", "client", "send", "ctx", "reqCtx", "exports", "__exportStar", "exports", "import_wish_rpc", "HailerError", "_HailerError", "error", "UserApi", "client", "userId", "error", "HailerError", "Kanban", "client", "processId", "options", "error", "HailerError", "activityId", "priority", "ActivityApi", "client", "Kanban", "processId", "phaseId", "options", "error", "HailerError", "activityId", "activities", "WorkspaceApi", "client", "error", "HailerError", "Activity", "client", "activityId", "options", "processId", "activityIds", "Snackbar", "client", "text", "buttonLabel", "duration", "Files", "client", "file", "filename", "options", "resolve", "reject", "reader", "Ui", "client", "Activity", "Snackbar", "workspaceId", "insightId", "Files", "Process", "client", "error", "HailerError", "processId", "fieldName", "field", "DEFAULT_ALLOWED_URLS", "DEFAULT_BACKEND_URL", "publicBackendMap", "App", "options", "manifestFile", "location", "manifestUrl", "manifestContent", "appId", "Form", "options", "formsKey", "res", "HailerError", "formsData", "InsightPublicApi", "options", "insightKey", "res", "HailerError", "input", "data", "row", "object", "header", "headerIndex", "ProductPublicApi", "options", "filter", "res", "HailerError", "id", "ProductVersionPublicApi", "options", "id", "res", "HailerError", "HailerPublicApi", "options", "InsightPublicApi", "Form", "App", "ProductPublicApi", "ProductVersionPublicApi", "WorkflowApi", "client", "error", "HailerError", "processId", "AppApi", "client", "appId", "config", "error", "HailerError", "InsightApi", "client", "insightId", "options", "error", "HailerError", "update", "PermissionApi", "client", "error", "HailerError", "ProductApi", "client", "filter", "options", "error", "HailerError", "id", "product", "isPublic", "ProductVersionApi", "client", "id", "error", "HailerError", "template", "ProductInstalledApi", "client", "productInstalled", "error", "HailerError", "id", "HailerApi", "options", "allowedUrls", "DEFAULT_ALLOWED_URLS", "msg", "UserApi", "AppApi", "ActivityApi", "InsightApi", "WorkspaceApi", "Process", "WorkflowApi", "PermissionApi", "HailerPublicApi", "Ui", "ProductApi", "ProductVersionApi", "ProductInstalledApi", "registerMessage", "DEFAULT_BACKEND_URL", "config", "error", "url", "event", "data", "publicBackendMap", "end", "op", "args"]
3
+ "sources": ["../node_modules/@wishcore/wish-rpc/src/rpc-client.ts", "../node_modules/@wishcore/wish-rpc/src/rpc-server.ts", "../node_modules/@wishcore/wish-rpc/src/index.ts", "../src/hailer-api.ts", "../src/types.ts", "../src/modules/user.ts", "../src/modules/activity/kanban.ts", "../src/modules/activity.ts", "../src/modules/workspace.ts", "../src/modules/ui/activity.ts", "../src/modules/ui/snackbar.ts", "../src/modules/ui/files.ts", "../src/modules/ui.ts", "../src/modules/process.ts", "../src/constants.ts", "../src/modules/public/app.ts", "../src/modules/public/form.ts", "../src/modules/public/insight.ts", "../src/modules/public/product.ts", "../src/modules/public.ts", "../src/modules/workflow.ts", "../src/modules/app.ts", "../src/modules/insight.ts", "../src/modules/permission.ts", "../src/modules/product.ts"],
4
+ "sourcesContent": [null, null, null, "import { Client } from '@wishcore/wish-rpc';\nimport { UserApi } from './modules/user';\nimport { ActivityApi } from './modules/activity';\nimport { WorkspaceApi } from './modules/workspace';\nimport { HailerApiInfo, HailerAppConfig, HailerSettings, HailerSignal } from './types';\nimport { Ui } from './modules/ui';\nimport { Process } from './modules/process';\nimport { DEFAULT_ALLOWED_URLS, DEFAULT_API_VERSION, DEFAULT_BACKEND_URL, publicBackendMap } from './constants';\nimport { HailerPublicApi } from './modules/public';\nimport { WorkflowApi } from './modules/workflow';\nimport { AppApi } from './modules/app';\nimport { InsightApi } from './modules/insight';\nimport { PermissionApi } from './modules/permission';\nimport { ProductApi } from './modules/product';\n\nexport interface Options {\n /** When connected is called the host is ready to receive calls */\n connected?: () => void;\n /** Callback when app is determined to be outside of Hailer, as a standalone app */\n outside?: (config?: any) => void;\n /** Callback on errors, defaults to printing errors in console */\n error?: (error: Error) => void;\n /** Callback called on app init and when permissions have changed */\n permissions?: () => void;\n /** Callback called on app init and when settings have changed */\n settings?: (data: HailerSettings) => void;\n /** Callback called on app init and when config has changed */\n config?: (config: any) => void;\n /** Will be called each time a subscribed signal is emitted from Hailer frontend. To subscribe to signals, add them to options.subscribedSignals[] */\n signals?: (signal: HailerSignal) => void;\n /** Urls the sdk is allowed to connect to. Defaults to all Hailer instances*/\n allowedUrls?: string[];\n /**\n * Optional signal filter, passes all signals by default\n * \n * Example:\n * \n * subscribedSignals: ['activity.create', 'activity.update']\n */\n subscribedSignals?: string[];\n /** Api version to be used in the app by default */\n apiVersion?: 1;\n /** Public backend Api url. Defaults to https://api.hailer.com */\n publicBackendUrl?: string;\n}\n\nexport class HailerApi {\n public user: UserApi;\n public app: AppApi;\n public activity: ActivityApi;\n public insight: InsightApi;\n public workspace: WorkspaceApi;\n public process: Process;\n public workflow: WorkflowApi;\n public permission: PermissionApi;\n public product: ProductApi;\n /** All public endpoints, which can be accessed while not logged in to Hailer. */\n public public: HailerPublicApi;\n /** User interface commands */\n public ui: Ui;\n /** Url of the Hailer instance hosting the API */\n private hostUrl?: string;\n\n private appId?: string;\n /** If set it indicates that app is locked to a specific workspaceId */\n private workspaceId?: string;\n private client: Client;\n private apiVersion: 1;\n private settings?: HailerSettings;\n private config?: HailerAppConfig;\n private subscribedSignals?: string[];\n private timer?: NodeJS.Timeout;\n /**\n * Hailer API state\n * \n * ```\n * true // outside hailer\n * false // logged into hailer\n * null // state not yet detected\n * ``` \n */\n private outside: boolean | null = null;\n\n /**\n * Create a Hailer API client for inteacting with Hailer. **NOTE** This only works when inside Hailer.\n *\n * This should be run after window is initialized for example in ***onMount*** in Svelte or in ***useEffect*** in React\n */\n constructor(\n public options: Options = {}\n ) {\n const allowedUrls = options.allowedUrls ?? DEFAULT_ALLOWED_URLS;\n this.apiVersion = options.apiVersion ?? DEFAULT_API_VERSION;\n this.subscribedSignals = options.subscribedSignals || [];\n \n this.client = new Client(msg => {\n if (this.hostUrl){\n parent.postMessage(JSON.stringify(msg), this.hostUrl)\n }\n })\n\n this.user = new UserApi(this.client);\n this.app = new AppApi(this.client);\n this.activity = new ActivityApi(this.client);\n this.insight = new InsightApi(this.client);\n this.workspace = new WorkspaceApi(this.client);\n this.process = new Process(this.client);\n this.workflow = new WorkflowApi(this.client);\n this.permission = new PermissionApi(this.client);\n this.public = new HailerPublicApi(this.options);\n this.ui = new Ui(this.client);\n this.product = new ProductApi(this.client);\n\n const registerMessage = JSON.stringify({ op: 'register', args: [] });\n\n // If we are not in Iframe set location to outside, else wait 100ms for response to register to check if we are in Hailer\n if (window.location === window.parent.location) {\n // Pick a backend to use for public requests, unless it is set\n if (!this.options.publicBackendUrl) {\n this.options.publicBackendUrl = DEFAULT_BACKEND_URL;\n }\n\n this.public.app.config().then(config => {\n // CSM app assumes we are inside hailer when config is called... breaks the thing...\n // this.options.config?.(config);\n\n this.outside = true;\n this.options.outside?.(config);\n }).catch(error => {\n this.options.error?.(error);\n console.error('Failed to get app configuration in Public App.', error);\n });\n } else {\n // if in a frame, try register to Hailer by sending register to all allowed urls\n allowedUrls.forEach(url => parent.postMessage(registerMessage, url));\n this.timer = setTimeout(() => {\n this.outside = true;\n this.options.outside?.()\n }, 100);\n }\n\n this.createEventListener();\n }\n\n private createEventListener() {\n window.addEventListener('message', async event => {\n const data = event.data;\n\n try {\n const msg = JSON.parse(data);\n if (msg.op === 'register') {\n if (this.appId) {\n console.error('App Id is already set...! Are you using hot-reload?');\n return;\n }\n\n clearTimeout(this.timer);\n\n this.appId = msg.data.appId;\n this.workspaceId = msg.data.workspaceId;\n\n // Set host url now that we have a response\n this.hostUrl = event.origin;\n\n // Pick a backend to use for public requests, unless it is set\n if (!this.options.publicBackendUrl) {\n this.options.publicBackendUrl = publicBackendMap[this.hostUrl] || DEFAULT_BACKEND_URL;\n }\n\n // Register listeners for config and settings\n this.client.request('v1.ui.settings', [], (error: any, data: HailerSettings, end: boolean) => {\n if (error) {\n console.log('ui.settings error:', error, data);\n return;\n }\n\n this.options.settings?.(data);\n });\n\n this.client.request('v1.config', [], (error: any, data: any, end: boolean) => {\n if (error) {\n console.log('config error:', error, data);\n return;\n }\n this.options.config?.(data)\n })\n\n // Register subscribed signals\n if (this.subscribedSignals) {\n this.client.request('v1.signals', [this.subscribedSignals], (error: any, data: any, end: boolean) => {\n if (error) {\n console.log('signals error:', error, data);\n return;\n }\n\n if (data) {\n this.options.signals?.(data);\n }\n });\n }\n\n this.outside = false;\n // Call connected callback\n this.options.connected?.();\n return;\n }\n\n // bail out unless appId is set, as the app is not properly registered\n if (!this.appId) {\n return;\n }\n\n this.client.messageReceived(msg);\n } catch (error) {\n console.log('Dropped invalid JSON message');\n }\n });\n }\n\n info(): HailerApiInfo {\n return {\n hostUrl: this.hostUrl,\n config: this.config,\n outside: this.outside,\n workspaceId: this.workspaceId,\n }\n }\n\n // TODO: This is here for development and debugging, might be removed later\n async request(op: string, args: any[]) {\n return await this.client.requestAsync(op, args);\n }\n}\n", "export interface User {\n _id: string;\n firstname: string;\n lastname: string;\n email: string;\n lastSeen: number;\n status?: string;\n managedUser?: boolean;\n removed?: number;\n defaultProfilepic: string;\n}\n\n/* export interface Workspace {\n _id: string;\n name: string;\n members: string[];\n settings: {\n isolatedTeams?: boolean;\n defaultView: string;\n functionFieldVersion?: 1 | 2;\n color?: string;\n allowPublicCopy?: boolean;\n };\n license: object;\n invoicing?: any;\n propertyFields?: {\n [section: string]: {\n [field: string]: any;\n };\n };\n} */\nexport interface Workspace {\n _id: string;\n name: string;\n}\n\nexport interface Activity {\n _id: string;\n process: string;\n teamAccount: TeamAccount // TODO: Convert in frontend\n created: number;\n uid: string;\n cid: string;\n discussion: string;\n currentPhase: string;\n active?: boolean;\n history?: any[];\n name: string;\n followers?: string[];\n completePhases?: string[];\n location?: {\n type: 'point' | 'area' | 'polyline',\n label: string | null\n data: {\n lat: number\n lng: number\n }[]\n };\n fields?: any;\n files?: any[];\n updated?: number;\n updatedBy?: string;\n priority?: number;\n sequence?: number\n}\n\nexport interface TeamAccount {\n account: string;\n team: string;\n}\n\nexport interface FormsData {\n files: string[];\n history: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n 0: {\n [fieldId: string]: {\n value: any;\n };\n };\n };\n name: string;\n location?: boolean;\n uid?: string;\n}\nexport interface FormsResponse {\n name: string;\n description?: string;\n enableUnlinkedMode: boolean;\n enableAttachments: boolean;\n enableMapLocation: boolean;\n locationRequired: 1;\n phases: {\n _id: string;\n followers: [];\n name: string;\n description: string;\n uid: string;\n created: number;\n fields: string[];\n announcementFields: [];\n announcementRecipients: [];\n announcementFieldsOrder: [];\n isEndpoint: boolean;\n }[];\n phasesOrder: string[];\n fields: {\n [id: string]: {\n data: [];\n label: string;\n required: boolean;\n type: string;\n inviteToDiscussionOnChange: boolean;\n _id: string;\n created: number;\n updated: number;\n uid: string;\n functionEnabled: boolean;\n };\n };\n enableMessenger: boolean;\n publicForm: {\n enableMessaging: boolean;\n };\n fieldsOrder: [];\n}\n\nexport interface FormCreateResponse {\n key: string,\n creator: string,\n followers: string,\n active: boolean,\n enableMessaging: boolean,\n allowRead: boolean\n}\n\nexport interface InsightResponse {\n insight: {\n name: string\n },\n data: InsightResponseData\n}\n\nexport interface InsightResponseData {\n headers: string[],\n rows: [],\n time: number\n}\n\nexport interface HailerAppConfig {\n fields?: {\n [fieldName: string]: {\n type: string;\n value?: string | number | boolean;\n };\n };\n}\n\nexport type HailerProcess = Workflow;\n\nexport interface Workflow {\n _id: string;\n cid: string;\n name: string;\n description?: string;\n fields: { [fieldId: string]: any };\n phases: { [phase_id: string]: WorkflowPhase };\n phasesOrder: string[];\n enablePredefinedName?: boolean;\n nameFunctionEnabled?: boolean;\n nameEditable?: boolean;\n productInstalledId: string;\n\n /*\n defaultView: 'table' | 'kanban' | 'map' | 'calendar';\n fields: { [fieldId: string]: any };\n fieldsOrder: string[];\n phasesRemoved: string[];\n members: any;\n updated: number;\n coverImage?: string;\n createNewLabel?: string;\n enableAddedField: boolean;\n enableLinkedAnnouncements?: boolean;\n enableMapLocation?: boolean;\n enableUnlinkedMode?: boolean;\n enableMessenger?: boolean;\n allowGuests?: boolean;\n enableGuestEditing?: boolean;\n enableModifiedField?: boolean;\n enableOwnerField?: boolean;\n enableOwnerTeamField?: boolean;\n ownerTeamFieldTitle?: string;\n enableUniqueName?: boolean;\n enablePreselectedTeam?: boolean;\n initPhaseDescription?: string;\n locationRequired?: boolean;\n nameColumnText?: string;\n nameFunction?: string;\n nameFunctionVariables?: any;\n personInCharge?: string;\n personInChargeLabel?: string;\n publicForm?: {\n key: string;\n active: boolean;\n creator: string;\n team_account: TeamAccount;\n followers: string;\n allowRead: boolean;\n enableMessaging?: boolean;\n }\n predefinedNamePrefix?: string;\n preselectedTeam?: TeamAccount;\n enableAttachments: boolean;\n nameFieldPlaceHolderText: string;\n order?: number;\n allowMultipleTags?: boolean;\n allowCustomTags?: boolean;\n requireFileTag?: boolean;\n documentTemplates?: any;\n color?: string;\n starred?: string[];\n isStarred?: boolean;\n createdActivities?: number;\n */\n}\n\nexport interface WorkflowPhase {\n _id: string;\n name: string;\n description?: string;\n fields?: string[];\n /*\n followers: string[];\n created: number;\n uid?: string;\n members?: any[]\n enableAnnouncement?: boolean,\n announcementFields?: string[];\n announcementRecipients?: string[];\n announcementFieldsOrder?: string[];\n announcementToOwner?: boolean;\n announcementToOwnerTeam?: boolean;\n isEndPoint?: boolean;\n possibleNextPhase?: string[];\n possibleNextPhaseSettings?: any;\n fieldOptions?: any;\n primaryNumericField?: string;\n webhooksEnabled?: boolean;\n webhookAdded?: boolean;\n webhookUpdated?: boolean;\n primaryDateField?: string | null | any;\n removed?: number;\n removedBy?: string;\n color?: string | null;\n */\n}\n\nexport type PermissionType = 'admin' | 'own' | 'ownteam' | 'any' | 'edit';\n\nexport interface Member {\n id: string;\n info: { [key: string]: string | number | boolean | null };\n permissions: PermissionType[];\n}\n\nexport interface InsightWorkflowSource {\n name: string;\n workflowId: string;\n fields: {\n name: string;\n fieldId?: string;\n /** Used for phaseLastMove meta */\n phaseId?: string;\n /** Activity information, like _id, created, phaseId etc. */\n meta?: string;\n }[];\n}\nexport interface InsightDoc {\n _id: string;\n name: string;\n sources: InsightWorkflowSource[];\n cid: string;\n /** User id of creator */\n uid: string;\n members: Member[];\n updated: number;\n public: boolean;\n /** Key for accessing Insight when set to public */\n publicKey?: string;\n /** sandboxed javascript with access to all activities in given workflows */\n function?: string;\n /** To be used with SQLite if we want to.... */\n query?: string;\n presets: {\n version: 1;\n name: string | 'default';\n options: any;\n }[];\n}\n\nexport type InsightPublic = Omit<InsightDoc, '_id'>;\n\n// These are separate so we can do different configs if necessary without it being a breaking change\nexport interface InsightData {\n headers: string[];\n rows: (string | number | null)[][];\n time: number;\n}\n\nexport interface InsightResponseAsObjectItem {\n [key: string]: any\n}\nexport type InsightResponseAsObjects = InsightResponseAsObjectItem[]\n\nexport interface KanbanListResponse {\n map: {\n [phaseId: string]: {\n activities: {\n _id: string,\n followers: string[],\n name: string,\n fields: { [key: string]: any }\n files: string[],\n primaryDateField: number,\n priority: number,\n }[]\n meta: {\n count: number,\n totalPrimaryNumericValue: number,\n primaryNumericFieldUnit: string | null\n }\n }\n }\n}\n\nexport interface KanbanLoadResponse {\n activity: {\n _id: string,\n followers: string[],\n name: string,\n fields: { [key: string]: any },\n files: string[],\n primaryDateField: number | null,\n priority: number,\n linkedFromCount: number\n },\n process: string,\n phase: string\n}\nexport interface ActivityListOptions {\n sortBy?: 'name' | 'created' | 'updated' | 'following' | 'owner' | 'team' | 'completedOn' | 'priority',\n sortOrder?: 'asc' | 'desc',\n limit?: number,\n skip?: number,\n includeUsers?: boolean,\n includeTeams?: boolean,\n includeHistory?: boolean\n filters?: any\n}\nexport interface ActivityCreateOptions {\n teamId?: string;\n fileIds?: string[];\n followerIds?: string[];\n location?: {\n label?: string;\n type: 'area' | 'point' | 'polyline';\n data: [{ lat: number, lng: number }];\n };\n discussionId?: string;\n phaseId?: string;\n returnDocument?: boolean;\n}\nexport interface ActivityKanbanListOptions {\n filter: {\n user?: {\n uid: string;\n field: string;\n },\n account?: string;\n team?: string;\n dates?: {\n field: string;\n start: number;\n end: number;\n };\n },\n search?: string;\n limit?: number;\n skip?: number;\n phase?: string;\n includeUsers?: boolean;\n includeTeams?: boolean;\n}\n\nexport interface HailerSettings {\n theme: 'light' | 'dark'\n preferredLanguages: string[];\n}\n\nexport interface HailerError {\n code: number,\n msg: string, \n debug: object\n}\n\nexport interface HailerApiInfo {\n /** Url of the Hailer instance hosting the API */\n hostUrl?: string;\n config?: HailerAppConfig;\n outside: boolean | null;\n workspaceId?: string;\n}\n\nexport class HailerError extends Error {\n public code: number\n public msg: string\n public debug: object\n constructor(error: {code: number, msg: string, debug: object}) {\n super()\n\n this.code = error.code\n this.msg = error.msg\n this.debug = error.debug\n \n Object.setPrototypeOf(this, HailerError.prototype);\n }\n}\n\nexport interface HailerSignal {\n sig: string;\n meta: any;\n}\n\nexport interface Product extends ProductType {\n _id: string;\n targetId: string;\n name: string;\n description?: string;\n icon?: string;\n images?: string[];\n externalUrl?: string;\n publisher?: string;\n /** Available or not in app store */\n public?: boolean;\n cid?: string;\n uid: string;\n}\n\nexport interface ProductSearchOption {\n limit?: number,\n skip?: number,\n search?: string,\n reverse?: boolean,\n sortBy?: 'name' | 'created' | 'updated' | 'type',\n sortOrder?: 'asc' | 'desc'\n}\n\nexport interface ProductSearchFilter extends ProductType {\n public?: boolean,\n cid?: string,\n uid?: string,\n}\n\nexport interface ProductType {\n type?: 'app' | 'template' | 'document-template',\n}\n\nexport interface ProductVersion {\n _id: string;\n name: string;\n versions?: Version[];\n cid?: string;\n}\n\nexport interface Version {\n version: string;\n description: string;\n packageHash: string;\n created: number;\n}\n\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, User } from '../types';\n\nexport class UserApi {\n constructor(private client: Client) {}\n\n /** \n * Returns the specified user\n * \n * @param userId id of the Hailer user\n *\n * @returns Hailer user information\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(userId: string): Promise<User> {\n try {\n const res = await this.client.requestAsync('v1.user.get', [userId]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Returns the current user\n *\n * \n * @returns the current Hailer user information\n *\n * @throws {HailerError} if request is incorrect\n */\n async current(): Promise<User> {\n try {\n const res = await this.client.requestAsync('v1.user.current', []);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Lists all Hailer users from a workspace\n * \n * \n * @returns list of Hailer users in the workspace the app user is currently in\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<{ [key: string]: User }> {\n try {\n const users = await this.client.requestAsync('v1.user.list', []);\n return users;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { ActivityKanbanListOptions, HailerError, KanbanListResponse, KanbanLoadResponse } from '../../types';\n\nexport class Kanban {\n constructor(private client: Client) { }\n \n /** \n * Lists all activities in a kanban grouped by phases\n * \n * @param processId the id of the process the kanban relates to\n * @param options ActivityKanbanListOptions\n *\n * @returns activities in kanban list format\n *\n * @throws {HailerError} if request fails\n */\n async list(processId: string, options?: ActivityKanbanListOptions): Promise<KanbanListResponse> {\n try {\n const res = await this.client.requestAsync('v1.activity.kanban.list', [processId, ...options ? [options] : []]);\n return res;\n } catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Loads a single activity in kanban format\n * \n * @param activityId activityId of the wanted activity\n *\n * @returns activity in kanban format\n * \n * @throws {HailerError} if request is incorrect\n */\n async load(activityId: string): Promise<KanbanLoadResponse> {\n try {\n const res = await this.client.requestAsync('v1.activity.kanban.load', [activityId]);\n return res;\n } catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Updates priority of activities in kanban\n * \n * @param activityId activityId of the wanted activity\n * @param priority new priority for the activity\n *\n * @throws {HailerError} if request is incorrect\n */\n async updatePriority(activityId: string, priority: number): Promise<void> {\n try {\n const res = await this.client.requestAsync('v1.activity.kanban.updatePriority', [{activityId, priority}]);\n return res;\n } catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { ActivityCreateOptions, ActivityListOptions, Activity, HailerError } from '../types';\nimport { Kanban } from './activity/kanban';\n\nexport class ActivityApi {\n public kanban: Kanban\n constructor(private client: Client) {\n this.kanban = new Kanban(client)\n }\n\n /** \n * Lists all activities from the specified process and phase\n *\n * @param processId process from current network\n * @param phaseId phase in the process specified in processId\n * @param options ActivityListOptions\n *\n * @returns List of Hailer activities from process and phase filtered with supplied options\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(processId: string, phaseId: string, options?: ActivityListOptions): Promise<Activity[]> {\n try {\n const res = await this.client.requestAsync('v1.activity.list', [processId, phaseId, options]);\n return res.activities;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets single activity\n *\n * @param activityId activity Id of the process specified in processId\n * @param processId Process where the activityId is\n * @param phaseId Phase where the activityId is in process specified by processId\n * @param options options containing apiVersion\n *\n * @returns Hailer activity information or undefined if no activity is found\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(activityId: string): Promise<Activity | undefined> {\n try {\n // Uses the same endpoint as getAll but only returns the activity in question\n return await this.client.requestAsync('v1.activity.get', [activityId]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Creates activities\n * \n * @param processId The process where the activity is created\n * @param activities new activities as objects\n * @param activities.name name of the activity\n * @param activities.fields fields of the activity\n * @param options ActivityCreateOptions\n *\n * @throws {HailerError} if request is incorrect\n */\n async create(processId: string, activities: { name: string; fields?: { [id: string]: string | number } }[], options?: ActivityCreateOptions ): Promise<Activity[]> {\n try {\n const res = await this.client.requestAsync('v1.activity.create', [processId, activities, ...options ? [options] : []]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Updates activites\n *\n * Each activity has the following parameters \n * @param activities updated activity objects of an activity to edit\n * @param activities.name New name of the activity\n * @param activities.fields change values of fields, null removes current value\n * @param activities.phaseId New phase of the activity\n * @param options \n *\n * @returns The number of updated activities\n *\n * @throws {HailerError} if request is incorrect\n */\n async update(\n activities: { _id: string, name?: string, fields?: { [id: string]: string | number | null }, phaseId?: string }[],\n options: any\n ): Promise<number> {\n try {\n const res = await this.client.requestAsync('v1.activity.update', [activities, ...options ? [options] : []]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Removes activities\n *\n * @param activities Ids of activities to be removed\n * @param options options containing apiVersion\n *\n * @returns The number of removed activities\n *\n * @throws {HailerError} if request is incorrect\n */\n async remove(activities: string[]): Promise<number> {\n try {\n const res = await this.client.requestAsync('v1.activity.remove', [activities]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, ProductVersion, Workspace } from '../types';\n\nexport class WorkspaceApi {\n product: {\n /** Publish template in Hailer market */\n publishTemplate: (template: {\n workspaceId?: string,\n versionId?: string,\n version: string,\n versionDescription: string,\n title: string,\n description: string\n }) => Promise<ProductVersion>\n\n /** Check if product is installed */\n isProductInstalled(\n id: string\n ): Promise<boolean>\n\n /** Get version */\n get(\n id: string\n ): Promise<ProductVersion | undefined>\n\n /** Install template from Hailer market */\n install(id: string): Promise<boolean>\n\n /** Get manifest content from Hailer market */\n getManifest(id: string): Promise<any>\n };\n\n constructor(private client: Client) {\n this.product = {\n publishTemplate: this.publishTemplate.bind(this),\n isProductInstalled: this.isProductInstalled.bind(this),\n get: this.get.bind(this),\n install: this.install.bind(this),\n getManifest: this.getManifest.bind(this),\n };\n }\n\n /** \n * Returns the current network\n *\n * @returns the Hailer Workspace information the user is currently in\n *\n * @throws {HailerError} if request is incorrect\n */\n async current(): Promise<Workspace> {\n try {\n const res = await this.client.requestAsync('v1.workspace.current', []);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /**\n * Returns all workspaces for user if personal app\n * If not personal app it returns only the current workspace\n * @returns the Hailer Workspaces information for the user\n * \n * * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<Workspace[]> {\n try {\n const res = await this.client.requestAsync('v1.workspace.list', []);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n\n /** \n * Publish template in Hailer market\n * \n * @param workspaceId Id of workspace\n * @param versionId link to version (empty if first publish)\n * @param version Version number\n * @param versionDescription Version description\n * @param title\n * @param description\n * \n * @returns Created version in Hailer market\n *\n * @throws {HailerError} if request is incorrect\n */\n private async publishTemplate(\n template: {\n workspaceId?: string,\n versionId?: string,\n version: string,\n versionDescription: string,\n title: string,\n description: string\n }\n ): Promise<ProductVersion> {\n try {\n const result = await this.client.requestAsync('v1.workspace.product.publishTemplate', [template]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Check if product is installed\n *\n * @param id Id of product in Hailer market\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n private async isProductInstalled(\n id: string\n ): Promise<boolean> {\n try {\n return await this.client.requestAsync('v1.workspace.product.isProductInstalled', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get version\n *\n * @param id targetId\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n private async get(\n id: string\n ): Promise<ProductVersion | undefined> {\n try {\n return await this.client.requestAsync('v1.workspace.product.get', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Install template from Hailer market\n *\n * @param id Id of product in Hailer market\n *\n * @returns true, if installed else error\n *\n * @throws {HailerError} if request is incorrect\n */\n private async install(id: string): Promise<boolean> {\n try {\n const result = await this.client.requestAsync('v1.workspace.product.install', [id]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get manifest content from Hailer market\n *\n * @param id target Id\n *\n * @returns Manifest content\n *\n * @throws {HailerError} if request is incorrect\n */\n private async getManifest(id: string): Promise<any> {\n try {\n return await this.client.requestAsync('v1.workspace.product.getManifest', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\n\nexport type ActivityTabTypes =\n 'detail' |\n 'discussion' |\n 'files' |\n 'location' |\n 'linkedFrom' |\n 'options';\n\nexport class Activity {\n constructor(private client: Client) {}\n\n /** Opens an activity in Hailer sidebar */\n async open(\n /** Hailer Activity Id */\n activityId: string,\n options?: {\n /** Which tab to open in activity aside */\n tab?: ActivityTabTypes\n },\n ): Promise<void> {\n await this.client.requestAsync('v1.ui.activity.open', [activityId, ...options ? [options] : []]);\n }\n\n /** Opens activity creation view in Hailer sidebar */\n async create(\n processId: string,\n options?: {\n /** Activity name/title */\n name?: string,\n /** Prepopulate fields */\n fields?: {\n [fieldId: string]: number | string | { start: number, end: number },\n },\n location?: {\n type: 'area' | 'point' | 'polyline',\n data: { lng: number, lat: number }[],\n },\n }\n ): Promise<{ _id: string, name: string } | null> {\n return await this.client.requestAsync('v1.ui.activity.create', [processId, ...options ? [options] : []]);\n }\n\n /** Opens multiple activity edit view in Hailer sidebar */\n async editMultiple(\n activityIds: string[]\n ) {\n return await this.client.requestAsync('v1.ui.activity.editMultiple', [activityIds]);\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\n\nexport class Snackbar {\n constructor(private client: Client) {}\n\n /** \n * Opens a snackbar in Hailer\n * @param text the text displayed on the snackbar\n * @param buttonLabel the label for the button on the snackbar, for example 'OK'\n * @param duration the time the snackbar is visible in ms\n */\n async open(\n /** The text displayed on the snackbar */\n text: string,\n /** The label for the button on the snackbar, for example 'OK' */\n buttonLabel: string,\n /** The time the snackbar is visible in ms */\n duration?: number,\n ): Promise<void> {\n await this.client.requestAsync('v1.ui.snackbar.open', [text, buttonLabel, duration]);\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\n\nexport class Files {\n constructor(private client: Client) {}\n\n /**\n * Uploads a file to Hailer\n *\n * @param file file to be uploaded\n * @param publicFile is the file accessible outside of Hailer\n * @param options if file is public\n *\n * @returns File ID in Hailer as string\n */\n public async uploadFile(file: File, filename: string, options: { isPublic?: boolean }): Promise<string> {\n return await this.client.requestAsync('v1.ui.file.upload', [await this.toBase64(file), filename, !!options?.isPublic]);\n }\n\n private toBase64(file: File): Promise<string | ArrayBuffer> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.readAsDataURL(file);\n reader.onload = () => resolve(reader.result ?? '');\n reader.onerror = reject;\n });\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { Activity } from './ui/activity';\nimport { Snackbar } from './ui/snackbar';\nimport { Files } from './ui/files';\n\n\nexport class Ui {\n public activity;\n public snackbar;\n public files;\n public insight;\n\n constructor(private client: Client) {\n this.activity = new Activity(client);\n this.snackbar = new Snackbar(client);\n\n this.insight = {\n create: async (\n /** Defaults to App workspace */\n workspaceId?: string\n ): Promise<void> => {\n await client.requestAsync('v1.ui.insight.create', [workspaceId]);\n },\n edit: async (\n insightId: string\n ): Promise<void> => {\n await client.requestAsync('v1.ui.insight.edit', [insightId]);\n },\n delete: async (\n insightId: string\n ): Promise<void> => {\n await client.requestAsync('v1.ui.insight.delete', [insightId]);\n },\n permission: async (\n insightId: string\n ): Promise<void> => {\n await client.requestAsync('v1.ui.insight.permission', [insightId]);\n }\n };\n\n this.files = new Files(client);\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, HailerProcess } from '../types';\n\n/** @deprecated Use Workflow instead */\nexport class Process {\n constructor(private client: Client) {}\n \n /** \n * Lists all processes from a workspace\n *\n * @returns all Hailer processes in the workspace the app user is currently in \n *\n * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<{ [key: string]: HailerProcess }> {\n try {\n const processes = await this.client.requestAsync('v1.process.list', []);\n return processes;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets a single process from a workspace\n * \n * @param processId the id of the process in question\n * \n * @returns the specified Hailer process\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(processId: string): Promise<HailerProcess> {\n try {\n const process = await this.client.requestAsync('v1.process.get', [processId]);\n return process;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /**\n * Gets an id of a field in a process by its name\n *\n * @param processId the id of the process in question\n * @param fieldName name of the field\n *\n * @returns the field id as string\n *\n * @throws {HailerError} if request is incorrect\n */\n async getFieldIdByName(processId: string, fieldName: string): Promise<string> {\n try {\n return Object.values((await this.get(processId))?.fields || {}).find(\n (field) => field.label.toLowerCase() === fieldName\n )?._id;\n }\n catch (error: any) {\n throw new HailerError(error)\n }\n }\n}\n", "// Changing this will be a breaking change\nexport const DEFAULT_API_VERSION = 1;\n\nexport const DEFAULT_ALLOWED_URLS = ['https://app.hailer.com', 'https://next.hailer.com', 'https://testapp.hailer.biz', 'https://app.hailer.biz', 'https://localhost:9443'];\n\nexport const DEFAULT_BACKEND_URL = 'https://api.hailer.com';\n\n/** Map of which backend to use depending on which frontend is hosting the app frame, be sure to fall back to production backend if no match */\nexport const publicBackendMap: { [host: string]: string } = {\n 'https://app.hailer.com': DEFAULT_BACKEND_URL,\n 'https://next.hailer.com': DEFAULT_BACKEND_URL,\n 'https://app.hailer.biz': 'https://api.hailer.biz',\n 'https://testapp.hailer.biz': 'https://testapi.hailer.biz',\n 'https://localhost:9443': 'http://localhost:1337',\n}\n", "import { Options } from '../../hailer-api';\nimport { HailerAppConfig } from '../../types';\n\nexport class App {\n constructor(private options: Options) {}\n\n /** \n * Read data from app API\n *\n * @param appId key of a specific insight\n *\n * @returns App manifest\n *\n * @throws {HailerError} if there is something wrong with the request or insight cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async config(): Promise<HailerAppConfig> {\n const manifestFile = 'manifest.json';\n const location = window.location.origin + window.location.pathname;\n let manifestUrl = location + manifestFile;\n\n if (location.endsWith('/index.html')) {\n manifestUrl = location.slice(0, -10) + manifestFile;\n }\n\n const manifestContent = await (await fetch(manifestUrl)).text();\n\n const manifest = JSON.parse(manifestContent);\n\n const appId = manifest.appId;\n\n const res = await fetch(this.options.publicBackendUrl + '/api/v3/app/public', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([appId])\n });\n\n return await res.json();\n }\n\n}\n", "import { Options } from '../../hailer-api';\nimport { FormCreateResponse, FormsData, FormsResponse, HailerError } from '../../types';\n\nexport class Form {\n constructor(private options: Options) {}\n\n /** \n * Read data from forms\n *\n * @param formsKey key of a form\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v2/forms\n *\n * @returns forms data as object or null if form could not be found\n *\n * @throws {HailerError} if there is something wrong with the request or form cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async data(formsKey: string): Promise<FormsResponse> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v2/forms/process/get', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([formsKey])\n });\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n\n /** \n * Submits form to specified process\n *\n * @param formsKey key of a form\n * @param formsData Data to be sent to form endpoint\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v2/forms\n *\n * @returns form creation data or null if form could not be created\n *\n * @throws {HailerError} if there is something wrong with the request or form cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async submit(formsKey: string, formsData: FormsData): Promise<FormCreateResponse> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v2/forms/activity/create', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([formsKey, formsData])\n });\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n}\n", "import { Options } from '../../hailer-api';\nimport { HailerError, InsightResponse, InsightResponseAsObjects, InsightResponseData } from '../../types';\n\nexport class InsightPublicApi {\n constructor(private options: Options) {}\n\n /** \n * Read data from insight API\n *\n * @param insightKey key of a specific insight\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v3/insight/public\n *\n * @returns Insight data as object\n *\n * @throws {HailerError} if there is something wrong with the request or insight cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async data(insightKey: string): Promise<InsightResponse> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v3/insight/public', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([insightKey])\n }\n );\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n\n /** \n * Read data from insight API and return in an array of JavaScript objects\n *\n * @param insightKey key of a specific insight\n * @param options Overrides default request options, url defaults to https://api.hailer.com/api/v3/insight/public\n *\n * @returns Insight data as array of JavaScript objects\n *\n * @throws {HailerError} if there is something wrong with the request or insight cannot be found\n * @throws {TypeError} if Hailer cannot be reached\n */\n async dataAsObject(insightKey: string): Promise<InsightResponseAsObjects> {\n const res = await this.data(insightKey);\n\n const input: InsightResponseData = res.data;\n const data: InsightResponseAsObjects = [];\n \n input.rows.forEach((row) => {\n // The object keys are constructed dynamically, so any is necessary\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const object: any = {};\n input.headers.forEach((header, headerIndex) => {\n object[header] = row[headerIndex];\n });\n data.push(object);\n });\n return data;\n }\n}\n", "import { Options } from '../../hailer-api';\nimport { HailerError, Product, ProductSearchFilter, ProductSearchOption, ProductType } from '../../types';\n\nexport class ProductPublicApi {\n constructor(private options: Options) {}\n\n /** \n * Lists products from Hailer market\n *\n * @param filter ProductSearchFilter\n * @param options ProductSearchOption\n *\n * @returns List of products in Hailer market filtered with supplied options\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(\n filter?: ProductSearchFilter, \n options?: ProductSearchOption): Promise<Product[]> {\n \n const res = await fetch(this.options.publicBackendUrl + '/api/v3/product/list', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([filter, options])\n });\n\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n\n /** \n * Gets single product from Hailer market\n *\n * @param id Product Id\n *\n * @returns Single product from Hailer market or undefined if no product found\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(id: string): Promise<Product | undefined> {\n const res = await fetch(this.options.publicBackendUrl + '/api/v3/product/get', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify([id])\n });\n\n if (!res.ok) {\n throw new HailerError(await res.json())\n }\n return await res.json();\n }\n}\n", "import { Options } from '../hailer-api';\nimport { Product } from '../types';\nimport { App } from './public/app';\nimport { Form } from './public/form';\nimport { InsightPublicApi } from './public/insight';\nimport { ProductPublicApi } from './public/product';\n\n/**\n * This class is used to access Hailer public API even when the app is outside of Hailer\n */\nexport class HailerPublicApi {\n /** Allows accessing public insight methods. Used for reading data from Hailer even when app is outside of Hailer */\n public insight: InsightPublicApi;\n /** Allows accessing public forms methods. Used for sending data to Hailer even when app is outside of Hailer */\n public form: Form;\n /** Access public App information */\n public app: App;\n /** Access public Product information */\n public product: ProductPublicApi;\n\n constructor(options: Options) {\n this.insight = new InsightPublicApi(options);\n this.form = new Form(options);\n this.app = new App(options);\n this.product = new ProductPublicApi(options);\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, Workflow } from '../types';\n\nexport class WorkflowApi {\n constructor(private client: Client) {}\n \n /** \n * Lists all processes from a workspace\n *\n * @returns all Hailer processes in the workspace the app user is currently in \n *\n * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<Workflow[]> {\n try {\n const processes = await this.client.requestAsync('v1.workflow.list', []);\n return processes;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets a single process from a workspace\n * \n * @param processId the id of the process in question\n * \n * @returns the specified Hailer process\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(processId: string): Promise<Workflow> {\n try {\n const process = await this.client.requestAsync('v1.workflow.get', [processId]);\n return process;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerAppConfig, HailerError, ProductVersion, Version } from '../types';\n\n/**\n * This class is used to access Hailer public API even when the app is outside of Hailer\n */\nexport class AppApi {\n product: {\n /** Check if product is installed */\n isProductInstalled(\n id: string\n ): Promise<boolean>\n\n /** Get version */\n get(\n id: string\n ): Promise<ProductVersion | undefined>\n\n /** Install app from Hailer market */\n install(id: string): Promise<boolean>\n\n /** Get installed version */\n getInstalledVersion(id: string): Promise<Version>\n\n /** Get manifest content from Hailer market */\n getManifest(id: string): Promise<any>\n };\n\n constructor(private client: Client) {\n this.product = {\n isProductInstalled: this.isProductInstalled.bind(this),\n get: this.get.bind(this),\n install: this.install.bind(this),\n getInstalledVersion: this.getInstalledVersion.bind(this),\n getManifest: this.getManifest.bind(this),\n };\n }\n\n config = {\n update: async (appId: string | undefined, config: HailerAppConfig): Promise<void> => {\n try {\n return await this.client.requestAsync('v1.app.config.update', [appId, config]);\n } catch (error: any) {\n console.log('Errorasd ', error);\n throw new HailerError(error);\n }\n }\n }\n\n /** \n * Check if product is installed\n *\n * @param id Id of product in Hailer market\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n private async isProductInstalled(\n id: string\n ): Promise<boolean> {\n try {\n return await this.client.requestAsync('v1.app.product.isProductInstalled', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get version\n *\n * @param id targetId\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n private async get(\n id: string\n ): Promise<ProductVersion | undefined> {\n try {\n return await this.client.requestAsync('v1.app.product.get', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Install app from Hailer market\n *\n * @param id Id of product in Hailer market\n *\n * @returns true, if installed else error\n *\n * @throws {HailerError} if request is incorrect\n */\n private async install(id: string): Promise<boolean> {\n try {\n const result = await this.client.requestAsync('v1.app.product.install', [id]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get installed version from Hailer market\n *\n * @param id Id of product in Hailer market\n *\n * @returns true, if installed else error\n *\n * @throws {HailerError} if request is incorrect\n */\n private async getInstalledVersion(id: string): Promise<Version> {\n try {\n const result = await this.client.requestAsync('v1.app.product.getInstalledVersion', [id]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get manifest content from Hailer market\n *\n * @param id target Id\n *\n * @returns Manifest content\n *\n * @throws {HailerError} if request is incorrect\n */\n private async getManifest(id: string): Promise<any> {\n try {\n return await this.client.requestAsync('v1.app.product.getManifest', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, InsightData, InsightDoc } from '../types';\n\nexport class InsightApi {\n constructor(private client: Client) {}\n\n /** \n * Get Insight data \n * \n * @param insightId the id of the Insight the data is fetched from\n * \n * @returns data from the Insight\n *\n * @throws {HailerError} if request is incorrect\n */\n async data(insightId: string, options: { update?: true }): Promise<InsightData> {\n\n\n try {\n return await this.client.requestAsync('v1.insight.data', [insightId, ...options ? [options] : []]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get Insight data \n * \n * \n * @returns data from the Insight\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(): Promise<InsightDoc[]> {\n try {\n return await this.client.requestAsync('v1.insight.list', []);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Get Insight data \n * \n * \n * @returns data from the Insight\n *\n * @throws {HailerError} if request is incorrect\n */\n async update(insightId: string, update: Partial<InsightDoc>): Promise<InsightDoc[]> {\n try {\n return await this.client.requestAsync('v1.insight.update', [insightId, update]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n } \n}\n\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError } from '../types';\n\n/**\n * This class is used to access Hailer public API even when the app is outside of Hailer\n */\nexport class PermissionApi {\n\n constructor(private client: Client) {}\n\n map = async (): Promise<void> => {\n try {\n return await this.client.requestAsync('v1.permission.map', []);\n } catch (error: any) {\n console.log('Failed to read permissions from Hailer, error:', error);\n throw new HailerError(error);\n }\n }\n}\n", "import { Client } from '@wishcore/wish-rpc';\nimport { HailerError, Product, ProductSearchOption, ProductSearchFilter } from '../types';\n\nexport class ProductApi {\n constructor(private client: Client) {}\n\n /** \n * Lists products from Hailer market\n *\n * @param filter ProductSearchFilter\n * @param options ProductSearchOption\n *\n * @returns List of products in Hailer market filtered with supplied options\n *\n * @throws {HailerError} if request is incorrect\n */\n async list(\n filter?: ProductSearchFilter, \n options?: ProductSearchOption): Promise<Product[]> {\n try {\n const res = await this.client.requestAsync('v1.product.list', [filter, options]);\n return res;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Gets single product from Hailer market\n *\n * @param id Product Id\n *\n * @returns Single product from Hailer market or undefined if no product found\n *\n * @throws {HailerError} if request is incorrect\n */\n async get(id: string): Promise<Product | undefined> {\n try {\n return await this.client.requestAsync('v1.product.get', [id]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Creates product in Hailer market\n * \n * @param versionId link to version\n * @param name Name of the product\n * @param description Description what this product is doing\n * @param icon Icon id for the product\n * @param images List of fileIds for showing pictures of the product\n * @param externalUrl Public URL for creator to show more information about the product\n * @param publisher Publisher (author)\n * @param type App, template, music etc.\n * \n * @returns Created product in Hailer market\n *\n * @throws {HailerError} if request is incorrect\n */\n async create(\n product: {\n versionId: string,\n name: string,\n description?: string,\n icon?: string,\n images?: string[],\n externalUrl?: string,\n publisher?: string,\n type?: string\n }\n ): Promise<Product> {\n try {\n const result = await this.client.requestAsync('v1.product.create', [product]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Updates product in Hailer market\n *\n * @param id Id of product in Hailer market\n * @param name Name of the product\n * @param description Description what this product is doing\n * @param icon Icon id for the product\n * @param images List of fileIds for showing pictures of the product\n * @param externalUrl Public URL for creator to show more information about the product\n * @param publisher Publisher (Author)\n * @param public: Visible or not in Hailer market\n * @param type App, template, music etc.\n *\n * @returns Updated product in Hailer market\n *\n * @throws {HailerError} if request is incorrect\n */\n async update(\n id: string,\n product: {\n name?: string,\n description?: string,\n icon?: string,\n images?: string[],\n externalUrl?: string,\n publisher?: string,\n public?: boolean,\n type?: string\n }\n ): Promise<Product> {\n try {\n const result = await this.client.requestAsync('v1.product.update', [id, product]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Remove product from Hailer market\n *\n * @param id Id of product in Hailer market\n *\n * @returns true, if removed\n *\n * @throws {HailerError} if request is incorrect\n */\n async remove(id: string): Promise<boolean> {\n try {\n const result = await this.client.requestAsync('v1.product.remove', [id]);\n return result;\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n\n /** \n * Set product as public or not (visible) in Hailer market\n *\n * @param id Id of product in Hailer market\n * @param isPublic Visible or not in Hailer market\n *\n * @returns true if ok else false\n *\n * @throws {HailerError} if request is incorrect\n */\n async setPublic(\n id: string,\n isPublic: boolean\n ): Promise<boolean> {\n try {\n return await this.client.requestAsync('v1.product.setPublic', [id, isPublic]);\n }\n catch (error: any) {\n throw new HailerError(error) \n }\n }\n}\n"],
5
+ "mappings": "26BAMA,IAAaA,EAAb,KAAmB,CAKf,YAAoBC,EAAuCC,EAAsB,CAA7D,KAAA,MAAAD,EAJZ,KAAA,SAAuB,CAAA,EACvB,KAAA,GAAK,EACL,KAAA,IAAM,MAGPC,GAAQA,EAAK,MACZ,KAAK,IAAMA,EAAK,IAExB,CAEA,SAAO,CACH,KAAK,SAAW,KAChB,KAAK,MAAQ,IACjB,CAEA,gBAAgBC,EAAG,CAEf,IAAMC,EAAM,CAAC,EAAED,EAAI,KAAOA,EAAI,KAAOA,EAAI,KAEnCE,EAAKF,EAAI,KAAOA,EAAI,KAAOA,EAAI,KAAOA,EAAI,IAE1CG,EAAU,KAAK,SAASD,CAAE,EAC5BE,EAEJ,GAAGD,GAAW,OAAOA,EAAQ,IAAO,WAAY,CAC5C,IAAIE,EACDL,EAAI,IAEHG,EAAQ,GAAG,KAAKA,EAAQ,QAAS,KAAM,KAAM,EAAI,EAE9CA,EAAQ,SACP,QAAQ,IAAI,qDAAqD,GAGjEE,EAAML,EAAI,IAAMA,EAAI,KAAO,KAC3BI,EAASD,EAAQ,GAAG,KAAKA,EAAQ,QAASE,EAAKL,EAAI,KAAMC,CAAG,GAKxE,OAAGA,GAEC,OAAO,KAAK,SAASC,CAAE,EAGpBE,CACX,CAEM,aAAaE,EAAYC,EAAW,0CACtC,OAAO,IAAI,QAAQ,CAACC,EAASC,IAAU,CACnC,KAAK,QAAQH,EAAIC,EAAM,C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", "debug", "Server", "methods", "i", "j", "o", "path", "prefix", "ip", "e", "args", "context", "cb", "result", "copy", "s", "filter", "d", "clientId", "msg", "respond", "id", "err", "data", "op", "client", "send", "ctx", "reqCtx", "exports", "__exportStar", "exports", "import_wish_rpc", "HailerError", "_HailerError", "error", "UserApi", "client", "userId", "error", "HailerError", "Kanban", "client", "processId", "options", "error", "HailerError", "activityId", "priority", "ActivityApi", "client", "Kanban", "processId", "phaseId", "options", "error", "HailerError", "activityId", "activities", "WorkspaceApi", "client", "error", "HailerError", "template", "id", "Activity", "client", "activityId", "options", "processId", "activityIds", "Snackbar", "client", "text", "buttonLabel", "duration", "Files", "client", "file", "filename", "options", "resolve", "reject", "reader", "Ui", "client", "Activity", "Snackbar", "workspaceId", "insightId", "Files", "Process", "client", "error", "HailerError", "processId", "fieldName", "field", "DEFAULT_ALLOWED_URLS", "DEFAULT_BACKEND_URL", "publicBackendMap", "App", "options", "manifestFile", "location", "manifestUrl", "manifestContent", "appId", "Form", "options", "formsKey", "res", "HailerError", "formsData", "InsightPublicApi", "options", "insightKey", "res", "HailerError", "input", "data", "row", "object", "header", "headerIndex", "ProductPublicApi", "options", "filter", "res", "HailerError", "id", "HailerPublicApi", "options", "InsightPublicApi", "Form", "App", "ProductPublicApi", "WorkflowApi", "client", "error", "HailerError", "processId", "AppApi", "client", "appId", "config", "error", "HailerError", "id", "InsightApi", "client", "insightId", "options", "error", "HailerError", "update", "PermissionApi", "client", "error", "HailerError", "ProductApi", "client", "filter", "options", "error", "HailerError", "id", "product", "isPublic", "HailerApi", "options", "allowedUrls", "DEFAULT_ALLOWED_URLS", "msg", "UserApi", "AppApi", "ActivityApi", "InsightApi", "WorkspaceApi", "Process", "WorkflowApi", "PermissionApi", "HailerPublicApi", "Ui", "ProductApi", "registerMessage", "DEFAULT_BACKEND_URL", "config", "error", "url", "event", "data", "publicBackendMap", "end", "op", "args"]
7
7
  }
@@ -10,8 +10,6 @@ import { AppApi } from './modules/app';
10
10
  import { InsightApi } from './modules/insight';
11
11
  import { PermissionApi } from './modules/permission';
12
12
  import { ProductApi } from './modules/product';
13
- import { ProductVersionApi } from './modules/product-version';
14
- import { ProductInstalledApi } from './modules/product-installed';
15
13
  export interface Options {
16
14
  /** When connected is called the host is ready to receive calls */
17
15
  connected?: () => void;
@@ -53,8 +51,6 @@ export declare class HailerApi {
53
51
  workflow: WorkflowApi;
54
52
  permission: PermissionApi;
55
53
  product: ProductApi;
56
- productVersion: ProductVersionApi;
57
- productInstalled: ProductInstalledApi;
58
54
  /** All public endpoints, which can be accessed while not logged in to Hailer. */
59
55
  public: HailerPublicApi;
60
56
  /** User interface commands */
@@ -1,12 +1,74 @@
1
1
  import { Client } from '@wishcore/wish-rpc';
2
- import { HailerAppConfig } from '../types';
2
+ import { HailerAppConfig, ProductVersion, Version } from '../types';
3
3
  /**
4
4
  * This class is used to access Hailer public API even when the app is outside of Hailer
5
5
  */
6
6
  export declare class AppApi {
7
7
  private client;
8
+ product: {
9
+ /** Check if product is installed */
10
+ isProductInstalled(id: string): Promise<boolean>;
11
+ /** Get version */
12
+ get(id: string): Promise<ProductVersion | undefined>;
13
+ /** Install app from Hailer market */
14
+ install(id: string): Promise<boolean>;
15
+ /** Get installed version */
16
+ getInstalledVersion(id: string): Promise<Version>;
17
+ /** Get manifest content from Hailer market */
18
+ getManifest(id: string): Promise<any>;
19
+ };
8
20
  constructor(client: Client);
9
21
  config: {
10
22
  update: (appId: string | undefined, config: HailerAppConfig) => Promise<void>;
11
23
  };
24
+ /**
25
+ * Check if product is installed
26
+ *
27
+ * @param id Id of product in Hailer market
28
+ *
29
+ * @returns true if ok else false
30
+ *
31
+ * @throws {HailerError} if request is incorrect
32
+ */
33
+ private isProductInstalled;
34
+ /**
35
+ * Get version
36
+ *
37
+ * @param id targetId
38
+ *
39
+ * @returns true if ok else false
40
+ *
41
+ * @throws {HailerError} if request is incorrect
42
+ */
43
+ private get;
44
+ /**
45
+ * Install app from Hailer market
46
+ *
47
+ * @param id Id of product in Hailer market
48
+ *
49
+ * @returns true, if installed else error
50
+ *
51
+ * @throws {HailerError} if request is incorrect
52
+ */
53
+ private install;
54
+ /**
55
+ * Get installed version from Hailer market
56
+ *
57
+ * @param id Id of product in Hailer market
58
+ *
59
+ * @returns true, if installed else error
60
+ *
61
+ * @throws {HailerError} if request is incorrect
62
+ */
63
+ private getInstalledVersion;
64
+ /**
65
+ * Get manifest content from Hailer market
66
+ *
67
+ * @param id target Id
68
+ *
69
+ * @returns Manifest content
70
+ *
71
+ * @throws {HailerError} if request is incorrect
72
+ */
73
+ private getManifest;
12
74
  }
@@ -87,16 +87,6 @@ export declare class ProductApi {
87
87
  * @throws {HailerError} if request is incorrect
88
88
  */
89
89
  remove(id: string): Promise<boolean>;
90
- /**
91
- * Install something from Hailer market
92
- *
93
- * @param id Id of product in Hailer market
94
- *
95
- * @returns true, if installed else error
96
- *
97
- * @throws {HailerError} if request is incorrect
98
- */
99
- install(id: string): Promise<boolean>;
100
90
  /**
101
91
  * Set product as public or not (visible) in Hailer market
102
92
  *
@@ -3,7 +3,6 @@ import { App } from './public/app';
3
3
  import { Form } from './public/form';
4
4
  import { InsightPublicApi } from './public/insight';
5
5
  import { ProductPublicApi } from './public/product';
6
- import { ProductVersionPublicApi } from './public/product-version';
7
6
  /**
8
7
  * This class is used to access Hailer public API even when the app is outside of Hailer
9
8
  */
@@ -16,7 +15,5 @@ export declare class HailerPublicApi {
16
15
  app: App;
17
16
  /** Access public Product information */
18
17
  product: ProductPublicApi;
19
- /** Access public Version information */
20
- productVersion: ProductVersionPublicApi;
21
18
  constructor(options: Options);
22
19
  }
@@ -21,6 +21,13 @@ export declare class Activity {
21
21
  end: number;
22
22
  };
23
23
  };
24
+ location?: {
25
+ type: 'area' | 'point' | 'polyline';
26
+ data: {
27
+ lng: number;
28
+ lat: number;
29
+ }[];
30
+ };
24
31
  }): Promise<{
25
32
  _id: string;
26
33
  name: string;
@@ -1,7 +1,26 @@
1
1
  import { Client } from '@wishcore/wish-rpc';
2
- import { Workspace } from '../types';
2
+ import { ProductVersion, Workspace } from '../types';
3
3
  export declare class WorkspaceApi {
4
4
  private client;
5
+ product: {
6
+ /** Publish template in Hailer market */
7
+ publishTemplate: (template: {
8
+ workspaceId?: string;
9
+ versionId?: string;
10
+ version: string;
11
+ versionDescription: string;
12
+ title: string;
13
+ description: string;
14
+ }) => Promise<ProductVersion>;
15
+ /** Check if product is installed */
16
+ isProductInstalled(id: string): Promise<boolean>;
17
+ /** Get version */
18
+ get(id: string): Promise<ProductVersion | undefined>;
19
+ /** Install template from Hailer market */
20
+ install(id: string): Promise<boolean>;
21
+ /** Get manifest content from Hailer market */
22
+ getManifest(id: string): Promise<any>;
23
+ };
5
24
  constructor(client: Client);
6
25
  /**
7
26
  * Returns the current network
@@ -19,4 +38,59 @@ export declare class WorkspaceApi {
19
38
  * * @throws {HailerError} if request is incorrect
20
39
  */
21
40
  list(): Promise<Workspace[]>;
41
+ /**
42
+ * Publish template in Hailer market
43
+ *
44
+ * @param workspaceId Id of workspace
45
+ * @param versionId link to version (empty if first publish)
46
+ * @param version Version number
47
+ * @param versionDescription Version description
48
+ * @param title
49
+ * @param description
50
+ *
51
+ * @returns Created version in Hailer market
52
+ *
53
+ * @throws {HailerError} if request is incorrect
54
+ */
55
+ private publishTemplate;
56
+ /**
57
+ * Check if product is installed
58
+ *
59
+ * @param id Id of product in Hailer market
60
+ *
61
+ * @returns true if ok else false
62
+ *
63
+ * @throws {HailerError} if request is incorrect
64
+ */
65
+ private isProductInstalled;
66
+ /**
67
+ * Get version
68
+ *
69
+ * @param id targetId
70
+ *
71
+ * @returns true if ok else false
72
+ *
73
+ * @throws {HailerError} if request is incorrect
74
+ */
75
+ private get;
76
+ /**
77
+ * Install template from Hailer market
78
+ *
79
+ * @param id Id of product in Hailer market
80
+ *
81
+ * @returns true, if installed else error
82
+ *
83
+ * @throws {HailerError} if request is incorrect
84
+ */
85
+ private install;
86
+ /**
87
+ * Get manifest content from Hailer market
88
+ *
89
+ * @param id target Id
90
+ *
91
+ * @returns Manifest content
92
+ *
93
+ * @throws {HailerError} if request is incorrect
94
+ */
95
+ private getManifest;
22
96
  }
@@ -175,10 +175,10 @@ if (!process.env.EMAIL && !process.env.LOCAL) {
175
175
  try {
176
176
  response = JSON.parse(body);
177
177
  // Market code
178
- if (response.manifest && response.manifest.versionId) {
179
- infoMarket = 'Note! Use versionId in public/manifest.json file when creating the product in market!';
180
- // Write versionId to manifest.json
181
- manifest.versionId = response.manifest.versionId;
178
+ if (response.manifest && response.manifest.targetId) {
179
+ infoMarket = 'Note! Use targetId in public/manifest.json file when creating the product in market!';
180
+ // Write targetId to manifest.json
181
+ manifest.targetId = response.manifest.targetId;
182
182
  // Convert the modified object back to JSON
183
183
  const updatedManifestContent = JSON.stringify(manifest, null, 2);
184
184
  // Write the updated JSON content back to manifest.json
package/lib/types.d.ts CHANGED
@@ -24,7 +24,7 @@ export interface Activity {
24
24
  currentPhase: string;
25
25
  active?: boolean;
26
26
  history?: any[];
27
- name?: string;
27
+ name: string;
28
28
  followers?: string[];
29
29
  completePhases?: string[];
30
30
  location?: {
@@ -320,7 +320,7 @@ export interface HailerSignal {
320
320
  }
321
321
  export interface Product extends ProductType {
322
322
  _id: string;
323
- versionId: string;
323
+ targetId: string;
324
324
  name: string;
325
325
  description?: string;
326
326
  icon?: string;
@@ -330,6 +330,7 @@ export interface Product extends ProductType {
330
330
  /** Available or not in app store */
331
331
  public?: boolean;
332
332
  cid?: string;
333
+ uid: string;
333
334
  }
334
335
  export interface ProductSearchOption {
335
336
  limit?: number;
@@ -350,17 +351,12 @@ export interface ProductType {
350
351
  export interface ProductVersion {
351
352
  _id: string;
352
353
  name: string;
353
- versions?: {
354
- version: string;
355
- description: string;
356
- packageHash: string;
357
- created: number;
358
- }[];
354
+ versions?: Version[];
359
355
  cid?: string;
360
356
  }
361
- export interface ProductInstalled {
362
- _id: string;
363
- productId: string;
364
- versionId: string;
357
+ export interface Version {
365
358
  version: string;
359
+ description: string;
360
+ packageHash: string;
361
+ created: number;
366
362
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hailer/app-sdk",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "SDK for building Hailer Apps",
5
5
  "author": "",
6
6
  "license": "ISC",