You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

admin-shell-messaging

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

admin-shell-messaging - npm Package Compare versions

Comparing version

to
0.1.12

4

dist/actions.d.ts

@@ -7,3 +7,4 @@ import { BreadcrumbParams, Message, ToastParams } from "./types";

CLEAR_BREADCRUMB_EXTRA_LEVELS = "CLEAR_BREADCRUMB_EXTRA_LEVELS",
SHOW_TOAST = "SHOW_TOAST"
SHOW_TOAST = "SHOW_TOAST",
HIDE_TOAST = "HIDE_TOAST"
}

@@ -16,2 +17,3 @@ export declare const ACTIONS: {

SHOW_TOAST: ({ payload }: ToastParams) => Message;
HIDE_TOAST: () => Message;
};

@@ -11,2 +11,3 @@ "use strict";

ACTION_TYPES["SHOW_TOAST"] = "SHOW_TOAST";
ACTION_TYPES["HIDE_TOAST"] = "HIDE_TOAST";
})(ACTION_TYPES = exports.ACTION_TYPES || (exports.ACTION_TYPES = {}));

@@ -38,3 +39,8 @@ exports.ACTIONS = {

}),
HIDE_TOAST: () => ({
action: {
type: ACTION_TYPES.HIDE_TOAST,
},
}),
};
//# sourceMappingURL=actions.js.map

@@ -28,1 +28,29 @@ import { ToastParams } from "./types";

export declare function showToast({ payload }: ToastParams): void;
/**
* Function to hide a previously displayed toast. It should
* be used along with the `showToast` method.
*
* ## @example
* ```jsx
* // other necessary imports up here...
* import { showToast, hideToast } from `@vtex/admin-shell-messaging`
*
* const App = () => {
* const { formatMessage } = useIntl()
*
* return (
* <div>
* <button onClick={() => {
* showToast({
* payload: formatMessage({ id: 'admin/my-example-app.some-toast-message' })
* })
* }}>Show toast</button>
* <button onClick={() => {
* hideToast()
* }}>Ok, enough of this toast</button>
* </div>
* )
* }
* ```
*/
export declare function hideToast(): void;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.showToast = void 0;
exports.hideToast = exports.showToast = void 0;
const actions_1 = require("./actions");

@@ -37,2 +37,33 @@ const shell_1 = require("./shell");

exports.showToast = showToast;
/**
* Function to hide a previously displayed toast. It should
* be used along with the `showToast` method.
*
* ## @example
* ```jsx
* // other necessary imports up here...
* import { showToast, hideToast } from `@vtex/admin-shell-messaging`
*
* const App = () => {
* const { formatMessage } = useIntl()
*
* return (
* <div>
* <button onClick={() => {
* showToast({
* payload: formatMessage({ id: 'admin/my-example-app.some-toast-message' })
* })
* }}>Show toast</button>
* <button onClick={() => {
* hideToast()
* }}>Ok, enough of this toast</button>
* </div>
* )
* }
* ```
*/
function hideToast() {
shell_1.shell.postMessage(actions_1.ACTIONS.HIDE_TOAST(), "*");
}
exports.hideToast = hideToast;
//# sourceMappingURL=toast.js.map
{
"name": "admin-shell-messaging",
"version": "0.1.11",
"version": "0.1.12",
"description": "Admin shell Iframe messaging package",

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

@@ -9,2 +9,3 @@ import { BreadcrumbParams, Message, ToastParams } from "./types";

SHOW_TOAST = "SHOW_TOAST",
HIDE_TOAST = "HIDE_TOAST",
}

@@ -40,2 +41,7 @@

}),
HIDE_TOAST: (): Message => ({
action: {
type: ACTION_TYPES.HIDE_TOAST,
},
}),
};

@@ -38,1 +38,32 @@ import { ACTIONS } from "./actions";

}
/**
* Function to hide a previously displayed toast. It should
* be used along with the `showToast` method.
*
* ## @example
* ```jsx
* // other necessary imports up here...
* import { showToast, hideToast } from `@vtex/admin-shell-messaging`
*
* const App = () => {
* const { formatMessage } = useIntl()
*
* return (
* <div>
* <button onClick={() => {
* showToast({
* payload: formatMessage({ id: 'admin/my-example-app.some-toast-message' })
* })
* }}>Show toast</button>
* <button onClick={() => {
* hideToast()
* }}>Ok, enough of this toast</button>
* </div>
* )
* }
* ```
*/
export function hideToast() {
shell.postMessage(ACTIONS.HIDE_TOAST(), "*");
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet