Reference
Interfaces
CheckEvent
Event representing checking the feature flag evaluation result
Properties
action
"check-is-enabled"
| "check-config"
check-is-enabled
means isEnabled
was checked, check-config
means config
was checked.
key
string
Feature key.
missingContextFields?
string
[]
Missing context fields.
ruleEvaluationResults?
boolean
[]
Rule evaluation results.
value?
| boolean
| { key
: string
; payload
: any
; }
Result of feature flag or configuration evaluation.
If action
is check-is-enabled
, this is the result of the feature flag evaluation and value
is a boolean.
If action
is check-config
, this is the result of the configuration evaluation.
version?
number
Version of targeting rules.
CompanyContext
Context is a set of key-value pairs. Id should always be present so that it can be referenced to an existing company.
Indexable
[key: string]: undefined | string | number
Properties
id
undefined
| string
| number
Company id
name?
string
Company name
UserContext
Indexable
[key: string]: undefined | string | number
Properties
email?
string
User email
id
undefined
| string
| number
User id
name?
string
User name
Type Aliases
BucketProps
type BucketProps = BucketContext & InitOptions & {
debug: boolean;
newBucketClient: (...args: ConstructorParameters<typeof BucketClient>) => BucketClient;
};
Type declaration
debug
?
boolean
newBucketClient
?
(...args
: ConstructorParameters
<typeof BucketClient
>) => BucketClient
RawFeatures
type RawFeatures = Record<string, RawFeature>;
RequestFeatureFeedbackOptions
type RequestFeatureFeedbackOptions = Omit<RequestFeedbackData, "featureKey" | "featureId">;
TrackEvent
type TrackEvent = {
attributes: | Record<string, any>
| null;
company: CompanyContext;
eventName: string;
user: UserContext;
};
Type declaration
Variables
BucketProvider
const BucketProvider: DefineComponent<Record<string, unknown>, Record<string, unknown>, unknown>;
default
default: {
install: void;
};
Type declaration
install()
void
Functions
useClient()
function useClient(): Ref<BucketClient, BucketClient>
Vue composable for getting the Bucket client.
This composable returns the Bucket client. You can use this to get the Bucket client at any point in your application.
Returns
Ref
<BucketClient
, BucketClient
>
The Bucket client.
useFeature()
function useFeature<TKey>(key: TKey): Ref<{
config: | {
key: string;
payload: any;
}
| {
key: undefined;
payload: undefined;
};
isEnabled: boolean;
isLoading: boolean;
key: UnwrapRef<TKey>;
requestFeedback: (opts: RequestFeatureFeedbackOptions) => void;
track: () => Promise<
| undefined
| Response>;
},
| {
config: FeatureRemoteConfig;
isEnabled: boolean;
isLoading: Ref<boolean, boolean>;
key: TKey;
requestFeedback: (opts: RequestFeatureFeedbackOptions) => void;
track: () => Promise<
| undefined
| Response>;
}
| {
config: | {
key: string;
payload: any;
}
| {
key: undefined;
payload: undefined;
};
isEnabled: boolean;
isLoading: boolean;
key: UnwrapRef<TKey>;
requestFeedback: (opts: RequestFeatureFeedbackOptions) => void;
track: () => Promise<
| undefined
| Response>;
}>
Type Parameters
TKey
extends string
Parameters
key
TKey
Returns
Ref
<{config
: | {key
: string
;payload
: any
;
}
| {key
: undefined
;payload
: undefined
;
};isEnabled
: boolean
;isLoading
: boolean
;key
: UnwrapRef
<TKey
>;requestFeedback
: (opts
: RequestFeatureFeedbackOptions
) => void
;track
: () => Promise
<
| undefined
| Response
>;
},
| {config
: FeatureRemoteConfig
;isEnabled
: boolean
;isLoading
: Ref
<boolean
, boolean
>;key
: TKey
;requestFeedback
: (opts
: RequestFeatureFeedbackOptions
) => void
;track
: () => Promise
<
| undefined
| Response
>;
}
| {config
: | {key
: string
;payload
: any
;
}
| {key
: undefined
;payload
: undefined
;
};isEnabled
: boolean
;isLoading
: boolean
;key
: UnwrapRef
<TKey
>;requestFeedback
: (opts
: RequestFeatureFeedbackOptions
) => void
;track
: () => Promise
<
| undefined
| Response
>;
}>
useIsLoading()
function useIsLoading(): Ref<boolean, boolean>
Vue composable for checking if the Bucket client is loading.
This composable returns a boolean value that indicates whether the Bucket client is loading. You can use this to check if the Bucket client is loading at any point in your application.
Returns
Ref
<boolean
, boolean
>
useRequestFeedback()
function useRequestFeedback(): (options: RequestFeedbackData) => void
Vue composable for requesting user feedback.
This composable returns a function that can be used to trigger the feedback collection flow with the Bucket SDK. You can use this to prompt users for feedback at any point in your application.
Returns
Function
A function that requests feedback from the user. The function accepts:
options
: An object containing feedback request options.
Parameters
options
Returns
void
Example
import { useRequestFeedback } from '@bucketco/vue-sdk';
const requestFeedback = useRequestFeedback();
// Request feedback from the user
requestFeedback({
prompt: "How was your experience?",
metadata: { page: "dashboard" }
});
useSendFeedback()
function useSendFeedback(): (opts: UnassignedFeedback) => Promise<
| undefined
| Response>
Vue composable for sending feedback.
This composable returns a function that can be used to send feedback to the Bucket SDK. You can use this to send feedback from your application.
Returns
Function
A function that sends feedback to the Bucket SDK. The function accepts:
options
: An object containing feedback options.
Parameters
Returns
Promise
<
| undefined
| Response
>
Example
import { useSendFeedback } from '@bucketco/vue-sdk';
const sendFeedback = useSendFeedback();
// Send feedback from the user
sendFeedback({
feedback: "I love this feature!",
metadata: { page: "dashboard" }
});
useTrack()
function useTrack(): (eventName: string, attributes?:
| null
| Record<string, any>) => Promise<
| undefined
| Response>
Vue composable for tracking custom events.
This composable returns a function that can be used to track custom events with the Bucket SDK.
Returns
Function
A function that tracks an event. The function accepts:
eventName
: The name of the event to track.attributes
: (Optional) Additional attributes to associate with the event.
Parameters
eventName
string
attributes
?
| null
| Record
<string
, any
>
Returns
Promise
<
| undefined
| Response
>
Example
import { useTrack } from '@bucketco/vue-sdk';
const track = useTrack();
// Track a custom event
track('button_clicked', { buttonName: 'Start Huddle' });
useUpdateCompany()
function useUpdateCompany(): (opts: {}) => Promise<void>
Vue composable for updating the company context.
This composable returns a function that can be used to update the company context with the Bucket SDK. You can use this to update the company context at any point in your application.
Returns
Function
A function that updates the company context. The function accepts:
opts
: An object containing the company context to update.
Parameters
opts
{}
Returns
Promise
<void
>
Example
import { useUpdateCompany } from '@bucketco/vue-sdk';
const updateCompany = useUpdateCompany();
// Update the company context
updateCompany({ id: "123", name: "Acme Inc." });
useUpdateOtherContext()
function useUpdateOtherContext(): (opts: {}) => Promise<void>
Vue composable for updating the other context.
This composable returns a function that can be used to update the other context with the Bucket SDK. You can use this to update the other context at any point in your application.
Returns
Function
A function that updates the other context. The function accepts:
opts
: An object containing the other context to update.
Parameters
opts
{}
Returns
Promise
<void
>
Example
import { useUpdateOtherContext } from '@bucketco/vue-sdk';
const updateOtherContext = useUpdateOtherContext();
// Update the other context
updateOtherContext({ id: "123", name: "Acme Inc." });
useUpdateUser()
function useUpdateUser(): (opts: {}) => Promise<void>
Vue composable for updating the user context.
This composable returns a function that can be used to update the user context with the Bucket SDK. You can use this to update the user context at any point in your application.
Returns
Function
A function that updates the user context. The function accepts:
opts
: An object containing the user context to update.
Parameters
opts
{}
Returns
Promise
<void
>
Example
import { useUpdateUser } from '@bucketco/vue-sdk';
const updateUser = useUpdateUser();
// Update the user context
updateUser({ id: "123", name: "John Doe" });
Last updated
Was this helpful?