Reference

Interfaces

CheckEvent

Event representing checking the flag evaluation result

Properties

Property
Type
Description

action

"check-is-enabled" | "check-config"

check-is-enabled means isEnabled was checked, check-config means config was checked.

key

string

Flag key.

missingContextFields?

string[]

Missing context fields.

ruleEvaluationResults?

boolean[]

Rule evaluation results.

value?

| boolean | { key: string; payload: any; }

Result of flag or configuration evaluation. If action is check-is-enabled, this is the result of the 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

Property
Type
Description

id

undefined | string | number

Company id

name?

string

Company name


Flag<TConfig>

Type Parameters

Type Parameter
Default type

TConfig extends FlagType["config"]

Properties

Property
Type

config

Ref< | EmptyFlagRemoteConfig | { key: string; } & TConfig, | EmptyFlagRemoteConfig | { key: string; } & TConfig>

isEnabled

Ref<boolean, boolean>

isLoading

Ref<boolean, boolean>

key

string

requestFeedback

Methods

track()

track(): 
  | undefined
  | Promise<
  | undefined
| Response>

Returns

| undefined | Promise< | undefined | Response>


UserContext

Indexable

[key: string]: undefined | string | number

Properties

Property
Type
Description

email?

string

User email

id

undefined | string | number

User id

name?

string

User name

Type Aliases

EmptyFlagRemoteConfig

type EmptyFlagRemoteConfig = {
  key: undefined;
  payload: undefined;
};

Type declaration

Name
Type

key

undefined

payload

undefined


FlagType

type FlagType = {
  config: {
     payload: any;
    };
};

Type declaration

Name
Type

config?

{ payload: any; }

config.payload

any


ReflagProps

type ReflagProps = ReflagContext & InitOptions & {
  debug: boolean;
  newReflagClient: (...args: ConstructorParameters<typeof ReflagClient>) => ReflagClient;
};

Type declaration

Name
Type

debug?

boolean

newReflagClient?


RequestFlagFeedbackOptions

type RequestFlagFeedbackOptions = Omit<RequestFeedbackData, "flagKey" | "featureId">;

TrackEvent

type TrackEvent = {
  attributes:   | Record<string, any>
     | null;
  company: CompanyContext;
  eventName: string;
  user: UserContext;
};

Type declaration

Name
Type

attributes?

| Record<string, any> | null

eventName

string

Variables

default

default: {
  install: void;
};

Type declaration

Name
Type

install()

void


ReflagProvider

const ReflagProvider: DefineComponent<Record<string, unknown>, Record<string, unknown>, unknown>;

Functions

useClient()

function useClient(): Ref<ReflagClient, ReflagClient>

Vue composable for getting the Reflag client.

This composable returns the Reflag client. You can use this to get the Reflag client at any point in your application.

Returns

Ref<ReflagClient, ReflagClient>

The Reflag client.


useFlag()

function useFlag(key: string): Flag<any>

Parameters

Parameter
Type

key

string

Returns

Flag<any>


useIsLoading()

function useIsLoading(): Ref<boolean, boolean>

Vue composable for checking if the Reflag client is loading.

This composable returns a boolean value that indicates whether the Reflag client is loading. You can use this to check if the Reflag 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 Reflag 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

Parameter
Type

Returns

void

Example

import { useRequestFeedback } from '@reflag/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 Reflag SDK. You can use this to send feedback from your application.

Returns

Function

A function that sends feedback to the Reflag SDK. The function accepts:

  • options: An object containing feedback options.

Parameters

Parameter
Type

Returns

Promise< | undefined | Response>

Example

import { useSendFeedback } from '@reflag/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 Reflag 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

Parameter
Type

eventName

string

attributes?

| null | Record<string, any>

Returns

Promise< | undefined | Response>

Example

import { useTrack } from '@reflag/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 Reflag 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

Parameter
Type

opts

{}

Returns

Promise<void>

Example

import { useUpdateCompany } from '@reflag/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 Reflag 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

Parameter
Type

opts

{}

Returns

Promise<void>

Example

import { useUpdateOtherContext } from '@reflag/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 Reflag 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

Parameter
Type

opts

{}

Returns

Promise<void>

Example

import { useUpdateUser } from '@reflag/vue-sdk';

const updateUser = useUpdateUser();

// Update the user context
updateUser({ id: "123", name: "John Doe" });

Last updated

Was this helpful?