What is a Widget?
Definition of a Widget
A Widget is ANY snippet of packaged javascript logic that runs in a browser. Regular, default widgets follow all 1fe standards and principles. They control their own release lifecycle and are responsible for verifying the API contracts they promise to other host experiences.
A Widget lives in its own GitHub repository, owns its own end-to-end CICD pipeline, and release management (all of which is orchestrated by 1fe), and runs perfectly well in the 1fe Playground, a Widget, or a Plugin.
A widget is never permitted to be an IIFE.
Types of Widgets
Plugin
Definition
A Plugin is a Widget that is TIED to a URL.
The technical difference between a Widget and a Plugin is the details in a configuration file - that provide information to the 1fe Shell via configurations.
A plugin will only ever exist in one place, and at one url. E.g. https://your-1fe-app.com/your-plugin-route
.
Pinned
Definition
A Pinned Widget is a widget where the version can be locked to a specific version by the host widget or plugin. If the host does not “pin” a version, the latest version will be used.
How do I host a pinned widget?
To “pin” a Pinned Widget, use the dependsOn
section within the .1fe.config.ts
file within your widget repository.
FAQ
What if I pin a widget that is not a “Pinned Widget”?
The 1fe ecosystem has several layers of validations that will prevent this from happening. @1fe/cli will throw an error at build time and, if for some reason that layer fails, the runtime will serve you the current version of the requested widget with a warning in the console.