Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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 0.1.10 to 0.1.11

8

dist/actions.d.ts

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

import { InsertOnBreadcrumbParams, Message } from "./types";
import { BreadcrumbParams, Message, ToastParams } from "./types";
export declare enum ACTION_TYPES {

@@ -6,3 +6,4 @@ START_LOADING = "START_LOADING",

INSERT_BREADCRUMB_EXTRA_LEVEL = "INSERT_BREADCRUMB_EXTRA_LEVEL",
CLEAR_BREADCRUMB_EXTRA_LEVELS = "CLEAR_BREADCRUMB_EXTRA_LEVELS"
CLEAR_BREADCRUMB_EXTRA_LEVELS = "CLEAR_BREADCRUMB_EXTRA_LEVELS",
SHOW_TOAST = "SHOW_TOAST"
}

@@ -12,4 +13,5 @@ export declare const ACTIONS: {

STOP_LOADING: () => Message;
INSERT_BREADCRUMB_EXTRA_LEVEL: ({ newLevelName, previousLevelUrl, }: InsertOnBreadcrumbParams) => Message;
INSERT_BREADCRUMB_EXTRA_LEVEL: ({ newLevelName, previousLevelUrl, }: BreadcrumbParams) => Message;
CLEAR_BREADCRUMB_EXTRA_LEVELS: () => Message;
SHOW_TOAST: ({ payload }: ToastParams) => Message;
};

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

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

