Skip to content

Commit ee1935d

Browse files
committed
revert: move prop types back into shared file
1 parent 630f848 commit ee1935d

4 files changed

Lines changed: 50 additions & 54 deletions

File tree

packages/vue-sdk/src/ReflagBootstrappedProvider.vue

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,7 @@
22
import { onMounted, provide, ref, watch } from "vue";
33
44
import { ProviderSymbol, useClientEvent, useReflagClient } from "./hooks";
5-
import { BootstrappedFlags, ReflagInitOptionsBase } from "./types";
6-
7-
/**
8-
* Props for the ReflagBootstrappedProvider.
9-
*/
10-
export type ReflagBootstrappedProps = ReflagInitOptionsBase & {
11-
/**
12-
* Pre-fetched flags to be used instead of fetching them from the server.
13-
*/
14-
flags: BootstrappedFlags;
15-
};
5+
import type { ReflagBootstrappedProps } from "./types";
166
177
const props = withDefaults(defineProps<ReflagBootstrappedProps>(), {
188
enableTracking: true,

packages/vue-sdk/src/ReflagProvider.vue

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,8 @@
11
<script setup lang="ts">
22
import { computed, onMounted, provide, ref, watch } from "vue";
33
4-
import type {
5-
CompanyContext,
6-
ReflagContext,
7-
UserContext,
8-
} from "@reflag/browser-sdk";
9-
104
import { ProviderSymbol, useClientEvent, useReflagClient } from "./hooks";
11-
import type { ReflagInitOptionsBase } from "./types";
12-
13-
/**
14-
* Props for the ReflagProvider.
15-
*/
16-
export type ReflagProps = ReflagInitOptionsBase & {
17-
/**
18-
* The context to use for the ReflagClient containing user, company, and other context.
19-
*/
20-
context?: ReflagContext;
21-
22-
/**
23-
* Company related context. If you provide `id` Reflag will enrich the evaluation context with
24-
* company attributes on Reflag servers.
25-
* @deprecated Use `context` instead, this property will be removed in the next major version
26-
*/
27-
company?: CompanyContext;
28-
29-
/**
30-
* User related context. If you provide `id` Reflag will enrich the evaluation context with
31-
* user attributes on Reflag servers.
32-
* @deprecated Use `context` instead, this property will be removed in the next major version
33-
*/
34-
user?: UserContext;
35-
36-
/**
37-
* Context which is not related to a user or a company.
38-
* @deprecated Use `context` instead, this property will be removed in the next major version
39-
*/
40-
otherContext?: Record<string, string | number | undefined>;
41-
};
5+
import type { ReflagProps } from "./types";
426
437
// any optional prop which has boolean as part of the type, will default to false
448
// instead of `undefined`, so we use `withDefaults` here to pass the undefined

packages/vue-sdk/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ export {
1616
useUpdateOtherContext,
1717
useUpdateUser,
1818
} from "./hooks";
19-
export type { ReflagBootstrappedProps } from "./ReflagBootstrappedProvider.vue";
20-
export type { ReflagProps } from "./ReflagProvider.vue";
2119
export type {
2220
BootstrappedFlags,
2321
EmptyFlagRemoteConfig,
2422
Flag,
2523
FlagType,
24+
ReflagBootstrappedProps,
25+
ReflagProps,
2626
RequestFlagFeedbackOptions,
2727
} from "./types";
2828
export type {

packages/vue-sdk/src/types.ts

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import type { Ref } from "vue";
22

33
import type {
4+
CompanyContext,
45
InitOptions,
56
RawFlags,
67
ReflagClient,
78
ReflagContext,
89
RequestFeedbackData,
10+
UserContext,
911
} from "@reflag/browser-sdk";
1012

1113
export type EmptyFlagRemoteConfig = { key: undefined; payload: undefined };
@@ -57,6 +59,11 @@ export type BootstrappedFlags = {
5759
flags: RawFlags;
5860
};
5961

62+
export type RequestFlagFeedbackOptions = Omit<
63+
RequestFeedbackData,
64+
"flagKey" | "featureId"
65+
>;
66+
6067
/**
6168
* Base init options for the ReflagProvider and ReflagBootstrappedProvider.
6269
* @internal
@@ -66,7 +73,42 @@ export type ReflagInitOptionsBase = Omit<
6673
"user" | "company" | "other" | "otherContext" | "bootstrappedFlags"
6774
>;
6875

69-
export type RequestFlagFeedbackOptions = Omit<
70-
RequestFeedbackData,
71-
"flagKey" | "featureId"
72-
>;
76+
/**
77+
* Props for the ReflagProvider.
78+
*/
79+
export type ReflagProps = ReflagInitOptionsBase & {
80+
/**
81+
* The context to use for the ReflagClient containing user, company, and other context.
82+
*/
83+
context?: ReflagContext;
84+
85+
/**
86+
* Company related context. If you provide `id` Reflag will enrich the evaluation context with
87+
* company attributes on Reflag servers.
88+
* @deprecated Use `context` instead, this property will be removed in the next major version
89+
*/
90+
company?: CompanyContext;
91+
92+
/**
93+
* User related context. If you provide `id` Reflag will enrich the evaluation context with
94+
* user attributes on Reflag servers.
95+
* @deprecated Use `context` instead, this property will be removed in the next major version
96+
*/
97+
user?: UserContext;
98+
99+
/**
100+
* Context which is not related to a user or a company.
101+
* @deprecated Use `context` instead, this property will be removed in the next major version
102+
*/
103+
otherContext?: Record<string, string | number | undefined>;
104+
};
105+
106+
/**
107+
* Props for the ReflagBootstrappedProvider.
108+
*/
109+
export type ReflagBootstrappedProps = ReflagInitOptionsBase & {
110+
/**
111+
* Pre-fetched flags to be used instead of fetching them from the server.
112+
*/
113+
flags: BootstrappedFlags;
114+
};

0 commit comments

Comments
 (0)