Logo

dev-resources.site

for different kinds of informations.

Building an embeddable Widget

Published at
7/18/2024
Categories
widget
frontend
plugin
Author
sibelius
Categories
3 categories in total
widget
open
frontend
open
plugin
open
Author
8 person written this
sibelius
open
Building an embeddable Widget

In the article Creating a Powerful Pix Checkout with Woovi Plugin and HTML, CSS and Js we learn how to use the Woovi widget in another website.

In this article, we are going to learn how to build that Embeddable Widget.

What is an Embeddable Widget?

An Embeddable Widget is a piece of frontend that you can put into another website.

You add a script tag to your application

<script src="https://plugin.woovi.com/v1/woovi.js" async>
Enter fullscreen mode Exit fullscreen mode

And this JavaScript will do something on your website.

You could also use an iframe to embed from websites directly to yours, but not as powerful as using custom JavaScript code.

A React Embeddable Widget

We are going to use React in our example, but this applies to any other frontend framework.

The first thing your Widget needs to do is to find a place to inject your React app.

const initWidget = () => {
  // <div id='woovi-order' data-appid={config.WOOVI_APP_ID} data-paymentlinkid={paymentLinkID} />
  const defaultOrderNodeWoovi = 'woovi-order';

  const wooviHostNodes = document.querySelectorAll(
    `#${defaultOrderNodeWoovi}`,
  );

  const [hostNode] = wooviHostNodes;

  const root = createRoot(hostNode);

  root.render(<Widget />);
}
Enter fullscreen mode Exit fullscreen mode

In the code above we expect to find one div with id woovi-order, so we can render our React App Widget.

If you were expecting a much more complicated code, I'm sorry, but that's it. As simple as that.

In Conclusion

Does your product have an embeddable widget? What use cases do you think in building an embeddable widget?
We like our Woovi Plugin (our embeddable widget) because it reduces a lot the cost of our customers to integrate payments into their websites and products. We take it off all the complexity of the design of the frontend and real-time over WebSockets.
They get all that for free with just a few lines of code.


Woovi
Woovi is a Startup that enables shoppers to pay as they like. Woovi provides instant payment solutions for merchants to accept orders to make this possible.

If you want to work with us, we are hiring!


Image by pikisuperstar on Freepik

widget Article's
30 articles in total
Favicon
Forex Ticker Widget: Simplifying Forex Monitoring for Users
Favicon
Passing variables from the static page to the widget
Favicon
How to launch a React Native app from the Lock Screen on iPhone
Favicon
Free Currency HTML-Widgets
Favicon
Integrating Live Forex Quotes into Your Trading Platform Seamlessly
Favicon
Implement a Secure, Dynamic Domain Approval System for Embeddable Widgets in Ruby on Rails
Favicon
The Future of Professional Networking on LinkedIn: How Businesses Can Adapt and Stay Ahead
Favicon
Embed JS Widgets with Rails: A Step-by-Step Guide
Favicon
Create embeddable widgets in react for static pages
Favicon
FloatyNavBar: Elevate Your Flutter App's Navigation
Favicon
Web music player with html-css-javascript
Favicon
Free Currency HTML-Widgets
Favicon
Building an embeddable Widget
Favicon
Video, Live Chat & Help Center widget for the website
Favicon
100 Common Flutter widget list
Favicon
Back to basic : Flutter widget lifecycle
Favicon
FlutterFlow has introduced this fantastic new draggable widget!
Favicon
Bigcommerce Widget Migration
Favicon
Simple Digital Clock Widget
Favicon
Exploring Simple Widgets II: Autocomplete
Favicon
Improved Data Point Graph Widget for Cumulocity IoT
Favicon
Enhancing Cumulocity IoT Capabilities: Map-Based Widgets
Favicon
The Journey of a Widget: Understanding the Lifecycle in Flutter
Favicon
flutter row widget example
Favicon
Flutter Column Widget Example
Favicon
Common Widgets in Flutter
Favicon
Creating an iOS Currency Exchange Rate Widget: A Step-by-Step Guide
Favicon
Flutter Custom Widget
Favicon
How to embed appointment scheduling widget on your website?
Favicon
How to screenshot a widget in the flutter

Featured ones: