From 34856a368c2a1a592ba30850c7043c2d18b0bc38 Mon Sep 17 00:00:00 2001 From: Ron Cohen Date: Fri, 20 Jun 2025 08:50:42 +0200 Subject: [PATCH 1/8] docs(vue-sdk): simplify getting started docs --- packages/vue-sdk/README.md | 37 ++----------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/packages/vue-sdk/README.md b/packages/vue-sdk/README.md index 3c4f6eb8..3a3b1cbd 100644 --- a/packages/vue-sdk/README.md +++ b/packages/vue-sdk/README.md @@ -46,23 +46,6 @@ const huddle = useFeature("huddle"); ``` @@ -128,24 +111,6 @@ The `` initializes the Bucket SDK, fetches features and starts l - `company`, `user` and `otherContext` make up the _context_ that is used to determine if a feature is enabled or not. `company` and `user` contexts are automatically transmitted to Bucket servers so the Bucket app can show you which companies have access to which features etc. > [!Note] > If you specify `company` and/or `user` they must have at least the `id` property, otherwise they will be ignored in their entirety. You should also supply anything additional you want to be able to evaluate feature targeting against, -- `fallbackFeatures`: A list of strings which specify which features to consider enabled if the SDK is unable to fetch features. Can be provided in two formats: - - ```ts - // Simple array of feature keys - fallbackFeatures={["feature1", "feature2"]} - - // Or with configuration overrides - fallbackFeatures: { - "feature1": true, // just enable the feature - "feature2": { // enable with configuration - key: "variant-a", - payload: { - limit: 100, - mode: "test" - } - } - } - ``` - `timeoutMs`: Timeout in milliseconds when fetching features from the server, - `staleWhileRevalidate`: If set to `true`, stale features will be returned while refetching features in the background, @@ -217,6 +182,8 @@ const huddle = useFeature("huddle"); ``` +See the reference docs for details. + ### `useTrack()` `useTrack()` lets you send custom events to Bucket. Use this whenever a user _uses_ a feature. From 89baf1205123c3f7ea7d9b9ab26d3aeb8eb1b329 Mon Sep 17 00:00:00 2001 From: Ron Cohen Date: Fri, 20 Jun 2025 08:53:02 +0200 Subject: [PATCH 2/8] wip on destructuring --- packages/vue-sdk/README.md | 29 +++++++++--- .../plain/components/StartHuddleButton.vue | 15 +++--- packages/vue-sdk/src/hooks.ts | 46 ++++++++++++------- 3 files changed, 58 insertions(+), 32 deletions(-) diff --git a/packages/vue-sdk/README.md b/packages/vue-sdk/README.md index 3c4f6eb8..d7df068a 100644 --- a/packages/vue-sdk/README.md +++ b/packages/vue-sdk/README.md @@ -66,6 +66,8 @@ const huddle = useFeature("huddle"); ``` +See [useFeature()](#usefeature) for a full example + ## Setting `user` and `company` Bucket determines which features are active for a given `user`, `company`, or `otherContext`. @@ -126,6 +128,7 @@ The `` initializes the Bucket SDK, fetches features and starts l - `publishableKey` is used to connect the provider to an _environment_ on Bucket. Find your `publishableKey` under [environment settings](https://app.bucket.co/envs/current/settings/app-environments) in Bucket, - `company`, `user` and `otherContext` make up the _context_ that is used to determine if a feature is enabled or not. `company` and `user` contexts are automatically transmitted to Bucket servers so the Bucket app can show you which companies have access to which features etc. + > [!Note] > If you specify `company` and/or `user` they must have at least the `id` property, otherwise they will be ignored in their entirety. You should also supply anything additional you want to be able to evaluate feature targeting against, - `fallbackFeatures`: A list of strings which specify which features to consider enabled if the SDK is unable to fetch features. Can be provided in two formats: @@ -183,26 +186,38 @@ If you want more control over loading screens, `useIsLoading()` returns a Ref void, // send a track event when the feature is used + requestFeedback: (...) => void // open up a feedback dialog +} +``` + +Example: ```vue