diff --git a/packages/builder/src/dataBinding.js b/packages/builder/src/dataBinding.js index 0cd9f8a4cf..6ba3c4cbfc 100644 --- a/packages/builder/src/dataBinding.js +++ b/packages/builder/src/dataBinding.js @@ -56,6 +56,7 @@ export const getBindableProperties = (asset, componentId) => { const stateBindings = getStateBindings() const selectedRowsBindings = getSelectedRowsBindings(asset) const roleBindings = getRoleBindings() + const embedBindings = getEmbedBindings() return [ ...contextBindings, ...urlBindings, @@ -64,6 +65,7 @@ export const getBindableProperties = (asset, componentId) => { ...deviceBindings, ...selectedRowsBindings, ...roleBindings, + ...embedBindings, ] } @@ -823,6 +825,26 @@ export const getActionBindings = (actions, actionId) => { return bindings } +/** + * Gets all device bindings for embeds. + */ +const getEmbedBindings = () => { + let bindings = [] + const safeEmbed = makePropSafe("embed") + + bindings = [ + { + type: "context", + runtimeBinding: `${safeEmbed}.`, + readableBinding: `ParentData`, + category: "Embed", + icon: "DevicePhone", + display: { type: "object", name: "Parent Data" }, + }, + ] + return bindings +} + /** * Gets the schema for a certain datasource plus. * The options which can be passed in are: diff --git a/packages/client/src/components/ClientApp.svelte b/packages/client/src/components/ClientApp.svelte index 763c8ef771..c0ae921a12 100644 --- a/packages/client/src/components/ClientApp.svelte +++ b/packages/client/src/components/ClientApp.svelte @@ -42,6 +42,7 @@ import FreeFooter from "components/FreeFooter.svelte" import MaintenanceScreen from "components/MaintenanceScreen.svelte" import SnippetsProvider from "./context/SnippetsProvider.svelte" + import EmbedProvider from "./context/EmbedProvider.svelte" // Provide contexts setContext("sdk", SDK) @@ -160,119 +161,121 @@ {#if $environmentStore.maintenance.length > 0} {:else} - - - - - - - - - {#key $builderStore.selectedComponentId} - {#if $builderStore.inBuilder} - - {/if} - {/key} - - -
- -
- {#if showDevTools} - + + + + + + + + + + {#key $builderStore.selectedComponentId} + {#if $builderStore.inBuilder} + {/if} + {/key} -
- {#if permissionError} -
- - - {@html ErrorSVG} - - You don't have permission to use this app - - - Ask your administrator to grant you access - - -
- {:else if !$screenStore.activeLayout} -
- - - {@html ErrorSVG} - - Something went wrong rendering your app - - - Get in touch with support if this issue persists - - -
- {:else if embedNoScreens} -
- - - {@html ErrorSVG} - - This Budibase app is not publicly accessible - - -
- {:else} - - {#key $screenStore.activeLayout._id} - - {/key} - - - diff --git a/packages/client/src/components/context/EmbedProvider.svelte b/packages/client/src/components/context/EmbedProvider.svelte new file mode 100644 index 0000000000..98bb41762a --- /dev/null +++ b/packages/client/src/components/context/EmbedProvider.svelte @@ -0,0 +1,11 @@ + + + + + +