Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@agility/app-sdk

Package Overview
Dependencies
Maintainers
4
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 0.1.1 to 0.1.2

2

dist/agility-cms-app-sdk.browser.js

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("agilityAppSDK",[],t):"object"==typeof exports?exports.agilityAppSDK=t():e.agilityAppSDK=t()}("undefined"!=typeof self?self:this,(function(){return(()=>{var e={666:e=>{var t=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var o=t&&t.prototype instanceof y?t:y,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(e,t,r){var n=f;return function(o,i){if(n===p)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw i;return T()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=N(a,r);if(c){if(c===m)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var u=l(e,t,r);if("normal"===u.type){if(n=r.done?d:h,u.arg===m)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=d,r.method="throw",r.arg=u.arg)}}}(e,r,a),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var f="suspendedStart",h="suspendedYield",p="executing",d="completed",m={};function y(){}function g(){}function v(){}var _={};u(_,i,(function(){return this}));var O=Object.getPrototypeOf,w=O&&O(O(x([])));w&&w!==r&&n.call(w,i)&&(_=w);var b=v.prototype=y.prototype=Object.create(_);function P(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function L(e,t){function r(o,i,a,c){var u=l(e[o],e,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,a,c)}),(function(e){r("throw",e,a,c)})):t.resolve(f).then((function(e){s.value=e,a(s)}),(function(e){return r("throw",e,a,c)}))}c(u.arg)}var o;this._invoke=function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}}function N(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,N(e,r),"throw"===r.method))return m;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var o=l(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,m;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function x(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:T}}function T(){return{value:t,done:!0}}return g.prototype=v,u(b,"constructor",v),u(v,"constructor",g),g.displayName=u(v,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,u(e,c,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},P(L.prototype),u(L.prototype,a,(function(){return this})),e.AsyncIterator=L,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new L(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},P(b),u(b,c,"Generator"),u(b,i,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=x,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:x(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.d(n,{default:()=>I});var e={};r.r(e),r.d(e,{openFlyout:()=>h,subscribeToFieldValueChanges:()=>p,updateFieldValue:()=>f});var t={};r.r(t),r.d(t,{closeFlyout:()=>d});var o={};r.r(o),r.d(o,{initializeAppConfig:()=>O,initializeField:()=>w,initializeFlyout:()=>b,resolveAppComponent:()=>L,types:()=>i});const i={APP_LOCATION_CUSTOM_FIELD:"CustomField",APP_LOCATION_FLYOUT:"Flyout",APP_LOCATION_UNKNOWN:"Unknown",APP_LOCATION_APP_CONFIG:"AppConfig",APP_FLYOUT_SIZE_SMALL:"Small",APP_FLYOUT_SIZE_LARGE:"Small"};var a=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(window.location.search);return null===t?"":decodeURIComponent(t[1].replace(/\+/g," "))},c=function(e){return e.location+"_"+e.fieldName+"_"+e.fieldID},u=function(e){var t=e.containerRef,r=e.messageID;setInterval((function(){!function(e){var t=e.height,r=e.messageID;window.parent&&window.parent.postMessage({message:t,type:"setHeight_for_".concat(r)},"*")}({height:t.current?t.current.offsetHeight:t.offsetHeight,messageID:r})}),500)},s=function(e){var t=e.message,r=e.messageChannel;window.parent&&window.parent.postMessage({message:t,type:r},"*")},l=function(e){var t=e.messageChannel,r=e.persist,n=void 0!==r&&r;return new Promise((function(e){window.addEventListener("message",(function r(o){if(o.data.type===t)return n||removeEventListener("message",r,!1),void e(o.data.message)}),!1)}))},f=function(e){var t=e.fieldName,r=e.fieldValue,n=c({location:this.location,fieldName:this.fieldName,fieldID:this.fieldID});t||(t=this.fieldName),s({message:{fieldName:t,fieldValue:r},messageChannel:"setNewValue_for_".concat(n)})},h=function(e){var t=e.title,r=e.size,n=e.name,o=e.onClose,a=e.params,u=c({location:i.APP_LOCATION_CUSTOM_FIELD,fieldID:this.fieldID,fieldName:this.fieldName});s({message:{title:t,size:r,name:n,params:a},messageChannel:"openFlyout_for_".concat(u)}),l({messageChannel:"closeFlyoutCallback_for_".concat(u)}).then((function(e){o(e)}))},p=function(e){var t=e.fieldName,r=e.onChange,n=c({fieldID:this.fieldID,fieldName:this.fieldName,location:this.location});l({messageChannel:"otherValueChanged_".concat(t,"_for_").concat(n),persist:!0}).then((function(e){r(e)})),s({message:t,messageChannel:"subscribeToOtherValueChanges_".concat(n)})},d=function(e){var t=e.params,r=i.APP_LOCATION_CUSTOM_FIELD,n=c({location:r,fieldID:this.fieldID,fieldName:this.fieldName});s({message:{location:r,fieldName:this.fieldName,fieldID:this.fieldID,params:t},messageChannel:"closeFlyout_for_".concat(n)})};function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function y(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){g(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function g(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function v(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function _(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){v(i,n,o,a,c,"next",e)}function c(e){v(i,n,o,a,c,"throw",e)}a(void 0)}))}}r(666);var O=function(e){var t=a("appDefinitionID");s({message:e,messageChannel:"setAppConfig_for_".concat(t)})},w=function(){var e=_(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.containerRef,e.next=3,P({containerRef:r,location:i.APP_LOCATION_CUSTOM_FIELD});case 3:return n=e.sent,e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),b=function(){var e=_(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.containerRef,e.next=3,P({containerRef:r,location:i.APP_LOCATION_FLYOUT});case 3:return n=e.sent,e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),P=function(){var r=_(regeneratorRuntime.mark((function r(n){var o,f;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return o=n.containerRef,f=n.location,r.abrupt("return",new Promise((function(r){var n=a("fieldID"),h=a("fieldName"),p=c({location:f,fieldName:h,fieldID:n});u({containerRef:o,messageID:p}),l({messageChannel:"setInitialProps_for_".concat(p)}).then((function(n){n.location=f;var o={};f===i.APP_LOCATION_CUSTOM_FIELD?o=e:f===i.APP_LOCATION_FLYOUT&&(o=t),r(y(y({},n),o))})),s({message:"ready",messageChannel:"ready_for_".concat(p)})})));case 2:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}(),L=function(e){var t=N(),r=e.appComponents.find((function(e){return e.location===t.location&&(!t.name||e.name===t.name)}));if(r)return r.componentToRender;console.error("Could not render the '"+e.name+"' component for '"+t.location+"' with the name of '"+t.name+"'")},N=function(){var e=a("location");return e===i.APP_LOCATION_CUSTOM_FIELD?{location:e,name:a("fieldTypeName")}:e===i.APP_LOCATION_APP_CONFIG?{location:e}:e===i.APP_LOCATION_FLYOUT?{location:e,name:a("flyoutName")}:{location:i.APP_LOCATION_UNKNOWN,name:null}};const I=o})(),n.default})()}));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("agilityAppSDK",[],t):"object"==typeof exports?exports.agilityAppSDK=t():e.agilityAppSDK=t()}("undefined"!=typeof self?self:this,(function(){return(()=>{var e={187:(e,t,r)=>{"use strict";r.d(t,{default:()=>A});var n={};r.r(n),r.d(n,{openFlyout:()=>p,subscribeToFieldValueChanges:()=>d,updateFieldValue:()=>h});var o={};r.r(o),r.d(o,{closeFlyout:()=>m});var i={};r.r(i),r.d(i,{initializeAppConfig:()=>b,initializeField:()=>P,initializeFlyout:()=>L,resolveAppComponent:()=>I,sdkVersion:()=>y.i8,types:()=>a});const a={APP_LOCATION_CUSTOM_FIELD:"CustomField",APP_LOCATION_FLYOUT:"Flyout",APP_LOCATION_UNKNOWN:"Unknown",APP_LOCATION_APP_CONFIG:"AppConfig",APP_FLYOUT_SIZE_SMALL:"Small",APP_FLYOUT_SIZE_LARGE:"Small"};var c=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(window.location.search);return null===t?"":decodeURIComponent(t[1].replace(/\+/g," "))},u=function(e){return e.location+"_"+e.fieldName+"_"+e.fieldID},s=function(e){var t=e.containerRef,r=e.messageID;setInterval((function(){!function(e){var t=e.height,r=e.messageID;window.parent&&window.parent.postMessage({message:t,type:"setHeight_for_".concat(r)},"*")}({height:t.current?t.current.offsetHeight:t.offsetHeight,messageID:r})}),500)},l=function(e){var t=e.message,r=e.messageChannel;window.parent&&window.parent.postMessage({message:t,type:r},"*")},f=function(e){var t=e.messageChannel,r=e.persist,n=void 0!==r&&r;return new Promise((function(e){window.addEventListener("message",(function r(o){if(o.data.type===t)return n||removeEventListener("message",r,!1),void e(o.data.message)}),!1)}))},h=function(e){var t=e.fieldName,r=e.fieldValue,n=u({location:this.location,fieldName:this.fieldName,fieldID:this.fieldID});t||(t=this.fieldName),l({message:{fieldName:t,fieldValue:r},messageChannel:"setNewValue_for_".concat(n)})},p=function(e){var t=e.title,r=e.size,n=e.name,o=e.onClose,i=e.params,c=u({location:a.APP_LOCATION_CUSTOM_FIELD,fieldID:this.fieldID,fieldName:this.fieldName});l({message:{title:t,size:r,name:n,params:i},messageChannel:"openFlyout_for_".concat(c)}),f({messageChannel:"closeFlyoutCallback_for_".concat(c)}).then((function(e){o(e)}))},d=function(e){var t=e.fieldName,r=e.onChange,n=u({fieldID:this.fieldID,fieldName:this.fieldName,location:this.location});f({messageChannel:"otherValueChanged_".concat(t,"_for_").concat(n),persist:!0}).then((function(e){r(e)})),l({message:t,messageChannel:"subscribeToOtherValueChanges_".concat(n)})},m=function(e){var t=e.params,r=a.APP_LOCATION_CUSTOM_FIELD,n=u({location:r,fieldID:this.fieldID,fieldName:this.fieldName});l({message:{location:r,fieldName:this.fieldName,fieldID:this.fieldID,params:t},messageChannel:"closeFlyout_for_".concat(n)})};r(666);const y={i8:"0.1.2"};function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function v(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?g(Object(r),!0).forEach((function(t){_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function O(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function w(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){O(i,n,o,a,c,"next",e)}function c(e){O(i,n,o,a,c,"throw",e)}a(void 0)}))}}var b=function(e){e.sdkVersion=y.i8;var t=c("appDefinitionID");l({message:e,messageChannel:"setAppConfig_for_".concat(t)})},P=function(){var e=w(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.containerRef,e.next=3,N({containerRef:r,location:a.APP_LOCATION_CUSTOM_FIELD});case 3:return n=e.sent,e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),L=function(){var e=w(regeneratorRuntime.mark((function e(t){var r,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.containerRef,e.next=3,N({containerRef:r,location:a.APP_LOCATION_FLYOUT});case 3:return n=e.sent,e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),N=function(){var e=w(regeneratorRuntime.mark((function e(t){var r,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.containerRef,i=t.location,e.abrupt("return",new Promise((function(e){var t=c("fieldID"),h=c("fieldName"),p=u({location:i,fieldName:h,fieldID:t});s({containerRef:r,messageID:p}),f({messageChannel:"setInitialProps_for_".concat(p)}).then((function(t){t.location=i;var r={};i===a.APP_LOCATION_CUSTOM_FIELD?r=n:i===a.APP_LOCATION_FLYOUT&&(r=o),e(v(v({},t),r))})),l({message:"ready",messageChannel:"ready_for_".concat(p)})})));case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),I=function(e){var t=C(),r=e.appComponents.find((function(e){return e.location===t.location&&(!t.name||e.name===t.name)}));if(r)return r.componentToRender;console.error("Could not render the '"+e.name+"' component for '"+t.location+"' with the name of '"+t.name+"'")},C=function(){var e=c("location");return e===a.APP_LOCATION_CUSTOM_FIELD?{location:e,name:c("fieldTypeName")}:e===a.APP_LOCATION_APP_CONFIG?{location:e}:e===a.APP_LOCATION_FLYOUT?{location:e,name:c("flyoutName")}:{location:a.APP_LOCATION_UNKNOWN,name:null}};const A=i},666:e=>{var t=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function s(e,t,r,n){var o=t&&t.prototype instanceof y?t:y,i=Object.create(o.prototype),a=new A(n||[]);return i._invoke=function(e,t,r){var n=f;return function(o,i){if(n===p)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw i;return T()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=N(a,r);if(c){if(c===m)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=p;var u=l(e,t,r);if("normal"===u.type){if(n=r.done?d:h,u.arg===m)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=d,r.method="throw",r.arg=u.arg)}}}(e,r,a),i}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var f="suspendedStart",h="suspendedYield",p="executing",d="completed",m={};function y(){}function g(){}function v(){}var _={};u(_,i,(function(){return this}));var O=Object.getPrototypeOf,w=O&&O(O(x([])));w&&w!==r&&n.call(w,i)&&(_=w);var b=v.prototype=y.prototype=Object.create(_);function P(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function L(e,t){function r(o,i,a,c){var u=l(e[o],e,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,a,c)}),(function(e){r("throw",e,a,c)})):t.resolve(f).then((function(e){s.value=e,a(s)}),(function(e){return r("throw",e,a,c)}))}c(u.arg)}var o;this._invoke=function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}}function N(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,N(e,r),"throw"===r.method))return m;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var o=l(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,m;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function I(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function C(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(I,this),this.reset(!0)}function x(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:T}}function T(){return{value:t,done:!0}}return g.prototype=v,u(b,"constructor",v),u(v,"constructor",g),g.displayName=u(v,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,u(e,c,"GeneratorFunction")),e.prototype=Object.create(b),e},e.awrap=function(e){return{__await:e}},P(L.prototype),u(L.prototype,a,(function(){return this})),e.AsyncIterator=L,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new L(s(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},P(b),u(b,c,"Generator"),u(b,i,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=x,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(C),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),C(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;C(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:x(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n=r(187);return n.default})()}));

@@ -14,2 +14,333 @@ (function webpackUniversalModuleDefinition(root, factory) {

/***/ 187:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": () => (/* binding */ src)
});
// NAMESPACE OBJECT: ./src/fields.js
var fields_namespaceObject = {};
__webpack_require__.r(fields_namespaceObject);
__webpack_require__.d(fields_namespaceObject, {
"openFlyout": () => (openFlyout),
"subscribeToFieldValueChanges": () => (subscribeToFieldValueChanges),
"updateFieldValue": () => (updateFieldValue)
});
// NAMESPACE OBJECT: ./src/flyouts.js
var flyouts_namespaceObject = {};
__webpack_require__.r(flyouts_namespaceObject);
__webpack_require__.d(flyouts_namespaceObject, {
"closeFlyout": () => (closeFlyout)
});
// NAMESPACE OBJECT: ./src/sdk.js
var sdk_namespaceObject = {};
__webpack_require__.r(sdk_namespaceObject);
__webpack_require__.d(sdk_namespaceObject, {
"initializeAppConfig": () => (initializeAppConfig),
"initializeField": () => (initializeField),
"initializeFlyout": () => (initializeFlyout),
"resolveAppComponent": () => (resolveAppComponent),
"sdkVersion": () => (package_namespaceObject.i8),
"types": () => (types)
});
;// CONCATENATED MODULE: ./src/types.js
/* harmony default export */ const types = ({
APP_LOCATION_CUSTOM_FIELD: 'CustomField',
APP_LOCATION_FLYOUT: 'Flyout',
APP_LOCATION_UNKNOWN: 'Unknown',
APP_LOCATION_APP_CONFIG: 'AppConfig',
APP_FLYOUT_SIZE_SMALL: 'Small',
APP_FLYOUT_SIZE_LARGE: 'Small' });
;// CONCATENATED MODULE: ./src/utils.js
var getUrlParameter = function getUrlParameter(name) {
//eslint-disable-next-line
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(window.location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
};
var getMessageID = function getMessageID(_ref) {var location = _ref.location,fieldName = _ref.fieldName,fieldID = _ref.fieldID;
return location + '_' + fieldName + '_' + fieldID;
};
var updateFieldHeight = function updateFieldHeight(_ref2) {var height = _ref2.height,messageID = _ref2.messageID;
if (window.parent) {
window.parent.postMessage({
message: height,
type: "setHeight_for_".concat(messageID) },
"*");
}
};
var autoSyncFieldHeight = function autoSyncFieldHeight(_ref3) {var containerRef = _ref3.containerRef,messageID = _ref3.messageID;
setInterval(function () {
updateFieldHeight({
height: containerRef.current ? containerRef.current.offsetHeight : containerRef.offsetHeight,
messageID: messageID });
}, 500);
};
;// CONCATENATED MODULE: ./src/messages.js
var notifyCMS = function notifyCMS(_ref) {var message = _ref.message,messageChannel = _ref.messageChannel;
if (window.parent) {
window.parent.postMessage({
message: message,
type: messageChannel },
"*");
}
};
var listenForCMS = function listenForCMS(_ref2) {var messageChannel = _ref2.messageChannel,_ref2$persist = _ref2.persist,persist = _ref2$persist === void 0 ? false : _ref2$persist;
return new Promise(function (resolve) {
var listener = function listener(e) {
//only care about these messages
if (e.data.type === messageChannel) {
if (!persist) {
removeEventListener("message", listener, false);
}
resolve(e.data.message);
return;
}
};
window.addEventListener("message", listener, false);
});
};
;// CONCATENATED MODULE: ./src/fields.js
var updateFieldValue = function updateFieldValue(_ref) {var fieldName = _ref.fieldName,fieldValue = _ref.fieldValue;
var messageID = getMessageID({
location: this.location,
fieldName: this.fieldName,
fieldID: this.fieldID });
if (!fieldName) {
fieldName = this.fieldName;
}
notifyCMS({
message: {
fieldName: fieldName,
fieldValue: fieldValue },
messageChannel: "setNewValue_for_".concat(messageID) });
};
var openFlyout = function openFlyout(_ref2) {var title = _ref2.title,size = _ref2.size,name = _ref2.name,onClose = _ref2.onClose,params = _ref2.params;
var messageID = getMessageID({
location: types.APP_LOCATION_CUSTOM_FIELD,
fieldID: this.fieldID,
fieldName: this.fieldName });
notifyCMS({
message: {
title: title,
size: size,
name: name,
params: params },
messageChannel: "openFlyout_for_".concat(messageID) });
listenForCMS({ messageChannel: "closeFlyoutCallback_for_".concat(messageID) }).then(function (message) {
onClose(message);
});
};
var subscribeToFieldValueChanges = function subscribeToFieldValueChanges(_ref3) {var fieldName = _ref3.fieldName,onChange = _ref3.onChange;
var messageID = getMessageID({
fieldID: this.fieldID,
fieldName: this.fieldName,
location: this.location });
listenForCMS({
messageChannel: "otherValueChanged_".concat(fieldName, "_for_").concat(messageID),
persist: true }).
then(function (message) {
onChange(message);
});
notifyCMS({
message: fieldName,
messageChannel: "subscribeToOtherValueChanges_".concat(messageID) });
};
;// CONCATENATED MODULE: ./src/flyouts.js
var closeFlyout = function closeFlyout(_ref) {var params = _ref.params;
var location = types.APP_LOCATION_CUSTOM_FIELD;
var messageID = getMessageID({
location: location,
fieldID: this.fieldID,
fieldName: this.fieldName });
notifyCMS({
message: {
location: location,
fieldName: this.fieldName,
fieldID: this.fieldID,
params: params },
messageChannel: "closeFlyout_for_".concat(messageID) });
};
// EXTERNAL MODULE: ./node_modules/regenerator-runtime/runtime.js
var runtime = __webpack_require__(666);
;// CONCATENATED MODULE: ./package.json
const package_namespaceObject = {"i8":"0.1.2"};
;// CONCATENATED MODULE: ./src/sdk.js
function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) {symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;});}keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {ownKeys(Object(source), true).forEach(function (key) {_defineProperty(target, key, source[key]);});} else if (Object.getOwnPropertyDescriptors) {Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));} else {ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}}return target;}function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {try {var info = gen[key](arg);var value = info.value;} catch (error) {reject(error);return;}if (info.done) {resolve(value);} else {Promise.resolve(value).then(_next, _throw);}}function _asyncToGenerator(fn) {return function () {var self = this,args = arguments;return new Promise(function (resolve, reject) {var gen = fn.apply(self, args);function _next(value) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);}function _throw(err) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);}_next(undefined);});};}
var initializeAppConfig = function initializeAppConfig(appConfig) {
//pass the sdk version to the CMS when setting the app config
appConfig.sdkVersion = package_namespaceObject.i8;
var appDefinitionID = getUrlParameter('appDefinitionID');
notifyCMS({ message: appConfig, messageChannel: "setAppConfig_for_".concat(appDefinitionID) });
};
var initializeField = /*#__PURE__*/function () {var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {var containerRef, fieldSDK;return regeneratorRuntime.wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0:containerRef = _ref.containerRef;_context.next = 3;return (
initializeAppComponent({ containerRef: containerRef, location: types.APP_LOCATION_CUSTOM_FIELD }));case 3:fieldSDK = _context.sent;return _context.abrupt("return",
fieldSDK);case 5:case "end":return _context.stop();}}}, _callee);}));return function initializeField(_x) {return _ref2.apply(this, arguments);};}();
var initializeFlyout = /*#__PURE__*/function () {var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(_ref3) {var containerRef, flyoutSDK;return regeneratorRuntime.wrap(function _callee2$(_context2) {while (1) {switch (_context2.prev = _context2.next) {case 0:containerRef = _ref3.containerRef;_context2.next = 3;return (
initializeAppComponent({ containerRef: containerRef, location: types.APP_LOCATION_FLYOUT }));case 3:flyoutSDK = _context2.sent;return _context2.abrupt("return",
flyoutSDK);case 5:case "end":return _context2.stop();}}}, _callee2);}));return function initializeFlyout(_x2) {return _ref4.apply(this, arguments);};}();
var initializeAppComponent = /*#__PURE__*/function () {var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(_ref5) {var containerRef, location;return regeneratorRuntime.wrap(function _callee3$(_context3) {while (1) {switch (_context3.prev = _context3.next) {case 0:containerRef = _ref5.containerRef, location = _ref5.location;return _context3.abrupt("return",
new Promise(function (resolve) {
var fieldID = getUrlParameter('fieldID');
var fieldName = getUrlParameter('fieldName');
var messageID = getMessageID({ location: location, fieldName: fieldName, fieldID: fieldID });
autoSyncFieldHeight({ containerRef: containerRef, messageID: messageID });
//get the field ready to wait for messages from the parent
//console.log(`${messageID} => Waiting for message from Agility CMS`)
//get the field ready to wait for messages from the parent
//console.log(`${messageID} => Waiting for message from Agility CMS`)
listenForCMS({ messageChannel: "setInitialProps_for_".concat(messageID) }).then(function (fieldInfo) {fieldInfo.location = location;
var availableMethods = {};
if (location === types.APP_LOCATION_CUSTOM_FIELD) {
availableMethods = fields_namespaceObject;
} else if (location === types.APP_LOCATION_FLYOUT) {
availableMethods = flyouts_namespaceObject;
}
//return our SDK for the appropriate UI component
//return our SDK for the appropriate UI component
resolve(_objectSpread(_objectSpread({}, fieldInfo),
availableMethods));
});
notifyCMS({ message: "ready", messageChannel: "ready_for_".concat(messageID) });
}));case 2:case "end":return _context3.stop();}}}, _callee3);}));return function initializeAppComponent(_x3) {return _ref6.apply(this, arguments);};}();
var resolveAppComponent = function resolveAppComponent(appConfig) {
var appLocation = getAppLocation();
var currentAppComponent = appConfig.appComponents.find(function (appComponent) {
return appComponent.location === appLocation.location && (!appLocation.name || appComponent.name === appLocation.name);
});
if (currentAppComponent) {
return currentAppComponent.componentToRender;
} else {
console.error("Could not render the '" + appConfig.name + "' component for '" + appLocation.location + "' with the name of '" + appLocation.name + "'");
}
};
var getAppLocation = function getAppLocation() {
var location = getUrlParameter('location');
if (location === types.APP_LOCATION_CUSTOM_FIELD) {
var fieldTypeName = getUrlParameter('fieldTypeName');
return {
location: location,
name: fieldTypeName };
} else if (location === types.APP_LOCATION_APP_CONFIG) {
return {
location: location };
} else if (location === types.APP_LOCATION_FLYOUT) {
var flyoutName = getUrlParameter('flyoutName');
return {
location: location,
name: flyoutName };
} else {
return {
location: types.APP_LOCATION_UNKNOWN,
name: null };
}
};
;// CONCATENATED MODULE: ./src/index.js
/* harmony default export */ const src = (sdk_namespaceObject);
/***/ }),
/***/ 666:

