@uniformdev/mesh-sdk 12.2.1-alpha.143 → 12.2.1-alpha.170

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -40,21 +40,26 @@ interface LocationDialogResponse<TDialogValue> {
40
40
  dialogId: string;
41
41
  /** The value set by the dialog. */
42
42
  value: TDialogValue;
43
- /** Allows for closing the dialog manually. Typically used when `closeDialogOnSetValue` is false. */
43
+ /** Allows for closing the dialog manually.
44
+ * Typically used when `closeDialogOnSetValue` is false. */
44
45
  closeDialog: () => Promise<void>;
45
46
  }
46
47
  declare type DialogType = 'location' | 'confirm';
47
48
  interface DialogOptions {
48
49
  /**
49
50
  * By default, dialogs will be closed when they set a value.
50
- * You can disable this behavior by setting the `disableCloseDialogOnSetValue` property to true.
51
- * You'll still be able to close a dialog via the `closeDialog` method that is returned from the `openLocationDialog` method.
51
+ * You can disable this behavior by setting the `disableCloseDialogOnSetValue`
52
+ * property to true.
53
+ * You'll still be able to close a dialog via the `closeDialog` method
54
+ * that is returned from the `openLocationDialog` method.
52
55
  */
53
56
  disableCloseDialogOnSetValue?: boolean;
54
57
  maxWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | 'full';
55
58
  /**
56
- * Parameters to pass to the dialog, which will be available in the dialog via the `metadata` object for the dialog location, e.g. `metadata.dialogParams`.
57
- * Parameters should be simple (serializable) types, not functions or DOM elements or similar non-serializable objects.
59
+ * Parameters to pass to the dialog, which will be available in the dialog via
60
+ * the `metadata` object for the dialog location, e.g. `metadata.dialogParams`.
61
+ * Parameters should be simple (serializable) types, not functions or DOM
62
+ * elements or similar non-serializable objects.
58
63
  */
59
64
  params?: DialogParams;
60
65
  }
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
1
- var g,u=({onHeightChange:l,autoResizingDisabled:o})=>{if(typeof window=="undefined")return;let e=window,i=()=>{let t=Math.ceil(e.document.documentElement.getBoundingClientRect().height);t!==g&&(g=t,l==null||l(t))},a=o?void 0:new MutationObserver(i),n={instance:e,observer:a,height:0,enableAutoResizing:()=>{a==null||a.observe(document.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),e.addEventListener("resize",i)},disableAutoResizing:()=>{a==null||a.disconnect(),e.removeEventListener("resize",i)}};return o||n.enableAutoResizing(),n};var D=()=>import("post-robot"),w={};async function v({autoResizingDisabled:l}={}){if(typeof window!="undefined"&&typeof window.UniformMeshSDK=="undefined"){if(typeof window.parent=="undefined"||window.parent==window)throw new Error("It appears you are trying to connect with the Uniform Mesh SDK outside of an iframe. Be sure you are loading your app via a location URL configured in the Uniform dashboard.");let o=await f({dialogResponseHandlers:w}),e=await o.initialize(),i={getCurrentLocation:()=>({getValue:()=>e.locationValue,setValue:async a=>{await o.setValue(a),e.locationValue=a},getMetadata:()=>e.locationMetadata}),currentWindow:u({onHeightChange:a=>{o.resize(a)},autoResizingDisabled:l}),version:e.uniformApiVersion,openLocationDialog:async({locationKey:a,options:n})=>{let t=await o.openDialog({dialogType:"location",data:{locationKey:a},options:n});if(!!t)return{dialogId:t.dialogId,value:t.value,closeDialog:async()=>{await o.closeDialog({dialogId:t.dialogId,dialogType:"location"})}}},closeLocationDialog:async({dialogId:a})=>{await o.closeDialog({dialogId:a,dialogType:"location"})},openConfirmationDialog:async({titleText:a,bodyText:n})=>{let t=await o.openDialog({dialogType:"confirm",data:{titleText:a,bodyText:n}});if(!!t)return{value:t.value,closeDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"confirm"})}}},closeConfirmationDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"confirm"})},openCurrentLocationDialog:async({options:a})=>{let n=await o.openDialog({dialogType:"location",data:{},options:a});if(!!n)return{dialogId:n.dialogId,value:n.value,closeDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"location"})}}},closeCurrentLocationDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"location"})},dialogContext:e.dialogContext};return window.UniformMeshSDK=i,i}}async function f({dialogResponseHandlers:l}){let o=await D();return o.on("dialog-value",{},async({data:e})=>{let i=l[e.dialogId];!i||(e.value?i.resolve({value:e.value,dialogId:e.dialogId}):e.error&&i.reject(e.error),delete l[e.dialogId])}),{initialize:async()=>(await o.send(window.parent,"initialize")).data,resize:async e=>{o.send(window.parent,"resize",{height:e})},getValue:async()=>{let e=await o.send(window.parent,"getValue");return e==null?void 0:e.data},setValue:async e=>{await o.send(window.parent,"setValue",e)},getMetadata:async()=>{let e=await o.send(window.parent,"getMetadata");return e==null?void 0:e.data},openDialog:async({dialogType:e,data:i,options:a})=>{var r;if(m(a==null?void 0:a.params)>1e5)throw new Error("Dialog parameters object is too large, maximum size is 100KB");let n=await o.send(window.parent,"openDialog",{dialogType:e,dialogData:i,options:a}),t=(r=n==null?void 0:n.data)==null?void 0:r.dialogId;if(!!t)return new Promise((c,p)=>{l[t]={resolve:c,reject:p}})},closeDialog:async({dialogId:e,dialogType:i,dialogData:a})=>{await o.send(window.parent,"closeDialog",{dialogId:e,dialogType:i,dialogData:a})}}}function m(l){if(!l||typeof Blob=="undefined")return 0;try{let o=JSON.stringify(l);return new Blob([o]).size}catch(o){throw new Error("Error calculating object size: "+o.message)}}export{v as initializeUniformMeshSDK};
1
+ var s,u=({onHeightChange:l,autoResizingDisabled:o})=>{if(typeof window=="undefined")return;let e=window,n=()=>{let i=Math.ceil(e.document.documentElement.getBoundingClientRect().height);i!==s&&(s=i,l==null||l(i))},a=o?void 0:new MutationObserver(n),t={instance:e,observer:a,height:0,enableAutoResizing:()=>{a==null||a.observe(document.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),e.addEventListener("resize",n)},disableAutoResizing:()=>{a==null||a.disconnect(),e.removeEventListener("resize",n)}};return o||t.enableAutoResizing(),t};var D=()=>import("post-robot"),w={};async function v({autoResizingDisabled:l}={}){if(typeof window!="undefined"&&typeof window.UniformMeshSDK=="undefined"){if(typeof window.parent=="undefined"||window.parent==window)throw new Error("It appears you are trying to connect with the Uniform Mesh SDK outside of an iframe. Be sure you are loading your app via a location URL configured in the Uniform dashboard.");let o=await f({dialogResponseHandlers:w}),e=await o.initialize(),n={getCurrentLocation:()=>({getValue:()=>e.locationValue,setValue:async a=>{await o.setValue(a),e.locationValue=a},getMetadata:()=>e.locationMetadata}),currentWindow:u({onHeightChange:a=>{o.resize(a)},autoResizingDisabled:l}),version:e.uniformApiVersion,openLocationDialog:async({locationKey:a,options:t})=>{let i=await o.openDialog({dialogType:"location",data:{locationKey:a},options:t});if(!!i)return{dialogId:i.dialogId,value:i.value,closeDialog:async()=>{await o.closeDialog({dialogId:i.dialogId,dialogType:"location"})}}},closeLocationDialog:async({dialogId:a})=>{await o.closeDialog({dialogId:a,dialogType:"location"})},openConfirmationDialog:async({titleText:a,bodyText:t})=>{let i=await o.openDialog({dialogType:"confirm",data:{titleText:a,bodyText:t}});if(!!i)return{dialogId:i.dialogId,value:i.value,closeDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"confirm"})}}},closeConfirmationDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"confirm"})},openCurrentLocationDialog:async({options:a})=>{let t=await o.openDialog({dialogType:"location",data:{},options:a});if(!!t)return{dialogId:t.dialogId,value:t.value,closeDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"location"})}}},closeCurrentLocationDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"location"})},dialogContext:e.dialogContext};return window.UniformMeshSDK=n,n}}async function f({dialogResponseHandlers:l}){let o=await D();return o.on("dialog-value",{},async({data:e})=>{let n=l[e.dialogId];!n||(e.value?n.resolve({value:e.value,dialogId:e.dialogId}):e.error&&n.reject(e.error),delete l[e.dialogId])}),{initialize:async()=>(await o.send(window.parent,"initialize")).data,resize:async e=>{o.send(window.parent,"resize",{height:e})},getValue:async()=>{let e=await o.send(window.parent,"getValue");return e==null?void 0:e.data},setValue:async e=>{await o.send(window.parent,"setValue",e)},getMetadata:async()=>{let e=await o.send(window.parent,"getMetadata");return e==null?void 0:e.data},openDialog:async({dialogType:e,data:n,options:a})=>{var r;if(m(a==null?void 0:a.params)>1e5)throw new Error("Dialog parameters object is too large, maximum size is 100KB");let t=await o.send(window.parent,"openDialog",{dialogType:e,dialogData:n,options:a}),i=(r=t==null?void 0:t.data)==null?void 0:r.dialogId;if(!!i)return new Promise((c,p)=>{l[i]={resolve:c,reject:p}})},closeDialog:async({dialogId:e,dialogType:n,dialogData:a})=>{await o.send(window.parent,"closeDialog",{dialogId:e,dialogType:n,dialogData:a})}}}function m(l){if(!l||typeof Blob=="undefined")return 0;try{let o=JSON.stringify(l);return new Blob([o]).size}catch(o){throw new Error("Error calculating object size: "+o.message)}}export{v as initializeUniformMeshSDK};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var f=Object.create;var r=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var d=a=>r(a,"__esModule",{value:!0});var v=(a,o)=>{for(var e in o)r(a,e,{get:o[e],enumerable:!0})},g=(a,o,e,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of y(o))!V.call(a,i)&&(e||i!=="default")&&r(a,i,{get:()=>o[i],enumerable:!(n=m(o,i))||n.enumerable});return a},x=(a,o)=>g(d(r(a!=null?f(T(a)):{},"default",!o&&a&&a.__esModule?{get:()=>a.default,enumerable:!0}:{value:a,enumerable:!0})),a),b=(a=>(o,e)=>a&&a.get(o)||(e=g(d({}),o,1),a&&a.set(o,e),e))(typeof WeakMap!="undefined"?new WeakMap:0);var z={};v(z,{initializeUniformMeshSDK:()=>k});var c,p=({onHeightChange:a,autoResizingDisabled:o})=>{if(typeof window=="undefined")return;let e=window,n=()=>{let l=Math.ceil(e.document.documentElement.getBoundingClientRect().height);l!==c&&(c=l,a==null||a(l))},i=o?void 0:new MutationObserver(n),t={instance:e,observer:i,height:0,enableAutoResizing:()=>{i==null||i.observe(document.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),e.addEventListener("resize",n)},disableAutoResizing:()=>{i==null||i.disconnect(),e.removeEventListener("resize",n)}};return o||t.enableAutoResizing(),t};var I=()=>import("post-robot"),h={};async function k({autoResizingDisabled:a}={}){if(typeof window!="undefined"&&typeof window.UniformMeshSDK=="undefined"){if(typeof window.parent=="undefined"||window.parent==window)throw new Error("It appears you are trying to connect with the Uniform Mesh SDK outside of an iframe. Be sure you are loading your app via a location URL configured in the Uniform dashboard.");let o=await M({dialogResponseHandlers:h}),e=await o.initialize(),n={getCurrentLocation:()=>({getValue:()=>e.locationValue,setValue:async i=>{await o.setValue(i),e.locationValue=i},getMetadata:()=>e.locationMetadata}),currentWindow:p({onHeightChange:i=>{o.resize(i)},autoResizingDisabled:a}),version:e.uniformApiVersion,openLocationDialog:async({locationKey:i,options:t})=>{let l=await o.openDialog({dialogType:"location",data:{locationKey:i},options:t});if(!!l)return{dialogId:l.dialogId,value:l.value,closeDialog:async()=>{await o.closeDialog({dialogId:l.dialogId,dialogType:"location"})}}},closeLocationDialog:async({dialogId:i})=>{await o.closeDialog({dialogId:i,dialogType:"location"})},openConfirmationDialog:async({titleText:i,bodyText:t})=>{let l=await o.openDialog({dialogType:"confirm",data:{titleText:i,bodyText:t}});if(!!l)return{value:l.value,closeDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"confirm"})}}},closeConfirmationDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"confirm"})},openCurrentLocationDialog:async({options:i})=>{let t=await o.openDialog({dialogType:"location",data:{},options:i});if(!!t)return{dialogId:t.dialogId,value:t.value,closeDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"location"})}}},closeCurrentLocationDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"location"})},dialogContext:e.dialogContext};return window.UniformMeshSDK=n,n}}async function M({dialogResponseHandlers:a}){let o=await I();return o.on("dialog-value",{},async({data:e})=>{let n=a[e.dialogId];!n||(e.value?n.resolve({value:e.value,dialogId:e.dialogId}):e.error&&n.reject(e.error),delete a[e.dialogId])}),{initialize:async()=>(await o.send(window.parent,"initialize")).data,resize:async e=>{o.send(window.parent,"resize",{height:e})},getValue:async()=>{let e=await o.send(window.parent,"getValue");return e==null?void 0:e.data},setValue:async e=>{await o.send(window.parent,"setValue",e)},getMetadata:async()=>{let e=await o.send(window.parent,"getMetadata");return e==null?void 0:e.data},openDialog:async({dialogType:e,data:n,options:i})=>{var s;if(R(i==null?void 0:i.params)>1e5)throw new Error("Dialog parameters object is too large, maximum size is 100KB");let t=await o.send(window.parent,"openDialog",{dialogType:e,dialogData:n,options:i}),l=(s=t==null?void 0:t.data)==null?void 0:s.dialogId;if(!!l)return new Promise((D,w)=>{a[l]={resolve:D,reject:w}})},closeDialog:async({dialogId:e,dialogType:n,dialogData:i})=>{await o.send(window.parent,"closeDialog",{dialogId:e,dialogType:n,dialogData:i})}}}function R(a){if(!a||typeof Blob=="undefined")return 0;try{let o=JSON.stringify(a);return new Blob([o]).size}catch(o){throw new Error("Error calculating object size: "+o.message)}}module.exports=b(z);0&&(module.exports={initializeUniformMeshSDK});
1
+ var f=Object.create;var r=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var d=a=>r(a,"__esModule",{value:!0});var v=(a,o)=>{for(var e in o)r(a,e,{get:o[e],enumerable:!0})},g=(a,o,e,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of y(o))!V.call(a,i)&&(e||i!=="default")&&r(a,i,{get:()=>o[i],enumerable:!(n=m(o,i))||n.enumerable});return a},I=(a,o)=>g(d(r(a!=null?f(T(a)):{},"default",!o&&a&&a.__esModule?{get:()=>a.default,enumerable:!0}:{value:a,enumerable:!0})),a),x=(a=>(o,e)=>a&&a.get(o)||(e=g(d({}),o,1),a&&a.set(o,e),e))(typeof WeakMap!="undefined"?new WeakMap:0);var z={};v(z,{initializeUniformMeshSDK:()=>k});var u,p=({onHeightChange:a,autoResizingDisabled:o})=>{if(typeof window=="undefined")return;let e=window,n=()=>{let t=Math.ceil(e.document.documentElement.getBoundingClientRect().height);t!==u&&(u=t,a==null||a(t))},i=o?void 0:new MutationObserver(n),l={instance:e,observer:i,height:0,enableAutoResizing:()=>{i==null||i.observe(document.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),e.addEventListener("resize",n)},disableAutoResizing:()=>{i==null||i.disconnect(),e.removeEventListener("resize",n)}};return o||l.enableAutoResizing(),l};var b=()=>import("post-robot"),h={};async function k({autoResizingDisabled:a}={}){if(typeof window!="undefined"&&typeof window.UniformMeshSDK=="undefined"){if(typeof window.parent=="undefined"||window.parent==window)throw new Error("It appears you are trying to connect with the Uniform Mesh SDK outside of an iframe. Be sure you are loading your app via a location URL configured in the Uniform dashboard.");let o=await M({dialogResponseHandlers:h}),e=await o.initialize(),n={getCurrentLocation:()=>({getValue:()=>e.locationValue,setValue:async i=>{await o.setValue(i),e.locationValue=i},getMetadata:()=>e.locationMetadata}),currentWindow:p({onHeightChange:i=>{o.resize(i)},autoResizingDisabled:a}),version:e.uniformApiVersion,openLocationDialog:async({locationKey:i,options:l})=>{let t=await o.openDialog({dialogType:"location",data:{locationKey:i},options:l});if(!!t)return{dialogId:t.dialogId,value:t.value,closeDialog:async()=>{await o.closeDialog({dialogId:t.dialogId,dialogType:"location"})}}},closeLocationDialog:async({dialogId:i})=>{await o.closeDialog({dialogId:i,dialogType:"location"})},openConfirmationDialog:async({titleText:i,bodyText:l})=>{let t=await o.openDialog({dialogType:"confirm",data:{titleText:i,bodyText:l}});if(!!t)return{dialogId:t.dialogId,value:t.value,closeDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"confirm"})}}},closeConfirmationDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"confirm"})},openCurrentLocationDialog:async({options:i})=>{let l=await o.openDialog({dialogType:"location",data:{},options:i});if(!!l)return{dialogId:l.dialogId,value:l.value,closeDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"location"})}}},closeCurrentLocationDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"location"})},dialogContext:e.dialogContext};return window.UniformMeshSDK=n,n}}async function M({dialogResponseHandlers:a}){let o=await b();return o.on("dialog-value",{},async({data:e})=>{let n=a[e.dialogId];!n||(e.value?n.resolve({value:e.value,dialogId:e.dialogId}):e.error&&n.reject(e.error),delete a[e.dialogId])}),{initialize:async()=>(await o.send(window.parent,"initialize")).data,resize:async e=>{o.send(window.parent,"resize",{height:e})},getValue:async()=>{let e=await o.send(window.parent,"getValue");return e==null?void 0:e.data},setValue:async e=>{await o.send(window.parent,"setValue",e)},getMetadata:async()=>{let e=await o.send(window.parent,"getMetadata");return e==null?void 0:e.data},openDialog:async({dialogType:e,data:n,options:i})=>{var s;if(R(i==null?void 0:i.params)>1e5)throw new Error("Dialog parameters object is too large, maximum size is 100KB");let l=await o.send(window.parent,"openDialog",{dialogType:e,dialogData:n,options:i}),t=(s=l==null?void 0:l.data)==null?void 0:s.dialogId;if(!!t)return new Promise((D,w)=>{a[t]={resolve:D,reject:w}})},closeDialog:async({dialogId:e,dialogType:n,dialogData:i})=>{await o.send(window.parent,"closeDialog",{dialogId:e,dialogType:n,dialogData:i})}}}function R(a){if(!a||typeof Blob=="undefined")return 0;try{let o=JSON.stringify(a);return new Blob([o]).size}catch(o){throw new Error("Error calculating object size: "+o.message)}}module.exports=x(z);0&&(module.exports={initializeUniformMeshSDK});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- var g,u=({onHeightChange:l,autoResizingDisabled:o})=>{if(typeof window=="undefined")return;let e=window,i=()=>{let t=Math.ceil(e.document.documentElement.getBoundingClientRect().height);t!==g&&(g=t,l==null||l(t))},a=o?void 0:new MutationObserver(i),n={instance:e,observer:a,height:0,enableAutoResizing:()=>{a==null||a.observe(document.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),e.addEventListener("resize",i)},disableAutoResizing:()=>{a==null||a.disconnect(),e.removeEventListener("resize",i)}};return o||n.enableAutoResizing(),n};var D=()=>import("post-robot"),w={};async function v({autoResizingDisabled:l}={}){if(typeof window!="undefined"&&typeof window.UniformMeshSDK=="undefined"){if(typeof window.parent=="undefined"||window.parent==window)throw new Error("It appears you are trying to connect with the Uniform Mesh SDK outside of an iframe. Be sure you are loading your app via a location URL configured in the Uniform dashboard.");let o=await f({dialogResponseHandlers:w}),e=await o.initialize(),i={getCurrentLocation:()=>({getValue:()=>e.locationValue,setValue:async a=>{await o.setValue(a),e.locationValue=a},getMetadata:()=>e.locationMetadata}),currentWindow:u({onHeightChange:a=>{o.resize(a)},autoResizingDisabled:l}),version:e.uniformApiVersion,openLocationDialog:async({locationKey:a,options:n})=>{let t=await o.openDialog({dialogType:"location",data:{locationKey:a},options:n});if(!!t)return{dialogId:t.dialogId,value:t.value,closeDialog:async()=>{await o.closeDialog({dialogId:t.dialogId,dialogType:"location"})}}},closeLocationDialog:async({dialogId:a})=>{await o.closeDialog({dialogId:a,dialogType:"location"})},openConfirmationDialog:async({titleText:a,bodyText:n})=>{let t=await o.openDialog({dialogType:"confirm",data:{titleText:a,bodyText:n}});if(!!t)return{value:t.value,closeDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"confirm"})}}},closeConfirmationDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"confirm"})},openCurrentLocationDialog:async({options:a})=>{let n=await o.openDialog({dialogType:"location",data:{},options:a});if(!!n)return{dialogId:n.dialogId,value:n.value,closeDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"location"})}}},closeCurrentLocationDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"location"})},dialogContext:e.dialogContext};return window.UniformMeshSDK=i,i}}async function f({dialogResponseHandlers:l}){let o=await D();return o.on("dialog-value",{},async({data:e})=>{let i=l[e.dialogId];!i||(e.value?i.resolve({value:e.value,dialogId:e.dialogId}):e.error&&i.reject(e.error),delete l[e.dialogId])}),{initialize:async()=>(await o.send(window.parent,"initialize")).data,resize:async e=>{o.send(window.parent,"resize",{height:e})},getValue:async()=>{let e=await o.send(window.parent,"getValue");return e==null?void 0:e.data},setValue:async e=>{await o.send(window.parent,"setValue",e)},getMetadata:async()=>{let e=await o.send(window.parent,"getMetadata");return e==null?void 0:e.data},openDialog:async({dialogType:e,data:i,options:a})=>{var r;if(m(a==null?void 0:a.params)>1e5)throw new Error("Dialog parameters object is too large, maximum size is 100KB");let n=await o.send(window.parent,"openDialog",{dialogType:e,dialogData:i,options:a}),t=(r=n==null?void 0:n.data)==null?void 0:r.dialogId;if(!!t)return new Promise((c,p)=>{l[t]={resolve:c,reject:p}})},closeDialog:async({dialogId:e,dialogType:i,dialogData:a})=>{await o.send(window.parent,"closeDialog",{dialogId:e,dialogType:i,dialogData:a})}}}function m(l){if(!l||typeof Blob=="undefined")return 0;try{let o=JSON.stringify(l);return new Blob([o]).size}catch(o){throw new Error("Error calculating object size: "+o.message)}}export{v as initializeUniformMeshSDK};
1
+ var s,u=({onHeightChange:l,autoResizingDisabled:o})=>{if(typeof window=="undefined")return;let e=window,n=()=>{let i=Math.ceil(e.document.documentElement.getBoundingClientRect().height);i!==s&&(s=i,l==null||l(i))},a=o?void 0:new MutationObserver(n),t={instance:e,observer:a,height:0,enableAutoResizing:()=>{a==null||a.observe(document.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),e.addEventListener("resize",n)},disableAutoResizing:()=>{a==null||a.disconnect(),e.removeEventListener("resize",n)}};return o||t.enableAutoResizing(),t};var D=()=>import("post-robot"),w={};async function v({autoResizingDisabled:l}={}){if(typeof window!="undefined"&&typeof window.UniformMeshSDK=="undefined"){if(typeof window.parent=="undefined"||window.parent==window)throw new Error("It appears you are trying to connect with the Uniform Mesh SDK outside of an iframe. Be sure you are loading your app via a location URL configured in the Uniform dashboard.");let o=await f({dialogResponseHandlers:w}),e=await o.initialize(),n={getCurrentLocation:()=>({getValue:()=>e.locationValue,setValue:async a=>{await o.setValue(a),e.locationValue=a},getMetadata:()=>e.locationMetadata}),currentWindow:u({onHeightChange:a=>{o.resize(a)},autoResizingDisabled:l}),version:e.uniformApiVersion,openLocationDialog:async({locationKey:a,options:t})=>{let i=await o.openDialog({dialogType:"location",data:{locationKey:a},options:t});if(!!i)return{dialogId:i.dialogId,value:i.value,closeDialog:async()=>{await o.closeDialog({dialogId:i.dialogId,dialogType:"location"})}}},closeLocationDialog:async({dialogId:a})=>{await o.closeDialog({dialogId:a,dialogType:"location"})},openConfirmationDialog:async({titleText:a,bodyText:t})=>{let i=await o.openDialog({dialogType:"confirm",data:{titleText:a,bodyText:t}});if(!!i)return{dialogId:i.dialogId,value:i.value,closeDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"confirm"})}}},closeConfirmationDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"confirm"})},openCurrentLocationDialog:async({options:a})=>{let t=await o.openDialog({dialogType:"location",data:{},options:a});if(!!t)return{dialogId:t.dialogId,value:t.value,closeDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"location"})}}},closeCurrentLocationDialog:async()=>{await o.closeDialog({dialogId:void 0,dialogType:"location"})},dialogContext:e.dialogContext};return window.UniformMeshSDK=n,n}}async function f({dialogResponseHandlers:l}){let o=await D();return o.on("dialog-value",{},async({data:e})=>{let n=l[e.dialogId];!n||(e.value?n.resolve({value:e.value,dialogId:e.dialogId}):e.error&&n.reject(e.error),delete l[e.dialogId])}),{initialize:async()=>(await o.send(window.parent,"initialize")).data,resize:async e=>{o.send(window.parent,"resize",{height:e})},getValue:async()=>{let e=await o.send(window.parent,"getValue");return e==null?void 0:e.data},setValue:async e=>{await o.send(window.parent,"setValue",e)},getMetadata:async()=>{let e=await o.send(window.parent,"getMetadata");return e==null?void 0:e.data},openDialog:async({dialogType:e,data:n,options:a})=>{var r;if(m(a==null?void 0:a.params)>1e5)throw new Error("Dialog parameters object is too large, maximum size is 100KB");let t=await o.send(window.parent,"openDialog",{dialogType:e,dialogData:n,options:a}),i=(r=t==null?void 0:t.data)==null?void 0:r.dialogId;if(!!i)return new Promise((c,p)=>{l[i]={resolve:c,reject:p}})},closeDialog:async({dialogId:e,dialogType:n,dialogData:a})=>{await o.send(window.parent,"closeDialog",{dialogId:e,dialogType:n,dialogData:a})}}}function m(l){if(!l||typeof Blob=="undefined")return 0;try{let o=JSON.stringify(l);return new Blob([o]).size}catch(o){throw new Error("Error calculating object size: "+o.message)}}export{v as initializeUniformMeshSDK};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/mesh-sdk",
3
- "version": "12.2.1-alpha.143+b54f3127",
3
+ "version": "12.2.1-alpha.170+899ea147",
4
4
  "description": "Uniform Mesh Framework SDK",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -25,18 +25,18 @@
25
25
  "ci:build": "tsup --minify --clean"
26
26
  },
27
27
  "dependencies": {
28
- "post-robot": "10.0.44"
28
+ "post-robot": "10.0.46"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/jest": "27.4.0",
32
- "@types/node": "16.11.21",
32
+ "@types/node": "16.11.24",
33
33
  "@types/post-robot": "10.0.3",
34
- "eslint": "8.7.0",
35
- "jest": "27.4.7",
34
+ "eslint": "8.8.0",
35
+ "jest": "27.5.1",
36
36
  "npm-run-all": "4.1.5",
37
37
  "rimraf": "3.0.2",
38
38
  "ts-jest": "27.1.3",
39
- "tsup": "5.11.11"
39
+ "tsup": "5.11.13"
40
40
  },
41
41
  "files": [
42
42
  "/dist"
@@ -44,5 +44,5 @@
44
44
  "publishConfig": {
45
45
  "access": "public"
46
46
  },
47
- "gitHead": "b54f3127570a6a8232fda786952b3abfc0963a49"
47
+ "gitHead": "899ea147cdea482a014e02911fc9554c81dd2cbc"
48
48
  }