widget-context-package
v1.2.0
Published
STEP 1: Install the package using the following command:
Downloads
6
Readme
STEP 1: Install the package using the following command:
npm i widget-context-package
STEP 2: Import the necessary functions in layout.js/ main.js:
import { WidgetContextWrapper } from "widget-context-package/dist/WidgetContext";
STEP 3: Wrap the frontend using WidgetContextWrapper, similarly to the context api:
< WidgetContextWrapper > {children} < WidgetContextWrapper />
STEP 4: Inport useWidgetContext in the file where the package should be used. Also import the iframeDataHandler function:
import { useWidgetContext } from "widget-context-package/dist/WidgetContext";
/////
const { iframeDataHandler } = useWidgetContext();
STEP 5: Use the iframeDataHandler function. example provided using onclick handler ID, name, email and phone should be passed in the iframeDataHandler function:
onClick={() => iframeDataHandler(data.recipientUID, data.recipientName, data.recipientEmail, data.recipientPhone)}>