@simpoobusiness/sdk
v2.0.96
Published
Simpoo SDK for embedding simpooBusiness inventory widgets into any web app
Downloads
538
Maintainers
Readme
Simpoo SDK
Simpoo SDK allows you to embed inventory widgets into any website (HTML, PHP, Next.js, WordPress, etc.) with just a script.
No npm installation is required.
🚀 Quick Start
Include SDK in Your Website
Add these tags inside your <head> or before </body>:
<script src="https://unpkg.com/@simpoobusiness/sdk/dist/simpoo-sdk.js"></script>Add a container where you want the inventory widget to appear:
<div id="inventory-widget"></div>Then initialize and render the widget:
Preferrably before the the closing tag </body> of the page
<script>
SimpooSDK.init({
apiKey: "YOUR_API_KEY",
env: "prod" // optional: 'dev' or 'prod' (defaults to 'dev')
});
SimpooSDK.renderWidget("inventory", "#inventory-widget");
</script>✅ That's it! The widget will load with full styling.
📦 CDN Files
simpoo-sdk.js→ Main SDK script (React included).simpoo-sdk.css→ Styles for inventory components.
⚙️ API Reference
SimpooSDK.init(config)
Initialize the SDK with your configuration.
Parameters:
config.apiKey(string) – Your API key.config.env(string, optional) – The environment to use. Can be'dev'or'prod'. Defaults to'dev'.
Example:
SimpooSDK.init({
apiKey: "12345",
env: "prod"
});SimpooSDK.renderWidget(widget_name, target, [props])
Renders a specific widget into a target container.
Parameters:
widget_name(string) – Name of the widget to render. Options:"inventory","sales_report".target(string | Element) – CSS selector for the container OR a direct DOM Element.props(object, optional) – Additional props to pass to the widget.
Returns: An object containing lifecycle methods:
unmount()– Properly destroys the React root and removes the widget from the DOM.
Example: Render Inventory Widget
const widget = await SimpooSDK.renderWidget("inventory", "#inventory-widget");
// Later, if you need to remove it:
widget.unmount();Example: Render Sales Report Widget
SimpooSDK.renderWidget("sales_report", "#sales-report-widget");SimpooSDK.version
Returns the current version of the SDK.
console.log(SimpooSDK.version); // e.g., "2.0.88"🔍 Troubleshooting
- Widget not rendering?
Ensure the container<div>exists and the selector matches.
📄 License
MIT
