diff --git a/packages/devtools/src/Devtools.stories.ts b/packages/devtools/src/Devtools.stories.ts index 0261bb2d..f5be31b5 100644 --- a/packages/devtools/src/Devtools.stories.ts +++ b/packages/devtools/src/Devtools.stories.ts @@ -12,6 +12,11 @@ const abbyMock = { "flag-1": true, "flag-2": false, }, + remoteConfig: { + "config-1": "string-value", + "config-2": 42, + "config-3": {type: "object/json"} + }, tests: { "test-1": { selectedVariant: "A", variants: ["A", "B"] }, "test-2": { selectedVariant: "B", variants: ["A", "B"] }, diff --git a/packages/devtools/src/Devtools.svelte b/packages/devtools/src/Devtools.svelte index c07f96d7..0e73e4c6 100644 --- a/packages/devtools/src/Devtools.svelte +++ b/packages/devtools/src/Devtools.svelte @@ -93,61 +93,63 @@ >
-

Flags:

- {#each Object.entries(flags) as [flagName, flagValue]} - { - window.postMessage({ type: "abby:update-flag", flagName, newValue }, "*"); - abby.updateFlag(flagName, newValue); - }} - /> - {/each} -
-

Remote Config:

- {#each Object.entries(remoteConfig) as [remoteConfigName, remoteConfigValue]} - {#if typeof remoteConfigValue === "string" || typeof remoteConfigValue === "number"} - +

Flags:

+ {#each Object.entries(flags) as [flagName, flagValue]} + { - window.postMessage({ type: "abby:update-flag", remoteConfigName, newValue }, "*"); - abby.updateRemoteConfig(remoteConfigName, newValue); + window.postMessage({ type: "abby:update-flag", flagName, newValue }, "*"); + abby.updateFlag(flagName, newValue); }} /> - {:else if typeof remoteConfigValue === "object"} -
-

{remoteConfigName}

- +

Remote Config:

+ {#each Object.entries(remoteConfig) as [remoteConfigName, remoteConfigValue]} + {#if typeof remoteConfigValue === "string" || typeof remoteConfigValue === "number"} + { window.postMessage({ type: "abby:update-flag", remoteConfigName, newValue }, "*"); abby.updateRemoteConfig(remoteConfigName, newValue); }} /> -
- {/if} - {/each} -
-

A/B Tests:

- {#each Object.entries(tests) as [testName, { selectedVariant, variants }]} - ({ + label: v, + value: v, + }))} + onChange={(newValue) => { + window.postMessage({ type: "abby:select-variant", testName, newValue }, "*"); + abby.updateLocalVariant(testName, newValue); + }} + /> + {/each} + {:else}