🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@chili-publish/publisher-interface

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chili-publish/publisher-interface - npm Package Compare versions

Comparing version

to
0.3.2

2

dist/chiliInternalWrapper.min.js

@@ -1,2 +0,2 @@

(()=>{var e,t,r,n,o;!function(e){e.Call="call",e.Reply="reply",e.Syn="syn",e.SynAck="synAck",e.Ack="ack"}(e||(e={})),function(e){e.Fulfilled="fulfilled",e.Rejected="rejected"}(t||(t={})),function(e){e.ConnectionDestroyed="ConnectionDestroyed",e.ConnectionTimeout="ConnectionTimeout",e.NoIframeSrc="NoIframeSrc"}(r||(r={})),function(e){e.DataCloneError="DataCloneError"}(n||(n={})),function(e){e.Message="message"}(o||(o={}));var i=(e,t)=>{const r=[];let n=!1;return{destroy(o){n||(n=!0,t(`${e}: Destroying connection`),r.forEach((e=>{e(o)})))},onDestroy(e){n?e():r.push(e)}}},c=e=>(...t)=>{e&&console.log("[Penpal]",...t)};const a=({name:e,message:t,stack:r})=>({name:e,message:t,stack:r});var s=(r,i,c)=>{const{localName:s,local:d,remote:u,originForSending:l,originForReceiving:g}=r;let w=!1;const S=r=>{if(r.source!==u||r.data.penpal!==e.Call)return;if("*"!==g&&r.origin!==g)return void c(`${s} received message from origin ${r.origin} which did not match expected origin ${g}`);const o=r.data,{methodName:d,args:S,id:h}=o;c(`${s}: Received ${d}() call`);const m=r=>o=>{if(c(`${s}: Sending ${d}() reply`),w)return void c(`${s}: Unable to send ${d}() reply due to destroyed connection`);const i={penpal:e.Reply,id:h,resolution:r,returnValue:o};r===t.Rejected&&o instanceof Error&&(i.returnValue=a(o),i.returnValueIsError=!0);try{u.postMessage(i,l)}catch(r){if(r.name===n.DataCloneError){const n={penpal:e.Reply,id:h,resolution:t.Rejected,returnValue:a(r),returnValueIsError:!0};u.postMessage(n,l)}throw r}};new Promise((e=>e(i[d].apply(i,S)))).then(m(t.Fulfilled),m(t.Rejected))};return d.addEventListener(o.Message,S),()=>{w=!0,d.removeEventListener(o.Message,S)}};let d=0;const u=e=>e?e.split("."):[],l=(e,t,r)=>{const n=u(t);return n.reduce(((e,t,o)=>(void 0===e[t]&&(e[t]={}),o===n.length-1&&(e[t]=r),e[t])),e),e},g=(e,t)=>{const r={};return Object.keys(e).forEach((n=>{const o=e[n],i=((e,t)=>{const r=u(t||"");return r.push(e),(e=>e.join("."))(r)})(n,t);"object"==typeof o&&Object.assign(r,g(o,i)),"function"==typeof o&&(r[i]=o)})),r};var w=(n,i,c,a,s)=>{const{localName:u,local:g,remote:w,originForSending:S,originForReceiving:h}=i;let m=!1;s(`${u}: Connecting call sender`);const y=n=>(...i)=>{let c;s(`${u}: Sending ${n}() call`);try{w.closed&&(c=!0)}catch(e){c=!0}if(c&&a(),m){const e=new Error(`Unable to send ${n}() call due to destroyed connection`);throw e.code=r.ConnectionDestroyed,e}return new Promise(((r,c)=>{const a=++d,l=i=>{if(i.source!==w||i.data.penpal!==e.Reply||i.data.id!==a)return;if("*"!==h&&i.origin!==h)return void s(`${u} received message from origin ${i.origin} which did not match expected origin ${h}`);const d=i.data;s(`${u}: Received ${n}() reply`),g.removeEventListener(o.Message,l);let S=d.returnValue;d.returnValueIsError&&(S=(e=>{const t=new Error;return Object.keys(e).forEach((r=>t[r]=e[r])),t})(S)),(d.resolution===t.Fulfilled?r:c)(S)};g.addEventListener(o.Message,l);const m={penpal:e.Call,id:a,methodName:n,args:i};w.postMessage(m,S)}))},p=c.reduce(((e,t)=>(e[t]=y(t),e)),{});return Object.assign(n,(e=>{const t={};for(const r in e)l(t,r,e[r]);return t})(p)),()=>{m=!0}};var S=(e,t)=>{let n;return void 0!==e&&(n=window.setTimeout((()=>{const n=new Error(`Connection timed out after ${e}ms`);n.code=r.ConnectionTimeout,t(n)}),e)),()=>{clearTimeout(n)}};var h=(t={})=>{const{parentOrigin:r="*",methods:n={},timeout:a,debug:d=!1}=t,u=c(d),l=i("Child",u),{destroy:h,onDestroy:m}=l,y=g(n),p=((t,r,n,o)=>{const{destroy:i,onDestroy:c}=n;return n=>{if(!(t instanceof RegExp?t.test(n.origin):"*"===t||t===n.origin))return void o(`Child: Handshake - Received SYN-ACK from origin ${n.origin} which did not match expected origin ${t}`);o("Child: Handshake - Received SYN-ACK, responding with ACK");const a="null"===n.origin?"*":n.origin,d={penpal:e.Ack,methodNames:Object.keys(r)};window.parent.postMessage(d,a);const u={localName:"Child",local:window,remote:window.parent,originForSending:a,originForReceiving:n.origin},l=s(u,r,o);c(l);const g={},S=w(g,u,n.data.methodNames,i,o);return c(S),g}})(r,y,l,u);return{promise:new Promise(((t,n)=>{const i=S(a,h),c=r=>{if((()=>{try{clearTimeout()}catch(e){return!1}return!0})()&&r.source===parent&&r.data&&r.data.penpal===e.SynAck){const e=p(r);e&&(window.removeEventListener(o.Message,c),i(),t(e))}};window.addEventListener(o.Message,c),(()=>{u("Child: Handshake - Sending SYN");const t={penpal:e.Syn},n=r instanceof RegExp?"*":r;window.parent.postMessage(t,n)})(),m((e=>{window.removeEventListener(o.Message,c),e&&n(e)}))})),destroy(){h()}}};let m;function y(e){return{isOk:!0,isError:!1,ok:e,error:void 0}}function p(e){return{isOk:!1,isError:!0,ok:void 0,error:e}}!function(e){e[e.error=0]="error",e[e.ok=1]="ok"}(m||(m={}));const v=setInterval((()=>{null!=window.editorObject&&null!=window.OnEditorEvent&&b()}),500);let j;const b=()=>{clearInterval(v),j=h({methods:{alert:f,getDirtyState:O,nextPage:E,previousPage:C,setSelectedPage:k,getSelectedPage:A,getSelectedPageName:$,getNumPages:P,removeListener:F,addListener:R,setProperty:I,getObject:N,executeFunction:L,getPageSnapshot:M,getFrameSnapshot:D,getFrameSubjectArea:x,setFrameSubjectArea:G,clearFrameSubjectArea:V,getAssetSubjectInfo:T,setAssetSubjectInfo:H,clearAssetSubjectInfo:K,setVariableIsLocked:Y}}),window.OnEditorEvent=(e,t)=>{j.promise.then((r=>{r.handleEvents(e,t)}))}},f=(e,t)=>{try{return window.editorObject.Alert(e,t),y(void 0)}catch(e){return p(e.toString())}},O=()=>{try{return y(window.editorObject.GetDirtyState())}catch(e){return p(e.toString())}},E=()=>{try{return window.editorObject.NextPage(),y(void 0)}catch(e){return p(e.toString())}},C=()=>{try{return window.editorObject.PreviousPage(),y(void 0)}catch(e){return p(e.toString())}},k=e=>{try{return window.editorObject.SetSelectedPage(e),y(void 0)}catch(e){return p(e.toString())}},A=()=>{try{return y(window.editorObject.GetSelectedPage())}catch(e){return p(e.toString())}},$=()=>{try{return y(window.editorObject.GetSelectedPageName())}catch(e){return p(e.toString())}},P=()=>{try{return y(window.editorObject.GetNumPages())}catch(e){return p(e.toString())}},F=e=>{try{return window.editorObject.RemoveListener(e),y(void 0)}catch(e){return p(e.toString())}},R=e=>{try{return window.editorObject.AddListener(e),y(void 0)}catch(e){return p(e.toString())}},N=e=>{try{return y(window.editorObject.GetObject(e))}catch(e){return p(e.toString())}},I=(e,t,r)=>{try{return window.editorObject.SetProperty(e,t,r),y(void 0)}catch(e){return p(e.toString())}},L=(e,t,r)=>{try{return y(window.editorObject.ExecuteFunction(e,t,...r))}catch(e){return p(e.toString())}},M=(e,t,r,n,o,i)=>{try{return y(window.editorObject.GetPageSnapshot(e,t,r,n,o,i))}catch(e){return p(e.toString())}},D=(e,t,r)=>{try{return y(window.editorObject.GetFrameSnapshot(e,t,r))}catch(e){return p(e.toString())}},x=e=>{try{return y(window.editorObject.GetFrameSubjectArea(e))}catch(e){return p(e.toString())}},G=(e,t,r,n,o)=>{try{return window.editorObject.SetFrameSubjectArea(e,t,r,n,o),y(void 0)}catch(e){return p(e.toString())}},V=e=>{try{return window.editorObject.ClearFrameSubjectArea(e),y(void 0)}catch(e){return p(e.toString())}},T=e=>{try{return y(window.editorObject.GetAssetSubjectInfo(e))}catch(e){return p(e.toString())}},H=(e,t,r,n,o,i,c)=>{try{return window.editorObject.SetAssetSubjectInfo(e,t,r,n,o,i,c),y(void 0)}catch(e){return p(e.toString())}},K=e=>{try{return window.editorObject.ClearAssetSubjectInfo(e),y(void 0)}catch(e){return p(e.toString())}},Y=(e,t)=>{try{return window.editorObject.SetVariableIsLocked(e,t),y(void 0)}catch(e){return p(e.toString())}}})();
(()=>{var e,t,r,n,o,i,c,a;(t=e||(e={})).Call="call",t.Reply="reply",t.Syn="syn",t.SynAck="synAck",t.Ack="ack",(n=r||(r={})).Fulfilled="fulfilled",n.Rejected="rejected",(i=o||(o={})).ConnectionDestroyed="ConnectionDestroyed",i.ConnectionTimeout="ConnectionTimeout",i.NoIframeSrc="NoIframeSrc",(c||(c={})).DataCloneError="DataCloneError",(a||(a={})).Message="message";var s=(e,t)=>{const r=[];let n=!1;return{destroy(o){n||(n=!0,t(`${e}: Destroying connection`),r.forEach((e=>{e(o)})))},onDestroy(e){n?e():r.push(e)}}},d=e=>(...t)=>{e&&console.log("[Penpal]",...t)};const u=({name:e,message:t,stack:r})=>({name:e,message:t,stack:r}),l=e=>{const t=new Error;return Object.keys(e).forEach((r=>t[r]=e[r])),t};var g=(t,n,o)=>{const{localName:i,local:s,remote:d,originForSending:l,originForReceiving:g}=t;let w=!1;const S=t=>{if(t.source!==d||t.data.penpal!==e.Call)return;if("*"!==g&&t.origin!==g)return void o(`${i} received message from origin ${t.origin} which did not match expected origin ${g}`);const a=t.data,{methodName:s,args:S,id:h}=a;o(`${i}: Received ${s}() call`);const m=t=>n=>{if(o(`${i}: Sending ${s}() reply`),w)return void o(`${i}: Unable to send ${s}() reply due to destroyed connection`);const a={penpal:e.Reply,id:h,resolution:t,returnValue:n};t===r.Rejected&&n instanceof Error&&(a.returnValue=u(n),a.returnValueIsError=!0);try{d.postMessage(a,l)}catch(t){if(t.name===c.DataCloneError){const n={penpal:e.Reply,id:h,resolution:r.Rejected,returnValue:u(t),returnValueIsError:!0};d.postMessage(n,l)}throw t}};new Promise((e=>e(n[s].apply(n,S)))).then(m(r.Fulfilled),m(r.Rejected))};return s.addEventListener(a.Message,S),()=>{w=!0,s.removeEventListener(a.Message,S)}};let w=0;const S=e=>e?e.split("."):[],h=(e,t,r)=>{const n=S(t);return n.reduce(((e,t,o)=>(void 0===e[t]&&(e[t]={}),o===n.length-1&&(e[t]=r),e[t])),e),e},m=(e,t)=>{const r={};return Object.keys(e).forEach((n=>{const o=e[n],i=((e,t)=>{const r=S(t||"");return r.push(e),(e=>e.join("."))(r)})(n,t);"object"==typeof o&&Object.assign(r,m(o,i)),"function"==typeof o&&(r[i]=o)})),r},y=e=>{const t={};for(const r in e)h(t,r,e[r]);return t};var p=(t,n,i,c,s)=>{const{localName:d,local:u,remote:g,originForSending:S,originForReceiving:h}=n;let m=!1;s(`${d}: Connecting call sender`);const p=t=>(...n)=>{let i;s(`${d}: Sending ${t}() call`);try{g.closed&&(i=!0)}catch(e){i=!0}if(i&&c(),m){const e=new Error(`Unable to send ${t}() call due to destroyed connection`);throw e.code=o.ConnectionDestroyed,e}return new Promise(((o,i)=>{const c=++w,m=n=>{if(n.source!==g||n.data.penpal!==e.Reply||n.data.id!==c)return;if("*"!==h&&n.origin!==h)return void s(`${d} received message from origin ${n.origin} which did not match expected origin ${h}`);const w=n.data;s(`${d}: Received ${t}() reply`),u.removeEventListener(a.Message,m);let S=w.returnValue;w.returnValueIsError&&(S=l(S)),(w.resolution===r.Fulfilled?o:i)(S)};u.addEventListener(a.Message,m);const y={penpal:e.Call,id:c,methodName:t,args:n};g.postMessage(y,S)}))},v=i.reduce(((e,t)=>(e[t]=p(t),e)),{});return Object.assign(t,y(v)),()=>{m=!0}};var v=(e,t)=>{let r;return void 0!==e&&(r=window.setTimeout((()=>{const r=new Error(`Connection timed out after ${e}ms`);r.code=o.ConnectionTimeout,t(r)}),e)),()=>{clearTimeout(r)}},j=(t,r,n,o)=>{const{destroy:i,onDestroy:c}=n;return n=>{if(!(t instanceof RegExp?t.test(n.origin):"*"===t||t===n.origin))return void o(`Child: Handshake - Received SYN-ACK from origin ${n.origin} which did not match expected origin ${t}`);o("Child: Handshake - Received SYN-ACK, responding with ACK");const a="null"===n.origin?"*":n.origin,s={penpal:e.Ack,methodNames:Object.keys(r)};window.parent.postMessage(s,a);const d={localName:"Child",local:window,remote:window.parent,originForSending:a,originForReceiving:n.origin},u=g(d,r,o);c(u);const l={},w=p(l,d,n.data.methodNames,i,o);return c(w),l}};var b,f,O=(t={})=>{const{parentOrigin:r="*",methods:n={},timeout:o,debug:i=!1}=t,c=d(i),u=s("Child",c),{destroy:l,onDestroy:g}=u,w=m(n),S=j(r,w,u,c);return{promise:new Promise(((t,n)=>{const i=v(o,l),s=r=>{if((()=>{try{clearTimeout()}catch(e){return!1}return!0})()&&r.source===parent&&r.data&&r.data.penpal===e.SynAck){const e=S(r);e&&(window.removeEventListener(a.Message,s),i(),t(e))}};window.addEventListener(a.Message,s),(()=>{c("Child: Handshake - Sending SYN");const t={penpal:e.Syn},n=r instanceof RegExp?"*":r;window.parent.postMessage(t,n)})(),g((e=>{window.removeEventListener(a.Message,s),e&&n(e)}))})),destroy(){l()}}};function E(e){return{isOk:!0,isError:!1,ok:e,error:void 0}}function C(e){return{isOk:!1,isError:!0,ok:void 0,error:e}}(f=b||(b={}))[f.error=0]="error",f[f.ok=1]="ok";const k=setInterval((()=>{null!=window.editorObject&&null!=window.OnEditorEvent&&$()}),500);let A;const $=()=>{clearInterval(k),A=O({methods:{alert:P,getDirtyState:F,nextPage:R,previousPage:N,setSelectedPage:I,getSelectedPage:L,getSelectedPageName:M,getNumPages:D,removeListener:x,addListener:G,setProperty:T,getObject:V,executeFunction:H,getPageSnapshot:K,getFrameSnapshot:Y,getFrameSubjectArea:U,setFrameSubjectArea:q,clearFrameSubjectArea:z,getAssetSubjectInfo:B,setAssetSubjectInfo:J,clearAssetSubjectInfo:Q,setVariableIsLocked:W}}),window.OnEditorEvent=(e,t)=>{A.promise.then((r=>{r.handleEvents(e,t)}))}},P=(e,t)=>{try{return window.editorObject.Alert(e,t),E(void 0)}catch(e){return C(e.toString())}},F=()=>{try{return E(window.editorObject.GetDirtyState())}catch(e){return C(e.toString())}},R=()=>{try{return window.editorObject.NextPage(),E(void 0)}catch(e){return C(e.toString())}},N=()=>{try{return window.editorObject.PreviousPage(),E(void 0)}catch(e){return C(e.toString())}},I=e=>{try{return window.editorObject.SetSelectedPage(e),E(void 0)}catch(e){return C(e.toString())}},L=()=>{try{return E(window.editorObject.GetSelectedPage())}catch(e){return C(e.toString())}},M=()=>{try{return E(window.editorObject.GetSelectedPageName())}catch(e){return C(e.toString())}},D=()=>{try{return E(window.editorObject.GetNumPages())}catch(e){return C(e.toString())}},x=e=>{try{return window.editorObject.RemoveListener(e),E(void 0)}catch(e){return C(e.toString())}},G=e=>{try{return window.editorObject.AddListener(e),E(void 0)}catch(e){return C(e.toString())}},V=e=>{try{return E(window.editorObject.GetObject(e))}catch(e){return C(e.toString())}},T=(e,t,r)=>{try{return window.editorObject.SetProperty(e,t,r),E(void 0)}catch(e){return C(e.toString())}},H=(e,t,r)=>{try{return E(window.editorObject.ExecuteFunction(e,t,...r))}catch(e){return C(e.toString())}},K=(e,t,r,n,o,i)=>{try{return E(window.editorObject.GetPageSnapshot(e,t,r,n,o,i))}catch(e){return C(e.toString())}},Y=(e,t,r)=>{try{return E(window.editorObject.GetFrameSnapshot(e,t,r))}catch(e){return C(e.toString())}},U=e=>{try{return E(window.editorObject.GetFrameSubjectArea(e))}catch(e){return C(e.toString())}},q=(e,t,r,n,o)=>{try{return window.editorObject.SetFrameSubjectArea(e,t,r,n,o),E(void 0)}catch(e){return C(e.toString())}},z=e=>{try{return window.editorObject.ClearFrameSubjectArea(e),E(void 0)}catch(e){return C(e.toString())}},B=e=>{try{return E(window.editorObject.GetAssetSubjectInfo(e))}catch(e){return C(e.toString())}},J=(e,t,r,n,o,i,c)=>{try{return window.editorObject.SetAssetSubjectInfo(e,t,r,n,o,i,c),E(void 0)}catch(e){return C(e.toString())}},Q=e=>{try{return window.editorObject.ClearAssetSubjectInfo(e),E(void 0)}catch(e){return C(e.toString())}},W=(e,t)=>{try{return window.editorObject.SetVariableIsLocked(e,t),E(void 0)}catch(e){return C(e.toString())}}})();
//# sourceMappingURL=chiliInternalWrapper.min.js.map

