This is page 6 of 7. Use http://codebase.md/bucketco/docs/.gitbook/assets/Screenshot%202025-09-12%20at%2015.04.39.png?lines=true&page={x} to view the full context.
# Directory Structure
```
├── .gitbook
│ ├── assets
│ │ ├── 03642c5-dwFrame_201 (1).png
│ │ ├── 03642c5-dwFrame_201.png
│ │ ├── 1753259671871 (1).jpeg
│ │ ├── 1a0b50d-image.png
│ │ ├── 1a439d9-image.png
│ │ ├── 2506596-Customized_Widgets.png
│ │ ├── 342658e-image.png
│ │ ├── 4017197-image.png
│ │ ├── 43e55f0-image.png
│ │ ├── 4783e3f-image.png
│ │ ├── 5b0ce63-image (1).png
│ │ ├── 5b0ce63-image.png
│ │ ├── 630b5e9-image.png
│ │ ├── 8bf8a6e-Frame_201.png
│ │ ├── 9efd67c-image.png
│ │ ├── aa37226-image.png
│ │ ├── Access (1) (1).png
│ │ ├── Access (1).png
│ │ ├── Access (2).png
│ │ ├── Access.png
│ │ ├── Adding features to a feature view-min.png
│ │ ├── Adopted-min.png
│ │ ├── Adoption strategy V2-min.png
│ │ ├── Adoption strategy-min.png
│ │ ├── Advanced targeting rules V2-min.png
│ │ ├── Advanced targeting rules v3-min.png
│ │ ├── Advanced targeting rules-min.png
│ │ ├── aecc6f2-image.png
│ │ ├── amplitude.svg
│ │ ├── An example targeting configuration with two rules.-min.png
│ │ ├── api.svg
│ │ ├── App Settings-min.png
│ │ ├── Automated feedback surveys settings v3-min.png
│ │ ├── Automated feedback surveys settings-min.png
│ │ ├── Automated feedback surveys-min.png
│ │ ├── aws-s3.svg
│ │ ├── be124cd-dwdwFrame_201 (1).png
│ │ ├── be124cd-dwdwFrame_201.png
│ │ ├── ccc4f9e-image.png
│ │ ├── CleanShot 2024-06-11 at 8 [email protected]
│ │ ├── CleanShot 2024-11-22 at 8 [email protected]
│ │ ├── CleanShot 2024-11-22 at 8 [email protected]
│ │ ├── CleanShot 2024-11-25 at 9 [email protected]
│ │ ├── CleanShot 2024-11-25 at 9 [email protected]
│ │ ├── CleanShot 2024-11-25 at 9 [email protected]
│ │ ├── CleanShot 2024-11-27 at 10 [email protected]
│ │ ├── CleanShot 2024-11-27 at 10 [email protected]
│ │ ├── CleanShot 2024-11-27 at 10 [email protected]
│ │ ├── CleanShot 2024-11-27 at 10 [email protected]
│ │ ├── CleanShot 2025-01-07 at 1 [email protected]
│ │ ├── CleanShot 2025-01-07 at 1 [email protected]
│ │ ├── CleanShot 2025-01-07 at 1 [email protected]
│ │ ├── CleanShot 2025-01-07 at 12 [email protected]
│ │ ├── CleanShot 2025-01-07 at 12 .39.12@2x (1).png
│ │ ├── CleanShot 2025-01-07 at 12 [email protected]
│ │ ├── CleanShot 2025-01-09 at 10 [email protected]
│ │ ├── CleanShot 2025-01-09 at 11 .11.54@2x (1).png
│ │ ├── CleanShot 2025-01-09 at 11 [email protected]
│ │ ├── CleanShot 2025-01-09 at 9 [email protected]
│ │ ├── CleanShot 2025-01-23 at 1 [email protected]
│ │ ├── CleanShot 2025-01-23 at 1 [email protected]
│ │ ├── CleanShot 2025-01-23 at 1 [email protected]
│ │ ├── CleanShot 2025-01-23 at 2 [email protected]
│ │ ├── CleanShot 2025-05-09 at 1 [email protected]
│ │ ├── CleanShot 2025-10-09 at 10 [email protected]
│ │ ├── Companies Tab-min.png
│ │ ├── Companies-min.png
│ │ ├── company example v2-min (1).png
│ │ ├── company example v2-min.png
│ │ ├── company example v3-min.png
│ │ ├── Company segment filters-min.png
│ │ ├── Create a new environment-min.png
│ │ ├── Creating and managing apps-min.png
│ │ ├── cursor-mcp-demo_h264.mp4
│ │ ├── datadog.svg
│ │ ├── Debugger-min (1).png
│ │ ├── Debugger-min (2).png
│ │ ├── Debugger-min.png
│ │ ├── Enabling Feedback Surveys-min.png
│ │ ├── Environments Page V2-min.png
│ │ ├── Environments Switcher-min.png
│ │ ├── Environments-min.png
│ │ ├── Evaluate Feature.png
│ │ ├── example 1 (1).png
│ │ ├── example 1.png
│ │ ├── example 2 (1).png
│ │ ├── example 2.png
│ │ ├── ezgif-242d06617aea38.gif
│ │ ├── Feature Tab-min.png
│ │ ├── Feature targeting rules example v2-min.png
│ │ ├── Feature targeting rules example V2-min.png
│ │ ├── Feature targeting rules example v3-min.png
│ │ ├── Feature targeting rules example-min.png
│ │ ├── Feature targeting rules UI V2-min.png
│ │ ├── Feature targeting rules UI v3-min.png
│ │ ├── Feature targeting rules UI-min.png
│ │ ├── Feature usage configuration-v2-min.png
│ │ ├── Feature view.png
│ │ ├── feature-flag-list-rum-event.d9c1c876a34458edc70d1317efaec05b.png.avif
│ │ ├── Feature-targeting-rules-v2-min.png
│ │ ├── Features Page V2-min (1).png
│ │ ├── Features Page V2-min.png
│ │ ├── Features Page-min.png
│ │ ├── Features-min.png
│ │ ├── Feedback Tab V2-min.png
│ │ ├── Feedback-min.png
│ │ ├── Getting started-min.png
│ │ ├── gitbook-logo.svg
│ │ ├── github-logo.svg
│ │ ├── Global settings - Feature views-min.png
│ │ ├── Global settings - Manual Targeting-min.png
│ │ ├── Global settings - Release Stages Editing V4-min.png
│ │ ├── Global settings - Release Stages-min.png
│ │ ├── Goal Form.png
│ │ ├── How to use release stages v2-min.png
│ │ ├── How to use release stages-min (1).png
│ │ ├── How to use release stages-min.png
│ │ ├── https___content.gitbook.com_content_pgXAy2Cgsm5pON9oJ06m_blobs_6wGbrQlJPE4JllBuIhla_image (1).png
│ │ ├── image (1) (1).png
│ │ ├── image (1) (2).png
│ │ ├── image (1).png
│ │ ├── image (10).png
│ │ ├── image (11).png
│ │ ├── image (12).png
│ │ ├── image (13).png
│ │ ├── image (14).png
│ │ ├── image (15).png
│ │ ├── image (16).png
│ │ ├── image (17).png
│ │ ├── image (18).png
│ │ ├── image (19).png
│ │ ├── image (2) (1).png
│ │ ├── image (2).png
│ │ ├── image (20).png
│ │ ├── image (21).png
│ │ ├── image (22).png
│ │ ├── image (23).png
│ │ ├── image (24).png
│ │ ├── image (25).png
│ │ ├── image (26).png
│ │ ├── image (27).png
│ │ ├── image (28).png
│ │ ├── image (29).png
│ │ ├── image (3).png
│ │ ├── image (30).png
│ │ ├── image (31).png
│ │ ├── image (32).png
│ │ ├── image (33).png
│ │ ├── image (4).png
│ │ ├── image (5).png
│ │ ├── image (6).png
│ │ ├── image (7).png
│ │ ├── image (8).png
│ │ ├── image (9).png
│ │ ├── image.png
│ │ ├── Iterate Feature V2.png
│ │ ├── LInear mention.mp4
│ │ ├── linear.svg
│ │ ├── mcp-remote-min.mp4
│ │ ├── mcp-remote.mp4
│ │ ├── mixpanel.svg
│ │ ├── Modifying or deleting an app-min.png
│ │ ├── Monitor (1) (1).png
│ │ ├── Monitor (1).png
│ │ ├── Monitor (2).png
│ │ ├── Monitor (3).png
│ │ ├── Monitor (4).png
│ │ ├── Monitor (5).png
│ │ ├── Monitor (6).png
│ │ ├── Monitor (7).png
│ │ ├── Monitor.png
│ │ ├── New feature.png
│ │ ├── next-js.svg
│ │ ├── node-js.svg
│ │ ├── openfeature.svg
│ │ ├── posthog.svg
│ │ ├── Pre-Release.png
│ │ ├── react.svg
│ │ ├── Release Goals.png
│ │ ├── Release Stage Beta Targeting Rules v3-min.png
│ │ ├── Release Stage Beta Targeting Rules V3-min.png
│ │ ├── Release Stage Beta Targeting Rules V5-min.png
│ │ ├── Release Stage Beta Targeting Rules-min.png
│ │ ├── remote config - 3.png
│ │ ├── Remote config.png
│ │ ├── Rolling back flags-V2.png
│ │ ├── Rules in other environments.png
│ │ ├── rum-explorer-error-feature-flag-search.7b9f6c046db1de1c71d279c139f1508a.png.avif
│ │ ├── rum-explorer-session-feature-flag-search.435802460fd607608ad5155f029da57b.png.avif
│ │ ├── Satisfaction feedback-min.png
│ │ ├── Satisified-min.png
│ │ ├── Save the segment-min.png
│ │ ├── Saving New Segment-min.png
│ │ ├── Screenshot 2024-08-14 at 19.25.06 (1).png
│ │ ├── Screenshot 2024-08-14 at 19.25.06.png
│ │ ├── Screenshot 2024-08-15 at 13.57.46.png
│ │ ├── Screenshot 2024-10-10 at 14.04.09.png
│ │ ├── Screenshot 2024-10-10 at 14.04.34.png
│ │ ├── Screenshot 2025-07-10 at 14.04.07.png
│ │ ├── Screenshot 2025-07-10 at 14.11.01.png
│ │ ├── Screenshot 2025-07-10 at 14.29.20.png
│ │ ├── Screenshot 2025-07-15 at 21.31.16.png
│ │ ├── Screenshot 2025-07-21 at 20.07.27.png
│ │ ├── Screenshot 2025-09-02 at 17.08.25.png
│ │ ├── Screenshot 2025-09-02 at 17.10.36 (1).png
│ │ ├── Screenshot 2025-09-02 at 17.10.36 (2).png
│ │ ├── Screenshot 2025-09-02 at 17.10.36.png
│ │ ├── Screenshot 2025-09-02 at 17.11.21 (1).png
│ │ ├── Screenshot 2025-09-02 at 17.11.21.png
│ │ ├── Screenshot 2025-09-02 at 17.13.15 (1).png
│ │ ├── Screenshot 2025-09-02 at 17.13.15.png
│ │ ├── Screenshot 2025-09-02 at 17.19.44 (1).png
│ │ ├── Screenshot 2025-09-02 at 17.19.44.png
│ │ ├── Screenshot 2025-09-09 at 09.32.31.png
│ │ ├── Screenshot 2025-09-12 at 11.50.41.png
│ │ ├── Screenshot 2025-09-12 at 12.30.38.png
│ │ ├── Screenshot 2025-09-12 at 13.14.44.png
│ │ ├── Screenshot 2025-09-12 at 13.18.07.png
│ │ ├── Screenshot 2025-09-12 at 13.21.25.png
│ │ ├── Screenshot 2025-09-12 at 13.25.21.png
│ │ ├── Screenshot 2025-09-12 at 14.29.56.png
│ │ ├── Screenshot 2025-09-12 at 14.37.52.png
│ │ ├── Screenshot 2025-09-12 at 14.58.27.png
│ │ ├── Screenshot 2025-09-12 at 15.00.32.png
│ │ ├── Screenshot 2025-09-12 at 15.01.32.png
│ │ ├── Screenshot 2025-09-12 at 15.03.33.png
│ │ ├── Screenshot 2025-09-12 at 15.04.39.png
│ │ ├── Screenshot 2025-09-12 at 15.06.50.png
│ │ ├── Screenshot 2025-09-12 at 15.13.45.png
│ │ ├── Screenshot 2025-09-12 at 15.14.43.png
│ │ ├── Screenshot 2025-09-12 at 15.16.42.png
│ │ ├── Screenshot 2025-09-12 at 15.18.42.png
│ │ ├── Screenshot 2025-09-12 at 15.32.39.png
│ │ ├── Screenshot 2025-09-12 at 15.33.57.png
│ │ ├── Screenshot 2025-09-12 at 15.35.09.png
│ │ ├── Screenshot 2025-09-12 at 15.36.14.png
│ │ ├── segment (1).svg
│ │ ├── segment.svg
│ │ ├── Segments.png
│ │ ├── Set segment conditions-min.png
│ │ ├── Setting multiple targeting rules.png
│ │ ├── Setting Tab-min.png
│ │ ├── Setting targeting rules v3-min.png
│ │ ├── Setting targeting rules-min.png
│ │ ├── Settings-min (1).png
│ │ ├── Settings-min.png
│ │ ├── slack (1).svg
│ │ ├── Slack (with auto-layout)-min.png
│ │ ├── Slack and Environments-min.png
│ │ ├── Slack and Feature views-min.png
│ │ ├── Slack Integration.png
│ │ ├── Slack Settings under Features-min.png
│ │ ├── Slack with User Feedback.png
│ │ ├── slack.svg
│ │ ├── slackConnected (1).png
│ │ ├── slackConnected.png
│ │ ├── slackDisconnected (1).png
│ │ ├── slackDisconnected.png
│ │ ├── STARS Configuration-min.png
│ │ ├── STARS Feature Funnel-min.png
│ │ ├── STARS Feature Report-min.png
│ │ ├── STARS states.png
│ │ ├── surveys-min.png
│ │ ├── Switching Between Environments-min.png
│ │ ├── Targeting rules interface-min.png
│ │ ├── Targeting rules.png
│ │ ├── There are 5 different types of conditions to chose from-min.png
│ │ ├── Track adoption in the UI V2-min.png
│ │ ├── Track adoption in the UI v3-min.png
│ │ ├── Track adoption in the UI-min.png
│ │ ├── Track new feature V2-min.png
│ │ ├── Tracking Tab-min.png
│ │ ├── ts-js.svg
│ │ ├── type-check-failed.png
│ │ ├── type-check-payload-failed.png
│ │ ├── usage attribute example v3.png
│ │ ├── usage attribute example-min.png
│ │ ├── Usage configuration-min.png
│ │ ├── vercel-logo.svg
│ │ ├── vue-logo.svg
│ │ ├── What is the STARS Framework v3-min.png
│ │ └── What is the STARS Framework_-min.png
│ └── includes
│ ├── integrations.md
│ ├── languages.md
│ ├── need-some-help-chat-with-us.md
│ ├── sdks.md
│ └── untitled.md
├── .github
│ └── README.md
├── .vscode
│ └── settings.json
├── api
│ ├── api-access.md
│ ├── cli.md
│ ├── mcp.md
│ ├── public-api
│ │ ├── public-api-reference.md
│ │ └── README.md
│ └── reflag-rest-api
│ ├── README.md
│ └── reflag-api-reference.md
├── guides
│ ├── self-opt-in.md
│ └── use-reflag-in-your-cli.md
├── integrations
│ ├── amplitude.md
│ ├── aws-s3.md
│ ├── cursor.md
│ ├── datadog.md
│ ├── github.md
│ ├── linear.md
│ ├── mixpanel.md
│ ├── overview.md
│ ├── posthog.md
│ ├── segment.md
│ └── slack.md
├── introduction
│ └── concepts
│ ├── app.md
│ ├── company.md
│ ├── environment.md
│ ├── event.md
│ ├── feature-events.md
│ ├── feature-view.md
│ ├── feature.md
│ ├── feedback.md
│ ├── filter.md
│ ├── README.md
│ ├── release-stage.md
│ ├── segment.md
│ ├── targeting-rules.md
│ └── user.md
├── product-handbook
│ ├── anonymous-users.md
│ ├── concepts
│ │ ├── app.md
│ │ ├── company.md
│ │ ├── environment.md
│ │ ├── event.md
│ │ ├── feature-events.md
│ │ ├── feature-view.md
│ │ ├── feature.md
│ │ ├── feedback.md
│ │ ├── filter.md
│ │ ├── README.md
│ │ ├── release-stage.md
│ │ ├── segment.md
│ │ ├── targeting-rules.md
│ │ └── user.md
│ ├── creating-and-managing-apps
│ │ ├── environments.md
│ │ └── README.md
│ ├── creating-and-managing-apps.md
│ ├── creating-segments.md
│ ├── data-export.md
│ ├── data-residency.md
│ ├── feature-clean-up-and-archival-beta
│ │ ├── ai-code-clean-up-beta.md
│ │ └── README.md
│ ├── feature-entitlements
│ │ ├── README.md
│ │ └── simple-role-based-entitlements.md
│ ├── feature-rollouts
│ │ ├── feature-targeting-rules.md
│ │ └── README.md
│ ├── feature-targeting-rules
│ │ ├── creating-segments.md
│ │ └── environments.md
│ ├── feature-views.md
│ ├── launch-monitor
│ │ ├── automated-feedback-surveys.md
│ │ ├── give-feedback-button.md
│ │ └── README.md
│ ├── product-overview.md
│ ├── remote-config.md
│ ├── self-opt-in.md
│ ├── service-resiliency.md
│ ├── team-permissions.md
│ └── type-safety.md
├── README.md
├── sdk
│ ├── _media
│ │ ├── type-check-failed.png
│ │ └── type-check-payload-failed.png
│ ├── @reflag
│ │ ├── browser-sdk
│ │ │ ├── globals.md
│ │ │ └── README.md
│ │ ├── node-sdk
│ │ │ ├── globals.md
│ │ │ └── README.md
│ │ ├── react-sdk
│ │ │ ├── globals.md
│ │ │ └── README.md
│ │ └── vue-sdk
│ │ ├── globals.md
│ │ └── README.md
│ ├── documents
│ │ ├── browser-sdk
│ │ │ └── FEEDBACK.md
│ │ └── cli
│ │ └── README.md
│ └── README.md
├── SUMMARY.md
├── support
│ └── get-support.md
└── supported-languages
├── next.js.md
├── openfeature.md
├── overview.md
└── ruby-rails-stimulus.md
```
# Files
--------------------------------------------------------------------------------
/sdk/@reflag/browser-sdk/globals.md:
--------------------------------------------------------------------------------
```markdown
1 | ---
2 | layout:
3 | visible: true
4 | title:
5 | visible: true
6 | description:
7 | visible: false
8 | tableOfContents:
9 | visible: true
10 | outline:
11 | visible: true
12 | pagination:
13 | visible: true
14 | ---
15 |
16 | # @reflag/browser-sdk
17 |
18 | ## Classes
19 |
20 | ### ReflagClient
21 |
22 | ReflagClient lets you interact with the Reflag API.
23 |
24 | #### Constructors
25 |
26 | ##### new ReflagClient()
27 |
28 | ```ts
29 | new ReflagClient(opts: InitOptions): ReflagClient
30 | ```
31 |
32 | Create a new ReflagClient instance.
33 |
34 | ###### Parameters
35 |
36 | <table>
37 | <thead>
38 | <tr>
39 | <th>Parameter</th>
40 | <th>Type</th>
41 | </tr>
42 | </thead>
43 | <tbody>
44 | <tr>
45 | <td>
46 |
47 | `opts`
48 |
49 | </td>
50 | <td>
51 |
52 | [`InitOptions`](globals.md#initoptions)
53 |
54 | </td>
55 | </tr>
56 | </tbody>
57 | </table>
58 |
59 | ###### Returns
60 |
61 | [`ReflagClient`](globals.md#reflagclient)
62 |
63 | #### Properties
64 |
65 | <table>
66 | <thead>
67 | <tr>
68 | <th>Property</th>
69 | <th>Modifier</th>
70 | <th>Type</th>
71 | </tr>
72 | </thead>
73 | <tbody>
74 | <tr>
75 | <td>
76 |
77 | <a id="logger"></a> `logger`
78 |
79 | </td>
80 | <td>
81 |
82 | `readonly`
83 |
84 | </td>
85 | <td>
86 |
87 | [`Logger`](globals.md#logger-1)
88 |
89 | </td>
90 | </tr>
91 | </tbody>
92 | </table>
93 |
94 | #### Methods
95 |
96 | ##### feedback()
97 |
98 | ```ts
99 | feedback(payload: Feedback): Promise<
100 | | undefined
101 | | Response>
102 | ```
103 |
104 | Submit user feedback to Reflag. Must include either `score` or `comment`, or both.
105 |
106 | ###### Parameters
107 |
108 | <table>
109 | <thead>
110 | <tr>
111 | <th>Parameter</th>
112 | <th>Type</th>
113 | <th>Description</th>
114 | </tr>
115 | </thead>
116 | <tbody>
117 | <tr>
118 | <td>
119 |
120 | `payload`
121 |
122 | </td>
123 | <td>
124 |
125 | [`Feedback`](globals.md#feedback-1)
126 |
127 | </td>
128 | <td>
129 |
130 | The feedback details to submit.
131 |
132 | </td>
133 | </tr>
134 | </tbody>
135 | </table>
136 |
137 | ###### Returns
138 |
139 | [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<
140 | \| `undefined`
141 | \| [`Response`](https://developer.mozilla.org/docs/Web/API/Response)\>
142 |
143 | The server response.
144 |
145 | ##### getConfig()
146 |
147 | ```ts
148 | getConfig(): Config
149 | ```
150 |
151 | Get the current configuration.
152 |
153 | ###### Returns
154 |
155 | [`Config`](globals.md#config)
156 |
157 | ##### getContext()
158 |
159 | ```ts
160 | getContext(): ReflagContext
161 | ```
162 |
163 | Get the current context.
164 |
165 | ###### Returns
166 |
167 | [`ReflagContext`](globals.md#reflagcontext)
168 |
169 | ##### ~~getFeature()~~
170 |
171 | ```ts
172 | getFeature(flagKey: string): Flag
173 | ```
174 |
175 | ###### Parameters
176 |
177 | <table>
178 | <thead>
179 | <tr>
180 | <th>Parameter</th>
181 | <th>Type</th>
182 | </tr>
183 | </thead>
184 | <tbody>
185 | <tr>
186 | <td>
187 |
188 | `flagKey`
189 |
190 | </td>
191 | <td>
192 |
193 | `string`
194 |
195 | </td>
196 | </tr>
197 | </tbody>
198 | </table>
199 |
200 | ###### Returns
201 |
202 | [`Flag`](globals.md#flag)
203 |
204 | ###### Deprecated
205 |
206 | Use `getFlag` instead.
207 |
208 | ##### ~~getFeatures()~~
209 |
210 | ```ts
211 | getFeatures(): RawFlags
212 | ```
213 |
214 | ###### Returns
215 |
216 | [`RawFlags`](globals.md#rawflags)
217 |
218 | ###### Deprecated
219 |
220 | Use `getFlags` instead.
221 |
222 | ##### getFlag()
223 |
224 | ```ts
225 | getFlag(flagKey: string): Flag
226 | ```
227 |
228 | Return a flag. Accessing `isEnabled` or `config` will automatically send a `check` event.
229 |
230 | ###### Parameters
231 |
232 | <table>
233 | <thead>
234 | <tr>
235 | <th>Parameter</th>
236 | <th>Type</th>
237 | <th>Description</th>
238 | </tr>
239 | </thead>
240 | <tbody>
241 | <tr>
242 | <td>
243 |
244 | `flagKey`
245 |
246 | </td>
247 | <td>
248 |
249 | `string`
250 |
251 | </td>
252 | <td>
253 |
254 | The key of the flag to get.
255 |
256 | </td>
257 | </tr>
258 | </tbody>
259 | </table>
260 |
261 | ###### Returns
262 |
263 | [`Flag`](globals.md#flag)
264 |
265 | A flag.
266 |
267 | ##### getFlags()
268 |
269 | ```ts
270 | getFlags(): RawFlags
271 | ```
272 |
273 | Returns a map of enabled flags.
274 | Accessing a flag will *not* send a check event
275 | and `isEnabled` does not take any flag overrides
276 | into account.
277 |
278 | ###### Returns
279 |
280 | [`RawFlags`](globals.md#rawflags)
281 |
282 | Map of flags.
283 |
284 | ##### getState()
285 |
286 | ```ts
287 | getState(): State
288 | ```
289 |
290 | ###### Returns
291 |
292 | [`State`](globals.md#state)
293 |
294 | ##### initialize()
295 |
296 | ```ts
297 | initialize(): Promise<void>
298 | ```
299 |
300 | Initialize the Reflag SDK.
301 |
302 | Must be called before calling other SDK methods.
303 |
304 | ###### Returns
305 |
306 | [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\>
307 |
308 | ##### off()
309 |
310 | ```ts
311 | off<THookType>(type: THookType, handler: (args0: HookArgs[THookType]) => void): void
312 | ```
313 |
314 | Remove an event listener
315 |
316 | ###### Type Parameters
317 |
318 | <table>
319 | <thead>
320 | <tr>
321 | <th>Type Parameter</th>
322 | </tr>
323 | </thead>
324 | <tbody>
325 | <tr>
326 | <td>
327 |
328 | `THookType` *extends* keyof [`HookArgs`](globals.md#hookargs)
329 |
330 | </td>
331 | </tr>
332 | </tbody>
333 | </table>
334 |
335 | ###### Parameters
336 |
337 | <table>
338 | <thead>
339 | <tr>
340 | <th>Parameter</th>
341 | <th>Type</th>
342 | <th>Description</th>
343 | </tr>
344 | </thead>
345 | <tbody>
346 | <tr>
347 | <td>
348 |
349 | `type`
350 |
351 | </td>
352 | <td>
353 |
354 | `THookType`
355 |
356 | </td>
357 | <td>
358 |
359 | Type of event to remove.
360 |
361 | </td>
362 | </tr>
363 | <tr>
364 | <td>
365 |
366 | `handler`
367 |
368 | </td>
369 | <td>
370 |
371 | (`args0`: [`HookArgs`](globals.md#hookargs)\[`THookType`\]) => `void`
372 |
373 | </td>
374 | <td>
375 |
376 | The same function that was passed to `on`.
377 |
378 | </td>
379 | </tr>
380 | </tbody>
381 | </table>
382 |
383 | ###### Returns
384 |
385 | `void`
386 |
387 | A function to remove the hook.
388 |
389 | ##### on()
390 |
391 | ```ts
392 | on<THookType>(type: THookType, handler: (args0: HookArgs[THookType]) => void): () => void
393 | ```
394 |
395 | Add an event listener
396 |
397 | ###### Type Parameters
398 |
399 | <table>
400 | <thead>
401 | <tr>
402 | <th>Type Parameter</th>
403 | </tr>
404 | </thead>
405 | <tbody>
406 | <tr>
407 | <td>
408 |
409 | `THookType` *extends* keyof [`HookArgs`](globals.md#hookargs)
410 |
411 | </td>
412 | </tr>
413 | </tbody>
414 | </table>
415 |
416 | ###### Parameters
417 |
418 | <table>
419 | <thead>
420 | <tr>
421 | <th>Parameter</th>
422 | <th>Type</th>
423 | <th>Description</th>
424 | </tr>
425 | </thead>
426 | <tbody>
427 | <tr>
428 | <td>
429 |
430 | `type`
431 |
432 | </td>
433 | <td>
434 |
435 | `THookType`
436 |
437 | </td>
438 | <td>
439 |
440 | Type of events to listen for
441 |
442 | </td>
443 | </tr>
444 | <tr>
445 | <td>
446 |
447 | `handler`
448 |
449 | </td>
450 | <td>
451 |
452 | (`args0`: [`HookArgs`](globals.md#hookargs)\[`THookType`\]) => `void`
453 |
454 | </td>
455 | <td>
456 |
457 | The function to call when the event is triggered.
458 |
459 | </td>
460 | </tr>
461 | </tbody>
462 | </table>
463 |
464 | ###### Returns
465 |
466 | `Function`
467 |
468 | A function to remove the hook.
469 |
470 | ###### Returns
471 |
472 | `void`
473 |
474 | ##### requestFeedback()
475 |
476 | ```ts
477 | requestFeedback(options: RequestFeedbackData): void
478 | ```
479 |
480 | Display the Reflag feedback form UI programmatically.
481 |
482 | This can be used to collect feedback from users in Reflag in cases where Automated Feedback Surveys isn't appropriate.
483 |
484 | ###### Parameters
485 |
486 | <table>
487 | <thead>
488 | <tr>
489 | <th>Parameter</th>
490 | <th>Type</th>
491 | </tr>
492 | </thead>
493 | <tbody>
494 | <tr>
495 | <td>
496 |
497 | `options`
498 |
499 | </td>
500 | <td>
501 |
502 | [`RequestFeedbackData`](globals.md#requestfeedbackdata)
503 |
504 | </td>
505 | </tr>
506 | </tbody>
507 | </table>
508 |
509 | ###### Returns
510 |
511 | `void`
512 |
513 | ##### setContext()
514 |
515 | ```ts
516 | setContext(context: ReflagDeprecatedContext): Promise<void>
517 | ```
518 |
519 | Update the context.
520 | Replaces the existing context with a new context.
521 |
522 | ###### Parameters
523 |
524 | <table>
525 | <thead>
526 | <tr>
527 | <th>Parameter</th>
528 | <th>Type</th>
529 | <th>Description</th>
530 | </tr>
531 | </thead>
532 | <tbody>
533 | <tr>
534 | <td>
535 |
536 | `context`
537 |
538 | </td>
539 | <td>
540 |
541 | [`ReflagDeprecatedContext`](globals.md#reflagdeprecatedcontext)
542 |
543 | </td>
544 | <td>
545 |
546 | The context to update.
547 |
548 | </td>
549 | </tr>
550 | </tbody>
551 | </table>
552 |
553 | ###### Returns
554 |
555 | [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\>
556 |
557 | ##### stop()
558 |
559 | ```ts
560 | stop(): Promise<void>
561 | ```
562 |
563 | Stop the SDK.
564 | This will stop any automated feedback surveys.
565 |
566 | ###### Returns
567 |
568 | [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\>
569 |
570 | ##### track()
571 |
572 | ```ts
573 | track(eventName: string, attributes?:
574 | | null
575 | | Record<string, any>): Promise<
576 | | undefined
577 | | Response>
578 | ```
579 |
580 | Track an event in Reflag.
581 |
582 | ###### Parameters
583 |
584 | <table>
585 | <thead>
586 | <tr>
587 | <th>Parameter</th>
588 | <th>Type</th>
589 | <th>Description</th>
590 | </tr>
591 | </thead>
592 | <tbody>
593 | <tr>
594 | <td>
595 |
596 | `eventName`
597 |
598 | </td>
599 | <td>
600 |
601 | `string`
602 |
603 | </td>
604 | <td>
605 |
606 | The name of the event.
607 |
608 | </td>
609 | </tr>
610 | <tr>
611 | <td>
612 |
613 | `attributes`?
614 |
615 | </td>
616 | <td>
617 |
618 | \| `null` \| [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>
619 |
620 | </td>
621 | <td>
622 |
623 | Any attributes you want to attach to the event.
624 |
625 | </td>
626 | </tr>
627 | </tbody>
628 | </table>
629 |
630 | ###### Returns
631 |
632 | [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<
633 | \| `undefined`
634 | \| [`Response`](https://developer.mozilla.org/docs/Web/API/Response)\>
635 |
636 | ##### updateCompany()
637 |
638 | ```ts
639 | updateCompany(company: {}): Promise<void>
640 | ```
641 |
642 | Update the company context.
643 | Performs a shallow merge with the existing company context.
644 | It will not update the context if nothing has changed.
645 |
646 | ###### Parameters
647 |
648 | <table>
649 | <thead>
650 | <tr>
651 | <th>Parameter</th>
652 | <th>Type</th>
653 | <th>Description</th>
654 | </tr>
655 | </thead>
656 | <tbody>
657 | <tr>
658 | <td>
659 |
660 | `company`
661 |
662 | </td>
663 | <td>
664 |
665 | \{\}
666 |
667 | </td>
668 | <td>
669 |
670 | The company details.
671 |
672 | </td>
673 | </tr>
674 | </tbody>
675 | </table>
676 |
677 | ###### Returns
678 |
679 | [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\>
680 |
681 | ##### updateFlags()
682 |
683 | ```ts
684 | updateFlags(flags: RawFlags, triggerEvent: boolean): void
685 | ```
686 |
687 | Update the flags.
688 |
689 | ###### Parameters
690 |
691 | <table>
692 | <thead>
693 | <tr>
694 | <th>Parameter</th>
695 | <th>Type</th>
696 | <th>Default value</th>
697 | <th>Description</th>
698 | </tr>
699 | </thead>
700 | <tbody>
701 | <tr>
702 | <td>
703 |
704 | `flags`
705 |
706 | </td>
707 | <td>
708 |
709 | [`RawFlags`](globals.md#rawflags)
710 |
711 | </td>
712 | <td>
713 |
714 | `undefined`
715 |
716 | </td>
717 | <td>
718 |
719 | The flags to update.
720 |
721 | </td>
722 | </tr>
723 | <tr>
724 | <td>
725 |
726 | `triggerEvent`
727 |
728 | </td>
729 | <td>
730 |
731 | `boolean`
732 |
733 | </td>
734 | <td>
735 |
736 | `true`
737 |
738 | </td>
739 | <td>
740 |
741 | Whether to trigger the `flagsUpdated` event.
742 |
743 | </td>
744 | </tr>
745 | </tbody>
746 | </table>
747 |
748 | ###### Returns
749 |
750 | `void`
751 |
752 | ##### updateOtherContext()
753 |
754 | ```ts
755 | updateOtherContext(otherContext: {}): Promise<void>
756 | ```
757 |
758 | Update the company context.
759 | Performs a shallow merge with the existing company context.
760 | It will not update the context if nothing has changed.
761 |
762 | ###### Parameters
763 |
764 | <table>
765 | <thead>
766 | <tr>
767 | <th>Parameter</th>
768 | <th>Type</th>
769 | <th>Description</th>
770 | </tr>
771 | </thead>
772 | <tbody>
773 | <tr>
774 | <td>
775 |
776 | `otherContext`
777 |
778 | </td>
779 | <td>
780 |
781 | \{\}
782 |
783 | </td>
784 | <td>
785 |
786 | Additional context.
787 |
788 | </td>
789 | </tr>
790 | </tbody>
791 | </table>
792 |
793 | ###### Returns
794 |
795 | [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\>
796 |
797 | ##### updateUser()
798 |
799 | ```ts
800 | updateUser(user: {}): Promise<void>
801 | ```
802 |
803 | Update the user context.
804 | Performs a shallow merge with the existing user context.
805 | It will not update the context if nothing has changed.
806 |
807 | ###### Parameters
808 |
809 | <table>
810 | <thead>
811 | <tr>
812 | <th>Parameter</th>
813 | <th>Type</th>
814 | </tr>
815 | </thead>
816 | <tbody>
817 | <tr>
818 | <td>
819 |
820 | `user`
821 |
822 | </td>
823 | <td>
824 |
825 | \{\}
826 |
827 | </td>
828 | </tr>
829 | </tbody>
830 | </table>
831 |
832 | ###### Returns
833 |
834 | [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\>
835 |
836 | ## Interfaces
837 |
838 | ### CheckEvent
839 |
840 | Event representing checking the flag evaluation result
841 |
842 | #### Properties
843 |
844 | <table>
845 | <thead>
846 | <tr>
847 | <th>Property</th>
848 | <th>Type</th>
849 | <th>Description</th>
850 | </tr>
851 | </thead>
852 | <tbody>
853 | <tr>
854 | <td>
855 |
856 | <a id="action"></a> `action`
857 |
858 | </td>
859 | <td>
860 |
861 | `"check-is-enabled"` \| `"check-config"`
862 |
863 | </td>
864 | <td>
865 |
866 | `check-is-enabled` means `isEnabled` was checked, `check-config` means `config` was checked.
867 |
868 | </td>
869 | </tr>
870 | <tr>
871 | <td>
872 |
873 | <a id="key"></a> `key`
874 |
875 | </td>
876 | <td>
877 |
878 | `string`
879 |
880 | </td>
881 | <td>
882 |
883 | Flag key.
884 |
885 | </td>
886 | </tr>
887 | <tr>
888 | <td>
889 |
890 | <a id="missingcontextfields"></a> `missingContextFields?`
891 |
892 | </td>
893 | <td>
894 |
895 | `string`[]
896 |
897 | </td>
898 | <td>
899 |
900 | Missing context fields.
901 |
902 | </td>
903 | </tr>
904 | <tr>
905 | <td>
906 |
907 | <a id="ruleevaluationresults"></a> `ruleEvaluationResults?`
908 |
909 | </td>
910 | <td>
911 |
912 | `boolean`[]
913 |
914 | </td>
915 | <td>
916 |
917 | Rule evaluation results.
918 |
919 | </td>
920 | </tr>
921 | <tr>
922 | <td>
923 |
924 | <a id="value"></a> `value?`
925 |
926 | </td>
927 | <td>
928 |
929 | \| `boolean` \| \{ `key`: `string`; `payload`: `any`; \}
930 |
931 | </td>
932 | <td>
933 |
934 | Result of flag or configuration evaluation.
935 | If `action` is `check-is-enabled`, this is the result of the flag evaluation and `value` is a boolean.
936 | If `action` is `check-config`, this is the result of the configuration evaluation.
937 |
938 | </td>
939 | </tr>
940 | <tr>
941 | <td>
942 |
943 | <a id="version"></a> `version?`
944 |
945 | </td>
946 | <td>
947 |
948 | `number`
949 |
950 | </td>
951 | <td>
952 |
953 | Version of targeting rules.
954 |
955 | </td>
956 | </tr>
957 | </tbody>
958 | </table>
959 |
960 | ***
961 |
962 | ### CompanyContext
963 |
964 | Context is a set of key-value pairs.
965 | This is used to determine if feature targeting matches and to track events.
966 | Id should always be present so that it can be referenced to an existing company.
967 |
968 | #### Indexable
969 |
970 | ```ts
971 | [key: string]: undefined | string | number
972 | ```
973 |
974 | #### Properties
975 |
976 | <table>
977 | <thead>
978 | <tr>
979 | <th>Property</th>
980 | <th>Type</th>
981 | <th>Description</th>
982 | </tr>
983 | </thead>
984 | <tbody>
985 | <tr>
986 | <td>
987 |
988 | <a id="id"></a> `id`
989 |
990 | </td>
991 | <td>
992 |
993 | `undefined` \| `string` \| `number`
994 |
995 | </td>
996 | <td>
997 |
998 | Company id
999 |
1000 | </td>
1001 | </tr>
1002 | <tr>
1003 | <td>
1004 |
1005 | <a id="name"></a> `name?`
1006 |
1007 | </td>
1008 | <td>
1009 |
1010 | `string`
1011 |
1012 | </td>
1013 | <td>
1014 |
1015 | Company name
1016 |
1017 | </td>
1018 | </tr>
1019 | </tbody>
1020 | </table>
1021 |
1022 | ***
1023 |
1024 | ### Config
1025 |
1026 | ReflagClient configuration.
1027 |
1028 | #### Properties
1029 |
1030 | <table>
1031 | <thead>
1032 | <tr>
1033 | <th>Property</th>
1034 | <th>Type</th>
1035 | <th>Description</th>
1036 | </tr>
1037 | </thead>
1038 | <tbody>
1039 | <tr>
1040 | <td>
1041 |
1042 | <a id="apibaseurl"></a> `apiBaseUrl`
1043 |
1044 | </td>
1045 | <td>
1046 |
1047 | `string`
1048 |
1049 | </td>
1050 | <td>
1051 |
1052 | Base URL of Reflag servers.
1053 |
1054 | </td>
1055 | </tr>
1056 | <tr>
1057 | <td>
1058 |
1059 | <a id="appbaseurl"></a> `appBaseUrl`
1060 |
1061 | </td>
1062 | <td>
1063 |
1064 | `string`
1065 |
1066 | </td>
1067 | <td>
1068 |
1069 | Base URL of the Reflag web app.
1070 |
1071 | </td>
1072 | </tr>
1073 | <tr>
1074 | <td>
1075 |
1076 | <a id="bootstrapped"></a> `bootstrapped`
1077 |
1078 | </td>
1079 | <td>
1080 |
1081 | `boolean`
1082 |
1083 | </td>
1084 | <td>
1085 |
1086 | Whether the client is bootstrapped.
1087 |
1088 | </td>
1089 | </tr>
1090 | <tr>
1091 | <td>
1092 |
1093 | <a id="enabletracking"></a> `enableTracking`
1094 |
1095 | </td>
1096 | <td>
1097 |
1098 | `boolean`
1099 |
1100 | </td>
1101 | <td>
1102 |
1103 | Whether to enable tracking.
1104 |
1105 | </td>
1106 | </tr>
1107 | <tr>
1108 | <td>
1109 |
1110 | <a id="offline"></a> `offline`
1111 |
1112 | </td>
1113 | <td>
1114 |
1115 | `boolean`
1116 |
1117 | </td>
1118 | <td>
1119 |
1120 | Whether to enable offline mode.
1121 |
1122 | </td>
1123 | </tr>
1124 | <tr>
1125 | <td>
1126 |
1127 | <a id="ssebaseurl"></a> `sseBaseUrl`
1128 |
1129 | </td>
1130 | <td>
1131 |
1132 | `string`
1133 |
1134 | </td>
1135 | <td>
1136 |
1137 | Base URL of Reflag servers for SSE connections used by AutoFeedback.
1138 |
1139 | </td>
1140 | </tr>
1141 | </tbody>
1142 | </table>
1143 |
1144 | ***
1145 |
1146 | ### FeedbackScoreSubmission
1147 |
1148 | #### Properties
1149 |
1150 | <table>
1151 | <thead>
1152 | <tr>
1153 | <th>Property</th>
1154 | <th>Type</th>
1155 | </tr>
1156 | </thead>
1157 | <tbody>
1158 | <tr>
1159 | <td>
1160 |
1161 | <a id="feedbackid"></a> `feedbackId?`
1162 |
1163 | </td>
1164 | <td>
1165 |
1166 | `string`
1167 |
1168 | </td>
1169 | </tr>
1170 | <tr>
1171 | <td>
1172 |
1173 | <a id="question"></a> `question`
1174 |
1175 | </td>
1176 | <td>
1177 |
1178 | `string`
1179 |
1180 | </td>
1181 | </tr>
1182 | <tr>
1183 | <td>
1184 |
1185 | <a id="score"></a> `score`
1186 |
1187 | </td>
1188 | <td>
1189 |
1190 | `number`
1191 |
1192 | </td>
1193 | </tr>
1194 | </tbody>
1195 | </table>
1196 |
1197 | ***
1198 |
1199 | ### FeedbackSubmission
1200 |
1201 | #### Properties
1202 |
1203 | <table>
1204 | <thead>
1205 | <tr>
1206 | <th>Property</th>
1207 | <th>Type</th>
1208 | </tr>
1209 | </thead>
1210 | <tbody>
1211 | <tr>
1212 | <td>
1213 |
1214 | <a id="comment"></a> `comment`
1215 |
1216 | </td>
1217 | <td>
1218 |
1219 | `string`
1220 |
1221 | </td>
1222 | </tr>
1223 | <tr>
1224 | <td>
1225 |
1226 | <a id="feedbackid-1"></a> `feedbackId?`
1227 |
1228 | </td>
1229 | <td>
1230 |
1231 | `string`
1232 |
1233 | </td>
1234 | </tr>
1235 | <tr>
1236 | <td>
1237 |
1238 | <a id="question-1"></a> `question`
1239 |
1240 | </td>
1241 | <td>
1242 |
1243 | `string`
1244 |
1245 | </td>
1246 | </tr>
1247 | <tr>
1248 | <td>
1249 |
1250 | <a id="score-1"></a> `score`
1251 |
1252 | </td>
1253 | <td>
1254 |
1255 | `number`
1256 |
1257 | </td>
1258 | </tr>
1259 | </tbody>
1260 | </table>
1261 |
1262 | ***
1263 |
1264 | ### Flag
1265 |
1266 | Represents a flag.
1267 |
1268 | #### Properties
1269 |
1270 | <table>
1271 | <thead>
1272 | <tr>
1273 | <th>Property</th>
1274 | <th>Type</th>
1275 | <th>Description</th>
1276 | </tr>
1277 | </thead>
1278 | <tbody>
1279 | <tr>
1280 | <td>
1281 |
1282 | <a id="config-1"></a> `config`
1283 |
1284 | </td>
1285 | <td>
1286 |
1287 | [`FlagRemoteConfig`](globals.md#flagremoteconfig)
1288 |
1289 | </td>
1290 | <td>
1291 |
1292 | ‐
1293 |
1294 | </td>
1295 | </tr>
1296 | <tr>
1297 | <td>
1298 |
1299 | <a id="isenabled"></a> `isEnabled`
1300 |
1301 | </td>
1302 | <td>
1303 |
1304 | `boolean`
1305 |
1306 | </td>
1307 | <td>
1308 |
1309 | Result of flag flag evaluation.
1310 | Note: Does not take local overrides into account.
1311 |
1312 | </td>
1313 | </tr>
1314 | <tr>
1315 | <td>
1316 |
1317 | <a id="isenabledoverride"></a> `isEnabledOverride`
1318 |
1319 | </td>
1320 | <td>
1321 |
1322 | `null` \| `boolean`
1323 |
1324 | </td>
1325 | <td>
1326 |
1327 | The current override status of isEnabled for the flag.
1328 |
1329 | </td>
1330 | </tr>
1331 | <tr>
1332 | <td>
1333 |
1334 | <a id="requestfeedback-1"></a> `requestFeedback`
1335 |
1336 | </td>
1337 | <td>
1338 |
1339 | (`options`: [`Omit`](https://www.typescriptlang.org/docs/handbook/utility-types.html#omittype-keys)\<[`RequestFeedbackData`](globals.md#requestfeedbackdata), `"featureId"` \| `"flagKey"`\>) => `void`
1340 |
1341 | </td>
1342 | <td>
1343 |
1344 | Function to request feedback for this flag.
1345 |
1346 | </td>
1347 | </tr>
1348 | <tr>
1349 | <td>
1350 |
1351 | <a id="track-1"></a> `track`
1352 |
1353 | </td>
1354 | <td>
1355 |
1356 | () => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\< \| `undefined` \| [`Response`](https://developer.mozilla.org/docs/Web/API/Response)\>
1357 |
1358 | </td>
1359 | <td>
1360 |
1361 | Function to send analytics events for this flag.
1362 |
1363 | </td>
1364 | </tr>
1365 | </tbody>
1366 | </table>
1367 |
1368 | #### Methods
1369 |
1370 | ##### setIsEnabledOverride()
1371 |
1372 | ```ts
1373 | setIsEnabledOverride(isEnabled: null | boolean): void
1374 | ```
1375 |
1376 | Set the override status for isEnabled for the flag.
1377 | Set to `null` to remove the override.
1378 |
1379 | ###### Parameters
1380 |
1381 | <table>
1382 | <thead>
1383 | <tr>
1384 | <th>Parameter</th>
1385 | <th>Type</th>
1386 | </tr>
1387 | </thead>
1388 | <tbody>
1389 | <tr>
1390 | <td>
1391 |
1392 | `isEnabled`
1393 |
1394 | </td>
1395 | <td>
1396 |
1397 | `null` \| `boolean`
1398 |
1399 | </td>
1400 | </tr>
1401 | </tbody>
1402 | </table>
1403 |
1404 | ###### Returns
1405 |
1406 | `void`
1407 |
1408 | ***
1409 |
1410 | ### HookArgs
1411 |
1412 | #### Properties
1413 |
1414 | <table>
1415 | <thead>
1416 | <tr>
1417 | <th>Property</th>
1418 | <th>Type</th>
1419 | <th>Description</th>
1420 | </tr>
1421 | </thead>
1422 | <tbody>
1423 | <tr>
1424 | <td>
1425 |
1426 | <a id="check"></a> `check`
1427 |
1428 | </td>
1429 | <td>
1430 |
1431 | [`CheckEvent`](globals.md#checkevent)
1432 |
1433 | </td>
1434 | <td>
1435 |
1436 | ‐
1437 |
1438 | </td>
1439 | </tr>
1440 | <tr>
1441 | <td>
1442 |
1443 | <a id="company"></a> `company`
1444 |
1445 | </td>
1446 | <td>
1447 |
1448 | [`CompanyContext`](globals.md#companycontext)
1449 |
1450 | </td>
1451 | <td>
1452 |
1453 | ‐
1454 |
1455 | </td>
1456 | </tr>
1457 | <tr>
1458 | <td>
1459 |
1460 | <a id="featuresupdated"></a> ~~`featuresUpdated`~~
1461 |
1462 | </td>
1463 | <td>
1464 |
1465 | [`RawFlags`](globals.md#rawflags)
1466 |
1467 | </td>
1468 | <td>
1469 |
1470 | **Deprecated**
1471 |
1472 | Use `flagsUpdated` instead.
1473 |
1474 | </td>
1475 | </tr>
1476 | <tr>
1477 | <td>
1478 |
1479 | <a id="flagsupdated"></a> `flagsUpdated`
1480 |
1481 | </td>
1482 | <td>
1483 |
1484 | [`RawFlags`](globals.md#rawflags)
1485 |
1486 | </td>
1487 | <td>
1488 |
1489 | ‐
1490 |
1491 | </td>
1492 | </tr>
1493 | <tr>
1494 | <td>
1495 |
1496 | <a id="stateupdated"></a> `stateUpdated`
1497 |
1498 | </td>
1499 | <td>
1500 |
1501 | [`State`](globals.md#state)
1502 |
1503 | </td>
1504 | <td>
1505 |
1506 | ‐
1507 |
1508 | </td>
1509 | </tr>
1510 | <tr>
1511 | <td>
1512 |
1513 | <a id="track-2"></a> `track`
1514 |
1515 | </td>
1516 | <td>
1517 |
1518 | [`TrackEvent`](globals.md#trackevent)
1519 |
1520 | </td>
1521 | <td>
1522 |
1523 | ‐
1524 |
1525 | </td>
1526 | </tr>
1527 | <tr>
1528 | <td>
1529 |
1530 | <a id="user"></a> `user`
1531 |
1532 | </td>
1533 | <td>
1534 |
1535 | [`UserContext`](globals.md#usercontext)
1536 |
1537 | </td>
1538 | <td>
1539 |
1540 | ‐
1541 |
1542 | </td>
1543 | </tr>
1544 | </tbody>
1545 | </table>
1546 |
1547 | ***
1548 |
1549 | ### Logger
1550 |
1551 | #### Methods
1552 |
1553 | ##### debug()
1554 |
1555 | ```ts
1556 | debug(message: string, ...args: any[]): void
1557 | ```
1558 |
1559 | ###### Parameters
1560 |
1561 | <table>
1562 | <thead>
1563 | <tr>
1564 | <th>Parameter</th>
1565 | <th>Type</th>
1566 | </tr>
1567 | </thead>
1568 | <tbody>
1569 | <tr>
1570 | <td>
1571 |
1572 | `message`
1573 |
1574 | </td>
1575 | <td>
1576 |
1577 | `string`
1578 |
1579 | </td>
1580 | </tr>
1581 | <tr>
1582 | <td>
1583 |
1584 | ...`args`
1585 |
1586 | </td>
1587 | <td>
1588 |
1589 | `any`[]
1590 |
1591 | </td>
1592 | </tr>
1593 | </tbody>
1594 | </table>
1595 |
1596 | ###### Returns
1597 |
1598 | `void`
1599 |
1600 | ##### error()
1601 |
1602 | ```ts
1603 | error(message: string, ...args: any[]): void
1604 | ```
1605 |
1606 | ###### Parameters
1607 |
1608 | <table>
1609 | <thead>
1610 | <tr>
1611 | <th>Parameter</th>
1612 | <th>Type</th>
1613 | </tr>
1614 | </thead>
1615 | <tbody>
1616 | <tr>
1617 | <td>
1618 |
1619 | `message`
1620 |
1621 | </td>
1622 | <td>
1623 |
1624 | `string`
1625 |
1626 | </td>
1627 | </tr>
1628 | <tr>
1629 | <td>
1630 |
1631 | ...`args`
1632 |
1633 | </td>
1634 | <td>
1635 |
1636 | `any`[]
1637 |
1638 | </td>
1639 | </tr>
1640 | </tbody>
1641 | </table>
1642 |
1643 | ###### Returns
1644 |
1645 | `void`
1646 |
1647 | ##### info()
1648 |
1649 | ```ts
1650 | info(message: string, ...args: any[]): void
1651 | ```
1652 |
1653 | ###### Parameters
1654 |
1655 | <table>
1656 | <thead>
1657 | <tr>
1658 | <th>Parameter</th>
1659 | <th>Type</th>
1660 | </tr>
1661 | </thead>
1662 | <tbody>
1663 | <tr>
1664 | <td>
1665 |
1666 | `message`
1667 |
1668 | </td>
1669 | <td>
1670 |
1671 | `string`
1672 |
1673 | </td>
1674 | </tr>
1675 | <tr>
1676 | <td>
1677 |
1678 | ...`args`
1679 |
1680 | </td>
1681 | <td>
1682 |
1683 | `any`[]
1684 |
1685 | </td>
1686 | </tr>
1687 | </tbody>
1688 | </table>
1689 |
1690 | ###### Returns
1691 |
1692 | `void`
1693 |
1694 | ##### warn()
1695 |
1696 | ```ts
1697 | warn(message: string, ...args: any[]): void
1698 | ```
1699 |
1700 | ###### Parameters
1701 |
1702 | <table>
1703 | <thead>
1704 | <tr>
1705 | <th>Parameter</th>
1706 | <th>Type</th>
1707 | </tr>
1708 | </thead>
1709 | <tbody>
1710 | <tr>
1711 | <td>
1712 |
1713 | `message`
1714 |
1715 | </td>
1716 | <td>
1717 |
1718 | `string`
1719 |
1720 | </td>
1721 | </tr>
1722 | <tr>
1723 | <td>
1724 |
1725 | ...`args`
1726 |
1727 | </td>
1728 | <td>
1729 |
1730 | `any`[]
1731 |
1732 | </td>
1733 | </tr>
1734 | </tbody>
1735 | </table>
1736 |
1737 | ###### Returns
1738 |
1739 | `void`
1740 |
1741 | ***
1742 |
1743 | ### OnScoreSubmitResult
1744 |
1745 | #### Properties
1746 |
1747 | <table>
1748 | <thead>
1749 | <tr>
1750 | <th>Property</th>
1751 | <th>Type</th>
1752 | </tr>
1753 | </thead>
1754 | <tbody>
1755 | <tr>
1756 | <td>
1757 |
1758 | <a id="feedbackid-2"></a> `feedbackId`
1759 |
1760 | </td>
1761 | <td>
1762 |
1763 | `string`
1764 |
1765 | </td>
1766 | </tr>
1767 | </tbody>
1768 | </table>
1769 |
1770 | ***
1771 |
1772 | ### OpenFeedbackFormOptions
1773 |
1774 | #### Properties
1775 |
1776 | <table>
1777 | <thead>
1778 | <tr>
1779 | <th>Property</th>
1780 | <th>Type</th>
1781 | <th>Description</th>
1782 | </tr>
1783 | </thead>
1784 | <tbody>
1785 | <tr>
1786 | <td>
1787 |
1788 | <a id="key-1"></a> `key`
1789 |
1790 | </td>
1791 | <td>
1792 |
1793 | `string`
1794 |
1795 | </td>
1796 | <td>
1797 |
1798 | ‐
1799 |
1800 | </td>
1801 | </tr>
1802 | <tr>
1803 | <td>
1804 |
1805 | <a id="onclose"></a> `onClose?`
1806 |
1807 | </td>
1808 | <td>
1809 |
1810 | () => `void`
1811 |
1812 | </td>
1813 | <td>
1814 |
1815 | ‐
1816 |
1817 | </td>
1818 | </tr>
1819 | <tr>
1820 | <td>
1821 |
1822 | <a id="ondismiss"></a> `onDismiss?`
1823 |
1824 | </td>
1825 | <td>
1826 |
1827 | () => `void`
1828 |
1829 | </td>
1830 | <td>
1831 |
1832 | ‐
1833 |
1834 | </td>
1835 | </tr>
1836 | <tr>
1837 | <td>
1838 |
1839 | <a id="onscoresubmit"></a> `onScoreSubmit?`
1840 |
1841 | </td>
1842 | <td>
1843 |
1844 | (`data`: [`FeedbackScoreSubmission`](globals.md#feedbackscoresubmission)) => [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`OnScoreSubmitResult`](globals.md#onscoresubmitresult)\>
1845 |
1846 | </td>
1847 | <td>
1848 |
1849 | ‐
1850 |
1851 | </td>
1852 | </tr>
1853 | <tr>
1854 | <td>
1855 |
1856 | <a id="onsubmit"></a> `onSubmit`
1857 |
1858 | </td>
1859 | <td>
1860 |
1861 | (`data`: [`FeedbackSubmission`](globals.md#feedbacksubmission)) => \| `void` \| [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\>
1862 |
1863 | </td>
1864 | <td>
1865 |
1866 | ‐
1867 |
1868 | </td>
1869 | </tr>
1870 | <tr>
1871 | <td>
1872 |
1873 | <a id="openwithcommentvisible"></a> `openWithCommentVisible?`
1874 |
1875 | </td>
1876 | <td>
1877 |
1878 | `boolean`
1879 |
1880 | </td>
1881 | <td>
1882 |
1883 | Open the form with both the score and comment fields visible.
1884 | Defaults to `false`
1885 |
1886 | </td>
1887 | </tr>
1888 | <tr>
1889 | <td>
1890 |
1891 | <a id="position"></a> `position?`
1892 |
1893 | </td>
1894 | <td>
1895 |
1896 | [`Position`](globals.md#position-1)
1897 |
1898 | </td>
1899 | <td>
1900 |
1901 | Control the placement and behavior of the feedback form.
1902 |
1903 | </td>
1904 | </tr>
1905 | <tr>
1906 | <td>
1907 |
1908 | <a id="title"></a> `title?`
1909 |
1910 | </td>
1911 | <td>
1912 |
1913 | `string`
1914 |
1915 | </td>
1916 | <td>
1917 |
1918 | ‐
1919 |
1920 | </td>
1921 | </tr>
1922 | <tr>
1923 | <td>
1924 |
1925 | <a id="translations"></a> `translations?`
1926 |
1927 | </td>
1928 | <td>
1929 |
1930 | [`Partial`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype)\<[`FeedbackTranslations`](globals.md#feedbacktranslations)\>
1931 |
1932 | </td>
1933 | <td>
1934 |
1935 | Add your own custom translations for the feedback form.
1936 | Undefined translation keys fall back to english defaults.
1937 |
1938 | </td>
1939 | </tr>
1940 | </tbody>
1941 | </table>
1942 |
1943 | ***
1944 |
1945 | ### ReflagContext
1946 |
1947 | Context is a set of key-value pairs.
1948 | This is used to determine if feature targeting matches and to track events.
1949 |
1950 | #### Extended by
1951 |
1952 | - [`ReflagDeprecatedContext`](globals.md#reflagdeprecatedcontext)
1953 |
1954 | #### Properties
1955 |
1956 | <table>
1957 | <thead>
1958 | <tr>
1959 | <th>Property</th>
1960 | <th>Type</th>
1961 | <th>Description</th>
1962 | </tr>
1963 | </thead>
1964 | <tbody>
1965 | <tr>
1966 | <td>
1967 |
1968 | <a id="company-1"></a> `company?`
1969 |
1970 | </td>
1971 | <td>
1972 |
1973 | [`CompanyContext`](globals.md#companycontext)
1974 |
1975 | </td>
1976 | <td>
1977 |
1978 | Company related context. If you provide `id` Reflag will enrich the evaluation context with
1979 | company attributes on Reflag servers.
1980 |
1981 | </td>
1982 | </tr>
1983 | <tr>
1984 | <td>
1985 |
1986 | <a id="other"></a> `other?`
1987 |
1988 | </td>
1989 | <td>
1990 |
1991 | [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `undefined` \| `string` \| `number`\>
1992 |
1993 | </td>
1994 | <td>
1995 |
1996 | Context which is not related to a user or a company.
1997 |
1998 | </td>
1999 | </tr>
2000 | <tr>
2001 | <td>
2002 |
2003 | <a id="user-1"></a> `user?`
2004 |
2005 | </td>
2006 | <td>
2007 |
2008 | [`UserContext`](globals.md#usercontext)
2009 |
2010 | </td>
2011 | <td>
2012 |
2013 | User related context. If you provide `id` Reflag will enrich the evaluation context with
2014 | user attributes on Reflag servers.
2015 |
2016 | </td>
2017 | </tr>
2018 | </tbody>
2019 | </table>
2020 |
2021 | ***
2022 |
2023 | ### ~~ReflagDeprecatedContext~~
2024 |
2025 | **`Internal`**
2026 |
2027 | #### Deprecated
2028 |
2029 | Use `ReflagContext` instead, this interface will be removed in the next major version
2030 |
2031 | #### Extends
2032 |
2033 | - [`ReflagContext`](globals.md#reflagcontext)
2034 |
2035 | #### Properties
2036 |
2037 | <table>
2038 | <thead>
2039 | <tr>
2040 | <th>Property</th>
2041 | <th>Type</th>
2042 | <th>Description</th>
2043 | </tr>
2044 | </thead>
2045 | <tbody>
2046 | <tr>
2047 | <td>
2048 |
2049 | <a id="company-2"></a> ~~`company?`~~
2050 |
2051 | </td>
2052 | <td>
2053 |
2054 | [`CompanyContext`](globals.md#companycontext)
2055 |
2056 | </td>
2057 | <td>
2058 |
2059 | Company related context. If you provide `id` Reflag will enrich the evaluation context with
2060 | company attributes on Reflag servers.
2061 |
2062 | </td>
2063 | </tr>
2064 | <tr>
2065 | <td>
2066 |
2067 | <a id="other-1"></a> ~~`other?`~~
2068 |
2069 | </td>
2070 | <td>
2071 |
2072 | [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `undefined` \| `string` \| `number`\>
2073 |
2074 | </td>
2075 | <td>
2076 |
2077 | Context which is not related to a user or a company.
2078 |
2079 | </td>
2080 | </tr>
2081 | <tr>
2082 | <td>
2083 |
2084 | <a id="othercontext"></a> ~~`otherContext?`~~
2085 |
2086 | </td>
2087 | <td>
2088 |
2089 | [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `undefined` \| `string` \| `number`\>
2090 |
2091 | </td>
2092 | <td>
2093 |
2094 | Context which is not related to a user or a company.
2095 |
2096 | **Deprecated**
2097 |
2098 | Use `other` instead, this property will be removed in the next major version
2099 |
2100 | </td>
2101 | </tr>
2102 | <tr>
2103 | <td>
2104 |
2105 | <a id="user-2"></a> ~~`user?`~~
2106 |
2107 | </td>
2108 | <td>
2109 |
2110 | [`UserContext`](globals.md#usercontext)
2111 |
2112 | </td>
2113 | <td>
2114 |
2115 | User related context. If you provide `id` Reflag will enrich the evaluation context with
2116 | user attributes on Reflag servers.
2117 |
2118 | </td>
2119 | </tr>
2120 | </tbody>
2121 | </table>
2122 |
2123 | ***
2124 |
2125 | ### ToolbarPosition
2126 |
2127 | #### Properties
2128 |
2129 | <table>
2130 | <thead>
2131 | <tr>
2132 | <th>Property</th>
2133 | <th>Type</th>
2134 | </tr>
2135 | </thead>
2136 | <tbody>
2137 | <tr>
2138 | <td>
2139 |
2140 | <a id="offset"></a> `offset?`
2141 |
2142 | </td>
2143 | <td>
2144 |
2145 | [`Offset`](globals.md#offset-1)
2146 |
2147 | </td>
2148 | </tr>
2149 | <tr>
2150 | <td>
2151 |
2152 | <a id="placement"></a> `placement`
2153 |
2154 | </td>
2155 | <td>
2156 |
2157 | [`DialogPlacement`](globals.md#dialogplacement)
2158 |
2159 | </td>
2160 | </tr>
2161 | </tbody>
2162 | </table>
2163 |
2164 | ***
2165 |
2166 | ### UserContext
2167 |
2168 | Context is a set of key-value pairs.
2169 | This is used to determine if feature targeting matches and to track events.
2170 | Id should always be present so that it can be referenced to an existing user.
2171 |
2172 | #### Indexable
2173 |
2174 | ```ts
2175 | [key: string]: undefined | string | number
2176 | ```
2177 |
2178 | #### Properties
2179 |
2180 | <table>
2181 | <thead>
2182 | <tr>
2183 | <th>Property</th>
2184 | <th>Type</th>
2185 | <th>Description</th>
2186 | </tr>
2187 | </thead>
2188 | <tbody>
2189 | <tr>
2190 | <td>
2191 |
2192 | <a id="email"></a> `email?`
2193 |
2194 | </td>
2195 | <td>
2196 |
2197 | `string`
2198 |
2199 | </td>
2200 | <td>
2201 |
2202 | User email
2203 |
2204 | </td>
2205 | </tr>
2206 | <tr>
2207 | <td>
2208 |
2209 | <a id="id-1"></a> `id`
2210 |
2211 | </td>
2212 | <td>
2213 |
2214 | `undefined` \| `string` \| `number`
2215 |
2216 | </td>
2217 | <td>
2218 |
2219 | User id
2220 |
2221 | </td>
2222 | </tr>
2223 | <tr>
2224 | <td>
2225 |
2226 | <a id="name-1"></a> `name?`
2227 |
2228 | </td>
2229 | <td>
2230 |
2231 | `string`
2232 |
2233 | </td>
2234 | <td>
2235 |
2236 | User name
2237 |
2238 | </td>
2239 | </tr>
2240 | </tbody>
2241 | </table>
2242 |
2243 | ## Type Aliases
2244 |
2245 | ### DialogPlacement
2246 |
2247 | ```ts
2248 | type DialogPlacement = "bottom-right" | "bottom-left" | "top-right" | "top-left";
2249 | ```
2250 |
2251 | ***
2252 |
2253 | ### FallbackFlagOverride
2254 |
2255 | ```ts
2256 | type FallbackFlagOverride =
2257 | | {
2258 | key: string;
2259 | payload: any;
2260 | }
2261 | | true;
2262 | ```
2263 |
2264 | ***
2265 |
2266 | ### Feedback
2267 |
2268 | ```ts
2269 | type Feedback = UnassignedFeedback & {
2270 | companyId: string;
2271 | userId: string;
2272 | };
2273 | ```
2274 |
2275 | #### Type declaration
2276 |
2277 | <table>
2278 | <thead>
2279 | <tr>
2280 | <th>Name</th>
2281 | <th>Type</th>
2282 | <th>Description</th>
2283 | </tr>
2284 | </thead>
2285 | <tbody>
2286 | <tr>
2287 | <td>
2288 |
2289 | `companyId`?
2290 |
2291 | </td>
2292 | <td>
2293 |
2294 | `string`
2295 |
2296 | </td>
2297 | <td>
2298 |
2299 | Company ID from your own application.
2300 |
2301 | </td>
2302 | </tr>
2303 | <tr>
2304 | <td>
2305 |
2306 | `userId`?
2307 |
2308 | </td>
2309 | <td>
2310 |
2311 | `string`
2312 |
2313 | </td>
2314 | <td>
2315 |
2316 | User ID from your own application.
2317 |
2318 | </td>
2319 | </tr>
2320 | </tbody>
2321 | </table>
2322 |
2323 | ***
2324 |
2325 | ### FeedbackOptions
2326 |
2327 | ```ts
2328 | type FeedbackOptions = {
2329 | autoFeedbackHandler: FeedbackPromptHandler;
2330 | enableAutoFeedback: boolean;
2331 | ui: {
2332 | position: Position;
2333 | translations: Partial<FeedbackTranslations>;
2334 | };
2335 | };
2336 | ```
2337 |
2338 | #### Type declaration
2339 |
2340 | <table>
2341 | <thead>
2342 | <tr>
2343 | <th>Name</th>
2344 | <th>Type</th>
2345 | <th>Description</th>
2346 | </tr>
2347 | </thead>
2348 | <tbody>
2349 | <tr>
2350 | <td>
2351 |
2352 | <a id="autofeedbackhandler"></a> `autoFeedbackHandler`?
2353 |
2354 | </td>
2355 | <td>
2356 |
2357 | [`FeedbackPromptHandler`](globals.md#feedbackprompthandler)
2358 |
2359 | </td>
2360 | <td>
2361 |
2362 | ‐
2363 |
2364 | </td>
2365 | </tr>
2366 | <tr>
2367 | <td>
2368 |
2369 | <a id="enableautofeedback"></a> `enableAutoFeedback`?
2370 |
2371 | </td>
2372 | <td>
2373 |
2374 | `boolean`
2375 |
2376 | </td>
2377 | <td>
2378 |
2379 | Enables automatic feedback prompting if it's set up in Reflag
2380 |
2381 | </td>
2382 | </tr>
2383 | <tr>
2384 | <td>
2385 |
2386 | <a id="ui"></a> `ui`?
2387 |
2388 | </td>
2389 | <td>
2390 |
2391 | \{
2392 | `position`: [`Position`](globals.md#position-1);
2393 | `translations`: [`Partial`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype)\<[`FeedbackTranslations`](globals.md#feedbacktranslations)\>;
2394 | \}
2395 |
2396 | </td>
2397 | <td>
2398 |
2399 | With these options you can override the look of the feedback prompt
2400 |
2401 | </td>
2402 | </tr>
2403 | <tr>
2404 | <td>
2405 |
2406 | `ui.position`?
2407 |
2408 | </td>
2409 | <td>
2410 |
2411 | [`Position`](globals.md#position-1)
2412 |
2413 | </td>
2414 | <td>
2415 |
2416 | Control the placement and behavior of the feedback form.
2417 |
2418 | </td>
2419 | </tr>
2420 | <tr>
2421 | <td>
2422 |
2423 | `ui.translations`?
2424 |
2425 | </td>
2426 | <td>
2427 |
2428 | [`Partial`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype)\<[`FeedbackTranslations`](globals.md#feedbacktranslations)\>
2429 |
2430 | </td>
2431 | <td>
2432 |
2433 | Add your own custom translations for the feedback form.
2434 | Undefined translation keys fall back to english defaults.
2435 |
2436 | </td>
2437 | </tr>
2438 | </tbody>
2439 | </table>
2440 |
2441 | ***
2442 |
2443 | ### FeedbackPrompt
2444 |
2445 | ```ts
2446 | type FeedbackPrompt = {
2447 | featureId: string;
2448 | promptId: string;
2449 | question: string;
2450 | showAfter: Date;
2451 | showBefore: Date;
2452 | };
2453 | ```
2454 |
2455 | #### Type declaration
2456 |
2457 | <table>
2458 | <thead>
2459 | <tr>
2460 | <th>Name</th>
2461 | <th>Type</th>
2462 | <th>Description</th>
2463 | </tr>
2464 | </thead>
2465 | <tbody>
2466 | <tr>
2467 | <td>
2468 |
2469 | <a id="featureid"></a> `featureId`
2470 |
2471 | </td>
2472 | <td>
2473 |
2474 | `string`
2475 |
2476 | </td>
2477 | <td>
2478 |
2479 | Feature ID from Reflag
2480 |
2481 | </td>
2482 | </tr>
2483 | <tr>
2484 | <td>
2485 |
2486 | <a id="promptid"></a> `promptId`
2487 |
2488 | </td>
2489 | <td>
2490 |
2491 | `string`
2492 |
2493 | </td>
2494 | <td>
2495 |
2496 | Id of the prompt
2497 |
2498 | </td>
2499 | </tr>
2500 | <tr>
2501 | <td>
2502 |
2503 | <a id="question-2"></a> `question`
2504 |
2505 | </td>
2506 | <td>
2507 |
2508 | `string`
2509 |
2510 | </td>
2511 | <td>
2512 |
2513 | Specific question user was asked
2514 |
2515 | </td>
2516 | </tr>
2517 | <tr>
2518 | <td>
2519 |
2520 | <a id="showafter"></a> `showAfter`
2521 |
2522 | </td>
2523 | <td>
2524 |
2525 | [`Date`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date)
2526 |
2527 | </td>
2528 | <td>
2529 |
2530 | Feedback prompt should appear only after this time
2531 |
2532 | </td>
2533 | </tr>
2534 | <tr>
2535 | <td>
2536 |
2537 | <a id="showbefore"></a> `showBefore`
2538 |
2539 | </td>
2540 | <td>
2541 |
2542 | [`Date`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date)
2543 |
2544 | </td>
2545 | <td>
2546 |
2547 | Feedback prompt will not be shown after this time
2548 |
2549 | </td>
2550 | </tr>
2551 | </tbody>
2552 | </table>
2553 |
2554 | ***
2555 |
2556 | ### FeedbackPromptHandler()
2557 |
2558 | ```ts
2559 | type FeedbackPromptHandler = (prompt: FeedbackPrompt, handlers: FeedbackPromptHandlerCallbacks) => void;
2560 | ```
2561 |
2562 | #### Parameters
2563 |
2564 | <table>
2565 | <thead>
2566 | <tr>
2567 | <th>Parameter</th>
2568 | <th>Type</th>
2569 | </tr>
2570 | </thead>
2571 | <tbody>
2572 | <tr>
2573 | <td>
2574 |
2575 | `prompt`
2576 |
2577 | </td>
2578 | <td>
2579 |
2580 | [`FeedbackPrompt`](globals.md#feedbackprompt)
2581 |
2582 | </td>
2583 | </tr>
2584 | <tr>
2585 | <td>
2586 |
2587 | `handlers`
2588 |
2589 | </td>
2590 | <td>
2591 |
2592 | [`FeedbackPromptHandlerCallbacks`](globals.md#feedbackprompthandlercallbacks)
2593 |
2594 | </td>
2595 | </tr>
2596 | </tbody>
2597 | </table>
2598 |
2599 | #### Returns
2600 |
2601 | `void`
2602 |
2603 | ***
2604 |
2605 | ### FeedbackPromptHandlerCallbacks
2606 |
2607 | ```ts
2608 | type FeedbackPromptHandlerCallbacks = {
2609 | openFeedbackForm: (options: FeedbackPromptHandlerOpenFeedbackFormOptions) => void;
2610 | reply: FeedbackPromptReplyHandler;
2611 | };
2612 | ```
2613 |
2614 | #### Type declaration
2615 |
2616 | <table>
2617 | <thead>
2618 | <tr>
2619 | <th>Name</th>
2620 | <th>Type</th>
2621 | </tr>
2622 | </thead>
2623 | <tbody>
2624 | <tr>
2625 | <td>
2626 |
2627 | <a id="openfeedbackform"></a> `openFeedbackForm`
2628 |
2629 | </td>
2630 | <td>
2631 |
2632 | (`options`: [`FeedbackPromptHandlerOpenFeedbackFormOptions`](globals.md#feedbackprompthandleropenfeedbackformoptions)) => `void`
2633 |
2634 | </td>
2635 | </tr>
2636 | <tr>
2637 | <td>
2638 |
2639 | <a id="reply"></a> `reply`
2640 |
2641 | </td>
2642 | <td>
2643 |
2644 | [`FeedbackPromptReplyHandler`](globals.md#feedbackpromptreplyhandler)
2645 |
2646 | </td>
2647 | </tr>
2648 | </tbody>
2649 | </table>
2650 |
2651 | ***
2652 |
2653 | ### FeedbackPromptHandlerOpenFeedbackFormOptions
2654 |
2655 | ```ts
2656 | type FeedbackPromptHandlerOpenFeedbackFormOptions = Omit<RequestFeedbackOptions,
2657 | | "featureId"
2658 | | "flagKey"
2659 | | "userId"
2660 | | "companyId"
2661 | | "onClose"
2662 | | "onDismiss">;
2663 | ```
2664 |
2665 | ***
2666 |
2667 | ### FeedbackPromptReply
2668 |
2669 | ```ts
2670 | type FeedbackPromptReply = {
2671 | comment: string;
2672 | companyId: string;
2673 | question: string;
2674 | score: number;
2675 | };
2676 | ```
2677 |
2678 | #### Type declaration
2679 |
2680 | <table>
2681 | <thead>
2682 | <tr>
2683 | <th>Name</th>
2684 | <th>Type</th>
2685 | </tr>
2686 | </thead>
2687 | <tbody>
2688 | <tr>
2689 | <td>
2690 |
2691 | <a id="comment-1"></a> `comment`?
2692 |
2693 | </td>
2694 | <td>
2695 |
2696 | `string`
2697 |
2698 | </td>
2699 | </tr>
2700 | <tr>
2701 | <td>
2702 |
2703 | <a id="companyid"></a> `companyId`?
2704 |
2705 | </td>
2706 | <td>
2707 |
2708 | `string`
2709 |
2710 | </td>
2711 | </tr>
2712 | <tr>
2713 | <td>
2714 |
2715 | <a id="question-3"></a> `question`
2716 |
2717 | </td>
2718 | <td>
2719 |
2720 | `string`
2721 |
2722 | </td>
2723 | </tr>
2724 | <tr>
2725 | <td>
2726 |
2727 | <a id="score-2"></a> `score`?
2728 |
2729 | </td>
2730 | <td>
2731 |
2732 | `number`
2733 |
2734 | </td>
2735 | </tr>
2736 | </tbody>
2737 | </table>
2738 |
2739 | ***
2740 |
2741 | ### FeedbackPromptReplyHandler()
2742 |
2743 | ```ts
2744 | type FeedbackPromptReplyHandler = <T>(reply: T) => T extends null ? Promise<void> : Promise<{
2745 | feedbackId: string;
2746 | }>;
2747 | ```
2748 |
2749 | #### Type Parameters
2750 |
2751 | <table>
2752 | <thead>
2753 | <tr>
2754 | <th>Type Parameter</th>
2755 | </tr>
2756 | </thead>
2757 | <tbody>
2758 | <tr>
2759 | <td>
2760 |
2761 | `T` *extends* [`FeedbackPromptReply`](globals.md#feedbackpromptreply) \| `null`
2762 |
2763 | </td>
2764 | </tr>
2765 | </tbody>
2766 | </table>
2767 |
2768 | #### Parameters
2769 |
2770 | <table>
2771 | <thead>
2772 | <tr>
2773 | <th>Parameter</th>
2774 | <th>Type</th>
2775 | </tr>
2776 | </thead>
2777 | <tbody>
2778 | <tr>
2779 | <td>
2780 |
2781 | `reply`
2782 |
2783 | </td>
2784 | <td>
2785 |
2786 | `T`
2787 |
2788 | </td>
2789 | </tr>
2790 | </tbody>
2791 | </table>
2792 |
2793 | #### Returns
2794 |
2795 | `T` *extends* `null` ? [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`void`\> : [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<\{
2796 | `feedbackId`: `string`;
2797 | \}\>
2798 |
2799 | ***
2800 |
2801 | ### FeedbackTranslations
2802 |
2803 | ```ts
2804 | type FeedbackTranslations = {
2805 | DefaultQuestionLabel: string;
2806 | QuestionPlaceholder: string;
2807 | ScoreDissatisfiedLabel: string;
2808 | ScoreNeutralLabel: string;
2809 | ScoreSatisfiedLabel: string;
2810 | ScoreStatusDescription: string;
2811 | ScoreStatusLoading: string;
2812 | ScoreStatusReceived: string;
2813 | ScoreVeryDissatisfiedLabel: string;
2814 | ScoreVerySatisfiedLabel: string;
2815 | SendButton: string;
2816 | SuccessMessage: string;
2817 | };
2818 | ```
2819 |
2820 | You can use this to override text values in the feedback form
2821 | with desired language translation
2822 |
2823 | #### Type declaration
2824 |
2825 | <table>
2826 | <thead>
2827 | <tr>
2828 | <th>Name</th>
2829 | <th>Type</th>
2830 | </tr>
2831 | </thead>
2832 | <tbody>
2833 | <tr>
2834 | <td>
2835 |
2836 | <a id="defaultquestionlabel"></a> `DefaultQuestionLabel`
2837 |
2838 | </td>
2839 | <td>
2840 |
2841 | `string`
2842 |
2843 | </td>
2844 | </tr>
2845 | <tr>
2846 | <td>
2847 |
2848 | <a id="questionplaceholder"></a> `QuestionPlaceholder`
2849 |
2850 | </td>
2851 | <td>
2852 |
2853 | `string`
2854 |
2855 | </td>
2856 | </tr>
2857 | <tr>
2858 | <td>
2859 |
2860 | <a id="scoredissatisfiedlabel"></a> `ScoreDissatisfiedLabel`
2861 |
2862 | </td>
2863 | <td>
2864 |
2865 | `string`
2866 |
2867 | </td>
2868 | </tr>
2869 | <tr>
2870 | <td>
2871 |
2872 | <a id="scoreneutrallabel"></a> `ScoreNeutralLabel`
2873 |
2874 | </td>
2875 | <td>
2876 |
2877 | `string`
2878 |
2879 | </td>
2880 | </tr>
2881 | <tr>
2882 | <td>
2883 |
2884 | <a id="scoresatisfiedlabel"></a> `ScoreSatisfiedLabel`
2885 |
2886 | </td>
2887 | <td>
2888 |
2889 | `string`
2890 |
2891 | </td>
2892 | </tr>
2893 | <tr>
2894 | <td>
2895 |
2896 | <a id="scorestatusdescription"></a> `ScoreStatusDescription`
2897 |
2898 | </td>
2899 | <td>
2900 |
2901 | `string`
2902 |
2903 | </td>
2904 | </tr>
2905 | <tr>
2906 | <td>
2907 |
2908 | <a id="scorestatusloading"></a> `ScoreStatusLoading`
2909 |
2910 | </td>
2911 | <td>
2912 |
2913 | `string`
2914 |
2915 | </td>
2916 | </tr>
2917 | <tr>
2918 | <td>
2919 |
2920 | <a id="scorestatusreceived"></a> `ScoreStatusReceived`
2921 |
2922 | </td>
2923 | <td>
2924 |
2925 | `string`
2926 |
2927 | </td>
2928 | </tr>
2929 | <tr>
2930 | <td>
2931 |
2932 | <a id="scoreverydissatisfiedlabel"></a> `ScoreVeryDissatisfiedLabel`
2933 |
2934 | </td>
2935 | <td>
2936 |
2937 | `string`
2938 |
2939 | </td>
2940 | </tr>
2941 | <tr>
2942 | <td>
2943 |
2944 | <a id="scoreverysatisfiedlabel"></a> `ScoreVerySatisfiedLabel`
2945 |
2946 | </td>
2947 | <td>
2948 |
2949 | `string`
2950 |
2951 | </td>
2952 | </tr>
2953 | <tr>
2954 | <td>
2955 |
2956 | <a id="sendbutton"></a> `SendButton`
2957 |
2958 | </td>
2959 | <td>
2960 |
2961 | `string`
2962 |
2963 | </td>
2964 | </tr>
2965 | <tr>
2966 | <td>
2967 |
2968 | <a id="successmessage"></a> `SuccessMessage`
2969 |
2970 | </td>
2971 | <td>
2972 |
2973 | `string`
2974 |
2975 | </td>
2976 | </tr>
2977 | </tbody>
2978 | </table>
2979 |
2980 | ***
2981 |
2982 | ### FlagOverrides
2983 |
2984 | ```ts
2985 | type FlagOverrides = Record<string, boolean | undefined>;
2986 | ```
2987 |
2988 | ***
2989 |
2990 | ### FlagRemoteConfig
2991 |
2992 | ```ts
2993 | type FlagRemoteConfig =
2994 | | {
2995 | key: string;
2996 | payload: any;
2997 | }
2998 | | {
2999 | key: undefined;
3000 | payload: undefined;
3001 | };
3002 | ```
3003 |
3004 | A remotely managed configuration value for a flag.
3005 |
3006 | #### Type declaration
3007 |
3008 | \{
3009 | `key`: `string`;
3010 | `payload`: `any`;
3011 | \}
3012 |
3013 | <table>
3014 | <thead>
3015 | <tr>
3016 | <th>Name</th>
3017 | <th>Type</th>
3018 | <th>Description</th>
3019 | </tr>
3020 | </thead>
3021 | <tbody>
3022 | <tr>
3023 | <td>
3024 |
3025 | `key`
3026 |
3027 | </td>
3028 | <td>
3029 |
3030 | `string`
3031 |
3032 | </td>
3033 | <td>
3034 |
3035 | The key of the matched configuration value.
3036 |
3037 | </td>
3038 | </tr>
3039 | <tr>
3040 | <td>
3041 |
3042 | `payload`
3043 |
3044 | </td>
3045 | <td>
3046 |
3047 | `any`
3048 |
3049 | </td>
3050 | <td>
3051 |
3052 | The optional user-supplied payload data.
3053 |
3054 | </td>
3055 | </tr>
3056 | </tbody>
3057 | </table>
3058 |
3059 | \{
3060 | `key`: `undefined`;
3061 | `payload`: `undefined`;
3062 | \}
3063 |
3064 | <table>
3065 | <thead>
3066 | <tr>
3067 | <th>Name</th>
3068 | <th>Type</th>
3069 | </tr>
3070 | </thead>
3071 | <tbody>
3072 | <tr>
3073 | <td>
3074 |
3075 | `key`
3076 |
3077 | </td>
3078 | <td>
3079 |
3080 | `undefined`
3081 |
3082 | </td>
3083 | </tr>
3084 | <tr>
3085 | <td>
3086 |
3087 | `payload`
3088 |
3089 | </td>
3090 | <td>
3091 |
3092 | `undefined`
3093 |
3094 | </td>
3095 | </tr>
3096 | </tbody>
3097 | </table>
3098 |
3099 | ***
3100 |
3101 | ### InitOptions
3102 |
3103 | ```ts
3104 | type InitOptions = ReflagDeprecatedContext & {
3105 | apiBaseUrl: string;
3106 | appBaseUrl: string;
3107 | bootstrappedFlags: RawFlags;
3108 | credentials: "include" | "same-origin" | "omit";
3109 | enableTracking: boolean;
3110 | expireTimeMs: number;
3111 | fallbackFlags: | string[]
3112 | | Record<string, FallbackFlagOverride>;
3113 | feedback: FeedbackOptions;
3114 | logger: Logger;
3115 | offline: boolean;
3116 | publishableKey: string;
3117 | sdkVersion: string;
3118 | sseBaseUrl: string;
3119 | staleTimeMs: number;
3120 | staleWhileRevalidate: boolean;
3121 | timeoutMs: number;
3122 | toolbar: ToolbarOptions;
3123 | };
3124 | ```
3125 |
3126 | ReflagClient initialization options.
3127 |
3128 | #### Type declaration
3129 |
3130 | <table>
3131 | <thead>
3132 | <tr>
3133 | <th>Name</th>
3134 | <th>Type</th>
3135 | <th>Description</th>
3136 | </tr>
3137 | </thead>
3138 | <tbody>
3139 | <tr>
3140 | <td>
3141 |
3142 | `apiBaseUrl`?
3143 |
3144 | </td>
3145 | <td>
3146 |
3147 | `string`
3148 |
3149 | </td>
3150 | <td>
3151 |
3152 | Base URL of Reflag servers. You can override this to use your mocked server.
3153 |
3154 | </td>
3155 | </tr>
3156 | <tr>
3157 | <td>
3158 |
3159 | `appBaseUrl`?
3160 |
3161 | </td>
3162 | <td>
3163 |
3164 | `string`
3165 |
3166 | </td>
3167 | <td>
3168 |
3169 | Base URL of the Reflag web app. Links open ín this app by default.
3170 |
3171 | </td>
3172 | </tr>
3173 | <tr>
3174 | <td>
3175 |
3176 | `bootstrappedFlags`?
3177 |
3178 | </td>
3179 | <td>
3180 |
3181 | [`RawFlags`](globals.md#rawflags)
3182 |
3183 | </td>
3184 | <td>
3185 |
3186 | Pre-fetched flags to be used instead of fetching them from the server.
3187 |
3188 | </td>
3189 | </tr>
3190 | <tr>
3191 | <td>
3192 |
3193 | `credentials`?
3194 |
3195 | </td>
3196 | <td>
3197 |
3198 | `"include"` \| `"same-origin"` \| `"omit"`
3199 |
3200 | </td>
3201 | <td>
3202 |
3203 | When proxying requests, you may want to include credentials like cookies
3204 | so you can authorize the request in the proxy.
3205 | This option controls the `credentials` option of the fetch API.
3206 |
3207 | </td>
3208 | </tr>
3209 | <tr>
3210 | <td>
3211 |
3212 | `enableTracking`?
3213 |
3214 | </td>
3215 | <td>
3216 |
3217 | `boolean`
3218 |
3219 | </td>
3220 | <td>
3221 |
3222 | Whether to enable tracking. Defaults to `true`.
3223 |
3224 | </td>
3225 | </tr>
3226 | <tr>
3227 | <td>
3228 |
3229 | `expireTimeMs`?
3230 |
3231 | </td>
3232 | <td>
3233 |
3234 | `number`
3235 |
3236 | </td>
3237 | <td>
3238 |
3239 | If set, flags will be cached between page loads for this duration
3240 |
3241 | </td>
3242 | </tr>
3243 | <tr>
3244 | <td>
3245 |
3246 | `fallbackFlags`?
3247 |
3248 | </td>
3249 | <td>
3250 |
3251 | \| `string`[]
3252 | \| [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, [`FallbackFlagOverride`](globals.md#fallbackflagoverride)\>
3253 |
3254 | </td>
3255 | <td>
3256 |
3257 | Flag keys for which `isEnabled` should fallback to true
3258 | if SDK fails to fetch flags from Reflag servers. If a record
3259 | is supplied instead of array, the values of each key represent the
3260 | configuration values and `isEnabled` is assume `true`.
3261 |
3262 | </td>
3263 | </tr>
3264 | <tr>
3265 | <td>
3266 |
3267 | `feedback`?
3268 |
3269 | </td>
3270 | <td>
3271 |
3272 | [`FeedbackOptions`](globals.md#feedbackoptions)
3273 |
3274 | </td>
3275 | <td>
3276 |
3277 | AutoFeedback specific configuration
3278 |
3279 | </td>
3280 | </tr>
3281 | <tr>
3282 | <td>
3283 |
3284 | `logger`?
3285 |
3286 | </td>
3287 | <td>
3288 |
3289 | [`Logger`](globals.md#logger-1)
3290 |
3291 | </td>
3292 | <td>
3293 |
3294 | You can provide a logger to see the logs of the network calls.
3295 | This is undefined by default.
3296 | For debugging purposes you can just set the browser console to this property:
3297 | ```javascript
3298 | options.logger = window.console;
3299 | ```
3300 |
3301 | </td>
3302 | </tr>
3303 | <tr>
3304 | <td>
3305 |
3306 | `offline`?
3307 |
3308 | </td>
3309 | <td>
3310 |
3311 | `boolean`
3312 |
3313 | </td>
3314 | <td>
3315 |
3316 | Whether to enable offline mode. Defaults to `false`.
3317 |
3318 | </td>
3319 | </tr>
3320 | <tr>
3321 | <td>
3322 |
3323 | `publishableKey`
3324 |
3325 | </td>
3326 | <td>
3327 |
3328 | `string`
3329 |
3330 | </td>
3331 | <td>
3332 |
3333 | Publishable key for authentication
3334 |
3335 | </td>
3336 | </tr>
3337 | <tr>
3338 | <td>
3339 |
3340 | `sdkVersion`?
3341 |
3342 | </td>
3343 | <td>
3344 |
3345 | `string`
3346 |
3347 | </td>
3348 | <td>
3349 |
3350 | Version of the SDK
3351 |
3352 | </td>
3353 | </tr>
3354 | <tr>
3355 | <td>
3356 |
3357 | `sseBaseUrl`?
3358 |
3359 | </td>
3360 | <td>
3361 |
3362 | `string`
3363 |
3364 | </td>
3365 | <td>
3366 |
3367 | Base URL of Reflag servers for SSE connections used by AutoFeedback.
3368 |
3369 | </td>
3370 | </tr>
3371 | <tr>
3372 | <td>
3373 |
3374 | `staleTimeMs`?
3375 |
3376 | </td>
3377 | <td>
3378 |
3379 | `number`
3380 |
3381 | </td>
3382 | <td>
3383 |
3384 | Stale flags will be returned if staleWhileRevalidate is true if no new flags can be fetched
3385 |
3386 | </td>
3387 | </tr>
3388 | <tr>
3389 | <td>
3390 |
3391 | `staleWhileRevalidate`?
3392 |
3393 | </td>
3394 | <td>
3395 |
3396 | `boolean`
3397 |
3398 | </td>
3399 | <td>
3400 |
3401 | If set to true stale flags will be returned while refetching flags
3402 |
3403 | </td>
3404 | </tr>
3405 | <tr>
3406 | <td>
3407 |
3408 | `timeoutMs`?
3409 |
3410 | </td>
3411 | <td>
3412 |
3413 | `number`
3414 |
3415 | </td>
3416 | <td>
3417 |
3418 | Timeout in milliseconds when fetching flags
3419 |
3420 | </td>
3421 | </tr>
3422 | <tr>
3423 | <td>
3424 |
3425 | `toolbar`?
3426 |
3427 | </td>
3428 | <td>
3429 |
3430 | [`ToolbarOptions`](globals.md#toolbaroptions)
3431 |
3432 | </td>
3433 | <td>
3434 |
3435 | Toolbar configuration
3436 |
3437 | </td>
3438 | </tr>
3439 | </tbody>
3440 | </table>
3441 |
3442 | ***
3443 |
3444 | ### Offset
3445 |
3446 | ```ts
3447 | type Offset = {
3448 | x: string | number;
3449 | y: string | number;
3450 | };
3451 | ```
3452 |
3453 | #### Type declaration
3454 |
3455 | <table>
3456 | <thead>
3457 | <tr>
3458 | <th>Name</th>
3459 | <th>Type</th>
3460 | <th>Description</th>
3461 | </tr>
3462 | </thead>
3463 | <tbody>
3464 | <tr>
3465 | <td>
3466 |
3467 | <a id="x"></a> `x`?
3468 |
3469 | </td>
3470 | <td>
3471 |
3472 | `string` \| `number`
3473 |
3474 | </td>
3475 | <td>
3476 |
3477 | Offset from the nearest horizontal screen edge after placement is resolved
3478 |
3479 | </td>
3480 | </tr>
3481 | <tr>
3482 | <td>
3483 |
3484 | <a id="y"></a> `y`?
3485 |
3486 | </td>
3487 | <td>
3488 |
3489 | `string` \| `number`
3490 |
3491 | </td>
3492 | <td>
3493 |
3494 | Offset from the nearest vertical screen edge after placement is resolved
3495 |
3496 | </td>
3497 | </tr>
3498 | </tbody>
3499 | </table>
3500 |
3501 | ***
3502 |
3503 | ### PopoverPlacement
3504 |
3505 | ```ts
3506 | type PopoverPlacement = Placement;
3507 | ```
3508 |
3509 | ***
3510 |
3511 | ### Position
3512 |
3513 | ```ts
3514 | type Position =
3515 | | {
3516 | type: "MODAL";
3517 | }
3518 | | {
3519 | offset: Offset;
3520 | placement: DialogPlacement;
3521 | type: "DIALOG";
3522 | }
3523 | | {
3524 | anchor: | HTMLElement
3525 | | null;
3526 | placement: PopoverPlacement;
3527 | type: "POPOVER";
3528 | };
3529 | ```
3530 |
3531 | ***
3532 |
3533 | ### RawFlag
3534 |
3535 | ```ts
3536 | type RawFlag = {
3537 | config: {
3538 | key: string;
3539 | missingContextFields: string[];
3540 | payload: any;
3541 | ruleEvaluationResults: boolean[];
3542 | version: number;
3543 | };
3544 | isEnabled: boolean;
3545 | isEnabledOverride: boolean | null;
3546 | key: string;
3547 | missingContextFields: string[];
3548 | ruleEvaluationResults: boolean[];
3549 | targetingVersion: number;
3550 | };
3551 | ```
3552 |
3553 | A flag fetched from the server.
3554 |
3555 | #### Type declaration
3556 |
3557 | <table>
3558 | <thead>
3559 | <tr>
3560 | <th>Name</th>
3561 | <th>Type</th>
3562 | <th>Description</th>
3563 | </tr>
3564 | </thead>
3565 | <tbody>
3566 | <tr>
3567 | <td>
3568 |
3569 | <a id="config-2"></a> `config`?
3570 |
3571 | </td>
3572 | <td>
3573 |
3574 | \{
3575 | `key`: `string`;
3576 | `missingContextFields`: `string`[];
3577 | `payload`: `any`;
3578 | `ruleEvaluationResults`: `boolean`[];
3579 | `version`: `number`;
3580 | \}
3581 |
3582 | </td>
3583 | <td>
3584 |
3585 | Optional user-defined dynamic configuration.
3586 |
3587 | </td>
3588 | </tr>
3589 | <tr>
3590 | <td>
3591 |
3592 | `config.key`
3593 |
3594 | </td>
3595 | <td>
3596 |
3597 | `string`
3598 |
3599 | </td>
3600 | <td>
3601 |
3602 | The key of the matched configuration value.
3603 |
3604 | </td>
3605 | </tr>
3606 | <tr>
3607 | <td>
3608 |
3609 | `config.missingContextFields`?
3610 |
3611 | </td>
3612 | <td>
3613 |
3614 | `string`[]
3615 |
3616 | </td>
3617 | <td>
3618 |
3619 | The missing context fields.
3620 |
3621 | </td>
3622 | </tr>
3623 | <tr>
3624 | <td>
3625 |
3626 | `config.payload`?
3627 |
3628 | </td>
3629 | <td>
3630 |
3631 | `any`
3632 |
3633 | </td>
3634 | <td>
3635 |
3636 | The optional user-supplied payload data.
3637 |
3638 | </td>
3639 | </tr>
3640 | <tr>
3641 | <td>
3642 |
3643 | `config.ruleEvaluationResults`?
3644 |
3645 | </td>
3646 | <td>
3647 |
3648 | `boolean`[]
3649 |
3650 | </td>
3651 | <td>
3652 |
3653 | The rule evaluation results.
3654 |
3655 | </td>
3656 | </tr>
3657 | <tr>
3658 | <td>
3659 |
3660 | `config.version`?
3661 |
3662 | </td>
3663 | <td>
3664 |
3665 | `number`
3666 |
3667 | </td>
3668 | <td>
3669 |
3670 | The version of the matched configuration value.
3671 |
3672 | </td>
3673 | </tr>
3674 | <tr>
3675 | <td>
3676 |
3677 | <a id="isenabled-1"></a> `isEnabled`
3678 |
3679 | </td>
3680 | <td>
3681 |
3682 | `boolean`
3683 |
3684 | </td>
3685 | <td>
3686 |
3687 | Result of flag evaluation.
3688 | Note: does not take local overrides into account.
3689 |
3690 | </td>
3691 | </tr>
3692 | <tr>
3693 | <td>
3694 |
3695 | <a id="isenabledoverride-1"></a> `isEnabledOverride`?
3696 |
3697 | </td>
3698 | <td>
3699 |
3700 | `boolean` \| `null`
3701 |
3702 | </td>
3703 | <td>
3704 |
3705 | If not null or undefined, the result is being overridden locally
3706 |
3707 | </td>
3708 | </tr>
3709 | <tr>
3710 | <td>
3711 |
3712 | <a id="key-2"></a> `key`
3713 |
3714 | </td>
3715 | <td>
3716 |
3717 | `string`
3718 |
3719 | </td>
3720 | <td>
3721 |
3722 | Flag key.
3723 |
3724 | </td>
3725 | </tr>
3726 | <tr>
3727 | <td>
3728 |
3729 | <a id="missingcontextfields-1"></a> `missingContextFields`?
3730 |
3731 | </td>
3732 | <td>
3733 |
3734 | `string`[]
3735 |
3736 | </td>
3737 | <td>
3738 |
3739 | Missing context fields.
3740 |
3741 | </td>
3742 | </tr>
3743 | <tr>
3744 | <td>
3745 |
3746 | <a id="ruleevaluationresults-1"></a> `ruleEvaluationResults`?
3747 |
3748 | </td>
3749 | <td>
3750 |
3751 | `boolean`[]
3752 |
3753 | </td>
3754 | <td>
3755 |
3756 | Rule evaluation results.
3757 |
3758 | </td>
3759 | </tr>
3760 | <tr>
3761 | <td>
3762 |
3763 | <a id="targetingversion"></a> `targetingVersion`?
3764 |
3765 | </td>
3766 | <td>
3767 |
3768 | `number`
3769 |
3770 | </td>
3771 | <td>
3772 |
3773 | Version of targeting rules.
3774 |
3775 | </td>
3776 | </tr>
3777 | </tbody>
3778 | </table>
3779 |
3780 | ***
3781 |
3782 | ### RawFlags
3783 |
3784 | ```ts
3785 | type RawFlags = Record<string, RawFlag>;
3786 | ```
3787 |
3788 | ***
3789 |
3790 | ### RequestFeedbackData
3791 |
3792 | ```ts
3793 | type RequestFeedbackData = Omit<OpenFeedbackFormOptions, "key" | "onSubmit"> & {
3794 | companyId: string;
3795 | flagKey: string;
3796 | onAfterSubmit: (data: FeedbackSubmission) => void;
3797 | };
3798 | ```
3799 |
3800 | #### Type declaration
3801 |
3802 | <table>
3803 | <thead>
3804 | <tr>
3805 | <th>Name</th>
3806 | <th>Type</th>
3807 | <th>Description</th>
3808 | </tr>
3809 | </thead>
3810 | <tbody>
3811 | <tr>
3812 | <td>
3813 |
3814 | `companyId`?
3815 |
3816 | </td>
3817 | <td>
3818 |
3819 | `string`
3820 |
3821 | </td>
3822 | <td>
3823 |
3824 | Company ID from your own application.
3825 |
3826 | </td>
3827 | </tr>
3828 | <tr>
3829 | <td>
3830 |
3831 | `flagKey`
3832 |
3833 | </td>
3834 | <td>
3835 |
3836 | `string`
3837 |
3838 | </td>
3839 | <td>
3840 |
3841 | Flag key.
3842 |
3843 | </td>
3844 | </tr>
3845 | <tr>
3846 | <td>
3847 |
3848 | `onAfterSubmit`?
3849 |
3850 | </td>
3851 | <td>
3852 |
3853 | (`data`: [`FeedbackSubmission`](globals.md#feedbacksubmission)) => `void`
3854 |
3855 | </td>
3856 | <td>
3857 |
3858 | Allows you to handle a copy of the already submitted
3859 | feedback.
3860 |
3861 | This can be used for side effects, such as storing a
3862 | copy of the feedback in your own application or CRM.
3863 |
3864 | </td>
3865 | </tr>
3866 | </tbody>
3867 | </table>
3868 |
3869 | ***
3870 |
3871 | ### RequestFeedbackOptions
3872 |
3873 | ```ts
3874 | type RequestFeedbackOptions = RequestFeedbackData & {
3875 | userId: string;
3876 | };
3877 | ```
3878 |
3879 | #### Type declaration
3880 |
3881 | <table>
3882 | <thead>
3883 | <tr>
3884 | <th>Name</th>
3885 | <th>Type</th>
3886 | <th>Description</th>
3887 | </tr>
3888 | </thead>
3889 | <tbody>
3890 | <tr>
3891 | <td>
3892 |
3893 | `userId`
3894 |
3895 | </td>
3896 | <td>
3897 |
3898 | `string`
3899 |
3900 | </td>
3901 | <td>
3902 |
3903 | User ID from your own application.
3904 |
3905 | </td>
3906 | </tr>
3907 | </tbody>
3908 | </table>
3909 |
3910 | ***
3911 |
3912 | ### State
3913 |
3914 | ```ts
3915 | type State = "idle" | "initializing" | "initialized" | "stopped";
3916 | ```
3917 |
3918 | State of the client.
3919 |
3920 | ***
3921 |
3922 | ### ToolbarOptions
3923 |
3924 | ```ts
3925 | type ToolbarOptions =
3926 | | boolean
3927 | | {
3928 | position: ToolbarPosition;
3929 | show: boolean;
3930 | };
3931 | ```
3932 |
3933 | Toolbar options.
3934 |
3935 | ***
3936 |
3937 | ### TrackEvent
3938 |
3939 | ```ts
3940 | type TrackEvent = {
3941 | attributes: | Record<string, any>
3942 | | null;
3943 | company: CompanyContext;
3944 | eventName: string;
3945 | user: UserContext;
3946 | };
3947 | ```
3948 |
3949 | #### Type declaration
3950 |
3951 | <table>
3952 | <thead>
3953 | <tr>
3954 | <th>Name</th>
3955 | <th>Type</th>
3956 | </tr>
3957 | </thead>
3958 | <tbody>
3959 | <tr>
3960 | <td>
3961 |
3962 | <a id="attributes"></a> `attributes`?
3963 |
3964 | </td>
3965 | <td>
3966 |
3967 | \| [`Record`](https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type)\<`string`, `any`\>
3968 | \| `null`
3969 |
3970 | </td>
3971 | </tr>
3972 | <tr>
3973 | <td>
3974 |
3975 | <a id="company-3"></a> `company`?
3976 |
3977 | </td>
3978 | <td>
3979 |
3980 | [`CompanyContext`](globals.md#companycontext)
3981 |
3982 | </td>
3983 | </tr>
3984 | <tr>
3985 | <td>
3986 |
3987 | <a id="eventname"></a> `eventName`
3988 |
3989 | </td>
3990 | <td>
3991 |
3992 | `string`
3993 |
3994 | </td>
3995 | </tr>
3996 | <tr>
3997 | <td>
3998 |
3999 | <a id="user-3"></a> `user`
4000 |
4001 | </td>
4002 | <td>
4003 |
4004 | [`UserContext`](globals.md#usercontext)
4005 |
4006 | </td>
4007 | </tr>
4008 | </tbody>
4009 | </table>
4010 |
4011 | ***
4012 |
4013 | ### UnassignedFeedback
4014 |
4015 | ```ts
4016 | type UnassignedFeedback = {
4017 | comment: string;
4018 | feedbackId: string;
4019 | flagKey: string;
4020 | promptedQuestion: string;
4021 | promptId: string;
4022 | question: string;
4023 | score: number;
4024 | source: "prompt" | "sdk" | "widget";
4025 | };
4026 | ```
4027 |
4028 | #### Type declaration
4029 |
4030 | <table>
4031 | <thead>
4032 | <tr>
4033 | <th>Name</th>
4034 | <th>Type</th>
4035 | <th>Description</th>
4036 | </tr>
4037 | </thead>
4038 | <tbody>
4039 | <tr>
4040 | <td>
4041 |
4042 | <a id="comment-2"></a> `comment`?
4043 |
4044 | </td>
4045 | <td>
4046 |
4047 | `string`
4048 |
4049 | </td>
4050 | <td>
4051 |
4052 | User supplied comment about your flag.
4053 |
4054 | </td>
4055 | </tr>
4056 | <tr>
4057 | <td>
4058 |
4059 | <a id="feedbackid-3"></a> `feedbackId`?
4060 |
4061 | </td>
4062 | <td>
4063 |
4064 | `string`
4065 |
4066 | </td>
4067 | <td>
4068 |
4069 | Reflag feedback ID
4070 |
4071 | </td>
4072 | </tr>
4073 | <tr>
4074 | <td>
4075 |
4076 | <a id="flagkey"></a> `flagKey`
4077 |
4078 | </td>
4079 | <td>
4080 |
4081 | `string`
4082 |
4083 | </td>
4084 | <td>
4085 |
4086 | Flag key.
4087 |
4088 | </td>
4089 | </tr>
4090 | <tr>
4091 | <td>
4092 |
4093 | <a id="promptedquestion"></a> `promptedQuestion`?
4094 |
4095 | </td>
4096 | <td>
4097 |
4098 | `string`
4099 |
4100 | </td>
4101 | <td>
4102 |
4103 | The original question.
4104 | This only needs to be populated if the feedback was submitted through the automated feedback surveys channel.
4105 |
4106 | </td>
4107 | </tr>
4108 | <tr>
4109 | <td>
4110 |
4111 | <a id="promptid-1"></a> `promptId`?
4112 |
4113 | </td>
4114 | <td>
4115 |
4116 | `string`
4117 |
4118 | </td>
4119 | <td>
4120 |
4121 | Reflag feedback prompt ID.
4122 |
4123 | This only exists if the feedback was submitted
4124 | as part of an automated prompt from Reflag.
4125 |
4126 | Used for internal state management of automated
4127 | feedback.
4128 |
4129 | </td>
4130 | </tr>
4131 | <tr>
4132 | <td>
4133 |
4134 | <a id="question-4"></a> `question`?
4135 |
4136 | </td>
4137 | <td>
4138 |
4139 | `string`
4140 |
4141 | </td>
4142 | <td>
4143 |
4144 | The question that was presented to the user.
4145 |
4146 | </td>
4147 | </tr>
4148 | <tr>
4149 | <td>
4150 |
4151 | <a id="score-3"></a> `score`?
4152 |
4153 | </td>
4154 | <td>
4155 |
4156 | `number`
4157 |
4158 | </td>
4159 | <td>
4160 |
4161 | Customer satisfaction score.
4162 |
4163 | </td>
4164 | </tr>
4165 | <tr>
4166 | <td>
4167 |
4168 | <a id="source"></a> `source`?
4169 |
4170 | </td>
4171 | <td>
4172 |
4173 | `"prompt"` \| `"sdk"` \| `"widget"`
4174 |
4175 | </td>
4176 | <td>
4177 |
4178 | Source of the feedback, depending on how the user was asked
4179 | - `prompt` - Feedback submitted by way of an automated feedback survey (prompted)
4180 | - `widget` - Feedback submitted via `requestFeedback`
4181 | - `sdk` - Feedback submitted via `feedback`
4182 |
4183 | </td>
4184 | </tr>
4185 | </tbody>
4186 | </table>
4187 |
4188 | ## Variables
4189 |
4190 | ### DEFAULT\_TRANSLATIONS
4191 |
4192 | ```ts
4193 | const DEFAULT_TRANSLATIONS: FeedbackTranslations;
4194 | ```
4195 |
4196 | ```tsx
4197 | import { FeedbackTranslations } from "../types";
4198 | /**
4199 | * {@includeCode ./defaultTranslations.tsx}
4200 | */
4201 | export const DEFAULT_TRANSLATIONS: FeedbackTranslations = {
4202 | DefaultQuestionLabel: "How satisfied are you with this feature?",
4203 | QuestionPlaceholder: "Write a comment",
4204 | ScoreStatusDescription: "Pick a score and leave a comment",
4205 | ScoreStatusLoading: "Saving score, please wait...",
4206 | ScoreStatusReceived: "Score has been received!",
4207 | ScoreVeryDissatisfiedLabel: "Very dissatisfied (1/5)",
4208 | ScoreDissatisfiedLabel: "Dissatisfied (2/5)",
4209 | ScoreNeutralLabel: "Neutral (3/5)",
4210 | ScoreSatisfiedLabel: "Satisfied (4/5)",
4211 | ScoreVerySatisfiedLabel: "Very satisfied (5/5)",
4212 | SuccessMessage: "Feedback received, thank you!",
4213 | SendButton: "Send feedback",
4214 | };
4215 | ```
4216 |
4217 | ***
4218 |
4219 | ### feedbackContainerId
4220 |
4221 | ```ts
4222 | const feedbackContainerId: "reflag-feedback-dialog-container" = "reflag-feedback-dialog-container";
4223 | ```
4224 |
4225 | ID of HTML DIV element which contains the feedback dialog
4226 |
4227 | ***
4228 |
4229 | ### propagatedEvents
4230 |
4231 | ```ts
4232 | const propagatedEvents: string[];
4233 | ```
4234 |
4235 | These events will be propagated to the feedback dialog
4236 |
4237 | #### See
4238 |
4239 | [https://developer.mozilla.org/en-US/docs/Web/API/Element#events](https://developer.mozilla.org/en-US/docs/Web/API/Element#events)
4240 |
```