You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge branch 'buc-3227-dogfooding-dont-require-satisfaction-score-when-asking-for' of https://github.com/bucketco/bucket-javascript-sdk into buc-3227-dogfooding-dont-require-satisfaction-score-when-asking-for
Copy file name to clipboardExpand all lines: packages/node-sdk/README.md
+27-30Lines changed: 27 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,22 +54,6 @@ Other supported languages/frameworks are in the [Supported languages](https://do
54
54
55
55
You can also [use the HTTP API directly](https://docs.reflag.com/api/http-api)
56
56
57
-
## Migrating from Bucket SDK
58
-
59
-
If you have been using the Bucket SDKs, the following list will help you migrate to Reflag SDK:
60
-
61
-
-`Bucket*` classes, and types have been renamed to `Reflag*` (e.g. `BucketClient` is now `ReflagClient`)
62
-
-`Feature*` classes, and types have been renamed to `Feature*` (e.g. `Feature` is now `Flag`, `RawFeatures` is now `RawFlags`)
63
-
- When using strongly-typed flags, the new `Flags` interface replaced `Features` interface
64
-
- All methods that contained `feature` in the name have been renamed to use the `flag` terminology (e.g. `getFeature` is `getFlag`)
65
-
- All environment variables that were prefixed with `BUCKET_` are now prefixed with `REFLAG_`
66
-
- The `BUCKET_HOST` environment variable and `host` option have been removed from `ReflagClient` constructor, use `REFLAG_API_BASE_URL` instead
67
-
- The `BUCKET_FEATURES_ENABLED` and `BUCKET_FEATURES_DISABLED` have been renamed to `REFLAG_FLAGS_ENABLED` and `REFLAG_FLAGS_DISABLED`
68
-
- The default configuration file has been renamed from `bucketConfig.json` to `reflag.config.json`
69
-
- The `fallbackFeatures` property in client constructor and configuration files has been renamed to `fallbackFlags`
70
-
-`featureKey` has been renamed to `flagKey` in all methods that accepts that argument
71
-
- The SDKs will not emit `evaluate` and `evaluate-config` events anymore
72
-
73
57
## Basic usage
74
58
75
59
To get started you need to obtain your secret key from the [environment settings](https://app.reflag.com/env-current/settings/app-environments)
@@ -98,9 +82,9 @@ export const reflagClient = new ReflagClient();
98
82
// Initialize the client and begin fetching flag targeting definitions.
99
83
// You must call this method prior to any calls to `getFlags()`,
100
84
// otherwise an empty object will be returned.
101
-
reflagClient.initialize().then({
102
-
console.log("Reflag initialized!")
103
-
})
85
+
reflagClient.initialize().then(() =>{
86
+
console.log("Reflag initialized!");
87
+
});
104
88
```
105
89
106
90
Once the client is initialized, you can obtain flags along with the `isEnabled`
@@ -255,7 +239,7 @@ export default {
255
239
};
256
240
```
257
241
258
-
See [examples/cloudflare-worker](examples/cloudflare-worker/src/index.ts) for a deployable example.
242
+
See [examples/cloudflare-worker](https://github.com/reflagcom/javascript/tree/main/packages/node-sdk/examples/cloudflare-worker/src/index.ts) for a deployable example.
259
243
260
244
Reflag maintains a cached set of flag definitions in the memory of your worker which it uses to decide which flags to turn on for which users/companies.
261
245
@@ -277,14 +261,11 @@ fallback behavior:
277
261
278
262
```typescript
279
263
// Network errors during tracking are logged but don't affect your application
{/* children here are shown when loading finishes */}
217
+
{/* children here are shown when loading finishes */}
244
218
</LoadingReflag>
245
-
<ReflagProvider>
219
+
</ReflagProvider>;
246
220
```
247
221
248
222
- `enableTracking`: Set to `false` to stop sending tracking events and user/company updates to Reflag. Useful when you're impersonating a user (defaults to `true`),
@@ -306,13 +280,13 @@ function StartHuddleButton() {
306
280
307
281
### `useTrack()`
308
282
309
-
`useTrack()` lets you send custom events to Reflag. Use this whenever a user _uses_ a feature. Create [features](https://docs.reflag.com/introduction/concepts/feature) in Reflag based off of these events to analyze feature usage.
310
-
Returns a function to send custom events to Reflag. Use this whenever a user _uses_ a feature. These events can be used to analyze feature usage and create new flags in Reflag.
283
+
`useTrack()` lets you send custom events to Reflag. Use this whenever a user _uses_ a feature. These events can be used to analyze feature usage in Reflag.
Returns a function that lets you open up a dialog to ask for feedback on a specific feature. This is useful for collecting targeted feedback about specific features.
327
-
328
-
`useRequestFeedback()` returns a function that lets you open up a dialog to ask for feedback on a specific feature.
329
-
See [Automated Feedback Surveys](https://docs.reflag.com/product-handbook/live-satisfaction) for how to do this automatically, without code.
300
+
`useRequestFeedback()` returns a function that lets you open up a dialog to ask for feedback on a specific feature. This is useful for collecting targeted feedback about specific features as part of roll out. See [Automated Feedback Surveys](https://docs.reflag.com/product-handbook/live-satisfaction) for how to do this automatically, without code.
330
301
331
302
When using the `useRequestFeedback` you must pass the flag key to `requestFeedback`.
332
303
The example below shows how to use `position` to ensure the popover appears next to the "Give feedback!" button.
@@ -454,6 +425,32 @@ function LoggingWrapper({ children }: { children: ReactNode }) {
454
425
}
455
426
```
456
427
428
+
## Migrating from Bucket SDK
429
+
430
+
If you have been using the Bucket SDKs, the following list will help you migrate to Reflag SDK:
431
+
432
+
- `Bucket*` classes, and types have been renamed to `Reflag*` (e.g. `BucketClient` is now `ReflagClient`)
433
+
- `Feature*` classes, and types have been renamed to `Flag*` (e.g. `Feature` is now `Flag`, `RawFeatures` is now `RawFlags`)
434
+
- When using strongly-typed flags, the new `Flags` interface replaced `Features` interface
435
+
- All methods that contained `feature` in the name have been renamed to use the `flag` terminology (e.g. `getFeature` is `getFlag`)
436
+
- The `fallbackFeatures` property in client constructor and configuration files has been renamed to `fallbackFlags`
437
+
- `featureKey` has been renamed to `flagKey` in all methods that accepts that argument
438
+
- The SDKs will not emit `evaluate` and `evaluate-config` events anymore
439
+
- The new cookies that are stored in the client's browser are now `reflag-*` prefixed instead of `bucket-*`
440
+
- The `featuresUpdated` hook has been renamed to `flagsUpdated`
441
+
- The `checkIsEnabled` and `checkConfig` hooks have been removed, use `check` from now on
442
+
443
+
To ease in transition to Reflag SDK, some of the old methods have been preserved as aliases to the new methods:
444
+
445
+
- `getFeature` method is an alias for `getFlag`
446
+
- `getFeatures` method is an alias for `getFlags`
447
+
- `useFeature` method is an alias for `useFlag`
448
+
- `featuresUpdated` hook is an alias for `flagsUpdated`
449
+
450
+
If you are running with strict Content Security Policies active on your website, you will need change them as follows:
451
+
452
+
- `connect-srchttps://front.bucket.co` to `connect-src https://front.reflag.com`
453
+
457
454
## ContentSecurityPolicy (CSP)
458
455
459
456
See [CSP](https://github.com/reflagcom/javascript/blob/main/packages/browser-sdk/README.md#content-security-policy-csp) for info on using Reflag React SDK with CSP
0 commit comments