Overview
mezon-web-sdk is a lightweight TypeScript library designed to facilitate seamless communication between web applications (running inside iframe channels) and the host Mezon application. It provides a simple and secure event-driven interface using the browser's postMessage API for cross-origin communication.
Why mezon-web-sdk?
This SDK abstracts the complexities of cross-origin iframe communication within Mezon channels, allowing developers to focus on building engaging channel applications. The core features include:
- 🟢 Event-Driven Communication: Easily send and receive events between your channel app and the Mezon client using a secure postMessage interface.
- 🔵 Secure by Design: Communication is restricted to trusted Mezon origins, preventing unauthorized interactions and ensuring application security.
- 🟡 Dynamic Integration: The host Mezon application can dynamically pass parameters, change themes, and inject custom CSS into your channel app at runtime.
- 🔴 State Persistence: Initialization parameters are automatically persisted in
sessionStorageto maintain state across page reloads and navigation. - 🟣 Cross-Platform Compatibility: Works seamlessly across all modern browsers and platforms where Mezon is supported.
- 🟠 Lightweight & Fast: Minimal footprint with no external dependencies, ensuring quick loading and optimal performance.
- ⚙️ TypeScript Support: Built with TypeScript for full type safety and enhanced developer experience with IntelliSense support.
Features
| Component | Details | |
|---|---|---|
| ⚙️ | Architecture |
|
| 🔩 | Core Functionality |
|
| 🔌 | Event System |
|
| 🎨 | Dynamic Styling |
|
| 🧩 | Utilities |
|
| 🛡️ | Security |
|
| 📦 | Dependencies |
|
| 🚀 | Performance |
|
Project Structure
└── mezon-web-js/
├── package.json
├── README.md
├── tsconfig.json
├── webpack.config.js
├── src/
│ ├── index.ts
│ └── webview/
│ ├── constant.ts
│ ├── index.ts
│ ├── types.ts
│ ├── utils.ts
│ └── webview.ts
├── example/
│ ├── index.html
│ ├── main.js
│ ├── counter.js
│ ├── style.css
│ └── public/
│ └── mezon-sdk.js
└── build/
├── mezon-web-sdk.js
└── mezon-web-sdk.d.ts