@@ -31,3 +32,9 @@ exports.ACTIONS = {

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

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

import { InsertOnBreadcrumbParams } from "./types";
import { BreadcrumbParams } from "./types";
/**

@@ -39,3 +39,3 @@ * Function to insert a new breadcrumb level.

*/
export declare function insertNewBreadcrumbLevel({ newLevelName, previousLevelUrl, }: InsertOnBreadcrumbParams): void;
export declare function insertNewBreadcrumbLevel({ newLevelName, previousLevelUrl, }: BreadcrumbParams): void;
/**

@@ -42,0 +42,0 @@ * Function to remove a previously set breadcrumb extra level by

@@ -44,7 +44,6 @@ "use strict";

function insertNewBreadcrumbLevel({ newLevelName, previousLevelUrl, }) {
const params = actions_1.ACTIONS.INSERT_BREADCRUMB_EXTRA_LEVEL({
shell_1.shell.postMessage(actions_1.ACTIONS.INSERT_BREADCRUMB_EXTRA_LEVEL({
newLevelName,
previousLevelUrl,
});
shell_1.shell.postMessage(params, "*");
}), "*");
}

@@ -83,6 +82,5 @@ exports.insertNewBreadcrumbLevel = insertNewBreadcrumbLevel;

function clearBreadcrumbExtraLevels() {
const params = actions_1.ACTIONS.CLEAR_BREADCRUMB_EXTRA_LEVELS();
shell_1.shell.postMessage(params, "*");
shell_1.shell.postMessage(actions_1.ACTIONS.CLEAR_BREADCRUMB_EXTRA_LEVELS(), "*");
}
exports.clearBreadcrumbExtraLevels = clearBreadcrumbExtraLevels;
//# sourceMappingURL=breadcrumb.js.map
export { ACTION_TYPES, ACTIONS } from "./actions";
export { insertNewBreadcrumbLevel, clearBreadcrumbExtraLevels, } from "./breadcrumb";
export { startLoading, stopLoading } from "./loadbar";
export { InsertOnBreadcrumbParams, Message, ReceivedMessage } from "./types";
export { BreadcrumbParams, ToastParams, Message, ReceivedMessage, ActionParams, Action, } from "./types";
export { shell } from "./shell";
export { navigate } from "./navigation";
export { showToast } from "./toast";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.navigate = exports.shell = exports.stopLoading = exports.startLoading = exports.clearBreadcrumbExtraLevels = exports.insertNewBreadcrumbLevel = exports.ACTIONS = exports.ACTION_TYPES = void 0;
exports.showToast = exports.navigate = exports.shell = exports.stopLoading = exports.startLoading = exports.clearBreadcrumbExtraLevels = exports.insertNewBreadcrumbLevel = exports.ACTIONS = exports.ACTION_TYPES = void 0;
var actions_1 = require("./actions");

@@ -17,2 +17,4 @@ Object.defineProperty(exports, "ACTION_TYPES", { enumerable: true, get: function () { return actions_1.ACTION_TYPES; } });

Object.defineProperty(exports, "navigate", { enumerable: true, get: function () { return navigation_1.navigate; } });
var toast_1 = require("./toast");
Object.defineProperty(exports, "showToast", { enumerable: true, get: function () { return toast_1.showToast; } });
//# sourceMappingURL=index.js.map

@@ -71,4 +71,3 @@ "use strict";

function startLoading() {
const params = actions_1.ACTIONS.START_LOADING();
shell_1.shell.postMessage(params, "*");
shell_1.shell.postMessage(actions_1.ACTIONS.START_LOADING(), "*");
return true;

@@ -139,4 +138,3 @@ }

function stopLoading() {
const params = actions_1.ACTIONS.STOP_LOADING();
shell_1.shell.postMessage(params, "*");
shell_1.shell.postMessage(actions_1.ACTIONS.STOP_LOADING(), "*");
return true;

@@ -143,0 +141,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.showToast = void 0;
const actions_1 = require("./actions");
const shell_1 = require("./shell");
/**
* Function to display a toast on the admin-shell level.
* It displays the payload as the toast message.
*
* ## @example
* ```jsx
* // other necessary imports up here...
* import { showToast } 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' })
* })
* }}
* />
* </div>
* )
* }
* ```
*/
function showToast({ payload }) {
shell_1.shell.postMessage(actions_1.ACTIONS.SHOW_TOAST({
payload,
}), "*");
}
exports.showToast = showToast;
//# sourceMappingURL=toast.js.map
import { ACTION_TYPES } from "./actions";
export interface InsertOnBreadcrumbParams {
export interface BreadcrumbParams {
/**

@@ -14,2 +14,12 @@ * Name of the new breadcrumb level that must be inserted.

}
export interface ToastParams {
/**
* Payload of the toast, or toast message.
* */
payload: string;
}
export declare type ActionParams = Partial<BreadcrumbParams> & Partial<ToastParams>;
export interface Action extends ActionParams {
type: ACTION_TYPES;
}
export interface Message {

@@ -20,10 +30,3 @@ /**

* */
action: {
type: ACTION_TYPES;
/**
* INSERT_BREADCRUMB_EXTRA_LEVEL action types
* */
newLevelName?: string;
previousLevelUrl?: string;
};
action: Action;
}

@@ -30,0 +33,0 @@ /**

{
"name": "admin-shell-messaging",
"version": "0.1.10",
"version": "0.1.11",
"description": "Admin shell Iframe messaging package",

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

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

import { InsertOnBreadcrumbParams, Message } from "./types";
import { BreadcrumbParams, Message, ToastParams } from "./types";

@@ -8,2 +8,3 @@ export enum ACTION_TYPES {

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

@@ -21,3 +22,3 @@

previousLevelUrl = window.location.pathname,
}: InsertOnBreadcrumbParams): Message => ({
}: BreadcrumbParams): Message => ({
action: {

@@ -34,2 +35,8 @@ type: ACTION_TYPES.INSERT_BREADCRUMB_EXTRA_LEVEL,

}),
SHOW_TOAST: ({ payload }: ToastParams): Message => ({
action: {
type: ACTION_TYPES.SHOW_TOAST,
payload,
},
}),
};
import { ACTIONS } from "./actions";
import { shell } from "./shell";
import { InsertOnBreadcrumbParams } from "./types";
import { BreadcrumbParams } from "./types";

@@ -45,9 +45,10 @@ /**

previousLevelUrl,
}: InsertOnBreadcrumbParams) {
const params = ACTIONS.INSERT_BREADCRUMB_EXTRA_LEVEL({
newLevelName,
previousLevelUrl,
});
shell.postMessage(params, "*");
}: BreadcrumbParams) {
shell.postMessage(
ACTIONS.INSERT_BREADCRUMB_EXTRA_LEVEL({
newLevelName,
previousLevelUrl,
}),
"*"
);
}

@@ -86,4 +87,3 @@

export function clearBreadcrumbExtraLevels() {
const params = ACTIONS.CLEAR_BREADCRUMB_EXTRA_LEVELS();
shell.postMessage(params, "*");
shell.postMessage(ACTIONS.CLEAR_BREADCRUMB_EXTRA_LEVELS(), "*");
}

@@ -7,4 +7,12 @@ export { ACTION_TYPES, ACTIONS } from "./actions";

export { startLoading, stopLoading } from "./loadbar";
export { InsertOnBreadcrumbParams, Message, ReceivedMessage } from "./types";
export {
BreadcrumbParams,
ToastParams,
Message,
ReceivedMessage,
ActionParams,
Action,
} from "./types";
export { shell } from "./shell";
export { navigate } from "./navigation";
export { showToast } from "./toast";

@@ -69,6 +69,3 @@ import { ACTIONS } from "./actions";

export function startLoading() {
const params = ACTIONS.START_LOADING();
shell.postMessage(params, "*");
shell.postMessage(ACTIONS.START_LOADING(), "*");
return true;

@@ -139,7 +136,4 @@ }

export function stopLoading() {
const params = ACTIONS.STOP_LOADING();
shell.postMessage(params, "*");
shell.postMessage(ACTIONS.STOP_LOADING(), "*");
return true;
}
import { ACTION_TYPES } from "./actions";
export interface InsertOnBreadcrumbParams {
export interface BreadcrumbParams {
/**

@@ -16,2 +16,15 @@ * Name of the new breadcrumb level that must be inserted.

export interface ToastParams {
/**
* Payload of the toast, or toast message.
* */
payload: string;
}
export type ActionParams = Partial<BreadcrumbParams> & Partial<ToastParams>;
export interface Action extends ActionParams {
type: ACTION_TYPES;
}
export interface Message {

@@ -22,10 +35,3 @@ /**

* */
action: {
type: ACTION_TYPES;
/**
* INSERT_BREADCRUMB_EXTRA_LEVEL action types
* */
newLevelName?: string;
previousLevelUrl?: string;
};
action: Action;
}

@@ -32,0 +38,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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