@cloudquery/plugin-config-ui-connector
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -66,6 +66,6 @@ /** | ||
*/ | ||
export declare function getPluginUiMessageHandler(): MessageHandler<"height_changed" | "validation_passed" | "validation_failed" | "open_url" | "ready" | "show_submit_button" | "current_values", PluginUiMessagePayload, "init" | "validate" | "submit_failed" | "request_current_values", FormMessagePayload>; | ||
export declare function getPluginUiMessageHandler(): MessageHandler<"height_changed" | "validation_passed" | "validation_failed" | "open_url" | "ready" | "show_submit_button" | "hide_submit_button" | "current_values", PluginUiMessagePayload, "init" | "validate" | "submit_failed" | "request_current_values", FormMessagePayload>; | ||
/** | ||
* A class to handle sending and receiving messages between CloudQuery Cloud App form and the plugin UI. | ||
* A class to handle sending and receiving messages between CloudQuery Cloud App form and the Plugin UI. | ||
* | ||
@@ -129,3 +129,9 @@ * @typeParam SendMessageType - A union of string literal types representing the possible message types for sending. | ||
/** | ||
* Type representing the payload structure for plugin UI messages. | ||
* Type of the message handler for the Plugin UI form. | ||
* @public | ||
*/ | ||
export declare type PluginUiMessageHandler = MessageHandler<PluginUiMessageType, PluginUiMessagePayload, FormMessageType, FormMessagePayload>; | ||
/** | ||
* Type representing the payload structure for Plugin UI messages. | ||
* | ||
@@ -186,2 +192,7 @@ * @public | ||
/** | ||
* Payload for the 'hide_submit_button' message type. | ||
* This message type has no associated payload. | ||
*/ | ||
hide_submit_button: void; | ||
/** | ||
* Payload for the 'current_values' message type. | ||
@@ -204,3 +215,3 @@ */ | ||
/** | ||
* Type representing the possible plugin UI message types to be sent. | ||
* Type representing the possible Plugin UI message types to be sent. | ||
* Extracts the types from the pluginUiMessageTypes array. | ||
@@ -213,8 +224,8 @@ * | ||
/** | ||
* List of message types to be sent by the plugin UI. | ||
* List of message types to be sent by the Plugin UI. | ||
* | ||
* @public | ||
*/ | ||
export declare const pluginUiMessageTypes: readonly ["height_changed", "validation_passed", "validation_failed", "open_url", "ready", "show_submit_button", "current_values"]; | ||
export declare const pluginUiMessageTypes: readonly ["height_changed", "validation_passed", "validation_failed", "open_url", "ready", "show_submit_button", "hide_submit_button", "current_values"]; | ||
export { } |
@@ -1,1 +0,1 @@ | ||
!function(e,s){if("object"==typeof exports&&"object"==typeof module)module.exports=s();else if("function"==typeof define&&define.amd)define([],s);else{var t=s();for(var a in t)("object"==typeof exports?exports:e)[a]=t[a]}}(this,(()=>(()=>{"use strict";var e={d:(s,t)=>{for(var a in t)e.o(t,a)&&!e.o(s,a)&&Object.defineProperty(s,a,{enumerable:!0,get:t[a]})},o:(e,s)=>Object.prototype.hasOwnProperty.call(e,s),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},s={};e.r(s),e.d(s,{MessageHandler:()=>i,formMessageTypes:()=>n,getPluginUiMessageHandler:()=>o,pluginUiMessageTypes:()=>a});const t="plugin-ui-connector-iframe",a=["height_changed","validation_passed","validation_failed","open_url","ready","show_submit_button","current_values"],n=["init","validate","submit_failed","request_current_values"];class i{constructor(e,s,t){this.callbacks=new Map,this.sendMessageTypes=new Set,this.receiveMessageTypes=new Set,this.sendMessageTypes=new Set(e),this.receiveMessageTypes=new Set(s),this.sendMessageWindow=t,window.addEventListener("message",this.handleMessage.bind(this))}sendMessage(e,s){if(!this.sendMessageTypes.has(e))throw new Error(`Unknown send message type: ${String(e)}`);this.sendMessageWindow.postMessage({type:e,payload:s,id:t},"*")}subscribeToMessage(e,s){if(!this.receiveMessageTypes.has(e))throw new Error(`Unknown receive message type: ${String(e)}`);const t=this.callbacks.get(e);return t?t.push(s):this.callbacks.set(e,[s]),()=>{const t=this.callbacks.get(e);t&&this.callbacks.set(e,t.filter((e=>e!==s)))}}subscribeToMessageOnce(e,s){const t=a=>{s(a);const n=this.callbacks.get(e);n&&this.callbacks.set(e,n.filter((e=>e!==t)))};return this.subscribeToMessage(e,t)}handleMessage(e){const{id:s}=e.data;if(s!==t)return;const a=e.data.type,n=this.callbacks.get(a);if(n)for(const s of n)s(e.data.payload)}}function o(){return new i(a,n,window.parent)}return s})())); | ||
!function(e,s){if("object"==typeof exports&&"object"==typeof module)module.exports=s();else if("function"==typeof define&&define.amd)define([],s);else{var t=s();for(var a in t)("object"==typeof exports?exports:e)[a]=t[a]}}(this,(()=>(()=>{"use strict";var e={d:(s,t)=>{for(var a in t)e.o(t,a)&&!e.o(s,a)&&Object.defineProperty(s,a,{enumerable:!0,get:t[a]})},o:(e,s)=>Object.prototype.hasOwnProperty.call(e,s),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},s={};e.r(s),e.d(s,{MessageHandler:()=>i,formMessageTypes:()=>n,getPluginUiMessageHandler:()=>o,pluginUiMessageTypes:()=>a});const t="plugin-ui-connector-iframe",a=["height_changed","validation_passed","validation_failed","open_url","ready","show_submit_button","hide_submit_button","current_values"],n=["init","validate","submit_failed","request_current_values"];class i{constructor(e,s,t){this.callbacks=new Map,this.sendMessageTypes=new Set,this.receiveMessageTypes=new Set,this.sendMessageTypes=new Set(e),this.receiveMessageTypes=new Set(s),this.sendMessageWindow=t,window.addEventListener("message",this.handleMessage.bind(this))}sendMessage(e,s){if(!this.sendMessageTypes.has(e))throw new Error(`Unknown send message type: ${String(e)}`);this.sendMessageWindow.postMessage({type:e,payload:s,id:t},"*")}subscribeToMessage(e,s){if(!this.receiveMessageTypes.has(e))throw new Error(`Unknown receive message type: ${String(e)}`);const t=this.callbacks.get(e);return t?t.push(s):this.callbacks.set(e,[s]),()=>{const t=this.callbacks.get(e);t&&this.callbacks.set(e,t.filter((e=>e!==s)))}}subscribeToMessageOnce(e,s){const t=a=>{s(a);const n=this.callbacks.get(e);n&&this.callbacks.set(e,n.filter((e=>e!==t)))};return this.subscribeToMessage(e,t)}handleMessage(e){const{id:s}=e.data;if(s!==t)return;const a=e.data.type,n=this.callbacks.get(a);if(n)for(const s of n)s(e.data.payload)}}function o(){return new i(a,n,window.parent)}return s})())); |
{ | ||
"name": "@cloudquery/plugin-config-ui-connector", | ||
"description": "Plugin configuration UI connector for CloudQuery Cloud App", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"private": false, | ||
@@ -6,0 +6,0 @@ "main": "./dist/index.js", |
@@ -7,3 +7,3 @@ # @cloudquery/plugin-config-ui-connector | ||
`@cloudquery/plugin-config-ui-connector` is a library designed to facilitate communication between CloudQuery Cloud App form and custom plugin UI. | ||
`@cloudquery/plugin-config-ui-connector` is a library designed to facilitate communication between CloudQuery Cloud App form and Plugin UI. | ||
@@ -10,0 +10,0 @@ ## Installation |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
30522
217