@@ -1,2 +0,2 @@

var e,t,r,n,o;!function(e){e.Call="call",e.Reply="reply",e.Syn="syn",e.SynAck="synAck",e.Ack="ack"}(e||(e={})),function(e){e.Fulfilled="fulfilled",e.Rejected="rejected"}(t||(t={})),function(e){e.ConnectionDestroyed="ConnectionDestroyed",e.ConnectionTimeout="ConnectionTimeout",e.NoIframeSrc="NoIframeSrc"}(r||(r={})),function(e){e.DataCloneError="DataCloneError"}(n||(n={})),function(e){e.Message="message"}(o||(o={}));var i=(e,t)=>{const r=[];let n=!1;return{destroy(o){n||(n=!0,t(`${e}: Destroying connection`),r.forEach((e=>{e(o)})))},onDestroy(e){n?e():r.push(e)}}},s=e=>(...t)=>{e&&console.log("[Penpal]",...t)};const a={"http:":"80","https:":"443"},c=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,d=["file:","data:"];const l=({name:e,message:t,stack:r})=>({name:e,message:t,stack:r});var h=(r,i,s)=>{const{localName:a,local:c,remote:d,originForSending:h,originForReceiving:u}=r;let g=!1;const w=r=>{if(r.source!==d||r.data.penpal!==e.Call)return;if("*"!==u&&r.origin!==u)return void s(`${a} received message from origin ${r.origin} which did not match expected origin ${u}`);const o=r.data,{methodName:c,args:w,id:m}=o;s(`${a}: Received ${c}() call`);const f=r=>o=>{if(s(`${a}: Sending ${c}() reply`),g)return void s(`${a}: Unable to send ${c}() reply due to destroyed connection`);const i={penpal:e.Reply,id:m,resolution:r,returnValue:o};r===t.Rejected&&o instanceof Error&&(i.returnValue=l(o),i.returnValueIsError=!0);try{d.postMessage(i,h)}catch(r){if(r.name===n.DataCloneError){const n={penpal:e.Reply,id:m,resolution:t.Rejected,returnValue:l(r),returnValueIsError:!0};d.postMessage(n,h)}throw r}};new Promise((e=>e(i[c].apply(i,w)))).then(f(t.Fulfilled),f(t.Rejected))};return c.addEventListener(o.Message,w),()=>{g=!0,c.removeEventListener(o.Message,w)}};let u=0;const g=e=>e?e.split("."):[],w=(e,t,r)=>{const n=g(t);return n.reduce(((e,t,o)=>(void 0===e[t]&&(e[t]={}),o===n.length-1&&(e[t]=r),e[t])),e),e},m=(e,t)=>{const r={};return Object.keys(e).forEach((n=>{const o=e[n],i=((e,t)=>{const r=g(t||"");return r.push(e),(e=>e.join("."))(r)})(n,t);"object"==typeof o&&Object.assign(r,m(o,i)),"function"==typeof o&&(r[i]=o)})),r};var f=(n,i,s,a,c)=>{const{localName:d,local:l,remote:h,originForSending:g,originForReceiving:m}=i;let f=!1;c(`${d}: Connecting call sender`);const b=n=>(...i)=>{let s;c(`${d}: Sending ${n}() call`);try{h.closed&&(s=!0)}catch(e){s=!0}if(s&&a(),f){const e=new Error(`Unable to send ${n}() call due to destroyed connection`);throw e.code=r.ConnectionDestroyed,e}return new Promise(((r,s)=>{const a=++u,w=i=>{if(i.source!==h||i.data.penpal!==e.Reply||i.data.id!==a)return;if("*"!==m&&i.origin!==m)return void c(`${d} received message from origin ${i.origin} which did not match expected origin ${m}`);const u=i.data;c(`${d}: Received ${n}() reply`),l.removeEventListener(o.Message,w);let g=u.returnValue;u.returnValueIsError&&(g=(e=>{const t=new Error;return Object.keys(e).forEach((r=>t[r]=e[r])),t})(g)),(u.resolution===t.Fulfilled?r:s)(g)};l.addEventListener(o.Message,w);const f={penpal:e.Call,id:a,methodName:n,args:i};h.postMessage(f,g)}))},E=s.reduce(((e,t)=>(e[t]=b(t),e)),{});return Object.assign(n,(e=>{const t={};for(const r in e)w(t,r,e[r]);return t})(E)),()=>{f=!0}};var b=(e,t)=>{let n;return void 0!==e&&(n=window.setTimeout((()=>{const n=new Error(`Connection timed out after ${e}ms`);n.code=r.ConnectionTimeout,t(n)}),e)),()=>{clearTimeout(n)}},E=t=>{let{iframe:n,methods:l={},childOrigin:u,timeout:g,debug:w=!1}=t;const E=s(w),p=i("Parent",E),{onDestroy:y,destroy:S}=p;u||((e=>{if(!e.src&&!e.srcdoc){const e=new Error("Iframe must have src or srcdoc property defined.");throw e.code=r.NoIframeSrc,e}})(n),u=(e=>{if(e&&d.find((t=>e.startsWith(t))))return"null";const t=document.location,r=c.exec(e);let n,o,i;return r?(n=r[1]?r[1]:t.protocol,o=r[2],i=r[4]):(n=t.protocol,o=t.hostname,i=t.port),`${n}//${o}${i&&i!==a[n]?`:${i}`:""}`})(n.src));const v="null"===u?"*":u,j=m(l),P=((t,r,n,o)=>i=>{if(!i.source)return;if("*"!==n&&i.origin!==n)return void t(`Parent: Handshake - Received SYN message from origin ${i.origin} which did not match expected origin ${n}`);t("Parent: Handshake - Received SYN, responding with SYN-ACK");const s={penpal:e.SynAck,methodNames:Object.keys(r)};i.source.postMessage(s,o)})(E,j,u,v),k=((e,t,r,n,o)=>{const{destroy:i,onDestroy:s}=n;let a,c;const d={};return n=>{if("*"!==t&&n.origin!==t)return void o(`Parent: Handshake - Received ACK message from origin ${n.origin} which did not match expected origin ${t}`);o("Parent: Handshake - Received ACK");const l={localName:"Parent",local:window,remote:n.source,originForSending:r,originForReceiving:t};a&&a(),a=h(l,e,o),s(a),c&&c.forEach((e=>{delete d[e]})),c=n.data.methodNames;const u=f(d,l,c,i,o);return s(u),d}})(j,u,v,p,E),A=new Promise(((t,r)=>{const i=b(g,S),s=r=>{if(r.source===n.contentWindow&&r.data)if(r.data.penpal!==e.Syn)if(r.data.penpal!==e.Ack);else{const e=k(r);e&&(i(),t(e))}else P(r)};window.addEventListener(o.Message,s),E("Parent: Awaiting handshake"),((e,t)=>{const{destroy:r,onDestroy:n}=t,o=setInterval((()=>{e.isConnected||(clearInterval(o),r())}),6e4);n((()=>{clearInterval(o)}))})(n,p),y((e=>{window.removeEventListener(o.Message,s),e&&r(e)}))}));return{promise:A,destroy(){S()}}};class p{chiliEventListenerCallbacks=new Map;constructor(){}static async build(e,t={}){const r=new p;r.child=await E({iframe:e,methods:{handleEvents:r.handleEvents.bind(r)},timeout:t.timeout,debug:t.penpalDebug}).promise;const n=t.events;if(null!=n&&n.length>0)for(const e of n)"string"==typeof e?r.addListener(e):r.addListener(e.name,e.func);return r}handleEvents(e,t){return this.chiliEventListenerCallbacks.has(e)&&this.chiliEventListenerCallbacks.get(e)?.(t),e}#e=null;get editorObject(){return null==this.#e&&(this.#e={Alert:this.alert.bind(this),GetDirtyState:this.getDirtyState.bind(this),NextPage:this.nextPage.bind(this),PreviousPage:this.previousPage.bind(this),SetSelectedPage:this.setSelectedPage.bind(this),GetSelectedPage:this.getSelectedPage.bind(this),GetSelectedPageName:this.getSelectedPageName.bind(this),GetNumPages:this.getNumPages.bind(this),RemoveListener:this.removeListener.bind(this),AddListener:this.addListener.bind(this),GetObject:this.getObject.bind(this),SetProperty:this.setProperty.bind(this),ExecuteFunction:this.executeFunction.bind(this),GetPageSnapshot:this.getPageSnapshot.bind(this),GetFrameSnapshot:this.getFrameSnapshot.bind(this),GetFrameSubjectArea:this.getFrameSubjectArea.bind(this),SetFrameSubjectArea:this.setFrameSubjectArea.bind(this),ClearFrameSubjectArea:this.clearFrameSubjectArea.bind(this),GetAssetSubjectInfo:this.getAssetSubjectInfo.bind(this),SetAssetSubjectInfo:this.setAssetSubjectInfo.bind(this),ClearAssetSubjectInfo:this.clearAssetSubjectInfo.bind(this),SetVariableIsLocked:this.setVariableIsLocked.bind(this)}),this.#e}async alert(e,t){const r=await this.child.alert(e,t);if(r.isError)throw new Error(r.error)}async getDirtyState(){const e=await this.child.getDirtyState();if(e.isError)throw new Error(e.error);return e.ok}async nextPage(){const e=await this.child.nextPage();if(e.isError)throw new Error(e.error)}async previousPage(){const e=await this.child.previousPage();if(e.isError)throw new Error(e.error)}async setSelectedPage(e){const t=await this.child.setSelectedPage(e);if(t.isError)throw new Error(t.error)}async getSelectedPage(){const e=await this.child.getSelectedPage();if(e.isError)throw new Error(e.error);return e.ok}async getSelectedPageName(){const e=await this.child.getSelectedPageName();if(e.isError)throw new Error(e.error);return e.ok}async getNumPages(){const e=await this.child.getNumPages();if(e.isError)throw new Error(e.error);return e.ok}async removeListener(e){this.chiliEventListenerCallbacks.delete(e);const t=await this.child.removeListener(e);if(t.isError)throw new Error(t.error)}async addListener(e,t){this.chiliEventListenerCallbacks.set(e,null==t?t=>{null!=window.OnEditorEvent&&window.OnEditorEvent(e,t)}:t);const r=await this.child.addListener(e);if(r.isError)throw new Error(r.error)}async getObject(e){const t=await this.child.getObject(e);if(t.isError)throw new Error(t.error);return t.ok}async setProperty(e,t,r){const n=await this.child.setProperty(e,t,r);if(n.isError)throw new Error(n.error)}async executeFunction(e,t,...r){const n=await this.child.executeFunction(e,t,r);if(n.isError)throw new Error(n.error);return n.ok}async getPageSnapshot(e,t,r,n,o,i){const s=await this.child.getPageSnapshot(e,t,r,n,o,i);if(s.isError)throw new Error(s.error);return s.ok}async getFrameSnapshot(e,t,r){const n=await this.child.getFrameSnapshot(e,t,r);if(n.isError)throw new Error(n.error);return n.ok}async getFrameSubjectArea(e){const t=await this.child.getFrameSubjectArea(e);if(t.isError)throw new Error(t.error);return t.ok}async setFrameSubjectArea(e,t,r,n,o){const i=await this.child.setFrameSubjectArea(e,t,r,n,o);if(i.isError)throw new Error(i.error)}async clearFrameSubjectArea(e){const t=await this.child.clearFrameSubjectArea(e);if(t.isError)throw new Error(t.error)}async getAssetSubjectInfo(e){const t=await this.child.getAssetSubjectInfo(e);if(t.isError)throw new Error(t.error);return t.ok}async setAssetSubjectInfo(e,t,r,n,o,i,s){const a=await this.child.setAssetSubjectInfo(e,t,r,n,o,i,s);if(a.isError)throw new Error(a.error)}async clearAssetSubjectInfo(e){const t=await this.child.clearAssetSubjectInfo(e);if(t.isError)throw new Error(t.error)}async setVariableIsLocked(e,t){const r=await this.child.setVariableIsLocked(e,t);if(r.isError)throw new Error(r.error)}}export{p as PublisherInterface};
var e,t,r,i,n,o,s,c,a,d,l,h,u={};e=u,t="PublisherInterface",r=()=>V,i=e=>V=e,Object.defineProperty(e,t,{get:r,set:i,enumerable:!0,configurable:!0}),(o=n||(n={})).Call="call",o.Reply="reply",o.Syn="syn",o.SynAck="synAck",o.Ack="ack",(c=s||(s={})).Fulfilled="fulfilled",c.Rejected="rejected",(d=a||(a={})).ConnectionDestroyed="ConnectionDestroyed",d.ConnectionTimeout="ConnectionTimeout",d.NoIframeSrc="NoIframeSrc",(l||(l={})).DataCloneError="DataCloneError",(h||(h={})).Message="message";var f=(e,t)=>{const r=[];let i=!1;return{destroy(n){i||(i=!0,t(`${e}: Destroying connection`),r.forEach((e=>{e(n)})))},onDestroy(e){i?e():r.push(e)}}},g=e=>(...t)=>{e&&console.log("[Penpal]",...t)};const v={"http:":"80","https:":"443"},m=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,w=["file:","data:"];var p=e=>{if(e&&w.find((t=>e.startsWith(t))))return"null";const t=document.location,r=m.exec(e);let i,n,o;r?(i=r[1]?r[1]:t.protocol,n=r[2],o=r[4]):(i=t.protocol,n=t.hostname,o=t.port);return`${i}//${n}${o&&o!==v[i]?`:${o}`:""}`};const b=({name:e,message:t,stack:r})=>({name:e,message:t,stack:r}),E=e=>{const t=new Error;return Object.keys(e).forEach((r=>t[r]=e[r])),t};var y=(e,t,r)=>{const{localName:i,local:o,remote:c,originForSending:a,originForReceiving:d}=e;let u=!1;const f=e=>{if(e.source!==c||e.data.penpal!==n.Call)return;if("*"!==d&&e.origin!==d)return void r(`${i} received message from origin ${e.origin} which did not match expected origin ${d}`);const o=e.data,{methodName:h,args:f,id:g}=o;r(`${i}: Received ${h}() call`);const v=e=>t=>{if(r(`${i}: Sending ${h}() reply`),u)return void r(`${i}: Unable to send ${h}() reply due to destroyed connection`);const o={penpal:n.Reply,id:g,resolution:e,returnValue:t};e===s.Rejected&&t instanceof Error&&(o.returnValue=b(t),o.returnValueIsError=!0);try{c.postMessage(o,a)}catch(e){if(e.name===l.DataCloneError){const t={penpal:n.Reply,id:g,resolution:s.Rejected,returnValue:b(e),returnValueIsError:!0};c.postMessage(t,a)}throw e}};new Promise((e=>e(t[h].apply(t,f)))).then(v(s.Fulfilled),v(s.Rejected))};return o.addEventListener(h.Message,f),()=>{u=!0,o.removeEventListener(h.Message,f)}};let S=0;const P=e=>e?e.split("."):[],j=(e,t,r)=>{const i=P(t);return i.reduce(((e,t,n)=>(void 0===e[t]&&(e[t]={}),n===i.length-1&&(e[t]=r),e[t])),e),e},k=(e,t)=>{const r={};return Object.keys(e).forEach((i=>{const n=e[i],o=((e,t)=>{const r=P(t||"");return r.push(e),(e=>e.join("."))(r)})(i,t);"object"==typeof n&&Object.assign(r,k(n,o)),"function"==typeof n&&(r[o]=n)})),r},A=e=>{const t={};for(const r in e)j(t,r,e[r]);return t};var F=(e,t,r,i,o)=>{const{localName:c,local:d,remote:l,originForSending:u,originForReceiving:f}=t;let g=!1;o(`${c}: Connecting call sender`);const v=e=>(...t)=>{let r;o(`${c}: Sending ${e}() call`);try{l.closed&&(r=!0)}catch(e){r=!0}if(r&&i(),g){const t=new Error(`Unable to send ${e}() call due to destroyed connection`);throw t.code=a.ConnectionDestroyed,t}return new Promise(((r,i)=>{const a=++S,g=t=>{if(t.source!==l||t.data.penpal!==n.Reply||t.data.id!==a)return;if("*"!==f&&t.origin!==f)return void o(`${c} received message from origin ${t.origin} which did not match expected origin ${f}`);const u=t.data;o(`${c}: Received ${e}() reply`),d.removeEventListener(h.Message,g);let v=u.returnValue;u.returnValueIsError&&(v=E(v)),(u.resolution===s.Fulfilled?r:i)(v)};d.addEventListener(h.Message,g);const v={penpal:n.Call,id:a,methodName:e,args:t};l.postMessage(v,u)}))},m=r.reduce(((e,t)=>(e[t]=v(t),e)),{});return Object.assign(e,A(m)),()=>{g=!0}},I=(e,t,r,i,n)=>{const{destroy:o,onDestroy:s}=i;let c,a;const d={};return i=>{if("*"!==t&&i.origin!==t)return void n(`Parent: Handshake - Received ACK message from origin ${i.origin} which did not match expected origin ${t}`);n("Parent: Handshake - Received ACK");const l={localName:"Parent",local:window,remote:i.source,originForSending:r,originForReceiving:t};c&&c(),c=y(l,e,n),s(c),a&&a.forEach((e=>{delete d[e]})),a=i.data.methodNames;const h=F(d,l,a,o,n);return s(h),d}},$=(e,t,r,i)=>o=>{if(!o.source)return;if("*"!==r&&o.origin!==r)return void e(`Parent: Handshake - Received SYN message from origin ${o.origin} which did not match expected origin ${r}`);e("Parent: Handshake - Received SYN, responding with SYN-ACK");const s={penpal:n.SynAck,methodNames:Object.keys(t)};o.source.postMessage(s,i)};var C=(e,t)=>{const{destroy:r,onDestroy:i}=t,n=setInterval((()=>{e.isConnected||(clearInterval(n),r())}),6e4);i((()=>{clearInterval(n)}))},L=(e,t)=>{let r;return void 0!==e&&(r=window.setTimeout((()=>{const r=new Error(`Connection timed out after ${e}ms`);r.code=a.ConnectionTimeout,t(r)}),e)),()=>{clearTimeout(r)}},N=e=>{if(!e.src&&!e.srcdoc){const e=new Error("Iframe must have src or srcdoc property defined.");throw e.code=a.NoIframeSrc,e}},R=e=>{let{iframe:t,methods:r={},childOrigin:i,timeout:o,debug:s=!1}=e;const c=g(s),a=f("Parent",c),{onDestroy:d,destroy:l}=a;i||(N(t),i=p(t.src));const u="null"===i?"*":i,v=k(r),m=$(c,v,i,u),w=I(v,i,u,a,c);return{promise:new Promise(((e,r)=>{const i=L(o,l),s=r=>{if(r.source===t.contentWindow&&r.data)if(r.data.penpal!==n.Syn)if(r.data.penpal!==n.Ack);else{const t=w(r);t&&(i(),e(t))}else m(r)};window.addEventListener(h.Message,s),c("Parent: Awaiting handshake"),C(t,a),d((e=>{window.removeEventListener(h.Message,s),e&&r(e)}))})),destroy(){l()}}};var x,D=function(e,t,r,i){return new(r||(r=Promise))((function(n,o){function s(e){try{a(i.next(e))}catch(e){o(e)}}function c(e){try{a(i.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(s,c)}a((i=i.apply(e,t||[])).next())}))},O=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},M=function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r};class V{constructor(){this.chiliEventListenerCallbacks=new Map,x.set(this,null)}static build(e,t={}){return D(this,void 0,void 0,(function*(){const r=new V;r.child=yield R({iframe:e,methods:{handleEvents:r.handleEvents.bind(r)},timeout:t.timeout,debug:t.penpalDebug}).promise;const i=t.events;if(null!=i&&i.length>0)for(const e of i)"string"==typeof e?r.addListener(e):r.addListener(e.name,e.func);return r}))}handleEvents(e,t){var r;return this.chiliEventListenerCallbacks.has(e)&&(null===(r=this.chiliEventListenerCallbacks.get(e))||void 0===r||r(t)),e}get editorObject(){return null==O(this,x,"f")&&M(this,x,{Alert:this.alert.bind(this),GetDirtyState:this.getDirtyState.bind(this),NextPage:this.nextPage.bind(this),PreviousPage:this.previousPage.bind(this),SetSelectedPage:this.setSelectedPage.bind(this),GetSelectedPage:this.getSelectedPage.bind(this),GetSelectedPageName:this.getSelectedPageName.bind(this),GetNumPages:this.getNumPages.bind(this),RemoveListener:this.removeListener.bind(this),AddListener:this.addListener.bind(this),GetObject:this.getObject.bind(this),SetProperty:this.setProperty.bind(this),ExecuteFunction:this.executeFunction.bind(this),GetPageSnapshot:this.getPageSnapshot.bind(this),GetFrameSnapshot:this.getFrameSnapshot.bind(this),GetFrameSubjectArea:this.getFrameSubjectArea.bind(this),SetFrameSubjectArea:this.setFrameSubjectArea.bind(this),ClearFrameSubjectArea:this.clearFrameSubjectArea.bind(this),GetAssetSubjectInfo:this.getAssetSubjectInfo.bind(this),SetAssetSubjectInfo:this.setAssetSubjectInfo.bind(this),ClearAssetSubjectInfo:this.clearAssetSubjectInfo.bind(this),SetVariableIsLocked:this.setVariableIsLocked.bind(this)},"f"),O(this,x,"f")}alert(e,t){return D(this,void 0,void 0,(function*(){const r=yield this.child.alert(e,t);if(r.isError)throw new Error(r.error)}))}getDirtyState(){return D(this,void 0,void 0,(function*(){const e=yield this.child.getDirtyState();if(e.isError)throw new Error(e.error);return e.ok}))}nextPage(){return D(this,void 0,void 0,(function*(){const e=yield this.child.nextPage();if(e.isError)throw new Error(e.error)}))}previousPage(){return D(this,void 0,void 0,(function*(){const e=yield this.child.previousPage();if(e.isError)throw new Error(e.error)}))}setSelectedPage(e){return D(this,void 0,void 0,(function*(){const t=yield this.child.setSelectedPage(e);if(t.isError)throw new Error(t.error)}))}getSelectedPage(){return D(this,void 0,void 0,(function*(){const e=yield this.child.getSelectedPage();if(e.isError)throw new Error(e.error);return e.ok}))}getSelectedPageName(){return D(this,void 0,void 0,(function*(){const e=yield this.child.getSelectedPageName();if(e.isError)throw new Error(e.error);return e.ok}))}getNumPages(){return D(this,void 0,void 0,(function*(){const e=yield this.child.getNumPages();if(e.isError)throw new Error(e.error);return e.ok}))}removeListener(e){return D(this,void 0,void 0,(function*(){this.chiliEventListenerCallbacks.delete(e);const t=yield this.child.removeListener(e);if(t.isError)throw new Error(t.error)}))}addListener(e,t){return D(this,void 0,void 0,(function*(){this.chiliEventListenerCallbacks.set(e,null==t?t=>{null!=window.OnEditorEvent&&window.OnEditorEvent(e,t)}:t);const r=yield this.child.addListener(e);if(r.isError)throw new Error(r.error)}))}getObject(e){return D(this,void 0,void 0,(function*(){const t=yield this.child.getObject(e);if(t.isError)throw new Error(t.error);return t.ok}))}setProperty(e,t,r){return D(this,void 0,void 0,(function*(){const i=yield this.child.setProperty(e,t,r);if(i.isError)throw new Error(i.error)}))}executeFunction(e,t,...r){return D(this,void 0,void 0,(function*(){const i=yield this.child.executeFunction(e,t,r);if(i.isError)throw new Error(i.error);return i.ok}))}getPageSnapshot(e,t,r,i,n,o){return D(this,void 0,void 0,(function*(){const s=yield this.child.getPageSnapshot(e,t,r,i,n,o);if(s.isError)throw new Error(s.error);return s.ok}))}getFrameSnapshot(e,t,r){return D(this,void 0,void 0,(function*(){const i=yield this.child.getFrameSnapshot(e,t,r);if(i.isError)throw new Error(i.error);return i.ok}))}getFrameSubjectArea(e){return D(this,void 0,void 0,(function*(){const t=yield this.child.getFrameSubjectArea(e);if(t.isError)throw new Error(t.error);return t.ok}))}setFrameSubjectArea(e,t,r,i,n){return D(this,void 0,void 0,(function*(){const o=yield this.child.setFrameSubjectArea(e,t,r,i,n);if(o.isError)throw new Error(o.error)}))}clearFrameSubjectArea(e){return D(this,void 0,void 0,(function*(){const t=yield this.child.clearFrameSubjectArea(e);if(t.isError)throw new Error(t.error)}))}getAssetSubjectInfo(e){return D(this,void 0,void 0,(function*(){const t=yield this.child.getAssetSubjectInfo(e);if(t.isError)throw new Error(t.error);return t.ok}))}setAssetSubjectInfo(e,t,r,i,n,o,s){return D(this,void 0,void 0,(function*(){const c=yield this.child.setAssetSubjectInfo(e,t,r,i,n,o,s);if(c.isError)throw new Error(c.error)}))}clearAssetSubjectInfo(e){return D(this,void 0,void 0,(function*(){const t=yield this.child.clearAssetSubjectInfo(e);if(t.isError)throw new Error(t.error)}))}setVariableIsLocked(e,t){return D(this,void 0,void 0,(function*(){const r=yield this.child.setVariableIsLocked(e,t);if(r.isError)throw new Error(r.error)}))}}x=new WeakMap;export{V as PublisherInterface,u as default};
//# sourceMappingURL=PublisherInterface.min.js.map

@@ -7,42 +7,85 @@ var $7i1sb$penpal = require("penpal");

$parcel$export(module.exports, "PublisherInterface", () => $0370263bd5c7e7d2$export$a13915682e709c4f);
$parcel$export(module.exports, "PublisherInterface", () => $3db7bcc71a7ab568$export$a13915682e709c4f, (v) => $3db7bcc71a7ab568$export$a13915682e709c4f = v);
class $0370263bd5c7e7d2$export$a13915682e709c4f {
chiliEventListenerCallbacks = new Map();
var $3db7bcc71a7ab568$var$__awaiter = undefined && undefined.__awaiter || function(thisArg, _arguments, P, generator) {
function adopt(value) {
return value instanceof P ? value : new P(function(resolve) {
resolve(value);
});
}
return new (P || (P = Promise))(function(resolve, reject) {
function fulfilled(value) {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
}
function rejected(value) {
try {
step(generator["throw"](value));
} catch (e) {
reject(e);
}
}
function step(result) {
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
}
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var $3db7bcc71a7ab568$var$__classPrivateFieldGet = undefined && undefined.__classPrivateFieldGet || function(receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var $3db7bcc71a7ab568$var$__classPrivateFieldSet = undefined && undefined.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
};
var $3db7bcc71a7ab568$var$_PublisherInterface_editorObject;
class $3db7bcc71a7ab568$export$a13915682e709c4f {
// eslint-disable-next-line @typescript-eslint/no-empty-function
constructor(){}
constructor(){
this.chiliEventListenerCallbacks = new Map();
$3db7bcc71a7ab568$var$_PublisherInterface_editorObject.set(this, null);
}
/**
* The build method will wait for a connection to the other side of iframe. Must be called before iframe `onload` event is fired.
*
* @param iframe
* @param options
* @returns {PublisherInterface}
*/ static async build(iframe, options = {}) {
const publisherInterface = new $0370263bd5c7e7d2$export$a13915682e709c4f();
publisherInterface.child = await $7i1sb$penpal.connectToChild({
iframe: // The iframe to which a connection should be made
iframe,
// Methods the parent is exposing to the child
methods: {
handleEvents: publisherInterface.handleEvents.bind(publisherInterface)
},
timeout: options.timeout,
debug: options.penpalDebug
}).promise;
const events = options.events;
if (events != null && events.length > 0) {
for (const event of events)if (typeof event == "string") publisherInterface.addListener(event);
else publisherInterface.addListener(event.name, event.func);
}
return publisherInterface;
* The build method will wait for a connection to the other side of iframe. Must be called before iframe `onload` event is fired.
*
* @param iframe
* @param options
* @returns {PublisherInterface}
*/ static build(iframe, options = {}) {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
const publisherInterface = new $3db7bcc71a7ab568$export$a13915682e709c4f();
publisherInterface.child = yield (0, $7i1sb$penpal.connectToChild)({
iframe: // The iframe to which a connection should be made
iframe,
// Methods the parent is exposing to the child
methods: {
handleEvents: publisherInterface.handleEvents.bind(publisherInterface)
},
timeout: options.timeout,
debug: options.penpalDebug
}).promise;
const events = options.events;
if (events != null && events.length > 0) {
for (const event of events)if (typeof event == "string") publisherInterface.addListener(event);
else publisherInterface.addListener(event.name, event.func);
}
return publisherInterface;
});
}
handleEvents(eventName, id) {
this.chiliEventListenerCallbacks.has(eventName) && this.chiliEventListenerCallbacks.get(eventName)?.(id);
var _a;
this.chiliEventListenerCallbacks.has(eventName) && ((_a = this.chiliEventListenerCallbacks.get(eventName)) === null || _a === void 0 || _a(id));
return eventName;
}
#editorObject = null;
/**
* Returns an alias for editorObject with similarly named functions. This is to help with backwards compatibility, but these functions still return a Promise.
*/ get editorObject() {
if (this.#editorObject == null) this.#editorObject = {
* Returns an alias for editorObject with similarly named functions. This is to help with backwards compatibility, but these functions still return a Promise.
*/ get editorObject() {
if ($3db7bcc71a7ab568$var$__classPrivateFieldGet(this, $3db7bcc71a7ab568$var$_PublisherInterface_editorObject, "f") == null) $3db7bcc71a7ab568$var$__classPrivateFieldSet(this, $3db7bcc71a7ab568$var$_PublisherInterface_editorObject, {
Alert: this.alert.bind(this),

@@ -70,248 +113,293 @@ GetDirtyState: this.getDirtyState.bind(this),

SetVariableIsLocked: this.setVariableIsLocked.bind(this)
};
return this.#editorObject;
}, "f");
return $3db7bcc71a7ab568$var$__classPrivateFieldGet(this, $3db7bcc71a7ab568$var$_PublisherInterface_editorObject, "f");
}
/**
* Displays a modal box within the editor UI containing a title with a message.
*
* @param message - The message to be displayed.
* @param title - The title/header of the modal.
*/ async alert(message, title) {
const response = await this.child.alert(message, title);
if (response.isError) throw new Error(response.error);
* Displays a modal box within the editor UI containing a title with a message.
*
* @param message - The message to be displayed.
* @param title - The title/header of the modal.
*/ alert(message, title) {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
const response = yield this.child.alert(message, title);
if (response.isError) throw new Error(response.error);
});
}
/**
* Returns value of document.isDirty which signifies if the document has been changed since previous save.
*
* @returns Returns boolean to signify if the document has been changed since previous save.
*/ async getDirtyState() {
const response = await this.child.getDirtyState();
if (response.isError) throw new Error(response.error);
return response.ok;
* Returns value of document.isDirty which signifies if the document has been changed since previous save.
*
* @returns Returns boolean to signify if the document has been changed since previous save.
*/ getDirtyState() {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
const response = yield this.child.getDirtyState();
if (response.isError) throw new Error(response.error);
return response.ok;
});
}
/**
* Selects the next page in the document.pages list.
* If the current selected page has the beginning index 0 then nothing happens.
*/ async nextPage() {
const response = await this.child.nextPage();
if (response.isError) throw new Error(response.error);
* Selects the next page in the document.pages list.
* If the current selected page has the beginning index 0 then nothing happens.
*/ nextPage() {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
const response = yield this.child.nextPage();
if (response.isError) throw new Error(response.error);
});
}
/**
* Selects the previous page in the document.pages list.
* If the current selected page has the last index then nothing happens.
*/ async previousPage() {
const response = await this.child.previousPage();
if (response.isError) throw new Error(response.error);
* Selects the previous page in the document.pages list.
* If the current selected page has the last index then nothing happens.
*/ previousPage() {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
const response = yield this.child.previousPage();
if (response.isError) throw new Error(response.error);
});
}
/**
* Selects page by common language page number causing the editor to visually jump to that page.
*
* @param page - Common language page number (page index + 1) to select.
*/ async setSelectedPage(page) {
const response = await this.child.setSelectedPage(page);
if (response.isError) throw new Error(response.error);
* Selects page by common language page number causing the editor to visually jump to that page.
*
* @param page - Common language page number (page index + 1) to select.
*/ setSelectedPage(page) {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
const response = yield this.child.setSelectedPage(page);
if (response.isError) throw new Error(response.error);
});
}
/**
* Returns the common language page number, which is page index + 1.
* So if you have page with index 0 selected, this would return 1.
*
* @returns Page index + 1 of the selected page.
*/ async getSelectedPage() {
const response = await this.child.getSelectedPage();
if (response.isError) throw new Error(response.error);
return response.ok;
* Returns the common language page number, which is page index + 1.
* So if you have page with index 0 selected, this would return 1.
*
* @returns Page index + 1 of the selected page.
*/ getSelectedPage() {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
const response = yield this.child.getSelectedPage();
if (response.isError) throw new Error(response.error);
return response.ok;
});
}
/**
* Returns the name of the selected page.
*
* @returns Name of the page.
*/ async getSelectedPageName() {
const response = await this.child.getSelectedPageName();
if (response.isError) throw new Error(response.error);
return response.ok;
* Returns the name of the selected page.
*
* @returns Name of the page.
*/ getSelectedPageName() {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
const response = yield this.child.getSelectedPageName();
if (response.isError) throw new Error(response.error);
return response.ok;
});
}
/**
* Returns the total number of pages.
*
* @returns The total number of pages.
*/ async getNumPages() {
const response = await this.child.getNumPages();
if (response.isError) throw new Error(response.error);
return response.ok;
* Returns the total number of pages.
*
* @returns The total number of pages.
*/ getNumPages() {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
const response = yield this.child.getNumPages();
if (response.isError) throw new Error(response.error);
return response.ok;
});
}
/**
* Removes the listener for the specified editor event.
*
* @param eventName - A case-sensitive string representing the editor event type to stop listening to.
*/ async removeListener(eventName) {
this.chiliEventListenerCallbacks.delete(eventName);
const response = await this.child.removeListener(eventName);
if (response.isError) throw new Error(response.error);
* Removes the listener for the specified editor event.
*
* @param eventName - A case-sensitive string representing the editor event type to stop listening to.
*/ removeListener(eventName) {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
this.chiliEventListenerCallbacks.delete(eventName);
const response = yield this.child.removeListener(eventName);
if (response.isError) throw new Error(response.error);
});
}
/**
* Adds a listener to an editor event and a user defined callback function when event is fired.
* The function will receive the target id of the event and is executed when the event is triggered.
*
* @example
* ```ts
* publisherInterface.addListener("FrameMoved", (targetId)=>{console.log(targetId)}));
* ```
* @param eventName - A case-sensitive string representing the editor event type to listen for.
* @param callbackFunction - A function that executes when the event is triggered. If callback is null, the listener will instead call window.OnEditorEvent
*/ async addListener(eventName, callbackFunction) {
this.chiliEventListenerCallbacks.set(eventName, callbackFunction == null ? (targetId)=>{
if (window.OnEditorEvent != null) window.OnEditorEvent(eventName, targetId);
} : callbackFunction);
const response = await this.child.addListener(eventName);
if (response.isError) throw new Error(response.error);
* Adds a listener to an editor event and a user defined callback function when event is fired.
* The function will receive the target id of the event and is executed when the event is triggered.
*
* @example
* ```ts
* publisherInterface.addListener("FrameMoved", (targetId)=>{console.log(targetId)}));
* ```
* @param eventName - A case-sensitive string representing the editor event type to listen for.
* @param callbackFunction - A function that executes when the event is triggered. If callback is null, the listener will instead call window.OnEditorEvent
*/ addListener(eventName, callbackFunction) {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
this.chiliEventListenerCallbacks.set(eventName, callbackFunction == null ? (targetId)=>{
if (window.OnEditorEvent != null) window.OnEditorEvent(eventName, targetId);
} : callbackFunction);
const response = yield this.child.addListener(eventName);
if (response.isError) throw new Error(response.error);
});
}
/**
* Gets the value of the property or object found at given chiliPath.
*
* @param chiliPath - A case-sensitive string query path for selecting properties and objects in a CHILI document.
* @returns Returns the value of the property or object found at given chiliPath.
*/ async getObject(chiliPath) {
const response = await this.child.getObject(chiliPath);
if (response.isError) throw new Error(response.error);
return response.ok;
* Gets the value of the property or object found at given chiliPath.
*
* @param chiliPath - A case-sensitive string query path for selecting properties and objects in a CHILI document.
* @returns Returns the value of the property or object found at given chiliPath.
*/ getObject(chiliPath) {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
const response = yield this.child.getObject(chiliPath);
if (response.isError) throw new Error(response.error);
return response.ok;
});
}
/**
* Sets the value of the property defined by property on the object defined by the chiliPath
*
* @param chiliPath - A case-sensitive string query path for selecting properties and objects in a CHILI document.
* @param property - The case-sensitive string name of the property found on the object of the chiliPath.
* @param value - The value to set the property.
*/ async setProperty(chiliPath, property, value) {
const response = await this.child.setProperty(chiliPath, property, value);
if (response.isError) throw new Error(response.error);
* Sets the value of the property defined by property on the object defined by the chiliPath
*
* @param chiliPath - A case-sensitive string query path for selecting properties and objects in a CHILI document.
* @param property - The case-sensitive string name of the property found on the object of the chiliPath.
* @param value - The value to set the property.
*/ setProperty(chiliPath, property, value) {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
const response = yield this.child.setProperty(chiliPath, property, value);
if (response.isError) throw new Error(response.error);
});
}
/**
* Executes function of functionName found as a property or method on the object defined in the chiliPath.
*
* @example
* // Will add a new frame of type text on page of index 0 at coordinates X: 10 mm and Y: 15 mm with width: 100 mm and height: 50 mm
* ```ts
* publisherInterface.ExecuteFunction('document.pages[0].frames', 'Add', 'text', '10 mm', '15 mm', '100 mm', '50 mm');
* ```
* @param chiliPath - A case-sensitive string query path for selecting properties and objects in a CHILI document.
* @param functionName - A case-sensitive string of the name of the function to execute.
* @param params - Parameters to be passed to function of functionName.
* @returns Returns the return of executed function.
*/ async executeFunction(chiliPath, functionName, ...params) {
const response = await this.child.executeFunction(chiliPath, functionName, params);
if (response.isError) throw new Error(response.error);
return response.ok;
* Executes function of functionName found as a property or method on the object defined in the chiliPath.
*
* @example
* // Will add a new frame of type text on page of index 0 at coordinates X: 10 mm and Y: 15 mm with width: 100 mm and height: 50 mm
* ```ts
* publisherInterface.ExecuteFunction('document.pages[0].frames', 'Add', 'text', '10 mm', '15 mm', '100 mm', '50 mm');
* ```
* @param chiliPath - A case-sensitive string query path for selecting properties and objects in a CHILI document.
* @param functionName - A case-sensitive string of the name of the function to execute.
* @param params - Parameters to be passed to function of functionName.
* @returns Returns the return of executed function.
*/ executeFunction(chiliPath, functionName, ...params) {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
const response = yield this.child.executeFunction(chiliPath, functionName, params);
if (response.isError) throw new Error(response.error);
return response.ok;
});
}
/**
* Returns a base64 encoded PNG snapshot image of a specific page.
*
* @example
* ```ts
* \\ This will get a 1000 by 1000 image of the first page and open it in a popup.
* let base64 = publisherInterface.GetPageSnapshot('0', '1000x1000', null, null, 'preview', true);
*
* let newImage = new Image();
* newImage.src = "data:image/png;base64," + base64;
*
* let popup = open("", "Popup", "width=1000,height=1000,top="+(window.screen.height/2)+",left="+(window.screen.height/2));
* popup.document.body.appendChild(newImage);
* ```
*
* @param pageIndex - The page index to return as an image.
* @param size - The size of the returned png. This can be set as an image size in pixels by using a string width x height. For example "1000x1500". This can be set as a zoom level. For example "75" would be 75% zoom of the document. This can be set as an object of width and height. For example \{width:1000 height:1000\}. If the size is set in pixels and the ratio is different from the page ratio, the image is scaled to fit entirely in the png and placed at (0,0) top left. The extra space at the bottom or the right is filled with background color. If a zoom percentage is given, the output size is automatically calculated using the document dimensions, assuming the resolution is 72 dpi.
* @param layers - An array of layers that are to be visible in the png. An array of visible layers can be provided using the layer "name" property or layer "id" property. If no list is passed, the layer visibility is the same as in the editor window.
* @param frames - An array of frames that are visible in the png. An array of visible frame elements can be provided using the frame "tag" property or layer "id" property. If no list is passed, the frame visibility is the same as in the editor window.
* @param viewMode - A string that is either: preview, edit, or technical. "preview" shows the page in standard preview mode in the same way as the editor does. If there is an active selection, it should not be indicated in the resulting png. Annotations should be hidden. "edit" shows the page in standard edit mode in the same way as the editor does. The view can be identical to the editor view, with active selections and frame handles. "technical" shows the page in edit mode, but without the control handles and selections. Annotations should be hidden.
* @param transparentBackground - A boolean that determines if the png document background should be transparent.
* @returns A base64 encoded PNG image of the document.
*/ async getPageSnapshot(pageIndex, size, layers, frames, viewMode, transparentBackground) {
const response = await this.child.getPageSnapshot(pageIndex, size, layers, frames, viewMode, transparentBackground);
if (response.isError) throw new Error(response.error);
return response.ok;
* Returns a base64 encoded PNG snapshot image of a specific page.
*
* @example
* ```ts
* \\ This will get a 1000 by 1000 image of the first page and open it in a popup.
* let base64 = publisherInterface.GetPageSnapshot('0', '1000x1000', null, null, 'preview', true);
*
* let newImage = new Image();
* newImage.src = "data:image/png;base64," + base64;
*
* let popup = open("", "Popup", "width=1000,height=1000,top="+(window.screen.height/2)+",left="+(window.screen.height/2));
* popup.document.body.appendChild(newImage);
* ```
*
* @param pageIndex - The page index to return as an image.
* @param size - The size of the returned png. This can be set as an image size in pixels by using a string width x height. For example "1000x1500". This can be set as a zoom level. For example "75" would be 75% zoom of the document. This can be set as an object of width and height. For example \{width:1000 height:1000\}. If the size is set in pixels and the ratio is different from the page ratio, the image is scaled to fit entirely in the png and placed at (0,0) top left. The extra space at the bottom or the right is filled with background color. If a zoom percentage is given, the output size is automatically calculated using the document dimensions, assuming the resolution is 72 dpi.
* @param layers - An array of layers that are to be visible in the png. An array of visible layers can be provided using the layer "name" property or layer "id" property. If no list is passed, the layer visibility is the same as in the editor window.
* @param frames - An array of frames that are visible in the png. An array of visible frame elements can be provided using the frame "tag" property or layer "id" property. If no list is passed, the frame visibility is the same as in the editor window.
* @param viewMode - A string that is either: preview, edit, or technical. "preview" shows the page in standard preview mode in the same way as the editor does. If there is an active selection, it should not be indicated in the resulting png. Annotations should be hidden. "edit" shows the page in standard edit mode in the same way as the editor does. The view can be identical to the editor view, with active selections and frame handles. "technical" shows the page in edit mode, but without the control handles and selections. Annotations should be hidden.
* @param transparentBackground - A boolean that determines if the png document background should be transparent.
* @returns A base64 encoded PNG image of the document.
*/ getPageSnapshot(pageIndex, size, layers, frames, viewMode, transparentBackground) {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
const response = yield this.child.getPageSnapshot(pageIndex, size, layers, frames, viewMode, transparentBackground);
if (response.isError) throw new Error(response.error);
return response.ok;
});
}
/**
* Returns a base64 encoded PNG snapshot image of a specific frame
*
* @param idOrTag - The id or tag of the frame to return as an image.
* @param size - The size of the returned png. This can be set as an image size in pixels by using a string width x height. For example "1000x1500". This can be set as a zoom level. For example "75" would be 75% zoom of the document. This can be set as an object of width and height. For example \{width:1000 height:1000\}. If the size is set in pixels and the ratio is different from the page ratio, the image is scaled to fit entirely in the png and placed at (0,0) top left. The extra space at the bottom or the right is filled with background color. If a zoom percentage is given, the output size is automatically calculated using the document dimensions, assuming the resolution is 72 dpi.
* @param transparentBackground - A boolean that determines if the png document background should be transparent.
* @returns A base64 encoded PNG image of the frame.
*/ async getFrameSnapshot(idOrTag, size, transparentBackground) {
const response = await this.child.getFrameSnapshot(idOrTag, size, transparentBackground);
if (response.isError) throw new Error(response.error);
return response.ok;
* Returns a base64 encoded PNG snapshot image of a specific frame
*
* @param idOrTag - The id or tag of the frame to return as an image.
* @param size - The size of the returned png. This can be set as an image size in pixels by using a string width x height. For example "1000x1500". This can be set as a zoom level. For example "75" would be 75% zoom of the document. This can be set as an object of width and height. For example \{width:1000 height:1000\}. If the size is set in pixels and the ratio is different from the page ratio, the image is scaled to fit entirely in the png and placed at (0,0) top left. The extra space at the bottom or the right is filled with background color. If a zoom percentage is given, the output size is automatically calculated using the document dimensions, assuming the resolution is 72 dpi.
* @param transparentBackground - A boolean that determines if the png document background should be transparent.
* @returns A base64 encoded PNG image of the frame.
*/ getFrameSnapshot(idOrTag, size, transparentBackground) {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
const response = yield this.child.getFrameSnapshot(idOrTag, size, transparentBackground);
if (response.isError) throw new Error(response.error);
return response.ok;
});
}
/**
* Gets the frame subject area for the image fit mode Smart Fit.
*
* @param idOrTag - The string id or tag of the frame.
* @returns - The subject area of the frame.
*/ async getFrameSubjectArea(idOrTag) {
const response = await this.child.getFrameSubjectArea(idOrTag);
if (response.isError) throw new Error(response.error);
return response.ok;
* Gets the frame subject area for the image fit mode Smart Fit.
*
* @param idOrTag - The string id or tag of the frame.
* @returns - The subject area of the frame.
*/ getFrameSubjectArea(idOrTag) {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
const response = yield this.child.getFrameSubjectArea(idOrTag);
if (response.isError) throw new Error(response.error);
return response.ok;
});
}
/**
* Sets the frame subject area for the image fit mode Smart Fit.
*
* @param idOrTag - The string id or tag of the frame.
* @param x - A number 0 to 1 representing the x coordinate. Setting the number outside that range will clip the result to 0 or 1.
* @param y - A number 0 to 1 representing the y coordinate. Setting the number outside that range will clip the result to 0 or 1.
* @param width - A number 0 to 1 representing width. Setting the number outside that range will clip the result to 0 or 1.
* @param height -A number 0 to 1 representing height. Setting the number outside that range will clip the result to 0 or 1.
*/ async setFrameSubjectArea(idOrTag, x, y, width, height) {
const response = await this.child.setFrameSubjectArea(idOrTag, x, y, width, height);
if (response.isError) throw new Error(response.error);
* Sets the frame subject area for the image fit mode Smart Fit.
*
* @param idOrTag - The string id or tag of the frame.
* @param x - A number 0 to 1 representing the x coordinate. Setting the number outside that range will clip the result to 0 or 1.
* @param y - A number 0 to 1 representing the y coordinate. Setting the number outside that range will clip the result to 0 or 1.
* @param width - A number 0 to 1 representing width. Setting the number outside that range will clip the result to 0 or 1.
* @param height -A number 0 to 1 representing height. Setting the number outside that range will clip the result to 0 or 1.
*/ setFrameSubjectArea(idOrTag, x, y, width, height) {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
const response = yield this.child.setFrameSubjectArea(idOrTag, x, y, width, height);
if (response.isError) throw new Error(response.error);
});
}
/**
* Resets the frame subject area to \{height: "0", width: "0", x: "1", y: "1"\}.
*
* @param idOrTag - The string id or tag of the frame to clear the subject area.
*/ async clearFrameSubjectArea(idOrTag) {
const response = await this.child.clearFrameSubjectArea(idOrTag);
if (response.isError) throw new Error(response.error);
* Resets the frame subject area to \{height: "0", width: "0", x: "1", y: "1"\}.
*
* @param idOrTag - The string id or tag of the frame to clear the subject area.
*/ clearFrameSubjectArea(idOrTag) {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
const response = yield this.child.clearFrameSubjectArea(idOrTag);
if (response.isError) throw new Error(response.error);
});
}
/**
* Gets the asset subject area for the target frame for image fit mode Smart Fit.
*
* @param frameIdOrTag - The string id or tag of the frame.
* @returns The asset subject area.
*/ async getAssetSubjectInfo(frameIdOrTag) {
const response = await this.child.getAssetSubjectInfo(frameIdOrTag);
if (response.isError) throw new Error(response.error);
return response.ok;
* Gets the asset subject area for the target frame for image fit mode Smart Fit.
*
* @param frameIdOrTag - The string id or tag of the frame.
* @returns The asset subject area.
*/ getAssetSubjectInfo(frameIdOrTag) {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
const response = yield this.child.getAssetSubjectInfo(frameIdOrTag);
if (response.isError) throw new Error(response.error);
return response.ok;
});
}
/**
* Sets the asset subject area for the target frame for image fit mode Smart Fit.
*
* @param frameIdOrTag - The string id or tag of the frame.
* @param x - A number 0 to 1 representing the x coordinate. Setting the number outside that range will clip the result to 0 or 1.
* @param y - A number 0 to 1 representing the y coordinate. Setting the number outside that range will clip the result to 0 or 1.
* @param width - A number 0 to 1 representing width. Setting the number outside that range will clip the result to 0 or 1.
* @param height - A number 0 to 1 representing height. Setting the number outside that range will clip the result to 0 or 1.
* @param poiX - A number 0 to 1 representing x coordinate of teh point of interest. Setting the number outside that range will clip the result to 0 or 1.
* @param poiY - A number 0 to 1 representing y coordinate of teh point of interest.
*/ async setAssetSubjectInfo(frameIdOrTag, x, y, width, height, poiX, poiY) {
const response = await this.child.setAssetSubjectInfo(frameIdOrTag, x, y, width, height, poiX, poiY);
if (response.isError) throw new Error(response.error);
* Sets the asset subject area for the target frame for image fit mode Smart Fit.
*
* @param frameIdOrTag - The string id or tag of the frame.
* @param x - A number 0 to 1 representing the x coordinate. Setting the number outside that range will clip the result to 0 or 1.
* @param y - A number 0 to 1 representing the y coordinate. Setting the number outside that range will clip the result to 0 or 1.
* @param width - A number 0 to 1 representing width. Setting the number outside that range will clip the result to 0 or 1.
* @param height - A number 0 to 1 representing height. Setting the number outside that range will clip the result to 0 or 1.
* @param poiX - A number 0 to 1 representing x coordinate of teh point of interest. Setting the number outside that range will clip the result to 0 or 1.
* @param poiY - A number 0 to 1 representing y coordinate of teh point of interest.
*/ setAssetSubjectInfo(frameIdOrTag, x, y, width, height, poiX, poiY) {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
const response = yield this.child.setAssetSubjectInfo(frameIdOrTag, x, y, width, height, poiX, poiY);
if (response.isError) throw new Error(response.error);
});
}
/**
* Resets the asset subject area of target to \{height: "0", width: "0", x: "1", y: "1", poiX: "0.5", poiY: "0.5"\}.
*
* @param frameIdOrTag - The string id or tag of the frame to clear the asset subject area.
*/ async clearAssetSubjectInfo(frameIdOrTag) {
const response = await this.child.clearAssetSubjectInfo(frameIdOrTag);
if (response.isError) throw new Error(response.error);
* Resets the asset subject area of target to \{height: "0", width: "0", x: "1", y: "1", poiX: "0.5", poiY: "0.5"\}.
*
* @param frameIdOrTag - The string id or tag of the frame to clear the asset subject area.
*/ clearAssetSubjectInfo(frameIdOrTag) {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
const response = yield this.child.clearAssetSubjectInfo(frameIdOrTag);
if (response.isError) throw new Error(response.error);
});
}
/**
* Sets the locked (editable) state of a variable.
*
* @param variableName - A case-sensitive string of the variable name to target.
* @param isLocked - A boolean to set the variable as locked or unlocked.
*/ async setVariableIsLocked(variableName, isLocked) {
const response = await this.child.setVariableIsLocked(variableName, isLocked);
if (response.isError) throw new Error(response.error);
* Sets the locked (editable) state of a variable.
*
* @param variableName - A case-sensitive string of the variable name to target.
* @param isLocked - A boolean to set the variable as locked or unlocked.
*/ setVariableIsLocked(variableName, isLocked) {
return $3db7bcc71a7ab568$var$__awaiter(this, void 0, void 0, function*() {
const response = yield this.child.setVariableIsLocked(variableName, isLocked);
if (response.isError) throw new Error(response.error);
});
}
}
$3db7bcc71a7ab568$var$_PublisherInterface_editorObject = new WeakMap();
{
"name": "@chili-publish/publisher-interface",
"version": "0.3.1",
"version": "0.3.2",
"author": "chili-publish",

@@ -48,4 +48,5 @@ "description": "PublisherInterface is a class object that allows you to interact with the CHILI Publisher editorObject via postMessage without the complexity of postMessage.",

"devDependencies": {
"@parcel/packager-ts": "2.5.0",
"@parcel/transformer-typescript-types": "2.5.0",
"@parcel/packager-ts": "^2.7.0",
"@parcel/transformer-typescript-tsc": "^2.7.0",
"@parcel/transformer-typescript-types": "^2.7.0",
"@playwright/test": "^1.27.1",

@@ -56,3 +57,3 @@ "@types/node": "^18.11.2",

"eslint": "^8.16.0",
"parcel": "2.5.0",
"parcel": "^2.7.0",
"playwright": "^1.27.1",

@@ -59,0 +60,0 @@ "typedoc": "^0.22.17",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet