New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@agility/app-sdk

Package Overview
Dependencies
Maintainers
3
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agility/app-sdk - npm Package Compare versions

Comparing version

to
2.0.3-rc2

2

dist/cjs/index.js

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

"use strict";var e=require("react"),t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},t(e,r)};function r(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}function n(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function o(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function i(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function a(e){return"function"==typeof e}function s(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var u=s((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function c(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var p=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,s,c;if(!this.closed){this.closed=!0;var p=this._parentage;if(p)if(this._parentage=null,Array.isArray(p))try{for(var l=n(p),f=l.next();!f.done;f=l.next()){f.value.remove(this)}}catch(t){e={error:t}}finally{try{f&&!f.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}else p.remove(this);var d=this.initialTeardown;if(a(d))try{d()}catch(e){c=e instanceof u?e.errors:[e]}var b=this._finalizers;if(b){this._finalizers=null;try{for(var h=n(b),y=h.next();!y.done;y=h.next()){var I=y.value;try{v(I)}catch(e){c=null!=c?c:[],e instanceof u?c=i(i([],o(c)),o(e.errors)):c.push(e)}}}catch(e){r={error:e}}finally{try{y&&!y.done&&(s=h.return)&&s.call(h)}finally{if(r)throw r.error}}}if(c)throw new u(c)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)v(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&c(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&c(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),l=p.EMPTY;function f(e){return e instanceof p||e&&"closed"in e&&a(e.remove)&&a(e.add)&&a(e.unsubscribe)}function v(e){a(e)?e():e.unsubscribe()}var d={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},b={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var a=b.delegate;return(null==a?void 0:a.setTimeout)?a.setTimeout.apply(a,i([e,t],o(r))):setTimeout.apply(void 0,i([e,t],o(r)))},clearTimeout:function(e){var t=b.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function h(){}function y(e){e()}var I=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,f(t)&&t.add(r)):r.destination=S,r}return r(t,e),t.create=function(e,t,r){return new w(e,t,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(p),m=Function.prototype.bind;function D(e,t){return m.call(e,t)}var g=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){_(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){_(e)}else _(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){_(e)}},e}(),w=function(e){function t(t,r,n){var o,i,s=e.call(this)||this;a(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:s&&d.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},o={next:t.next&&D(t.next,i),error:t.error&&D(t.error,i),complete:t.complete&&D(t.complete,i)}):o=t;return s.destination=new g(o),s}return r(t,e),t}(I);function _(e){var t;t=e,b.setTimeout((function(){throw t}))}var S={closed:!0,next:h,error:function(e){throw e},complete:h},x="function"==typeof Symbol&&Symbol.observable||"@@observable";function T(e){return e}var P=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,i=(n=e)&&n instanceof I||function(e){return e&&a(e.next)&&a(e.error)&&a(e.complete)}(n)&&f(n)?e:new w(e,t,r);return y((function(){var e=o,t=e.operator,r=e.source;i.add(t?t.call(i,r):r?o._subscribe(i):o._trySubscribe(i))})),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=O(t))((function(t,n){var o=new w({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[x]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(0===(e=t).length?T:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=O(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function O(e){var t;return null!==(t=null!=e?e:d.Promise)&&void 0!==t?t:Promise}var E=s((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),A=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return r(t,e),t.prototype.lift=function(e){var t=new C(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new E},t.prototype.next=function(e){var t=this;y((function(){var r,o;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=n(t.currentObservers),a=i.next();!a.done;a=i.next()){a.value.next(e)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}}}))},t.prototype.error=function(e){var t=this;y((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}}))},t.prototype.complete=function(){var e=this;y((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this,n=r.hasError,o=r.isStopped,i=r.observers;return n||o?l:(this.currentObservers=null,i.push(e),new p((function(){t.currentObservers=null,c(i,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,o=t.isStopped;r?e.error(n):o&&e.complete()},t.prototype.asObservable=function(){var e=new P;return e.source=this,e},t.create=function(e,t){return new C(e,t)},t}(P),C=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return r(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:l},t}(A),M=0;var z=function(){return"operation-".concat(++M)},k={},j=function(e){var t=e.operationID,r=e.operation,n=e.autoDelete,o=void 0===n||n;return k[t]={operation:r,autoDelete:o},r},L=function(e){delete k[e]},N=function(e){var t=e.data,r=t.operationID;if(r){var n=function(e){var t=k[e],r=t.operation;return t.autoDelete&&delete k[e],r||null}(r);n&&n.next(t.arg||(null==t?void 0:t.error))}},F=function(e){window.parent.postMessage(e,"*")},V=function(){var e;if("undefined"==typeof window)return null;var t=window.location.search;return null!==(e=new URLSearchParams(t).get("appID"))&&void 0!==e?e:null},R=function(e){var t=e.fieldName,r=e.onChange,n=V();if(n){var o=z(),i="fieldName-".concat(n),a={appID:n,operationID:o,operationType:"addFieldListener",arg:{fieldName:t,operationID:i,operationType:"onFieldChanged"}},s=new A;j({operationID:o,operation:s});var u=new A;u.subscribe((function(e){var t=e.fieldValue;r(t)})),j({operationID:i,operation:u,autoDelete:!1}),F(a)}},U=Object.freeze({__proto__:null,addFieldListener:R,addSelectedItemListener:function(e){var t=e.onChange,r=V();if(r){var n=z(),o="selectedItem-".concat(r),i={appID:r,operationID:n,operationType:"addSelectedItemListener",arg:{operationID:o,operationType:"onSelectedItemChange"}},a=new A;j({operationID:n,operation:a});var s=new A;s.subscribe((function(e){var r=e.selectedItems;t(r)})),j({operationID:o,operation:s,autoDelete:!1}),F(i)}},getContentItem:function(){var e=V();if(e){var t=z(),r={appID:e,operationID:t,operationType:"getContentItem"},n=new A,o=new Promise((function(e){n.subscribe((function(t){e(t),n.unsubscribe()}))}));return j({operationID:t,operation:n}),F(r),o}},getSelectedItems:function(){var e=V();if(e){var t=z(),r={appID:e,operationID:t,operationType:"getSelectedItems"},n=new A,o=new Promise((function(e){n.subscribe((function(t){var r=t.selectedItems;e(r),n.unsubscribe()}))}));return j({operationID:t,operation:n}),F(r),o}},removeFieldListener:function(e){var t=e.fieldName,r=V();if(r){var n=z(),o={appID:r,operationID:n,operationType:"removeFieldListener",arg:{fieldName:t,operationID:"fieldName-".concat(r)}},i=new A;i.subscribe((function(e){var t=e.removeOperationID;L(t),i.unsubscribe()})),j({operationID:n,operation:i}),F(o)}},removeSelectedItemListener:function(){var e=V();if(e){var t=z(),r={appID:e,operationID:t,operationType:"removeSelectedItemListener",arg:{operationID:"selectedItem-".concat(e)}},n=new A;n.subscribe((function(e){var t=e.removeOperationID;L(t),n.unsubscribe()})),j({operationID:t,operation:n}),F(r)}},setFieldValue:function(e){var t=e.name,r=e.value,n=V();if(n){var o=z(),i={appID:n,operationID:o,operationType:"setFieldValue",arg:{name:t,value:r}},a=new A;j({operationID:o,operation:a}),F(i)}}}),B=Object.freeze({__proto__:null,persistData:function(e){var t=e.key,r=e.value,n=V();if(n){var o=z(),i={appID:n,operationID:o,operationType:"persistData",arg:{key:t,value:r}},a=new A,s=new Promise((function(e,t){a.subscribe((function(t){e(t),a.unsubscribe()}))}));return j({operationID:o,operation:a}),F(i),s}},updateConfigurationValue:function(e){var t=e.name,r=e.value,n=V();if(n){var o=z(),i={appID:n,operationID:o,operationType:"updateConfigurationValue",arg:{name:t,value:r}},a=new A,s=new Promise((function(e){a.subscribe((function(t){e(t),a.unsubscribe()}))}));return j({operationID:o,operation:a}),F(i),s}}}),H=Object.freeze({__proto__:null,selectAssets:function(e){var t=e.title,r=e.singleSelectOnly,n=e.callback,o=V();if(o){var i=z(),a=z(),s={appID:o,operationID:i,operationType:"selectAssets",arg:{closeModalID:a,title:t,singleSelectOnly:r}},u=new A;j({operationID:i,operation:u});var c=new A;c.subscribe((function(e){var t=e.assets;n(t),c.unsubscribe()})),j({operationID:a,operation:c}),F(s)}}}),K=Object.freeze({__proto__:null,getPageItem:function(){var e=V();if(e){var t=z(),r={appID:e,operationID:t,operationType:"getPageItem"},n=new A,o=new Promise((function(e){n.subscribe((function(t){e(t),n.unsubscribe()}))}));return j({operationID:t,operation:n}),F(r),o}}}),Y=function(e){var t=e.height,r=V();if(r){var n=z(),o={appID:r,operationID:n,operationType:"setHeight",arg:{height:t}},i=new A;j({operationID:n,operation:i}),F(o)}};exports.assetsMethods=H,exports.closeModal=function(e){var t=V(),r=function(){var e;if("undefined"==typeof window)return null;var t=window.location.search;return null!==(e=new URLSearchParams(t).get("closeModalID"))&&void 0!==e?e:null}();if(t&&r){var n=z();F({appID:t,operationID:n,operationType:"closeModal",arg:{closeModalID:r,props:e}})}},exports.configMethods=B,exports.contentItemMethods=U,exports.getAPIKey=function(e){var t=e.apiType,r=V();if(r){var n=z(),o={appID:r,operationID:n,operationType:"getAPIKey",arg:{apiType:t}},i=new A,a=new Promise((function(e){i.subscribe((function(t){var r=t.apiKey;e(r),i.unsubscribe()}))}));return j({operationID:n,operation:i}),F(o),a}},exports.getAppInstall=function(){var e=V();if(!e)return null;var t=z(),r={appID:e,operationID:t,operationType:"getAppInstall"},n=new A,o=new Promise((function(e,t){n.subscribe((function(t){e(t),n.unsubscribe()}))}));return j({operationID:t,operation:n}),F(r),o},exports.getManagementAPIToken=function(){var e=V();if(e){var t=z(),r={appID:e,operationID:t,operationType:"getManagementAPIToken"},n=new A,o=new Promise((function(e){n.subscribe((function(t){var r=t.token;e(r),n.unsubscribe()}))}));return j({operationID:t,operation:n}),F(r),o}},exports.openAlertModal=function(e){var t=e.title,r=e.message,n=e.okButtonText,o=e.cancelButtonText,i=e.iconName,a=void 0===i?"":i,s=e.iconColor,u=void 0===s?"":s,c=e.callback,p=V();if(p){var l=z(),f=z(),v={appID:p,operationID:l,operationType:"openAlertModal",arg:{closeModalID:f,title:t,message:r,okButtonText:n,cancelButtonText:o,iconName:a,iconColor:u}},d=new A;j({operationID:l,operation:d});var b=new A;b.subscribe((function(e){c(null==e?void 0:e.ok),b.unsubscribe()})),j({operationID:f,operation:b}),F(v)}},exports.openModal=function(e){var t=e.name,r=e.title,n=e.props,o=e.callback,i=V();if(i){var a=z(),s=z(),u={appID:i,operationID:a,operationType:"openModal",arg:{closeModalID:s,title:r||null,name:t,props:n}},c=new A;j({operationID:a,operation:c});var p=new A;p.subscribe((function(e){o(null==e?void 0:e.props),p.unsubscribe()})),j({operationID:s,operation:p}),F(u)}},exports.pageMethods=K,exports.refresh=function(){var e=V();if(e){var t=z(),r={appID:e,operationID:t,operationType:"refresh"},n=new A;j({operationID:t,operation:n}),F(r)}},exports.setExtraConfigValues=function(e){var t=V();if(t){var r=z(),n={appID:t,operationID:r,operationType:"setExtraConfigValues",arg:e},o=new A,i=new Promise((function(e,t){o.subscribe((function(t){e(t),o.unsubscribe()}))}));return j({operationID:r,operation:o}),F(n),i}},exports.setHeight=Y,exports.setVisibility=function(e){var t=e.fieldID,r=e.visibility,n=V();if(n){var o=z(),i={appID:n,operationID:o,operationType:"setVisibility",arg:{fieldID:t,visibility:r}},a=new A;j({operationID:o,operation:a}),F(i)}},exports.useAgilityAppSDK=function(){var t=e.useState(!0),r=t[0],n=t[1],o=e.useState(null),i=o[0],a=o[1],s=e.useState(null),u=s[0],c=s[1],p=e.useState(null),l=p[0],f=p[1],v=e.useState(null),d=v[0],b=v[1],h=e.useState(null),y=h[0],I=h[1],m=e.useState(null),D=m[0],g=m[1],w=e.useState(null),_=w[0];w[1];var S=e.useState(""),x=S[0],T=S[1],P=e.useState(null),O=P[0],E=P[1];return e.useEffect((function(){var e=V();if(e){var t=new A;t.subscribe((function(e){var r,o;e&&(a(e.app),c(e.instance),f(e.locale),b(e.field||null),g(e.contentItem||null),I(e.contentModel||null),E(e.modalProps||null),e.field&&(T((null===(r=e.contentItem)||void 0===r?void 0:r.values[e.field.name])||""),R({fieldName:null===(o=e.field)||void 0===o?void 0:o.name,onChange:function(e){T(e||"")}})),n(!1),t.unsubscribe())}));var r=z();return j({operationID:r,operation:t}),window.addEventListener("message",N,!1),F({appID:e,operationID:r,operationType:"initialize"}),function(){removeEventListener("message",N,!1)}}}),[]),{initializing:r,appInstallContext:i,instance:u,locale:l,field:d,contentItem:D,contentModel:y,pageItem:_,modalProps:O,fieldValue:x}},exports.useAgilityPreInstall=function(){var t=e.useState(!0),r=t[0],n=t[1],o=e.useState(null),i=o[0],a=o[1],s=e.useState(null),u=s[0];s[1];var c=e.useState(null),p=c[0];return c[1],e.useEffect((function(){var e=V();if(e){var t=new A;t.subscribe((function(e){e&&(a(e.app),n(!1),t.unsubscribe())}));var r=z();return j({operationID:r,operation:t}),window.addEventListener("message",N,!1),F({appID:e,operationID:r,operationType:"preInstall"}),function(){removeEventListener("message",N,!1)}}}),[]),{initializing:r,appInstallContext:i,instance:u,locale:p}},exports.useResizeHeight=function(t,r){void 0===r&&(r=0),e.useEffect((function(){var e=null==t?void 0:t.current;if(e){var n=new ResizeObserver((function(e){var t=e[0];t&&Y({height:t.contentRect.height+r})}));return n.observe(e),function(){return n.disconnect()}}}),[null==t?void 0:t.current])};
"use strict";var e=require("react"),t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},t(e,r)};function r(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}function n(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function o(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function i(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function a(e){return"function"==typeof e}function s(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var u=s((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function c(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var p=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,s,c;if(!this.closed){this.closed=!0;var p=this._parentage;if(p)if(this._parentage=null,Array.isArray(p))try{for(var l=n(p),f=l.next();!f.done;f=l.next()){f.value.remove(this)}}catch(t){e={error:t}}finally{try{f&&!f.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}else p.remove(this);var d=this.initialTeardown;if(a(d))try{d()}catch(e){c=e instanceof u?e.errors:[e]}var b=this._finalizers;if(b){this._finalizers=null;try{for(var h=n(b),y=h.next();!y.done;y=h.next()){var I=y.value;try{v(I)}catch(e){c=null!=c?c:[],e instanceof u?c=i(i([],o(c)),o(e.errors)):c.push(e)}}}catch(e){r={error:e}}finally{try{y&&!y.done&&(s=h.return)&&s.call(h)}finally{if(r)throw r.error}}}if(c)throw new u(c)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)v(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&c(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&c(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),l=p.EMPTY;function f(e){return e instanceof p||e&&"closed"in e&&a(e.remove)&&a(e.add)&&a(e.unsubscribe)}function v(e){a(e)?e():e.unsubscribe()}var d={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},b={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var a=b.delegate;return(null==a?void 0:a.setTimeout)?a.setTimeout.apply(a,i([e,t],o(r))):setTimeout.apply(void 0,i([e,t],o(r)))},clearTimeout:function(e){var t=b.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function h(){}function y(e){e()}var I=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,f(t)&&t.add(r)):r.destination=S,r}return r(t,e),t.create=function(e,t,r){return new w(e,t,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(p),m=Function.prototype.bind;function D(e,t){return m.call(e,t)}var g=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){_(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){_(e)}else _(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){_(e)}},e}(),w=function(e){function t(t,r,n){var o,i,s=e.call(this)||this;a(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:s&&d.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},o={next:t.next&&D(t.next,i),error:t.error&&D(t.error,i),complete:t.complete&&D(t.complete,i)}):o=t;return s.destination=new g(o),s}return r(t,e),t}(I);function _(e){var t;t=e,b.setTimeout((function(){throw t}))}var S={closed:!0,next:h,error:function(e){throw e},complete:h},x="function"==typeof Symbol&&Symbol.observable||"@@observable";function T(e){return e}var P=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,i=(n=e)&&n instanceof I||function(e){return e&&a(e.next)&&a(e.error)&&a(e.complete)}(n)&&f(n)?e:new w(e,t,r);return y((function(){var e=o,t=e.operator,r=e.source;i.add(t?t.call(i,r):r?o._subscribe(i):o._trySubscribe(i))})),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=O(t))((function(t,n){var o=new w({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[x]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(0===(e=t).length?T:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=O(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function O(e){var t;return null!==(t=null!=e?e:d.Promise)&&void 0!==t?t:Promise}var E=s((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),A=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return r(t,e),t.prototype.lift=function(e){var t=new C(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new E},t.prototype.next=function(e){var t=this;y((function(){var r,o;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=n(t.currentObservers),a=i.next();!a.done;a=i.next()){a.value.next(e)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}}}))},t.prototype.error=function(e){var t=this;y((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}}))},t.prototype.complete=function(){var e=this;y((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this,n=r.hasError,o=r.isStopped,i=r.observers;return n||o?l:(this.currentObservers=null,i.push(e),new p((function(){t.currentObservers=null,c(i,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,o=t.isStopped;r?e.error(n):o&&e.complete()},t.prototype.asObservable=function(){var e=new P;return e.source=this,e},t.create=function(e,t){return new C(e,t)},t}(P),C=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return r(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:l},t}(A),M=0;var z=function(){return"operation-".concat(++M)},k={},j=function(e){var t=e.operationID,r=e.operation,n=e.autoDelete,o=void 0===n||n;return k[t]={operation:r,autoDelete:o},r},L=function(e){delete k[e]},N=function(e){var t=e.data,r=t.operationID;if(r){var n=function(e){var t=k[e],r=t.operation;return t.autoDelete&&delete k[e],r||null}(r);n&&n.next(t.arg||(null==t?void 0:t.error))}},F=function(e){window.parent.postMessage(e,"*")},V=function(){var e;if("undefined"==typeof window)return null;var t=window.location.search;return null!==(e=new URLSearchParams(t).get("appID"))&&void 0!==e?e:null},R=function(e){var t=e.fieldName,r=e.onChange,n=V();if(n){var o=z(),i="fieldName-".concat(n),a={appID:n,operationID:o,operationType:"addFieldListener",arg:{fieldName:t,operationID:i,operationType:"onFieldChanged"}},s=new A;j({operationID:o,operation:s});var u=new A;u.subscribe((function(e){var t=e.fieldValue;r(t)})),j({operationID:i,operation:u,autoDelete:!1}),F(a)}},U=Object.freeze({__proto__:null,addFieldListener:R,addSelectedItemListener:function(e){var t=e.onChange,r=V();if(r){var n=z(),o="selectedItem-".concat(r),i={appID:r,operationID:n,operationType:"addSelectedItemListener",arg:{operationID:o,operationType:"onSelectedItemChange"}},a=new A;j({operationID:n,operation:a});var s=new A;s.subscribe((function(e){var r=e.selectedItems;t(r)})),j({operationID:o,operation:s,autoDelete:!1}),F(i)}},getContentItem:function(){var e=V();if(e){var t=z(),r={appID:e,operationID:t,operationType:"getContentItem"},n=new A,o=new Promise((function(e){n.subscribe((function(t){e(t),n.unsubscribe()}))}));return j({operationID:t,operation:n}),F(r),o}},getSelectedItems:function(){var e=V();if(e){var t=z(),r={appID:e,operationID:t,operationType:"getSelectedItems"},n=new A,o=new Promise((function(e){n.subscribe((function(t){var r=t.selectedItems;e(r),n.unsubscribe()}))}));return j({operationID:t,operation:n}),F(r),o}},removeFieldListener:function(e){var t=e.fieldName,r=V();if(r){var n=z(),o={appID:r,operationID:n,operationType:"removeFieldListener",arg:{fieldName:t,operationID:"fieldName-".concat(r)}},i=new A;i.subscribe((function(e){var t=e.removeOperationID;L(t),i.unsubscribe()})),j({operationID:n,operation:i}),F(o)}},removeSelectedItemListener:function(){var e=V();if(e){var t=z(),r={appID:e,operationID:t,operationType:"removeSelectedItemListener",arg:{operationID:"selectedItem-".concat(e)}},n=new A;n.subscribe((function(e){var t=e.removeOperationID;L(t),n.unsubscribe()})),j({operationID:t,operation:n}),F(r)}},setFieldValue:function(e){var t=e.name,r=e.value,n=V();if(n){var o=z(),i={appID:n,operationID:o,operationType:"setFieldValue",arg:{name:t,value:r}},a=new A;j({operationID:o,operation:a}),F(i)}}}),B=Object.freeze({__proto__:null,persistData:function(e){var t=e.key,r=e.value,n=V();if(n){var o=z(),i={appID:n,operationID:o,operationType:"persistData",arg:{key:t,value:r}},a=new A,s=new Promise((function(e,t){a.subscribe((function(t){e(t),a.unsubscribe()}))}));return j({operationID:o,operation:a}),F(i),s}},updateConfigurationValue:function(e){var t=e.name,r=e.value,n=V();if(n){var o=z(),i={appID:n,operationID:o,operationType:"updateConfigurationValue",arg:{name:t,value:r}},a=new A,s=new Promise((function(e){a.subscribe((function(t){e(t),a.unsubscribe()}))}));return j({operationID:o,operation:a}),F(i),s}}}),H=Object.freeze({__proto__:null,selectAssets:function(e){var t=e.title,r=e.singleSelectOnly,n=e.callback,o=V();if(o){var i=z(),a=z(),s={appID:o,operationID:i,operationType:"selectAssets",arg:{closeModalID:a,title:t,singleSelectOnly:r}},u=new A;j({operationID:i,operation:u});var c=new A;c.subscribe((function(e){var t=e.assets;n(t),c.unsubscribe()})),j({operationID:a,operation:c}),F(s)}}}),K=Object.freeze({__proto__:null,getPageItem:function(){var e=V();if(e){var t=z(),r={appID:e,operationID:t,operationType:"getPageItem"},n=new A,o=new Promise((function(e){n.subscribe((function(t){e(t),n.unsubscribe()}))}));return j({operationID:t,operation:n}),F(r),o}}}),Y=function(e){var t=e.height,r=V();if(r){var n=z(),o={appID:r,operationID:n,operationType:"setHeight",arg:{height:t}},i=new A;j({operationID:n,operation:i}),F(o)}};exports.assetsMethods=H,exports.closeModal=function(e){var t=V(),r=function(){var e;if("undefined"==typeof window)return null;var t=window.location.search;return null!==(e=new URLSearchParams(t).get("closeModalID"))&&void 0!==e?e:null}();if(t&&r){var n=z();F({appID:t,operationID:n,operationType:"closeModal",arg:{closeModalID:r,props:e}})}},exports.configMethods=B,exports.contentItemMethods=U,exports.getAPIKey=function(e){var t=e.apiType,r=V();if(r){var n=z(),o={appID:r,operationID:n,operationType:"getAPIKey",arg:{apiType:t}},i=new A,a=new Promise((function(e){i.subscribe((function(t){var r=t.apiKey;e(r),i.unsubscribe()}))}));return j({operationID:n,operation:i}),F(o),a}},exports.getAppInstall=function(){var e=V();if(!e)return null;var t=z(),r={appID:e,operationID:t,operationType:"getAppInstall"},n=new A,o=new Promise((function(e,t){n.subscribe((function(t){e(t),n.unsubscribe()}))}));return j({operationID:t,operation:n}),F(r),o},exports.getManagementAPIToken=function(){var e=V();if(e){var t=z(),r={appID:e,operationID:t,operationType:"getManagementAPIToken"},n=new A,o=new Promise((function(e){n.subscribe((function(t){var r=t.token;e(r),n.unsubscribe()}))}));return j({operationID:t,operation:n}),F(r),o}},exports.openAlertModal=function(e){var t=e.title,r=e.message,n=e.okButtonText,o=e.cancelButtonText,i=e.iconName,a=void 0===i?"":i,s=e.iconColor,u=void 0===s?"":s,c=e.callback,p=V();if(p){var l=z(),f=z(),v={appID:p,operationID:l,operationType:"openAlertModal",arg:{closeModalID:f,title:t,message:r,okButtonText:n,cancelButtonText:o,iconName:a,iconColor:u}},d=new A;j({operationID:l,operation:d});var b=new A;b.subscribe((function(e){c(null==e?void 0:e.ok),b.unsubscribe()})),j({operationID:f,operation:b}),F(v)}},exports.openModal=function(e){var t=e.name,r=e.title,n=e.props,o=e.callback,i=V();if(i){var a=z(),s=z(),u={appID:i,operationID:a,operationType:"openModal",arg:{closeModalID:s,title:r||null,name:t,props:n}},c=new A;j({operationID:a,operation:c});var p=new A;p.subscribe((function(e){o(null==e?void 0:e.props),p.unsubscribe()})),j({operationID:s,operation:p}),F(u)}},exports.pageMethods=K,exports.refresh=function(){var e=V();if(e){var t=z(),r={appID:e,operationID:t,operationType:"refresh"},n=new A;j({operationID:t,operation:n}),F(r)}},exports.setExtraConfigValues=function(e){var t=V();if(t){var r=z(),n={appID:t,operationID:r,operationType:"setExtraConfigValues",arg:e},o=new A,i=new Promise((function(e,t){o.subscribe((function(t){e(t),o.unsubscribe()}))}));return j({operationID:r,operation:o}),F(n),i}},exports.setHeight=Y,exports.setVisibility=function(e){var t=e.fieldID,r=e.visibility,n=V();if(n){var o=z(),i={appID:n,operationID:o,operationType:"setVisibility",arg:{fieldID:t,visibility:r}},a=new A;j({operationID:o,operation:a}),F(i)}},exports.useAgilityAppSDK=function(){var t=e.useState(!0),r=t[0],n=t[1],o=e.useState(null),i=o[0],a=o[1],s=e.useState(null),u=s[0],c=s[1],p=e.useState(null),l=p[0],f=p[1],v=e.useState(null),d=v[0],b=v[1],h=e.useState(null),y=h[0],I=h[1],m=e.useState(null),D=m[0],g=m[1],w=e.useState(null),_=w[0];w[1];var S=e.useState(""),x=S[0],T=S[1],P=e.useState(null),O=P[0],E=P[1];return e.useEffect((function(){var e=V();if(e){var t=new A;t.subscribe((function(e){var r,o;e&&(a(e.app),c(e.instance),f(e.locale),b(e.field||null),g(e.contentItem||null),I(e.contentModel||null),E(e.modalProps||null),e.field&&(T((null===(r=e.contentItem)||void 0===r?void 0:r.values[e.field.name])||""),R({fieldName:null===(o=e.field)||void 0===o?void 0:o.name,onChange:function(e){T(e||"")}})),n(!1),t.unsubscribe())}));var r=z();return j({operationID:r,operation:t}),window.addEventListener("message",N,!1),F({appID:e,operationID:r,operationType:"initialize"}),function(){removeEventListener("message",N,!1)}}}),[]),{initializing:r,appInstallContext:i,instance:u,locale:l,field:d,contentItem:D,contentModel:y,pageItem:_,modalProps:O,fieldValue:x}},exports.useAgilityPreInstall=function(){var t=e.useState(!0),r=t[0],n=t[1],o=e.useState(null),i=o[0],a=o[1],s=e.useState(null),u=s[0];s[1];var c=e.useState(null),p=c[0];return c[1],e.useEffect((function(){var e=V();if(e){var t=new A;t.subscribe((function(e){e&&(a(e.app),n(!1),t.unsubscribe())}));var r=z();return j({operationID:r,operation:t}),window.addEventListener("message",N,!1),F({appID:e,operationID:r,operationType:"preInstall"}),function(){removeEventListener("message",N,!1)}}}),[]),{initializing:r,appInstallContext:i,instance:u,locale:p}},exports.useResizeHeight=function(t){var r=t.ref,n=t.padding,o=void 0===n?0:n;e.useEffect((function(){var e=null==r?void 0:r.current;if(e){var t=new ResizeObserver((function(e){var t=e[0];t&&Y({height:t.contentRect.height+o})}));return t.observe(e),function(){return t.disconnect()}}}),[null==r?void 0:r.current])};
//# sourceMappingURL=index.js.map
import { RefObject } from "react";
interface Props {
ref: RefObject<HTMLElement>;
padding?: number;
}
/**

@@ -7,3 +11,3 @@ * useResizeHeight detects the height of the current ref object, and triggers the setHeight method to update the Content Manager

*/
declare const useResizeHeight: (ref: RefObject<HTMLElement>, padding?: number) => void;
declare const useResizeHeight: ({ ref, padding }: Props) => void;
export default useResizeHeight;

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

import{useState as e,useEffect as t}from"react";var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},r(e,t)};function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function o(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function a(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function u(e){return"function"==typeof e}function s(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var c=s((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function p(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var l=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,s;if(!this.closed){this.closed=!0;var p=this._parentage;if(p)if(this._parentage=null,Array.isArray(p))try{for(var l=o(p),f=l.next();!f.done;f=l.next()){f.value.remove(this)}}catch(t){e={error:t}}finally{try{f&&!f.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}else p.remove(this);var v=this.initialTeardown;if(u(v))try{v()}catch(e){s=e instanceof c?e.errors:[e]}var b=this._finalizers;if(b){this._finalizers=null;try{for(var h=o(b),y=h.next();!y.done;y=h.next()){var I=y.value;try{d(I)}catch(e){s=null!=s?s:[],e instanceof c?s=a(a([],i(s)),i(e.errors)):s.push(e)}}}catch(e){r={error:e}}finally{try{y&&!y.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}}if(s)throw new c(s)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)d(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&p(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&p(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),f=l.EMPTY;function v(e){return e instanceof l||e&&"closed"in e&&u(e.remove)&&u(e.add)&&u(e.unsubscribe)}function d(e){u(e)?e():e.unsubscribe()}var b={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},h={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=h.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,a([e,t],i(r))):setTimeout.apply(void 0,a([e,t],i(r)))},clearTimeout:function(e){var t=h.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function y(){}function I(e){e()}var m=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,v(t)&&t.add(r)):r.destination=T,r}return n(t,e),t.create=function(e,t,r){return new _(e,t,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(l),D=Function.prototype.bind;function w(e,t){return D.call(e,t)}var g=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){S(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){S(e)}else S(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){S(e)}},e}(),_=function(e){function t(t,r,n){var o,i,a=e.call(this)||this;u(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:a&&b.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return a.unsubscribe()},o={next:t.next&&w(t.next,i),error:t.error&&w(t.error,i),complete:t.complete&&w(t.complete,i)}):o=t;return a.destination=new g(o),a}return n(t,e),t}(m);function S(e){var t;t=e,h.setTimeout((function(){throw t}))}var T={closed:!0,next:y,error:function(e){throw e},complete:y},x="function"==typeof Symbol&&Symbol.observable||"@@observable";function O(e){return e}var P=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,i=(n=e)&&n instanceof m||function(e){return e&&u(e.next)&&u(e.error)&&u(e.complete)}(n)&&v(n)?e:new _(e,t,r);return I((function(){var e=o,t=e.operator,r=e.source;i.add(t?t.call(i,r):r?o._subscribe(i):o._trySubscribe(i))})),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=E(t))((function(t,n){var o=new _({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[x]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(0===(e=t).length?O:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=E(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function E(e){var t;return null!==(t=null!=e?e:b.Promise)&&void 0!==t?t:Promise}var C=s((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),A=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return n(t,e),t.prototype.lift=function(e){var t=new M(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new C},t.prototype.next=function(e){var t=this;I((function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=o(t.currentObservers),a=i.next();!a.done;a=i.next()){a.value.next(e)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}}))},t.prototype.error=function(e){var t=this;I((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}}))},t.prototype.complete=function(){var e=this;I((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this,n=r.hasError,o=r.isStopped,i=r.observers;return n||o?f:(this.currentObservers=null,i.push(e),new l((function(){t.currentObservers=null,p(i,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,o=t.isStopped;r?e.error(n):o&&e.complete()},t.prototype.asObservable=function(){var e=new P;return e.source=this,e},t.create=function(e,t){return new M(e,t)},t}(P),M=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return n(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:f},t}(A),z=0;var j=function(){return"operation-".concat(++z)},k={},L=function(e){var t=e.operationID,r=e.operation,n=e.autoDelete,o=void 0===n||n;return k[t]={operation:r,autoDelete:o},r},N=function(e){delete k[e]},F=function(e){var t=e.data,r=t.operationID;if(r){var n=function(e){var t=k[e],r=t.operation;return t.autoDelete&&delete k[e],r||null}(r);n&&n.next(t.arg||(null==t?void 0:t.error))}},V=function(e){window.parent.postMessage(e,"*")},U=function(){var e;if("undefined"==typeof window)return null;var t=window.location.search;return null!==(e=new URLSearchParams(t).get("appID"))&&void 0!==e?e:null},B=function(e){var t=e.fieldName,r=e.onChange,n=U();if(n){var o=j(),i="fieldName-".concat(n),a={appID:n,operationID:o,operationType:"addFieldListener",arg:{fieldName:t,operationID:i,operationType:"onFieldChanged"}},u=new A;L({operationID:o,operation:u});var s=new A;s.subscribe((function(e){var t=e.fieldValue;r(t)})),L({operationID:i,operation:s,autoDelete:!1}),V(a)}},R=Object.freeze({__proto__:null,addFieldListener:B,addSelectedItemListener:function(e){var t=e.onChange,r=U();if(r){var n=j(),o="selectedItem-".concat(r),i={appID:r,operationID:n,operationType:"addSelectedItemListener",arg:{operationID:o,operationType:"onSelectedItemChange"}},a=new A;L({operationID:n,operation:a});var u=new A;u.subscribe((function(e){var r=e.selectedItems;t(r)})),L({operationID:o,operation:u,autoDelete:!1}),V(i)}},getContentItem:function(){var e=U();if(e){var t=j(),r={appID:e,operationID:t,operationType:"getContentItem"},n=new A,o=new Promise((function(e){n.subscribe((function(t){e(t),n.unsubscribe()}))}));return L({operationID:t,operation:n}),V(r),o}},getSelectedItems:function(){var e=U();if(e){var t=j(),r={appID:e,operationID:t,operationType:"getSelectedItems"},n=new A,o=new Promise((function(e){n.subscribe((function(t){var r=t.selectedItems;e(r),n.unsubscribe()}))}));return L({operationID:t,operation:n}),V(r),o}},removeFieldListener:function(e){var t=e.fieldName,r=U();if(r){var n=j(),o={appID:r,operationID:n,operationType:"removeFieldListener",arg:{fieldName:t,operationID:"fieldName-".concat(r)}},i=new A;i.subscribe((function(e){var t=e.removeOperationID;N(t),i.unsubscribe()})),L({operationID:n,operation:i}),V(o)}},removeSelectedItemListener:function(){var e=U();if(e){var t=j(),r={appID:e,operationID:t,operationType:"removeSelectedItemListener",arg:{operationID:"selectedItem-".concat(e)}},n=new A;n.subscribe((function(e){var t=e.removeOperationID;N(t),n.unsubscribe()})),L({operationID:t,operation:n}),V(r)}},setFieldValue:function(e){var t=e.name,r=e.value,n=U();if(n){var o=j(),i={appID:n,operationID:o,operationType:"setFieldValue",arg:{name:t,value:r}},a=new A;L({operationID:o,operation:a}),V(i)}}}),H=function(){var r=e(!0),n=r[0],o=r[1],i=e(null),a=i[0],u=i[1],s=e(null),c=s[0],p=s[1],l=e(null),f=l[0],v=l[1],d=e(null),b=d[0],h=d[1],y=e(null),I=y[0],m=y[1],D=e(null),w=D[0],g=D[1],_=e(null),S=_[0];_[1];var T=e(""),x=T[0],O=T[1],P=e(null),E=P[0],C=P[1];return t((function(){var e=U();if(e){var t=new A;t.subscribe((function(e){var r,n;e&&(u(e.app),p(e.instance),v(e.locale),h(e.field||null),g(e.contentItem||null),m(e.contentModel||null),C(e.modalProps||null),e.field&&(O((null===(r=e.contentItem)||void 0===r?void 0:r.values[e.field.name])||""),B({fieldName:null===(n=e.field)||void 0===n?void 0:n.name,onChange:function(e){O(e||"")}})),o(!1),t.unsubscribe())}));var r=j();return L({operationID:r,operation:t}),window.addEventListener("message",F,!1),V({appID:e,operationID:r,operationType:"initialize"}),function(){removeEventListener("message",F,!1)}}}),[]),{initializing:n,appInstallContext:a,instance:c,locale:f,field:b,contentItem:w,contentModel:I,pageItem:S,modalProps:E,fieldValue:x}},K=function(){var r=e(!0),n=r[0],o=r[1],i=e(null),a=i[0],u=i[1],s=e(null),c=s[0];s[1];var p=e(null),l=p[0];return p[1],t((function(){var e=U();if(e){var t=new A;t.subscribe((function(e){e&&(u(e.app),o(!1),t.unsubscribe())}));var r=j();return L({operationID:r,operation:t}),window.addEventListener("message",F,!1),V({appID:e,operationID:r,operationType:"preInstall"}),function(){removeEventListener("message",F,!1)}}}),[]),{initializing:n,appInstallContext:a,instance:c,locale:l}},Y=Object.freeze({__proto__:null,persistData:function(e){var t=e.key,r=e.value,n=U();if(n){var o=j(),i={appID:n,operationID:o,operationType:"persistData",arg:{key:t,value:r}},a=new A,u=new Promise((function(e,t){a.subscribe((function(t){e(t),a.unsubscribe()}))}));return L({operationID:o,operation:a}),V(i),u}},updateConfigurationValue:function(e){var t=e.name,r=e.value,n=U();if(n){var o=j(),i={appID:n,operationID:o,operationType:"updateConfigurationValue",arg:{name:t,value:r}},a=new A,u=new Promise((function(e){a.subscribe((function(t){e(t),a.unsubscribe()}))}));return L({operationID:o,operation:a}),V(i),u}}}),q=Object.freeze({__proto__:null,selectAssets:function(e){var t=e.title,r=e.singleSelectOnly,n=e.callback,o=U();if(o){var i=j(),a=j(),u={appID:o,operationID:i,operationType:"selectAssets",arg:{closeModalID:a,title:t,singleSelectOnly:r}},s=new A;L({operationID:i,operation:s});var c=new A;c.subscribe((function(e){var t=e.assets;n(t),c.unsubscribe()})),L({operationID:a,operation:c}),V(u)}}}),G=Object.freeze({__proto__:null,getPageItem:function(){var e=U();if(e){var t=j(),r={appID:e,operationID:t,operationType:"getPageItem"},n=new A,o=new Promise((function(e){n.subscribe((function(t){e(t),n.unsubscribe()}))}));return L({operationID:t,operation:n}),V(r),o}}}),J=function(e){var t=e.height,r=U();if(r){var n=j(),o={appID:r,operationID:n,operationType:"setHeight",arg:{height:t}},i=new A;L({operationID:n,operation:i}),V(o)}},Q=function(e){var t=e.title,r=e.message,n=e.okButtonText,o=e.cancelButtonText,i=e.iconName,a=void 0===i?"":i,u=e.iconColor,s=void 0===u?"":u,c=e.callback,p=U();if(p){var l=j(),f=j(),v={appID:p,operationID:l,operationType:"openAlertModal",arg:{closeModalID:f,title:t,message:r,okButtonText:n,cancelButtonText:o,iconName:a,iconColor:s}},d=new A;L({operationID:l,operation:d});var b=new A;b.subscribe((function(e){c(null==e?void 0:e.ok),b.unsubscribe()})),L({operationID:f,operation:b}),V(v)}},W=function(e){var t=e.name,r=e.title,n=e.props,o=e.callback,i=U();if(i){var a=j(),u=j(),s={appID:i,operationID:a,operationType:"openModal",arg:{closeModalID:u,title:r||null,name:t,props:n}},c=new A;L({operationID:a,operation:c});var p=new A;p.subscribe((function(e){o(null==e?void 0:e.props),p.unsubscribe()})),L({operationID:u,operation:p}),V(s)}},X=function(e){var t=U(),r=function(){var e;if("undefined"==typeof window)return null;var t=window.location.search;return null!==(e=new URLSearchParams(t).get("closeModalID"))&&void 0!==e?e:null}();if(t&&r){var n=j();V({appID:t,operationID:n,operationType:"closeModal",arg:{closeModalID:r,props:e}})}},Z=function(){var e=U();if(!e)return null;var t=j(),r={appID:e,operationID:t,operationType:"getAppInstall"},n=new A,o=new Promise((function(e,t){n.subscribe((function(t){e(t),n.unsubscribe()}))}));return L({operationID:t,operation:n}),V(r),o},$=function(){var e=U();if(e){var t=j(),r={appID:e,operationID:t,operationType:"refresh"},n=new A;L({operationID:t,operation:n}),V(r)}},ee=function(e){var t=e.fieldID,r=e.visibility,n=U();if(n){var o=j(),i={appID:n,operationID:o,operationType:"setVisibility",arg:{fieldID:t,visibility:r}},a=new A;L({operationID:o,operation:a}),V(i)}},te=function(e){var t=U();if(t){var r=j(),n={appID:t,operationID:r,operationType:"setExtraConfigValues",arg:e},o=new A,i=new Promise((function(e,t){o.subscribe((function(t){e(t),o.unsubscribe()}))}));return L({operationID:r,operation:o}),V(n),i}},re=function(){var e=U();if(e){var t=j(),r={appID:e,operationID:t,operationType:"getManagementAPIToken"},n=new A,o=new Promise((function(e){n.subscribe((function(t){var r=t.token;e(r),n.unsubscribe()}))}));return L({operationID:t,operation:n}),V(r),o}},ne=function(e){var t=e.apiType,r=U();if(r){var n=j(),o={appID:r,operationID:n,operationType:"getAPIKey",arg:{apiType:t}},i=new A,a=new Promise((function(e){i.subscribe((function(t){var r=t.apiKey;e(r),i.unsubscribe()}))}));return L({operationID:n,operation:i}),V(o),a}},oe=function(e,r){void 0===r&&(r=0),t((function(){var t=null==e?void 0:e.current;if(t){var n=new ResizeObserver((function(e){var t=e[0];t&&J({height:t.contentRect.height+r})}));return n.observe(t),function(){return n.disconnect()}}}),[null==e?void 0:e.current])};export{q as assetsMethods,X as closeModal,Y as configMethods,R as contentItemMethods,ne as getAPIKey,Z as getAppInstall,re as getManagementAPIToken,Q as openAlertModal,W as openModal,G as pageMethods,$ as refresh,te as setExtraConfigValues,J as setHeight,ee as setVisibility,H as useAgilityAppSDK,K as useAgilityPreInstall,oe as useResizeHeight};
import{useState as e,useEffect as t}from"react";var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},r(e,t)};function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function o(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function a(e,t,r){if(r||2===arguments.length)for(var n,o=0,i=t.length;o<i;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}function u(e){return"function"==typeof e}function s(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var c=s((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function p(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var l=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,r,n,s;if(!this.closed){this.closed=!0;var p=this._parentage;if(p)if(this._parentage=null,Array.isArray(p))try{for(var l=o(p),f=l.next();!f.done;f=l.next()){f.value.remove(this)}}catch(t){e={error:t}}finally{try{f&&!f.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}else p.remove(this);var v=this.initialTeardown;if(u(v))try{v()}catch(e){s=e instanceof c?e.errors:[e]}var b=this._finalizers;if(b){this._finalizers=null;try{for(var h=o(b),y=h.next();!y.done;y=h.next()){var I=y.value;try{d(I)}catch(e){s=null!=s?s:[],e instanceof c?s=a(a([],i(s)),i(e.errors)):s.push(e)}}}catch(e){r={error:e}}finally{try{y&&!y.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}}if(s)throw new c(s)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)d(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&p(t,e)},e.prototype.remove=function(t){var r=this._finalizers;r&&p(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),f=l.EMPTY;function v(e){return e instanceof l||e&&"closed"in e&&u(e.remove)&&u(e.add)&&u(e.unsubscribe)}function d(e){u(e)?e():e.unsubscribe()}var b={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},h={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=h.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,a([e,t],i(r))):setTimeout.apply(void 0,a([e,t],i(r)))},clearTimeout:function(e){var t=h.delegate;return((null==t?void 0:t.clearTimeout)||clearTimeout)(e)},delegate:void 0};function y(){}function I(e){e()}var m=function(e){function t(t){var r=e.call(this)||this;return r.isStopped=!1,t?(r.destination=t,v(t)&&t.add(r)):r.destination=T,r}return n(t,e),t.create=function(e,t,r){return new _(e,t,r)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(l),D=Function.prototype.bind;function w(e,t){return D.call(e,t)}var g=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){S(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){S(e)}else S(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){S(e)}},e}(),_=function(e){function t(t,r,n){var o,i,a=e.call(this)||this;u(t)||!t?o={next:null!=t?t:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:a&&b.useDeprecatedNextContext?((i=Object.create(t)).unsubscribe=function(){return a.unsubscribe()},o={next:t.next&&w(t.next,i),error:t.error&&w(t.error,i),complete:t.complete&&w(t.complete,i)}):o=t;return a.destination=new g(o),a}return n(t,e),t}(m);function S(e){var t;t=e,h.setTimeout((function(){throw t}))}var T={closed:!0,next:y,error:function(e){throw e},complete:y},x="function"==typeof Symbol&&Symbol.observable||"@@observable";function O(e){return e}var P=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n,o=this,i=(n=e)&&n instanceof m||function(e){return e&&u(e.next)&&u(e.error)&&u(e.complete)}(n)&&v(n)?e:new _(e,t,r);return I((function(){var e=o,t=e.operator,r=e.source;i.add(t?t.call(i,r):r?o._subscribe(i):o._trySubscribe(i))})),i},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=E(t))((function(t,n){var o=new _({next:function(t){try{e(t)}catch(e){n(e),o.unsubscribe()}},error:n,complete:t});r.subscribe(o)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[x]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return(0===(e=t).length?O:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=E(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function E(e){var t;return null!==(t=null!=e?e:b.Promise)&&void 0!==t?t:Promise}var C=s((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),A=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return n(t,e),t.prototype.lift=function(e){var t=new M(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new C},t.prototype.next=function(e){var t=this;I((function(){var r,n;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=o(t.currentObservers),a=i.next();!a.done;a=i.next()){a.value.next(e)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}}}))},t.prototype.error=function(e){var t=this;I((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var r=t.observers;r.length;)r.shift().error(e)}}))},t.prototype.complete=function(){var e=this;I((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,r=this,n=r.hasError,o=r.isStopped,i=r.observers;return n||o?f:(this.currentObservers=null,i.push(e),new l((function(){t.currentObservers=null,p(i,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,r=t.hasError,n=t.thrownError,o=t.isStopped;r?e.error(n):o&&e.complete()},t.prototype.asObservable=function(){var e=new P;return e.source=this,e},t.create=function(e,t){return new M(e,t)},t}(P),M=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return n(t,e),t.prototype.next=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===r||r.call(t,e)},t.prototype.error=function(e){var t,r;null===(r=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===r||r.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,r;return null!==(r=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==r?r:f},t}(A),z=0;var j=function(){return"operation-".concat(++z)},k={},L=function(e){var t=e.operationID,r=e.operation,n=e.autoDelete,o=void 0===n||n;return k[t]={operation:r,autoDelete:o},r},N=function(e){delete k[e]},F=function(e){var t=e.data,r=t.operationID;if(r){var n=function(e){var t=k[e],r=t.operation;return t.autoDelete&&delete k[e],r||null}(r);n&&n.next(t.arg||(null==t?void 0:t.error))}},V=function(e){window.parent.postMessage(e,"*")},U=function(){var e;if("undefined"==typeof window)return null;var t=window.location.search;return null!==(e=new URLSearchParams(t).get("appID"))&&void 0!==e?e:null},B=function(e){var t=e.fieldName,r=e.onChange,n=U();if(n){var o=j(),i="fieldName-".concat(n),a={appID:n,operationID:o,operationType:"addFieldListener",arg:{fieldName:t,operationID:i,operationType:"onFieldChanged"}},u=new A;L({operationID:o,operation:u});var s=new A;s.subscribe((function(e){var t=e.fieldValue;r(t)})),L({operationID:i,operation:s,autoDelete:!1}),V(a)}},R=Object.freeze({__proto__:null,addFieldListener:B,addSelectedItemListener:function(e){var t=e.onChange,r=U();if(r){var n=j(),o="selectedItem-".concat(r),i={appID:r,operationID:n,operationType:"addSelectedItemListener",arg:{operationID:o,operationType:"onSelectedItemChange"}},a=new A;L({operationID:n,operation:a});var u=new A;u.subscribe((function(e){var r=e.selectedItems;t(r)})),L({operationID:o,operation:u,autoDelete:!1}),V(i)}},getContentItem:function(){var e=U();if(e){var t=j(),r={appID:e,operationID:t,operationType:"getContentItem"},n=new A,o=new Promise((function(e){n.subscribe((function(t){e(t),n.unsubscribe()}))}));return L({operationID:t,operation:n}),V(r),o}},getSelectedItems:function(){var e=U();if(e){var t=j(),r={appID:e,operationID:t,operationType:"getSelectedItems"},n=new A,o=new Promise((function(e){n.subscribe((function(t){var r=t.selectedItems;e(r),n.unsubscribe()}))}));return L({operationID:t,operation:n}),V(r),o}},removeFieldListener:function(e){var t=e.fieldName,r=U();if(r){var n=j(),o={appID:r,operationID:n,operationType:"removeFieldListener",arg:{fieldName:t,operationID:"fieldName-".concat(r)}},i=new A;i.subscribe((function(e){var t=e.removeOperationID;N(t),i.unsubscribe()})),L({operationID:n,operation:i}),V(o)}},removeSelectedItemListener:function(){var e=U();if(e){var t=j(),r={appID:e,operationID:t,operationType:"removeSelectedItemListener",arg:{operationID:"selectedItem-".concat(e)}},n=new A;n.subscribe((function(e){var t=e.removeOperationID;N(t),n.unsubscribe()})),L({operationID:t,operation:n}),V(r)}},setFieldValue:function(e){var t=e.name,r=e.value,n=U();if(n){var o=j(),i={appID:n,operationID:o,operationType:"setFieldValue",arg:{name:t,value:r}},a=new A;L({operationID:o,operation:a}),V(i)}}}),H=function(){var r=e(!0),n=r[0],o=r[1],i=e(null),a=i[0],u=i[1],s=e(null),c=s[0],p=s[1],l=e(null),f=l[0],v=l[1],d=e(null),b=d[0],h=d[1],y=e(null),I=y[0],m=y[1],D=e(null),w=D[0],g=D[1],_=e(null),S=_[0];_[1];var T=e(""),x=T[0],O=T[1],P=e(null),E=P[0],C=P[1];return t((function(){var e=U();if(e){var t=new A;t.subscribe((function(e){var r,n;e&&(u(e.app),p(e.instance),v(e.locale),h(e.field||null),g(e.contentItem||null),m(e.contentModel||null),C(e.modalProps||null),e.field&&(O((null===(r=e.contentItem)||void 0===r?void 0:r.values[e.field.name])||""),B({fieldName:null===(n=e.field)||void 0===n?void 0:n.name,onChange:function(e){O(e||"")}})),o(!1),t.unsubscribe())}));var r=j();return L({operationID:r,operation:t}),window.addEventListener("message",F,!1),V({appID:e,operationID:r,operationType:"initialize"}),function(){removeEventListener("message",F,!1)}}}),[]),{initializing:n,appInstallContext:a,instance:c,locale:f,field:b,contentItem:w,contentModel:I,pageItem:S,modalProps:E,fieldValue:x}},K=function(){var r=e(!0),n=r[0],o=r[1],i=e(null),a=i[0],u=i[1],s=e(null),c=s[0];s[1];var p=e(null),l=p[0];return p[1],t((function(){var e=U();if(e){var t=new A;t.subscribe((function(e){e&&(u(e.app),o(!1),t.unsubscribe())}));var r=j();return L({operationID:r,operation:t}),window.addEventListener("message",F,!1),V({appID:e,operationID:r,operationType:"preInstall"}),function(){removeEventListener("message",F,!1)}}}),[]),{initializing:n,appInstallContext:a,instance:c,locale:l}},Y=Object.freeze({__proto__:null,persistData:function(e){var t=e.key,r=e.value,n=U();if(n){var o=j(),i={appID:n,operationID:o,operationType:"persistData",arg:{key:t,value:r}},a=new A,u=new Promise((function(e,t){a.subscribe((function(t){e(t),a.unsubscribe()}))}));return L({operationID:o,operation:a}),V(i),u}},updateConfigurationValue:function(e){var t=e.name,r=e.value,n=U();if(n){var o=j(),i={appID:n,operationID:o,operationType:"updateConfigurationValue",arg:{name:t,value:r}},a=new A,u=new Promise((function(e){a.subscribe((function(t){e(t),a.unsubscribe()}))}));return L({operationID:o,operation:a}),V(i),u}}}),q=Object.freeze({__proto__:null,selectAssets:function(e){var t=e.title,r=e.singleSelectOnly,n=e.callback,o=U();if(o){var i=j(),a=j(),u={appID:o,operationID:i,operationType:"selectAssets",arg:{closeModalID:a,title:t,singleSelectOnly:r}},s=new A;L({operationID:i,operation:s});var c=new A;c.subscribe((function(e){var t=e.assets;n(t),c.unsubscribe()})),L({operationID:a,operation:c}),V(u)}}}),G=Object.freeze({__proto__:null,getPageItem:function(){var e=U();if(e){var t=j(),r={appID:e,operationID:t,operationType:"getPageItem"},n=new A,o=new Promise((function(e){n.subscribe((function(t){e(t),n.unsubscribe()}))}));return L({operationID:t,operation:n}),V(r),o}}}),J=function(e){var t=e.height,r=U();if(r){var n=j(),o={appID:r,operationID:n,operationType:"setHeight",arg:{height:t}},i=new A;L({operationID:n,operation:i}),V(o)}},Q=function(e){var t=e.title,r=e.message,n=e.okButtonText,o=e.cancelButtonText,i=e.iconName,a=void 0===i?"":i,u=e.iconColor,s=void 0===u?"":u,c=e.callback,p=U();if(p){var l=j(),f=j(),v={appID:p,operationID:l,operationType:"openAlertModal",arg:{closeModalID:f,title:t,message:r,okButtonText:n,cancelButtonText:o,iconName:a,iconColor:s}},d=new A;L({operationID:l,operation:d});var b=new A;b.subscribe((function(e){c(null==e?void 0:e.ok),b.unsubscribe()})),L({operationID:f,operation:b}),V(v)}},W=function(e){var t=e.name,r=e.title,n=e.props,o=e.callback,i=U();if(i){var a=j(),u=j(),s={appID:i,operationID:a,operationType:"openModal",arg:{closeModalID:u,title:r||null,name:t,props:n}},c=new A;L({operationID:a,operation:c});var p=new A;p.subscribe((function(e){o(null==e?void 0:e.props),p.unsubscribe()})),L({operationID:u,operation:p}),V(s)}},X=function(e){var t=U(),r=function(){var e;if("undefined"==typeof window)return null;var t=window.location.search;return null!==(e=new URLSearchParams(t).get("closeModalID"))&&void 0!==e?e:null}();if(t&&r){var n=j();V({appID:t,operationID:n,operationType:"closeModal",arg:{closeModalID:r,props:e}})}},Z=function(){var e=U();if(!e)return null;var t=j(),r={appID:e,operationID:t,operationType:"getAppInstall"},n=new A,o=new Promise((function(e,t){n.subscribe((function(t){e(t),n.unsubscribe()}))}));return L({operationID:t,operation:n}),V(r),o},$=function(){var e=U();if(e){var t=j(),r={appID:e,operationID:t,operationType:"refresh"},n=new A;L({operationID:t,operation:n}),V(r)}},ee=function(e){var t=e.fieldID,r=e.visibility,n=U();if(n){var o=j(),i={appID:n,operationID:o,operationType:"setVisibility",arg:{fieldID:t,visibility:r}},a=new A;L({operationID:o,operation:a}),V(i)}},te=function(e){var t=U();if(t){var r=j(),n={appID:t,operationID:r,operationType:"setExtraConfigValues",arg:e},o=new A,i=new Promise((function(e,t){o.subscribe((function(t){e(t),o.unsubscribe()}))}));return L({operationID:r,operation:o}),V(n),i}},re=function(){var e=U();if(e){var t=j(),r={appID:e,operationID:t,operationType:"getManagementAPIToken"},n=new A,o=new Promise((function(e){n.subscribe((function(t){var r=t.token;e(r),n.unsubscribe()}))}));return L({operationID:t,operation:n}),V(r),o}},ne=function(e){var t=e.apiType,r=U();if(r){var n=j(),o={appID:r,operationID:n,operationType:"getAPIKey",arg:{apiType:t}},i=new A,a=new Promise((function(e){i.subscribe((function(t){var r=t.apiKey;e(r),i.unsubscribe()}))}));return L({operationID:n,operation:i}),V(o),a}},oe=function(e){var r=e.ref,n=e.padding,o=void 0===n?0:n;t((function(){var e=null==r?void 0:r.current;if(e){var t=new ResizeObserver((function(e){var t=e[0];t&&J({height:t.contentRect.height+o})}));return t.observe(e),function(){return t.disconnect()}}}),[null==r?void 0:r.current])};export{q as assetsMethods,X as closeModal,Y as configMethods,R as contentItemMethods,ne as getAPIKey,Z as getAppInstall,re as getManagementAPIToken,Q as openAlertModal,W as openModal,G as pageMethods,$ as refresh,te as setExtraConfigValues,J as setHeight,ee as setVisibility,H as useAgilityAppSDK,K as useAgilityPreInstall,oe as useResizeHeight};
//# sourceMappingURL=index.js.map
import { RefObject } from "react";
interface Props {
ref: RefObject<HTMLElement>;
padding?: number;
}
/**

@@ -7,3 +11,3 @@ * useResizeHeight detects the height of the current ref object, and triggers the setHeight method to update the Content Manager

*/
declare const useResizeHeight: (ref: RefObject<HTMLElement>, padding?: number) => void;
declare const useResizeHeight: ({ ref, padding }: Props) => void;
export default useResizeHeight;

@@ -414,3 +414,3 @@ import { RefObject } from 'react';

interface Props$3 {
interface Props$4 {
key: string;

@@ -425,3 +425,3 @@ value: string;

*/
declare const persistData: ({ key, value }: Props$3) => Promise<IAppDataPersistValue> | void;
declare const persistData: ({ key, value }: Props$4) => Promise<IAppDataPersistValue> | void;

@@ -445,3 +445,3 @@ declare const index_d$3_persistData: typeof persistData;

interface Props$2 {
interface Props$3 {
fieldName: string;

@@ -456,3 +456,3 @@ onChange: (fieldValue: any) => void;

*/
declare const addFieldListener: ({ fieldName, onChange }: Props$2) => void;
declare const addFieldListener: ({ fieldName, onChange }: Props$3) => void;

@@ -467,3 +467,3 @@ /**

interface Props$1 {
interface Props$2 {
fieldName: string;

@@ -477,3 +477,3 @@ }

*/
declare const removeFieldListener: ({ fieldName }: Props$1) => void;
declare const removeFieldListener: ({ fieldName }: Props$2) => void;

@@ -488,3 +488,3 @@ /**

interface Props {
interface Props$1 {
onChange: (fieldValue: any) => void;

@@ -498,3 +498,3 @@ }

*/
declare const addSelectedItemListener: ({ onChange }: Props) => void;
declare const addSelectedItemListener: ({ onChange }: Props$1) => void;

@@ -620,2 +620,6 @@ /**

interface Props {
ref: RefObject<HTMLElement>;
padding?: number;
}
/**

@@ -626,4 +630,4 @@ * useResizeHeight detects the height of the current ref object, and triggers the setHeight method to update the Content Manager

*/
declare const useResizeHeight: (ref: RefObject<HTMLElement>, padding?: number) => void;
declare const useResizeHeight: ({ ref, padding }: Props) => void;
export { APITypes, AgilityAddSKReturn, IAPIKeyParam, IAlertModalParam, IAppConfigValue, IAppDataPersistValue, IAppEventParam, IAppFieldValue, IAppHeightValue, IAppInstallContext, IAppInstallInfo, IAppSelectedItems, IAppVisibility, IAssetItem, IConfig, IContentItem, IContentModel, IContextParam, IField, IInstallApp, IInstallContext, IInstance, IModalParam, IPageItem, SelectedItem, index_d$1 as assetsMethods, closeModal, index_d$3 as configMethods, index_d$2 as contentItemMethods, getAPIKey, getAppInstall, getManagementAPIToken, openAlertModal, openModal, index_d as pageMethods, refresh, setExtraConfigValues, setHeight, setVisibility, useAgilityAppSDK, useAgilityPreInstall, useResizeHeight };
{
"name": "@agility/app-sdk",
"version": "2.0.3-rc1",
"version": "2.0.3-rc2",
"description": "JavaScript library for building Agility CMS apps.",

@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet