whitelabel sdk light (#6147)

* all

* all
This commit is contained in:
Ruben Fiszel
2025-07-09 01:41:02 +02:00
committed by GitHub
parent ff59112514
commit f71ddb75ec
3 changed files with 39 additions and 8 deletions
+26 -4
View File
@@ -3,11 +3,33 @@
import type { FlowBuilderProps } from './flow_builder'
import FlowBuilder from './FlowBuilder.svelte'
let { flowStore: oldFlowStore, disableAi, ...props }: FlowBuilderProps = $props()
let {
flowStore: oldFlowStore,
disableAi,
light,
...props
}: FlowBuilderProps & { light?: boolean } = $props()
let flowStore = $state(oldFlowStore)
let trialRender = $state(true)
if (light) {
setTimeout(() => {
trialRender = false
}, 1000 * 300)
}
</script>
<AiChatLayout noPadding={true} {disableAi}>
<FlowBuilder {flowStore} {disableAi} {...props} />
</AiChatLayout>
{#if trialRender}
<AiChatLayout noPadding={true} {disableAi}>
{#if light}<div class="bg-red-500 absolute z-10">Trial version</div>{/if}
<FlowBuilder {flowStore} {disableAi} {...props} />
</AiChatLayout>
{:else}
<div class="flex flex-col items-center justify-center h-screen">
<div class="text-2xl font-bold"
>Windmill Whitelabel SDK is in trial mode and disabled itself after 5 minutes</div
>
</div>
{/if}
@@ -10,15 +10,22 @@
import { sendUserToast } from '$lib/toast'
import { Loader2 } from 'lucide-svelte'
import { refreshStateStore } from '$lib/svelte5Utils.svelte'
import SimpleEditor from '../../SimpleEditor.svelte'
const { flowStore } = getContext<FlowEditorContext>('FlowEditorContext')
const { flowStore } = $state(getContext<FlowEditorContext>('FlowEditorContext'))
export let drawer: Drawer | undefined
interface Props {
drawer: Drawer | undefined
}
let code = ''
let { drawer = $bindable() }: Props = $props()
let code = $state('')
let editor = $state(undefined) as SimpleEditor | undefined
function reload() {
code = YAML.stringify(filteredContentForExport(flowStore.val))
editor?.setCode(code)
}
function apply() {
@@ -46,6 +53,7 @@
flowStore.val.schema = parsed.schema
flowStore.val.tag = parsed.tag
refreshStateStore(flowStore)
sendUserToast('Changes applied')
} catch (e) {
sendUserToast('Error parsing yaml: ' + e), true
}
@@ -63,7 +71,7 @@
{#await import('../../SimpleEditor.svelte')}
<Loader2 class="animate-spin" />
{:then Module}
<Module.default autoHeight bind:code lang="yaml" />
<Module.default bind:this={editor} autoHeight bind:code lang="yaml" />
{/await}
{/if}
</DrawerContent>
@@ -41,6 +41,7 @@
<!-- <ScriptWrapper {script} neverShowMeta={true} {customUi} /> -->
<FlowWrapper
light
disableAi
pathStoreInit="u/foo/bar"
{customUi}