Skip to content

Unified JS SDK docs #582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,10 @@
"authorTitle"
],
"editor.inlineSuggest.showToolbar": "onHover",
"terminal.integrated.cwd": "website"
"terminal.integrated.cwd": "website",
"files.associations": {
"*.mdx": "mdx"
},
"mdx.experimentalLanguageServer": true,
"typescript.tsserver.experimental.enableProjectDiagnostics": true
}
10 changes: 5 additions & 5 deletions website/docs/advanced/migration-from-launchdarkly.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ Let's see now step by step how to convert this code to ConfigCat:
```

Please note that the ConfigCat client doesn't maintain a persistent connection to the remote server, but uses different
polling strategies to get the data necessary for feature flag evaluation. Refer to the [SDK reference](../../sdk-reference/node#creating-the-configcat-client)
polling strategies to get the data necessary for feature flag evaluation. Refer to the [SDK reference](../../sdk-reference/js/overview#creating-the-configcat-client)
to learn more about the options. For frontend applications and long-running backend services, Auto Polling mode is
usually a good choice.
1. Adjust the wait-for-initialization logic.
Expand All @@ -274,7 +274,7 @@ Let's see now step by step how to convert this code to ConfigCat:
the default value you pass to them.)

Actually, you only need this wait-for-initialization logic at the startup of your applications if you want to use
[synchronous feature flag evaluation via snapshots](../../sdk-reference/node#snapshots-and-synchronous-feature-flag-evaluation).
[synchronous feature flag evaluation via snapshots](../../sdk-reference/js/overview#snapshots-and-synchronous-feature-flag-evaluation).
* For other polling modes, the wait-for-initialization logic doesn't make sense, so just omit it.
1. Rewrite LaunchDarkly contexts to ConfigCat User Objects.

Expand All @@ -283,7 +283,7 @@ Let's see now step by step how to convert this code to ConfigCat:
but it's a simpler data structure.

To be able to convert a context data structure to a User Object one, you will need to do the following:
* Read [the section on User Objects](../../sdk-reference/node#user-object) in the reference of the SDK for your
* Read [the section on User Objects](../../sdk-reference/js/overview#user-object) in the reference of the SDK for your
platform.
* Read [this section](../migration-from-launchdarkly-translation#mapping-between-launchdarkly-contexts-and-configcat-user-objects)
to learn how context paths are mapped to User Object attribute names.
Expand Down Expand Up @@ -313,14 +313,14 @@ Let's see now step by step how to convert this code to ConfigCat:
* ConfigCat SDKs don't support [automatic camel casing](https://launchdarkly.com/docs/sdk/client-side/react/react-web#flag-keys-in-the-react-web-sdk)
of feature flag keys.
* In statically typed languages, ConfigCat evaluation methods require that the default value type and the feature
flag type match. (Usually, there is [a section about this](../../sdk-reference/node#setting-type-mapping) in the
flag type match. (Usually, there is [a section about this](../../sdk-reference/js/overview#setting-type-mapping) in the
SDK reference.)
* Please be extra careful when evaluating number type feature flags. ConfigCat distinguishes between integer and
decimal number feature flags. The former must be evaluated using `getValue<int>`, `getIntValue` or similar, while
the latter must be evaluated using `getValue<double>`, `getDoubleValue` or similar. (JavaScript-based SDKs don't
have this issue, but you can run into it in other languages.)
* On some platforms, the ConfigCat client provides asynchronous evaluation methods only. In such cases, synchronous
feature flag evaluation is usually still possible, [via snapshots](../../sdk-reference/node#snapshots-and-synchronous-feature-flag-evaluation).
feature flag evaluation is usually still possible, [via snapshots](../../sdk-reference/js/overview#snapshots-and-synchronous-feature-flag-evaluation).
But this works slightly differently from the asynchronous methods, so make sure you understand its behavior and
possible pitfalls.

Expand Down
50 changes: 0 additions & 50 deletions website/docs/sdk-reference/community/deno.mdx

This file was deleted.

4 changes: 3 additions & 1 deletion website/docs/sdk-reference/dotnet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ else
}
```

