33import {
44 type ReactFlagEvaluationOptions ,
55 type ReactFlagEvaluationNoSuspenseOptions ,
6+ type FlagQuery ,
67 useFlag ,
78 useSuspenseFlag ,
89} from "@openfeature/react-sdk" ;
910
11+ // Flag key constants for programmatic access
12+ export const FlagKeys = {
13+ /** Flag key for Controls the free shipping banner on the website. SHOP-4287 */
14+ FREE_SHIPPING_BANNER : "free-shipping-banner" ,
15+ /** Flag key for Make the header stay at the top of the page while scrolling. */
16+ STICKY_HEADER : "sticky-header" ,
17+ /** Flag key for When on, use postgres else sqlite. */
18+ USE_DISTRIBUTED_DB : "use-distributed-db" ,
19+ /** Flag key for When on, use a secure connection to the database. This only applies when use-distributed-db is on. */
20+ USE_SECURE_PROTOCOL : "use-secure-protocol" ,
21+ } as const ;
22+
1023/**
11- * Add free shipping to the UI.
12- *
13- * **Details:**
14- * - flag key: `offer-free-shipping`
15- * - default value: `false`
16- * - type: `boolean`
17- */
18- export const useOfferFreeShipping = ( options ?: ReactFlagEvaluationOptions ) => {
19- return useFlag ( "offer-free-shipping" , false , options ) ;
24+ * Controls the free shipping banner on the website. SHOP-4287
25+ *
26+ * **Details:**
27+ * - flag key: `free-shipping-banner`
28+ * - default value: `false`
29+ * - type: `boolean`
30+ */
31+ export const useFreeShippingBanner = (
32+ options ?: ReactFlagEvaluationOptions
33+ ) : FlagQuery < boolean > => {
34+ return useFlag ( FlagKeys . FREE_SHIPPING_BANNER , false , options ) ;
2035} ;
2136
2237/**
23- * Add free shipping to the UI.
38+ * Controls the free shipping banner on the website. SHOP-4287
2439*
2540* **Details:**
26- * - flag key: `offer- free-shipping`
41+ * - flag key: `free-shipping-banner `
2742* - default value: `false`
2843* - type: `boolean`
2944*
3045* Equivalent to useFlag with options: `{ suspend: true }`
3146* @experimental — Suspense is an experimental feature subject to change in future versions.
3247*/
33- export const useSuspenseOfferFreeShipping = ( options ?: ReactFlagEvaluationNoSuspenseOptions ) => {
34- return useSuspenseFlag ( "offer-free-shipping" , false , options ) ;
48+ export const useSuspenseFreeShippingBanner = (
49+ options ?: ReactFlagEvaluationNoSuspenseOptions
50+ ) : FlagQuery < boolean > => {
51+ return useSuspenseFlag ( FlagKeys . FREE_SHIPPING_BANNER , false , options ) ;
3552} ;
3653
3754/**
38- * Make the header stay at the top of the page while scrolling.
39- *
40- * **Details:**
41- * - flag key: `sticky-header`
42- * - default value: `false`
43- * - type: `boolean`
44- */
45- export const useStickyHeader = ( options ?: ReactFlagEvaluationOptions ) => {
46- return useFlag ( "sticky-header" , false , options ) ;
55+ * Make the header stay at the top of the page while scrolling.
56+ *
57+ * **Details:**
58+ * - flag key: `sticky-header`
59+ * - default value: `false`
60+ * - type: `boolean`
61+ */
62+ export const useStickyHeader = (
63+ options ?: ReactFlagEvaluationOptions
64+ ) : FlagQuery < boolean > => {
65+ return useFlag ( FlagKeys . STICKY_HEADER , false , options ) ;
4766} ;
4867
4968/**
@@ -57,20 +76,24 @@ export const useStickyHeader = (options?: ReactFlagEvaluationOptions) => {
5776* Equivalent to useFlag with options: `{ suspend: true }`
5877* @experimental — Suspense is an experimental feature subject to change in future versions.
5978*/
60- export const useSuspenseStickyHeader = ( options ?: ReactFlagEvaluationNoSuspenseOptions ) => {
61- return useSuspenseFlag ( "sticky-header" , false , options ) ;
79+ export const useSuspenseStickyHeader = (
80+ options ?: ReactFlagEvaluationNoSuspenseOptions
81+ ) : FlagQuery < boolean > => {
82+ return useSuspenseFlag ( FlagKeys . STICKY_HEADER , false , options ) ;
6283} ;
6384
6485/**
65- * When on, use postgres else sqlite.
66- *
67- * **Details:**
68- * - flag key: `use-distributed-db`
69- * - default value: `false`
70- * - type: `boolean`
71- */
72- export const useUseDistributedDb = ( options ?: ReactFlagEvaluationOptions ) => {
73- return useFlag ( "use-distributed-db" , false , options ) ;
86+ * When on, use postgres else sqlite.
87+ *
88+ * **Details:**
89+ * - flag key: `use-distributed-db`
90+ * - default value: `false`
91+ * - type: `boolean`
92+ */
93+ export const useUseDistributedDb = (
94+ options ?: ReactFlagEvaluationOptions
95+ ) : FlagQuery < boolean > => {
96+ return useFlag ( FlagKeys . USE_DISTRIBUTED_DB , false , options ) ;
7497} ;
7598
7699/**
@@ -84,20 +107,24 @@ export const useUseDistributedDb = (options?: ReactFlagEvaluationOptions) => {
84107* Equivalent to useFlag with options: `{ suspend: true }`
85108* @experimental — Suspense is an experimental feature subject to change in future versions.
86109*/
87- export const useSuspenseUseDistributedDb = ( options ?: ReactFlagEvaluationNoSuspenseOptions ) => {
88- return useSuspenseFlag ( "use-distributed-db" , false , options ) ;
110+ export const useSuspenseUseDistributedDb = (
111+ options ?: ReactFlagEvaluationNoSuspenseOptions
112+ ) : FlagQuery < boolean > => {
113+ return useSuspenseFlag ( FlagKeys . USE_DISTRIBUTED_DB , false , options ) ;
89114} ;
90115
91116/**
92- * When on, use a secure connection to the database. This only applies when use-distributed-db is on.
93- *
94- * **Details:**
95- * - flag key: `use-secure-protocol`
96- * - default value: `false`
97- * - type: `boolean`
98- */
99- export const useUseSecureProtocol = ( options ?: ReactFlagEvaluationOptions ) => {
100- return useFlag ( "use-secure-protocol" , false , options ) ;
117+ * When on, use a secure connection to the database. This only applies when use-distributed-db is on.
118+ *
119+ * **Details:**
120+ * - flag key: `use-secure-protocol`
121+ * - default value: `false`
122+ * - type: `boolean`
123+ */
124+ export const useUseSecureProtocol = (
125+ options ?: ReactFlagEvaluationOptions
126+ ) : FlagQuery < boolean > => {
127+ return useFlag ( FlagKeys . USE_SECURE_PROTOCOL , false , options ) ;
101128} ;
102129
103130/**
@@ -111,6 +138,6 @@ export const useUseSecureProtocol = (options?: ReactFlagEvaluationOptions) => {
111138* Equivalent to useFlag with options: `{ suspend: true }`
112139* @experimental — Suspense is an experimental feature subject to change in future versions.
113140*/
114- export const useSuspenseUseSecureProtocol = ( options ?: ReactFlagEvaluationNoSuspenseOptions ) => {
115- return useSuspenseFlag ( "use-secure-protocol" , false , options ) ;
141+ export const useSuspenseUseSecureProtocol = ( options ?: ReactFlagEvaluationNoSuspenseOptions ) : FlagQuery < boolean > => {
142+ return useSuspenseFlag ( FlagKeys . USE_SECURE_PROTOCOL , false , options ) ;
116143} ;
0 commit comments