Documentation / @frak-labs/core-sdk / actions / modalBuilder
Function: modalBuilder()
modalBuilder(
client,args):ModalBuilder
Defined in: actions/wrapper/modalBuilder.ts:98
Helper to craft Frak modal, and share a base initial config
Parameters
client
The current Frak Client
args
login?
ModalStepMetadata & { allowSso: true; ssoMetadata?: SsoMetadata; } | ModalStepMetadata & { allowSso?: false; ssoMetadata?: undefined; }
Login step parameters
metadata?
Common modal metadata (customisation, language etc)
Returns
Example
Here is an example of how to use the modalBuilder to create and display a sharing modal:
// Create the modal builder
const modalBuilder = window.FrakSDK.modalBuilder(frakClient, baseModalConfig);
// Configure the information to be shared via the sharing link
const sharingConfig = {
popupTitle: "Share this with your friends",
text: "Discover our product!",
link: window.location.href,
};
// Display the sharing modal
function modalShare() {
modalBuilder.sharing(sharingConfig).display();
}See
- ModalStepTypes for more info about each modal step types and their parameters
- ModalRpcMetadata for more info about the metadata that can be passed to the modal
- ModalRpcStepsResultType for more info about the result of each modal steps
- displayModal for more info about how the modal is displayed