Appearance
Are you an LLM? You can read better optimized documentation at /features/notebook/sharing/signed-embed/use-case.md for this page in Markdown format
Use cases
Design examples for a signed embed, assuming a retail-support SaaS. For a summary of parameter roles, see Multi-tenant; for publishing and settings, see Signed embed; for integration steps, see Integration steps.
For code examples, also see the README of the Codatum Embed SDK.
Scenario
Assume a SaaS that supports retail store operations, embedding a dashboard of sales and KPIs per store. When a store manager or an area manager logs in, only the information related to their own store is shown.
Notebook parameters
Assume the source notebook has the following parameters. The parameter names are examples; they aren't required names.
tenant_id- The tenant ID the logged-in user belongs to.
- Text input.
store_id- The ID of the store to display.
- Text select. The choices are the store IDs within the tenant specified by
tenant_id.
date_range- The aggregation period.
- Date range. The default value is a relative date, 7 days ending yesterday.
product_category- The product category to aggregate.
- Text multi select. When nothing is selected, the SQL conditions show all categories.
Configuration example A: using the signed embed's own form
Notebook design assumptions
- Fix
tenant_idto restrict the data that can be accessed.- The SQL that extracts data must always include
tenant_idas a filter condition. - Even when extracting store data, include
tenant_idas a condition in addition tostore_id, so that another tenant's store data can't be extracted.
- The SQL that extracts data must always include
- Design
date_rangeandproduct_categoryso any value can be specified.
Parameter configuration
tenant_id: server-side parameter fixed valuestore_id: server-side parameter initial valuedate_range: client-side parameterproduct_category: client-side parameter
Flow up to display
- Issue a token server-side.
- Specify the user's
tenant_idas the fixed value. - Among the stores tied to
tenant_id, specify thestore_idto display initially as the initial value.
- Specify the user's
- Render initially on the frontend.
- In the return value of the Embed SDK's
tokenProvider, include the following client-side parameters inparams.- For
date_range, configure it to use the default value as the initial value, so the relative date is recalculated (see Relative dates). - Specify an empty array as the initial value for
product_category.
- For
- In the return value of the Embed SDK's
- The user operates the dashboard.
- The user can change
store_id,date_range, andproduct_categoryfrom the input form.
- The user can change
Configuration example B: managing parameters on the embedding app side
Notebook design assumptions
Same as configuration example A.
Parameter configuration
tenant_id: server-side parameter fixed valuestore_id: client-side parameterdate_range: client-side parameterproduct_category: client-side parameter
Flow up to display
- Issue a token server-side.
- Specify the user's
tenant_idas the fixed value.
- Specify the user's
- Render initially on the frontend.
- Enable
displayOptions.hideParamsFormto hide the parameter form. - In the return value of
tokenProvider, include thestore_id,date_range, andproduct_categorymanaged by the embedding app inparams.
- Enable
- The user operates the dashboard.
- To update the display based on a condition change on the embedding app side, use the following steps.
- Reuse the token used for the initial render, and reload the embed (for example, via
reload) with the full set of updated client-side parameters included inparams.- Send the full set (
store_id,date_range,product_category), not just the diff. - If the same user uses the same fixed value, the token can be reused within its expiration period.
- Send the full set (
Configuration example C: updating a server-side parameter's fixed value
Notebook design assumptions
- Fix both
tenant_idandstore_idto restrict the data that can be accessed.- Unlike configuration example A, this assumes
store_idalso needs to be fixed server-side.
- Unlike configuration example A, this assumes
- Design
date_rangeandproduct_categoryso any value can be specified, as in configuration example A.
Parameter configuration
tenant_id: server-side parameter fixed valuestore_id: server-side parameter fixed valuedate_range: client-side parameterproduct_category: client-side parameter
Flow up to display
- Issue a token server-side.
- Specify the user's
tenant_idand thestore_idto display initially as fixed values.
- Specify the user's
- Render initially on the frontend.
- In the return value of
tokenProvider, include the following client-side parameters inparams.- For
date_range, configure it to use the default value as the initial value, so the relative date is recalculated (see Relative dates). - Specify an empty array as the initial value for
product_category.
- For
- In the return value of
- The user operates the dashboard.
store_idis a fixed value, so it can't be changed from the input form. Provide a store-switching UI on the embedding app side.- To change stores and re-render, reissue the token with the new
store_id, then send the new token and the full set of client-side parameters.- Changing a fixed value requires reissuing the token.
- Send the full set of client-side parameters (
date_range,product_category), not just the diff. - If you want to preserve values the user changed before the redraw, record them using the Embed SDK's
paramChangedevent (onParamChangedin React / Vue) and include them when resending.
date_rangeandproduct_categorycan be changed from the input form.