Embeddable Calculator
Full documentation for the Tenet Embeddable Calculator API.
Just Getting Started?We recommend checking out the quick-start guide.
Full API Guide for Embedding Tenet Calculators
The Tenet API provides various methods and functionalities to embed and interact with the Tenet calculator. Here's a comprehensive guide:
1. tenet.embedCalculator(querySelectorString, optionsObject)
tenet.embedCalculator(querySelectorString, optionsObject)Instantiates embedded Tenet calculators. Multiple calls to the same selected elements will destroy the previous instance and set up a new calculator instance.
-
Arguments
querySelector(optional): A query selector string to identify elements to transform into calculators. Any valid query that works withdocument.querySelectoris acceptable. If omitted, it defaults to"[data-tenet-calculator]".options(optional): A configuration object for customization.
-
Options Configuration (all optional)
width: The width of the iframe (e.g., "1260px" or "100%"). Defaults to "1260px" or “625px” withverticalDefaultenabled.height: The height of the iframe. Defaults to “600px” or “1060px” withverticalDefaultenabled.verticalDefault: Changes the default size to portrait (625px x 1060px). No effect if custom width or height specified.showLoader: Shows or hides the default Tenet loader. Defaults to true.showErrors: Shows or hides the default error state. Defaults to true.verbose: Enables logging for integration setup. Defaults to false.onLoad: Callback invoked when instantiated.onError: Callback invoked on error.
-
Returns: An array of instantiated calculator objects or errors if any occurred during instantiation.
-
Example
tenet.embedCalculator.ready(() => { tenet.embedCalculator("#myCalculatorId", { width: "100%", height: "100%", verbose: true, onLoad: () => console.log('embed has finished instantiating calculator'), }) })
2. tenet.embedCalculator.ready(callback)
tenet.embedCalculator.ready(callback)Fires a callback when tenet.embedCalculator is ready to be called.
-
Arguments
callback: The function to be invoked when script loading is complete.
-
Example
tenet.embedCalculator.ready(() => { tenet.embedCalculator() })
3. tenet.noConflict()
tenet.noConflict()Removes the Tenet API object from the global namespace.
-
Returns: The Tenet API object.
-
Example
const myTenetAPI = tenet.noConflict(); myTenetAPI.embedCalculator();
Need Help?
For further assistance or more detailed information, reach out to our support team at [email protected].
Updated 3 months ago
