This page describes the interaction between the Generic Delivery Connector, Templafy and the user.
An iframe will be rendered in the background pointing towards the Base URL
specified in the settings.
This URL should host the Delivery Controller.
The Controller first needs to be initialized using:
React:
useInitialize();
TypeScript:
await Templafy.initialize();
- The Delivery Controller can specify the next action of the button by invoking on of the following methods:
Templafy.sendRequireInput()
Next click shows Delivery Controller content
Templafy.sendShouldAuthenticate()
Next click opens authentication popup
Templafy.sendCanUpload()
Next click sends the document URL to the Delivery Controller and shows finalization screen
Templafy.sendClearButton()
Next click clears the next action, disabling the button
- The controller should then let Templafy know whether to show an authentication popup using:
Templafy.sendShouldAuthenticate({
shouldAuthenticate: true | false;
authenticationUrl?: "location of authentication popup";
})
- The popup can then report the result of the authentication using:
Templafy.sendAuthenticationComplete({
authenticationSuccessful: true,
state: "<some state>"
});
There is a possibility to pass some arbitrary state to the Delivery Controller. This will be available from:
React:
const {authenticationState} = useInitialize();
TypeScript:
const {
authenticationState,
authenticationSuccessful
} = await Templafy.getAuthenticationState();
- At this point, a loading screen will be shown and the Delivery Controller will be sent a download URL pointing to the created document. It can be retrieved using:
React:
const {documentUrl} = useDocumentUrl();
TypeScript:
const documentUrl = await Templafy.getDocumentUrl();
After the Delivery Controller has completed the upload, it can redirect the main window to the location of the document using:
Templafy.sendUploadComplete("https://LOCATION_OF_DOCUMENT");