@@ -832,328 +1163,8 @@ /***/ ((module) => {

/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
(() => {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
"default": () => (/* binding */ src)
});
// NAMESPACE OBJECT: ./src/fields.js
var fields_namespaceObject = {};
__webpack_require__.r(fields_namespaceObject);
__webpack_require__.d(fields_namespaceObject, {
"openFlyout": () => (openFlyout),
"subscribeToFieldValueChanges": () => (subscribeToFieldValueChanges),
"updateFieldValue": () => (updateFieldValue)
});
// NAMESPACE OBJECT: ./src/flyouts.js
var flyouts_namespaceObject = {};
__webpack_require__.r(flyouts_namespaceObject);
__webpack_require__.d(flyouts_namespaceObject, {
"closeFlyout": () => (closeFlyout)
});
// NAMESPACE OBJECT: ./src/sdk.js
var sdk_namespaceObject = {};
__webpack_require__.r(sdk_namespaceObject);
__webpack_require__.d(sdk_namespaceObject, {
"initializeAppConfig": () => (initializeAppConfig),
"initializeField": () => (initializeField),
"initializeFlyout": () => (initializeFlyout),
"resolveAppComponent": () => (resolveAppComponent),
"types": () => (types)
});
;// CONCATENATED MODULE: ./src/types.js
/* harmony default export */ const types = ({
APP_LOCATION_CUSTOM_FIELD: 'CustomField',
APP_LOCATION_FLYOUT: 'Flyout',
APP_LOCATION_UNKNOWN: 'Unknown',
APP_LOCATION_APP_CONFIG: 'AppConfig',
APP_FLYOUT_SIZE_SMALL: 'Small',
APP_FLYOUT_SIZE_LARGE: 'Small' });
;// CONCATENATED MODULE: ./src/utils.js
var getUrlParameter = function getUrlParameter(name) {
//eslint-disable-next-line
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
var results = regex.exec(window.location.search);
return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));
};
var getMessageID = function getMessageID(_ref) {var location = _ref.location,fieldName = _ref.fieldName,fieldID = _ref.fieldID;
return location + '_' + fieldName + '_' + fieldID;
};
var updateFieldHeight = function updateFieldHeight(_ref2) {var height = _ref2.height,messageID = _ref2.messageID;
if (window.parent) {
window.parent.postMessage({
message: height,
type: "setHeight_for_".concat(messageID) },
"*");
}
};
var autoSyncFieldHeight = function autoSyncFieldHeight(_ref3) {var containerRef = _ref3.containerRef,messageID = _ref3.messageID;
setInterval(function () {
updateFieldHeight({
height: containerRef.current ? containerRef.current.offsetHeight : containerRef.offsetHeight,
messageID: messageID });
}, 500);
};
;// CONCATENATED MODULE: ./src/messages.js
var notifyCMS = function notifyCMS(_ref) {var message = _ref.message,messageChannel = _ref.messageChannel;
if (window.parent) {
window.parent.postMessage({
message: message,
type: messageChannel },
"*");
}
};
var listenForCMS = function listenForCMS(_ref2) {var messageChannel = _ref2.messageChannel,_ref2$persist = _ref2.persist,persist = _ref2$persist === void 0 ? false : _ref2$persist;
return new Promise(function (resolve) {
var listener = function listener(e) {
//only care about these messages
if (e.data.type === messageChannel) {
if (!persist) {
removeEventListener("message", listener, false);
}
resolve(e.data.message);
return;
}
};
window.addEventListener("message", listener, false);
});
};
;// CONCATENATED MODULE: ./src/fields.js
var updateFieldValue = function updateFieldValue(_ref) {var fieldName = _ref.fieldName,fieldValue = _ref.fieldValue;
var messageID = getMessageID({
location: this.location,
fieldName: this.fieldName,
fieldID: this.fieldID });
if (!fieldName) {
fieldName = this.fieldName;
}
notifyCMS({
message: {
fieldName: fieldName,
fieldValue: fieldValue },
messageChannel: "setNewValue_for_".concat(messageID) });
};
var openFlyout = function openFlyout(_ref2) {var title = _ref2.title,size = _ref2.size,name = _ref2.name,onClose = _ref2.onClose,params = _ref2.params;
var messageID = getMessageID({
location: types.APP_LOCATION_CUSTOM_FIELD,
fieldID: this.fieldID,
fieldName: this.fieldName });
notifyCMS({
message: {
title: title,
size: size,
name: name,
params: params },
messageChannel: "openFlyout_for_".concat(messageID) });
listenForCMS({ messageChannel: "closeFlyoutCallback_for_".concat(messageID) }).then(function (message) {
onClose(message);
});
};
var subscribeToFieldValueChanges = function subscribeToFieldValueChanges(_ref3) {var fieldName = _ref3.fieldName,onChange = _ref3.onChange;
var messageID = getMessageID({
fieldID: this.fieldID,
fieldName: this.fieldName,
location: this.location });
listenForCMS({
messageChannel: "otherValueChanged_".concat(fieldName, "_for_").concat(messageID),
persist: true }).
then(function (message) {
onChange(message);
});
notifyCMS({
message: fieldName,
messageChannel: "subscribeToOtherValueChanges_".concat(messageID) });
};
;// CONCATENATED MODULE: ./src/flyouts.js
var closeFlyout = function closeFlyout(_ref) {var params = _ref.params;
var location = types.APP_LOCATION_CUSTOM_FIELD;
var messageID = getMessageID({
location: location,
fieldID: this.fieldID,
fieldName: this.fieldName });
notifyCMS({
message: {
location: location,
fieldName: this.fieldName,
fieldID: this.fieldID,
params: params },
messageChannel: "closeFlyout_for_".concat(messageID) });
};
// EXTERNAL MODULE: ./node_modules/regenerator-runtime/runtime.js
var runtime = __webpack_require__(666);
;// CONCATENATED MODULE: ./src/sdk.js
function ownKeys(object, enumerableOnly) {var keys = Object.keys(object);if (Object.getOwnPropertySymbols) {var symbols = Object.getOwnPropertySymbols(object);if (enumerableOnly) {symbols = symbols.filter(function (sym) {return Object.getOwnPropertyDescriptor(object, sym).enumerable;});}keys.push.apply(keys, symbols);}return keys;}function _objectSpread(target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i] != null ? arguments[i] : {};if (i % 2) {ownKeys(Object(source), true).forEach(function (key) {_defineProperty(target, key, source[key]);});} else if (Object.getOwnPropertyDescriptors) {Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));} else {ownKeys(Object(source)).forEach(function (key) {Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));});}}return target;}function _defineProperty(obj, key, value) {if (key in obj) {Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true });} else {obj[key] = value;}return obj;}function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {try {var info = gen[key](arg);var value = info.value;} catch (error) {reject(error);return;}if (info.done) {resolve(value);} else {Promise.resolve(value).then(_next, _throw);}}function _asyncToGenerator(fn) {return function () {var self = this,args = arguments;return new Promise(function (resolve, reject) {var gen = fn.apply(self, args);function _next(value) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);}function _throw(err) {asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);}_next(undefined);});};}
var initializeAppConfig = function initializeAppConfig(appConfig) {
var appDefinitionID = getUrlParameter('appDefinitionID');
notifyCMS({ message: appConfig, messageChannel: "setAppConfig_for_".concat(appDefinitionID) });
};
var initializeField = /*#__PURE__*/function () {var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {var containerRef, fieldSDK;return regeneratorRuntime.wrap(function _callee$(_context) {while (1) {switch (_context.prev = _context.next) {case 0:containerRef = _ref.containerRef;_context.next = 3;return (
initializeAppComponent({ containerRef: containerRef, location: types.APP_LOCATION_CUSTOM_FIELD }));case 3:fieldSDK = _context.sent;return _context.abrupt("return",
fieldSDK);case 5:case "end":return _context.stop();}}}, _callee);}));return function initializeField(_x) {return _ref2.apply(this, arguments);};}();
var initializeFlyout = /*#__PURE__*/function () {var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(_ref3) {var containerRef, flyoutSDK;return regeneratorRuntime.wrap(function _callee2$(_context2) {while (1) {switch (_context2.prev = _context2.next) {case 0:containerRef = _ref3.containerRef;_context2.next = 3;return (
initializeAppComponent({ containerRef: containerRef, location: types.APP_LOCATION_FLYOUT }));case 3:flyoutSDK = _context2.sent;return _context2.abrupt("return",
flyoutSDK);case 5:case "end":return _context2.stop();}}}, _callee2);}));return function initializeFlyout(_x2) {return _ref4.apply(this, arguments);};}();
var initializeAppComponent = /*#__PURE__*/function () {var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(_ref5) {var containerRef, location;return regeneratorRuntime.wrap(function _callee3$(_context3) {while (1) {switch (_context3.prev = _context3.next) {case 0:containerRef = _ref5.containerRef, location = _ref5.location;return _context3.abrupt("return",
new Promise(function (resolve) {
var fieldID = getUrlParameter('fieldID');
var fieldName = getUrlParameter('fieldName');
var messageID = getMessageID({ location: location, fieldName: fieldName, fieldID: fieldID });
autoSyncFieldHeight({ containerRef: containerRef, messageID: messageID });
//get the field ready to wait for messages from the parent
//console.log(`${messageID} => Waiting for message from Agility CMS`)
//get the field ready to wait for messages from the parent
//console.log(`${messageID} => Waiting for message from Agility CMS`)
listenForCMS({ messageChannel: "setInitialProps_for_".concat(messageID) }).then(function (fieldInfo) {fieldInfo.location = location;
var availableMethods = {};
if (location === types.APP_LOCATION_CUSTOM_FIELD) {
availableMethods = fields_namespaceObject;
} else if (location === types.APP_LOCATION_FLYOUT) {
availableMethods = flyouts_namespaceObject;
}
//return our SDK for the appropriate UI component
//return our SDK for the appropriate UI component
resolve(_objectSpread(_objectSpread({}, fieldInfo),
availableMethods));
});
notifyCMS({ message: "ready", messageChannel: "ready_for_".concat(messageID) });
}));case 2:case "end":return _context3.stop();}}}, _callee3);}));return function initializeAppComponent(_x3) {return _ref6.apply(this, arguments);};}();
var resolveAppComponent = function resolveAppComponent(appConfig) {
var appLocation = getAppLocation();
var currentAppComponent = appConfig.appComponents.find(function (appComponent) {
return appComponent.location === appLocation.location && (!appLocation.name || appComponent.name === appLocation.name);
});
if (currentAppComponent) {
return currentAppComponent.componentToRender;
} else {
console.error("Could not render the '" + appConfig.name + "' component for '" + appLocation.location + "' with the name of '" + appLocation.name + "'");
}
};
var getAppLocation = function getAppLocation() {
var location = getUrlParameter('location');
if (location === types.APP_LOCATION_CUSTOM_FIELD) {
var fieldTypeName = getUrlParameter('fieldTypeName');
return {
location: location,
name: fieldTypeName };
} else if (location === types.APP_LOCATION_APP_CONFIG) {
return {
location: location };
} else if (location === types.APP_LOCATION_FLYOUT) {
var flyoutName = getUrlParameter('flyoutName');
return {
location: location,
name: flyoutName };
} else {
return {
location: types.APP_LOCATION_UNKNOWN,
name: null };
}
};
;// CONCATENATED MODULE: ./src/index.js
/* harmony default export */ const src = (sdk_namespaceObject);
})();
/******/
/******/ // startup
/******/ // Load entry module and return exports
/******/ // This entry module doesn't tell about it's top-level declarations so it can't be inlined
/******/ var __webpack_exports__ = __webpack_require__(187);
/******/
/******/ return __webpack_exports__;

@@ -1160,0 +1171,0 @@ /******/ })()

{
"name": "@agility/app-sdk",
"version": "0.1.1",
"version": "0.1.2",
"description": "JavaScript library for building Agility CMS apps.",

@@ -5,0 +5,0 @@ "main": "dist/agility-cms-app-sdk.node.js",

@@ -7,6 +7,7 @@ import * as fieldMethods from './fields'

import { notifyCMS, listenForCMS } from './messages'
import { version as sdkVersion} from '../package.json'
const initializeAppConfig = (appConfig) => {
//pass the sdk version to the CMS when setting the app config
appConfig.sdkVersion = sdkVersion;
const appDefinitionID = getUrlParameter('appDefinitionID');

@@ -109,3 +110,4 @@ notifyCMS({ message: appConfig, messageChannel: `setAppConfig_for_${appDefinitionID}`})

resolveAppComponent,
types
types,
sdkVersion
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc