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

postmessage-communicator

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postmessage-communicator - npm Package Compare versions

Comparing version 4.1.0 to 5.0.0

4

CHANGELOG.md

@@ -13,2 +13,6 @@ # Changelog

## [v5.0.0] - 2021-01-04
- Updated event types and payloads in Vendor Communicator
## [v4.1.0] - 2022-12-23

@@ -15,0 +19,0 @@

79

dist/classes/VendorCommunicator.d.ts
import { Communicator } from './Communicator';
export declare enum VendorEvent {
AddToCart = "AddToCart",
AppInitialized = "AppInitialized",
ContactDesigner = "ContactDesigner",
iFrameLoaded = "iFrameLoaded",
iFrameRedirect = "iFrameRedirect",
DirtyStateChanged = "DirtyStateChanged",
iFrameLoaded = "iFrameLoaded",
ProjectSaved = "ProjectSaved",
ProjectDeleted = "ProjectDeleted",
ProjectSaved = "ProjectSaved",
TrackingEvent = "TrackingEvent",
ContactDesigner = "ContactDesigner",
AddToCart = "AddToCart",
ContinueToCart = "ContinueToCart",
TokenRefreshRequested = "TokenRefreshRequested",
UnauthorizedToken = "UnauthorizedToken",
ContinueToCart = "ContinueToCart"
TrackingEvent = "TrackingEvent"
}
interface Metadata {
source?: string;
interface CommonPayload {
message?: string;
token: string;
customerId: string;
}
interface CommonMetadata {
title: string;

@@ -21,16 +26,37 @@ brand: string;

color: string;
thumbnailUrl: string;
price: number;
retailPrice?: number;
thumbnailUrl?: string;
[key: string]: string | number | undefined;
}
interface CabinetsMetadata extends CommonMetadata {
source?: string;
area?: number;
price?: number;
}
interface EventPayload {
interface SnapshotPayload<M extends CommonMetadata> extends CommonPayload {
schema: string;
token: string;
customerId: string;
projectId: string;
versionId: string;
metadata: Metadata;
bom?: any;
metadata: M;
bom: string;
}
interface TrackingEvent {
interface ProjectSavedPayload extends CommonPayload {
projectId: string;
versionId?: string;
}
interface ProjectDeletedPayload extends CommonPayload {
projectId: string;
}
interface DirtyStateChangedPayload extends CommonPayload {
projectId: string;
isDirty: boolean;
}
interface iFrameRedirectPayload extends CommonPayload {
app: string;
key?: string | number;
}
interface TokenRefreshRequestedPayload extends CommonPayload {
requestId: string;
}
interface TrackingEventPayload {
actionName: string;

@@ -41,14 +67,15 @@ actionData: Record<string, unknown>;

constructor(origin: string);
addToCart(payload: EventPayload): void;
appInitialized(): void;
contactDesigner(payload: EventPayload): void;
dirtyStateChanged(): void;
iframeLoaded(): void;
projectSaved(): void;
projectDeleted(): void;
trackEvent(payload: TrackingEvent): void;
tokenRefreshRequested(): void;
appInitialized(message: string): void;
iframeLoaded(message: string): void;
iframeRedirect(payload: iFrameRedirectPayload): void;
dirtyStateChanged(payload: DirtyStateChangedPayload): void;
projectSaved(payload: ProjectSavedPayload): void;
projectDeleted(payload: ProjectDeletedPayload): void;
contactDesigner(payload: SnapshotPayload<CabinetsMetadata>): void;
addToCart(payload: SnapshotPayload<CabinetsMetadata>): void;
continueToCart(payload: SnapshotPayload<CabinetsMetadata>): void;
tokenRefreshRequested(payload: TokenRefreshRequestedPayload): void;
unauthorizedToken(error: string): void;
continueToCart(payload: EventPayload): void;
trackEvent(payload: TrackingEventPayload): void;
}
export {};

@@ -7,13 +7,14 @@ "use strict";

(function (VendorEvent) {
VendorEvent["AddToCart"] = "AddToCart";
VendorEvent["AppInitialized"] = "AppInitialized";
VendorEvent["ContactDesigner"] = "ContactDesigner";
VendorEvent["iFrameLoaded"] = "iFrameLoaded";
VendorEvent["iFrameRedirect"] = "iFrameRedirect";
VendorEvent["DirtyStateChanged"] = "DirtyStateChanged";
VendorEvent["iFrameLoaded"] = "iFrameLoaded";
VendorEvent["ProjectSaved"] = "ProjectSaved";
VendorEvent["ProjectDeleted"] = "ProjectDeleted";
VendorEvent["ProjectSaved"] = "ProjectSaved";
VendorEvent["TrackingEvent"] = "TrackingEvent";
VendorEvent["ContactDesigner"] = "ContactDesigner";
VendorEvent["AddToCart"] = "AddToCart";
VendorEvent["ContinueToCart"] = "ContinueToCart";
VendorEvent["TokenRefreshRequested"] = "TokenRefreshRequested";
VendorEvent["UnauthorizedToken"] = "UnauthorizedToken";
VendorEvent["ContinueToCart"] = "ContinueToCart";
VendorEvent["TrackingEvent"] = "TrackingEvent";
})(VendorEvent = exports.VendorEvent || (exports.VendorEvent = {}));

@@ -26,36 +27,39 @@ class VendorCommunicator extends Communicator_1.Communicator {

}
addToCart(payload) {
this.post({ type: VendorEvent.AddToCart, payload });
appInitialized(message) {
this.post({ type: VendorEvent.AppInitialized, payload: message });
}
appInitialized() {
this.post({ type: VendorEvent.AddToCart });
iframeLoaded(message) {
this.post({ type: VendorEvent.iFrameLoaded, payload: message });
}
contactDesigner(payload) {
this.post({ type: VendorEvent.ContactDesigner, payload });
iframeRedirect(payload) {
this.post({ type: VendorEvent.iFrameRedirect, payload });
}
dirtyStateChanged() {
this.post({ type: VendorEvent.DirtyStateChanged });
dirtyStateChanged(payload) {
this.post({ type: VendorEvent.DirtyStateChanged, payload });
}
iframeLoaded() {
this.post({ type: VendorEvent.iFrameLoaded });
projectSaved(payload) {
this.post({ type: VendorEvent.ProjectSaved, payload });
}
projectSaved() {
this.post({ type: VendorEvent.ProjectSaved });
projectDeleted(payload) {
this.post({ type: VendorEvent.ProjectDeleted, payload });
}
projectDeleted() {
this.post({ type: VendorEvent.ProjectDeleted });
contactDesigner(payload) {
this.post({ type: VendorEvent.ContactDesigner, payload });
}
trackEvent(payload) {
this.post({ type: VendorEvent.TrackingEvent, payload });
addToCart(payload) {
this.post({ type: VendorEvent.AddToCart, payload });
}
tokenRefreshRequested() {
this.post({ type: VendorEvent.TokenRefreshRequested });
continueToCart(payload) {
this.post({ type: VendorEvent.ContinueToCart, payload });
}
tokenRefreshRequested(payload) {
this.post({ type: VendorEvent.TokenRefreshRequested, payload });
}
unauthorizedToken(error) {
this.post({ type: VendorEvent.UnauthorizedToken, payload: error });
}
continueToCart(payload) {
this.post({ type: VendorEvent.ContinueToCart, payload });
trackEvent(payload) {
this.post({ type: VendorEvent.TrackingEvent, payload });
}
}
exports.VendorCommunicator = VendorCommunicator;
{
"name": "postmessage-communicator",
"version": "4.1.0",
"version": "5.0.0",
"description": "[![Release](https://img.shields.io/github/v/release/wayfair-incubator/oss-template?display_name=tag)](CHANGELOG.md) [![Lint](https://github.com/wayfair-incubator/oss-template/actions/workflows/lint.yml/badge.svg?branch=main)](https://github.com/wayfair-incubator/oss-template/actions/workflows/lint.yml) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.0-4baaaa.svg)](CODE_OF_CONDUCT.md) [![Maintainer](https://img.shields.io/badge/Maintainer-Wayfair-7F187F)](https://wayfair.github.io)",

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

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