5.0.0 • Published 1 year ago

postmessage-communicator v5.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

postmessage-communicator

Release Lint Contributor Covenant Maintainer

About The Project

Use this tool to communicate across an iframe using postmessage subscription.

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

This is an example of how to list things you need to use the software and how to install them.

  • yarn

    npm install --global yarn

Installation

  1. Clone the repo

    git clone https://github.com/wayfair-incubator/postmessage-communicator.git
  2. Install yarn packages and compile typescript code

    yarn
    yarn tsc

Communicator API

subscribe

Parameter NameRequiredDescriptionTypeDefault
eventTypeyesevent type to listen forstring
cbyescallback fired on event(e: MessageEvent) => void

unsubscribe

Parameter NameRequiredDescriptionTypeDefault
cbyescallback returned as subscription(e: MessageEvent) => void

post

Parameter NameRequiredDescriptionTypeDefault
typeyesevent type to post eg: addToCartstring | VendorEvent | ClientEvent
payloadyespost dataanything but a function

Vendor Communicator API

addToCart

Parameter NameRequiredDescriptionTypeDefault
customerUidyescustomer identifierstring
projectIdyesproject identifierstring
projectVersionnoproject versionstring
brandyesbrand descriptionstring
styleyesstyle descriptionstring
coloryescolorstring
urlyesthumbnail image urlstring
bomyesbill of materialsstring

designerHandOff

Parameter NameRequiredDescriptionTypeDefault
customerUidyescustomer identifierstring
projectIdyesproject identifierstring
projectVersionnoproject versionstring
brandyesbrand descriptionstring
styleyesstyle descriptionstring
coloryescolorstring
urlyesthumbnail image urlstring
areayesarea of roomnumber

requestToken

no parameters

projectDirty

no parameters

projectSaved

no parameters

projectDeleted

no parameters

continueToCart

Parameter NameRequiredDescriptionTypeDefault
customerUidyescustomer identifierstring
projectIdyesproject identifierstring
projectVersionnoproject versionstring
brandyesbrand descriptionstring
styleyesstyle descriptionstring
coloryescolorstring
urlyesthumbnail image urlstring
bomyesbill of materialsstring

Client Communicator API

init

Parameter NameRequiredDescriptionTypeDefault
tokenyesJWT token with initialization payloadstring
landingExperienceyesrequested landing page for applicationstring

refreshToken

Parameter NameRequiredDescriptionTypeDefault
tokenyesJWT token with initialization payloadstring

addToCartStatus

Parameter NameRequiredDescriptionTypeDefault
successyesflag indicating if the add to cart event succeded or notboolean
messageyesstatus messagestring
projectIdyesproject idstring
versionIdyesproject versionstring

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated. For detailed contributing guidelines, please see CONTRIBUTING.md

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Project Link: https://github.com/wayfair-incubator/postmessage-communicator

Acknowledgements

This template was adapted from https://github.com/othneildrew/Best-README-Template.

5.0.0

1 year ago

4.1.0

1 year ago

4.0.0

1 year ago

3.0.0

2 years ago

2.0.0

2 years ago

1.0.0

2 years ago