The _ConfigCat SDK_ also offers a synchronous API for feature flag evaluation. Read more [here](#snapshots-and-non-blocking-synchronous-feature-flag-evaluation).

### 5. Dispose the _ConfigCat_ client

You can safely dispose all clients at once or individually and release all associated resources on application exit.
Expand Down Expand Up @@ -115,7 +117,7 @@ These are the available options on the `ConfigCatClientOptions` class:
| `HttpClientHandler` | Optional, `HttpClientHandler` to provide network credentials and proxy settings. [More about the proxy settings](#using-configcat-behind-a-proxy). | built-in `HttpClientHandler` |
| `HttpTimeout` | Optional, sets the underlying HTTP client's timeout. [More about the HTTP timeout](#http-timeout). | `TimeSpan.FromSeconds(30)` |
| `FlagOverrides` | Optional, sets the local feature flag & setting overrides. [More about feature flag overrides](#flag-overrides). | |
| `DataGovernance` | Optional, defaults to `Global`. Describes the location of your feature flag and setting data within the ConfigCat CDN. This parameter needs to be in sync with your Data Governance preferences. [More about Data Governance](../advanced/data-governance.mdx). Available options: `Global`, `EuOnly` | `Global` |
| `DataGovernance` | Optional, describes the location of your feature flag and setting data within the ConfigCat CDN. This parameter needs to be in sync with your Data Governance preferences. [More about Data Governance](../advanced/data-governance.mdx). Available options: `Global`, `EuOnly` | `Global` |
| `DefaultUser` | Optional, sets the default user. [More about default user](#default-user). | `null` (none) |
| `Offline` | Optional, determines whether the client should be initialized to offline mode. [More about offline mode](#online--offline-mode). | `false` |

Expand Down
2 changes: 2 additions & 0 deletions website/docs/sdk-reference/ios.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ if isMyAwesomeFeatureEnabled {
</TabItem>
</Tabs>

The _ConfigCat SDK_ also offers a synchronous API for feature flag evaluation. Read more [here](#snapshots-and-non-blocking-synchronous-feature-flag-evaluation).

### 5. Close ConfigCat client​

You can safely shut down all clients at once or individually and release all associated resources on application exit.
Expand Down
15 changes: 13 additions & 2 deletions website/docs/sdk-reference/js-ssr.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: 'js-ssr'
title: JavaScript (SSR) SDK Reference
description: ConfigCat JavaScript (SSR) SDK Reference. This is a step-by-step guide on how to use feature flags in your Server-Side-Rendered (SSR) JavaScript application.
title: Legacy JavaScript (SSR) SDK Reference
description: ConfigCat Legacy JavaScript (SSR) SDK Reference. This is a step-by-step guide on how to use feature flags in your Server-Side-Rendered (SSR) JavaScript application.
---

export const JavaScriptSSRSchema = require('@site/src/schema-markup/sdk-reference/js-ssr.json');
Expand All @@ -16,6 +16,17 @@ export const JavaScriptSSRSchema = require('@site/src/schema-markup/sdk-referenc
[![codecov](https://codecov.io/gh/configcat/js-ssr-sdk/branch/master/graph/badge.svg)](https://codecov.io/gh/configcat/js-ssr-sdk)
[![Known Vulnerabilities](https://snyk.io/test/github/configcat/js-ssr-sdk/badge.svg?targetFile=package.json)](https://snyk.io/test/github/configcat/js-ssr-sdk?targetFile=package.json)

:::caution
This SDK is no longer maintained as it has been superseded by the new [Browser (JavaScript) SDK](../js/browser).

The new SDK maintains backward compatibility, so migration is typically as simple as:
1. uninstalling the old NPM package,
1. installing the new one,
1. adjusting the `import` statements.

For installation details, see the [relavant section](../js/browser#1-install-and-import-package) in the new SDK's documentation.
:::

:::info
This SDK is for Server-Side Rendered JavaScript frameworks like <a href="https://nuxtjs.org" target="_blank">NuxtJS</a>.
:::
Expand Down
15 changes: 11 additions & 4 deletions website/docs/sdk-reference/js.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
id: 'js'
title: JavaScript SDK Reference
description: ConfigCat JavaScript SDK Reference. This is a step-by-step guide on how to use feature flags in your JavaScript applications.
title: Legacy JavaScript SDK Reference
description: ConfigCat Legacy JavaScript SDK Reference. This is a step-by-step guide on how to use feature flags in your JavaScript applications.
---

import Tabs from '@theme/Tabs';
Expand All @@ -20,8 +20,15 @@ export const JavaScriptSchema = require('@site/src/schema-markup/sdk-reference/j
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=configcat_js-sdk&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=configcat_js-sdk)
[![JSDELIVR](https://data.jsdelivr.com/v1/package/npm/configcat-js/badge)](https://www.jsdelivr.com/package/npm/configcat-js)

:::info
For JavaScript SSR (Server-Side Rendered) applications we recommend using [ConfigCat JS-SSR SDK](./js-ssr.mdx).
:::caution
This SDK is no longer maintained as it has been superseded by the new [Browser (JavaScript) SDK](../js/browser).

The new SDK maintains backward compatibility, so migration is typically as simple as:
1. uninstalling the old NPM package,
1. installing the new one,
1. adjusting the `import` statements.

For installation details, see the [relavant section](../js/browser#1-install-and-import-package) in the new SDK's documentation.
:::

<a href="https://github.com/configcat/js-sdk" target="_blank">
Expand Down
Loading