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

@mxenabled/widget-post-message-definitions

Package Overview
Dependencies
Maintainers
9
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mxenabled/widget-post-message-definitions - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

18

dist/generated.d.ts

@@ -9,3 +9,3 @@ /**

*/
import { BasePostMessageCallbackProps } from "./lib";
import { BasePostMessageCallbackProps, MessageEventData } from "./lib";
export declare enum Type {

@@ -188,2 +188,8 @@ Load = "mx/load",

/**
* Dispatch a post message event that we got from a message event for any
* widget. Does not handle widget specific post messages. See other dispatch
* methods for widget specific dispatching.
*/
export declare function dispatchWidgetPostMessageEvent(event: MessageEvent<MessageEventData>, callbacks: WidgetPostMessageCallbackProps<MessageEvent<MessageEventData>>): void;
/**
* Dispatch a post message event that we got from a url change event for the

@@ -194,2 +200,7 @@ * Connect Widget.

/**
* Dispatch a post message event that we got from a window/document message for the
* Connect Widget.
*/
export declare function dispatchConnectPostMessageEvent(event: MessageEvent<MessageEventData>, callbacks: ConnectPostMessageCallbackProps<MessageEvent<MessageEventData>>): void;
/**
* Dispatch a post message event that we got from a url change event for the

@@ -199,1 +210,6 @@ * Pulse Widget.

export declare function dispatchPulseLocationChangeEvent(url: string, callbacks: PulsePostMessageCallbackProps<string>): void;
/**
* Dispatch a post message event that we got from a window/document message for the
* Pulse Widget.
*/
export declare function dispatchPulsePostMessageEvent(event: MessageEvent<MessageEventData>, callbacks: PulsePostMessageCallbackProps<MessageEvent<MessageEventData>>): void;

@@ -293,2 +293,18 @@ /**

/**
* @see {buildPayload}
*/
function buildPayloadFromPostMessageEventData(data) {
const rawType = data.type || "type not provided";
let type;
if (rawType && rawType in typeLookup) {
type = typeLookup[rawType];
}
else {
throw new PostMessageUnknownTypeError(rawType);
}
const metadata = data.metadata || {};
const payload = buildPayload(type, metadata);
return payload;
}
/**
* Called if we encounter an error while parsing or dispatching a post message

@@ -332,2 +348,17 @@ * event. Internal errors are dispatched to the appropriate error callback, and

/**
* Dispatch a post message event that we got from a message event for any
* widget. Does not handle widget specific post messages. See other dispatch
* methods for widget specific dispatching.
*/
export function dispatchWidgetPostMessageEvent(event, callbacks) {
try {
dispatchOnMessage(event, callbacks);
const payload = buildPayloadFromPostMessageEventData(event.data);
dispatchWidgetInternalMessage(payload, callbacks);
}
catch (error) {
dispatchError(event, error, callbacks);
}
}
/**
* Dispatch a validated internal message for any widget.

@@ -368,2 +399,16 @@ */

/**
* Dispatch a post message event that we got from a window/document message for the
* Connect Widget.
*/
export function dispatchConnectPostMessageEvent(event, callbacks) {
try {
dispatchOnMessage(event, callbacks);
const payload = buildPayloadFromPostMessageEventData(event.data);
dispatchConnectInternalMessage(payload, callbacks);
}
catch (error) {
dispatchError(event, error, callbacks);
}
}
/**
* Dispatch a validated internal message for the Connect Widget.

@@ -446,2 +491,16 @@ */

/**
* Dispatch a post message event that we got from a window/document message for the
* Pulse Widget.
*/
export function dispatchPulsePostMessageEvent(event, callbacks) {
try {
dispatchOnMessage(event, callbacks);
const payload = buildPayloadFromPostMessageEventData(event.data);
dispatchPulseInternalMessage(payload, callbacks);
}
catch (error) {
dispatchError(event, error, callbacks);
}
}
/**
* Dispatch a validated internal message for the Pulse Widget.

@@ -448,0 +507,0 @@ */

@@ -16,2 +16,7 @@ export declare type BasePostMessageCallbackProps<T> = {

}
export declare type MessageEventData = {
mx?: boolean;
metadata?: Metadata;
type?: string;
};
export declare type Value = string | number;

@@ -18,0 +23,0 @@ export declare type NestedValue = Record<string, Value>;

3

package.json
{
"name": "@mxenabled/widget-post-message-definitions",
"version": "1.0.6",
"version": "1.0.7",
"description": "Widget Post Message Definitions for use in SDKs",

@@ -32,2 +32,3 @@ "main": "dist/index.js",

"preset": "ts-jest",
"testEnvironment": "./test/environment.ts",
"collectCoverageFrom": [

@@ -34,0 +35,0 @@ "src/**/**"

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