@allowmy/webpopup
v1.1.0
Published
Popup Web User Experience
Downloads
2
Readme
AllowMy Web Popup
Popup Web User Experience
Overview
This library provides a wrapper for an iFrame that executes code on a remote server (at hostUrl) It expects the embedded code to be downloadable from WIDGET_DOWNLOAD_PATH and implement the interface WebWidgetCore This code is expected to use the Zoid component.
Start a flow by triggering the user popup:
import { WebPopupInitializer } from "@allowmy/webpopup"
// init the popup
const options = {
agentId: 'my-service-agent-id',
hostUrl: 'https://myservice.com',
}
const popupInit = WebPopupInitializer()
const webPopup = await popupInit.init(options)
// trigger the popup to appear and run an action on host service
webPopup.launch('myAction', {agentId: 123, actionParam1: '123'})
.then((result) => {console.log('myAction result', result)})
.catch((error) => {console.log('error', error)})
This will launch a pop-up. When the user finishes the flow, the onError or onSuccess callback will be called.
Important
- This library must be used within browser or a web wrapper component that has a
window
object - The popup flow should be triggered by the user clicking a button, link, or some other item that causes an Event. This will help get around pop-up blockers
Installation
npm install @allowmy/webpopup