Skip to content

Latest commit

 

History

History
68 lines (54 loc) · 1.32 KB

README.md

File metadata and controls

68 lines (54 loc) · 1.32 KB

react-vite-widget-sdk-template

A boilerplate for building React-based widget SDKs with Vite, designed for embedding via external scripts

Clone this repo

git clone https://github.com/code4mk/react-vite-widget-sdk-template.git

Install dependencies

pnpm install

Run the development server

pnpm run dev

Build the production version

pnpm run build
build/
├── sdk-widget.css
└── sdk-widget.iife.js

how to setup sdk widget as external script

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Widget Development</title>
    <link rel="stylesheet" href="sdk-widget.css">
  </head>
  <body class="font-sans">
    <!-- your code hee -->
    
    <script src="sdk-widget.iife.js"></script>
    <script>
      window.addEventListener('load', () => {
        window.initSdkWidget({
          company_name: 'company name',
          company_slug: 'company slug',
          additional_open_id: 'sdk_widget_button' // optional
        });
      });
    </script>
  </body>
</html> 

💼 Want to build your own widget (sdk)?
📧 [email protected]
🚀 Available for hire