Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: '@launchdarkly/browser Bug Report'
about: Create a report to help us improve
title: ''
labels: 'package: sdk/combined-browser, bug'
assignees: ''
---

**Is this a support request?**
This issue tracker is maintained by LaunchDarkly SDK developers and is intended for feedback on the code in this library. If you're not sure whether the problem you are having is specifically related to this library, or to the LaunchDarkly service overall, it may be more appropriate to contact the LaunchDarkly support team; they can help to investigate the problem and will consult the SDK team if necessary. You can submit a support request by going [here](https://support.launchdarkly.com/) and clicking "submit a request", or by emailing [email protected].

Note that issues filed on this issue tracker are publicly accessible. Do not provide any private account information on your issues. If your problem is specific to your account, you should submit a support request as described above.

**Describe the bug**
A clear and concise description of what the bug is.

**To reproduce**
Steps to reproduce the behavior.

**Expected behavior**
A clear and concise description of what you expected to happen.

**Logs**
If applicable, add any log output related to your problem.

**SDK version**
The version of this SDK that you are using.

**Language version, developer tools**
For instance, Go 1.11 or Ruby 2.5.3. If you are using a language that requires a separate compiler, such as C, please include the name and version of the compiler too.

**OS/platform**
For instance, Ubuntu 16.04, Windows 10, or Android 4.0.3. If your code is running in a browser, please also include the browser type and version.

**Additional context**
Add any other context about the problem here.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: '@launchdarkly/browser Feature Request'
about: Create a report to help us improve
title: ''
labels: 'package: sdk/combined-browser, feature'
assignees: ''
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I would love to see the SDK [...does something new...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context about the feature request here.
44 changes: 44 additions & 0 deletions .github/workflows/combined-browser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: sdk/combined-browser

on:
push:
branches: [main, 'feat/**']
paths-ignore:
- '**.md' #Do not need to run CI for markdown changes.
pull_request:
branches: [main, 'feat/**']
paths-ignore:
- '**.md'

jobs:
build-test-browser:
permissions:
pull-requests: write
runs-on: ubuntu-latest

strategy:
matrix:
# Node versions to run on.
version: [18, 21]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.version }}
registry-url: 'https://registry.npmjs.org'
- id: shared
name: Shared CI Steps
uses: ./actions/ci
with:
workspace_name: '@launchdarkly/browser'
workspace_path: packages/sdk/combined-browser
- name: Check package size
if: github.event_name == 'pull_request' && matrix.version == '21'
uses: ./actions/package-size
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
target_file: 'packages/sdk/combined-browser/dist/index.js'
package_name: '@launchdarkly/browser'
pr_number: ${{ github.event.number }}
size_limit: 200000
1 change: 1 addition & 0 deletions .github/workflows/manual-publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ on:
- packages/sdk/browser
- packages/sdk/server-ai
- packages/telemetry/browser-telemetry
- packages/sdk/combined-browser
name: Publish Documentation
jobs:
build-publish:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/manual-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ on:
- packages/sdk/browser
- packages/sdk/server-ai
- packages/telemetry/browser-telemetry
- packages/sdk/combined-browser
prerelease:
description: 'Is this a prerelease. If so, then the latest tag will not be updated in npm.'
type: boolean
Expand Down
23 changes: 22 additions & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
package-browser-released: ${{ steps.release.outputs['packages/sdk/browser--release_created'] }}
package-server-ai-released: ${{ steps.release.outputs['packages/sdk/server-ai--release_created'] }}
package-browser-telemetry-released: ${{ steps.release.outputs['packages/telemetry/browser-telemetry--release_created'] }}
package-combined-browser-released: ${{ steps.release.outputs['packages/sdk/combined-browser--release_created'] }}
steps:
- uses: googleapis/release-please-action@v4
id: release
Expand Down Expand Up @@ -207,7 +208,7 @@ jobs:
with:
node-version: 22.x
registry-url: 'https://registry.npmjs.org'
- id: release-react-native
- id: release-browser
name: Full release of packages/sdk/browser
uses: ./actions/full-release
with:
Expand Down Expand Up @@ -439,3 +440,23 @@ jobs:
with:
workspace_path: packages/telemetry/browser-telemetry
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}

release-combined-browser:
runs-on: ubuntu-latest
needs: ['release-please', 'release-browser']
permissions:
id-token: write
contents: write
if: ${{ always() && !failure() && !cancelled() && needs.release-please.outputs.package-combined-browser-released == 'true'}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22.x
registry-url: 'https://registry.npmjs.org'
- id: release-combined-browser
name: Full release of packages/sdk/combined-browser
uses: ./actions/full-release
with:
workspace_path: packages/sdk/combined-browser
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
3 changes: 2 additions & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
"packages/sdk/browser": "0.7.0",
"packages/sdk/server-ai": "0.9.8",
"packages/telemetry/browser-telemetry": "1.0.8",
"packages/tooling/jest": "0.1.7"
"packages/tooling/jest": "0.1.7",
"packages/sdk/combined-browser": "0.0.0"
}
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ This includes shared libraries, used by SDKs and other tools, as well as SDKs.
| [@launchdarkly/react-native-client-sdk](packages/sdk/react-native/README.md) | [![NPM][sdk-react-native-npm-badge]][sdk-react-native-npm-link] | [React-Native][package-sdk-react-native-issues] | [![Actions Status][sdk-react-native-ci-badge]][sdk-react-native-ci] |
| [@launchdarkly/js-client-sdk](packages/sdk/browser/README.md) | [![NPM][sdk-browser-npm-badge]][sdk-browser-npm-link] | [Browser][package-sdk-browser-issues] | [![Actions Status][sdk-browser-ci-badge]][sdk-browser-ci] |
| [@launchdarkly/server-sdk-ai](packages/sdk/server-ai/README.md) | [![NPM][sdk-server-ai-npm-badge]][sdk-server-ai-npm-link] | [server-ai][package-sdk-server-ai-issues] | [![Actions Status][sdk-server-ai-ci-badge]][sdk-server-ai-ci] |
<!--| [@launchdarkly/browser](packages/sdk/combined-browser/README.md) | [![NPM][sdk-combined-browser-npm-badge]][sdk-browser-npm-link] | [Combined Browser][package-sdk-combined-browser-issues] | [![Actions Status][sdk-combined-browser-ci-badge]][sdk-combined-browser-ci] |-->
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be un-commented once packages are published.


| Shared packages | npm | issues | tests |
| ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------- |
Expand Down Expand Up @@ -209,3 +210,13 @@ We encourage pull requests and other contributions from the community. Check out
[browser-telemetry-npm-badge]: https://img.shields.io/npm/v/@launchdarkly/browser-telemetry.svg?style=flat-square
[browser-telemetry-npm-link]: https://www.npmjs.com/package/@launchdarkly/browser-telemetry
[browser-telemetry-issues]: https://github.com/launchdarkly/js-core/issues?q=is%3Aissue+is%3Aopen+label%3A%22package%3A+telemetry%2Fbrowser-telemetry%22+
[//]: # 'sdk/combined-browser'
[sdk-browser-ci-badge]: https://github.com/launchdarkly/js-core/actions/workflows/combined-browser.yml/badge.svg
[sdk-browser-ci]: https://github.com/launchdarkly/js-core/actions/workflows/combined-browser.yml
[sdk-browser-npm-badge]: https://img.shields.io/npm/v/@launchdarkly/browser.svg?style=flat-square
[sdk-browser-npm-link]: https://www.npmjs.com/package/@launchdarkly/browser
[sdk-browser-ghp-badge]: https://img.shields.io/static/v1?label=GitHub+Pages&message=API+reference&color=00add8
[sdk-browser-ghp-link]: https://launchdarkly.github.io/js-core/packages/sdk/combined-browser/docs/
[sdk-browser-dm-badge]: https://img.shields.io/npm/dm/@launchdarkly/browser.svg?style=flat-square
[sdk-browser-dt-badge]: https://img.shields.io/npm/dt/@launchdarkly/browser.svg?style=flat-square
[package-sdk-browser-issues]: https://github.com/launchdarkly/js-core/issues?q=is%3Aissue+is%3Aopen+label%3A%22package%3A+sdk%2Fcombined-browser%22+
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"packages/sdk/server-ai/examples/bedrock",
"packages/sdk/server-ai/examples/openai",
"packages/telemetry/browser-telemetry",
"contract-tests"
"contract-tests",
"packages/sdk/combined-browser"
],
"private": true,
"scripts": {
Expand Down
Empty file.
13 changes: 13 additions & 0 deletions packages/sdk/combined-browser/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2025 Catamorphic, Co.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
61 changes: 61 additions & 0 deletions packages/sdk/combined-browser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# LaunchDarkly JavaScript SDK for Browsers with included Observability.

[![NPM][combined-browser-sdk-npm-badge]][combined-browser-sdk-npm-link]
[![Actions Status][combined-browser-sdk-ci-badge]][combined-browser-sdk-ci]
[![Documentation][combined-browser-sdk-ghp-badge]][combined-browser-sdk-ghp-link]
[![NPM][combined-browser-sdk-dm-badge]][combined-browser-sdk-npm-link]
[![NPM][combined-browser-sdk-dt-badge]][combined-browser-sdk-npm-link]

# ⛔️⛔️⛔️⛔️

> [!CAUTION]
> This library is a alpha version and should not be considered ready for production use while this message is visible.
# ☝️☝️☝️☝️☝️☝️

<!--
## Install
```shell
# npm
npm i @launchdarkly/browser
# yarn
yarn add -D @launchdarkly/browser
```
-->

## Getting started

Refer to the [SDK documentation](https://docs.launchdarkly.com/sdk/client-side/javascript#getting-started) for instructions on getting started with using the SDK.

Note: _If you are using JavaScript in a non-combined-browser environment, please check our other SDK packages in [js-core](https://github.com/launchdarkly/js-core)_
Please note that the JavaScript SDK has two special requirements in terms of your LaunchDarkly environment. First, in terms of the credentials for your environment that appear on your [Account Settings](https://app.launchdarkly.com/settings/projects) dashboard, the JavaScript SDK uses the "Client-side ID"-- not the "SDK key" or the "Mobile key". Second, for any feature flag that you will be using in JavaScript code, you must check the "Make this flag available to client-side SDKs" box on that flag's Settings page.

## Verifying SDK build provenance with the SLSA framework

LaunchDarkly uses the [SLSA framework](https://slsa.dev/spec/v1.0/about) (Supply-chain Levels for Software Artifacts) to help developers make their supply chain more secure by ensuring the authenticity and build integrity of our published SDK packages. To learn more, see the [provenance guide](PROVENANCE.md).

## About LaunchDarkly

- LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
- Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
- Gradually roll out a feature to an increasing percentage of users, and track the effect that the feature has on key metrics (for instance, how likely is a user to complete a purchase if they have feature A versus feature B?).
- Turn off a feature that you realize is causing performance problems in production, without needing to re-deploy, or even restart the application with a changed configuration file.
- Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan).
- Disable parts of your application to facilitate maintenance, without taking everything offline.
- LaunchDarkly provides feature flag SDKs for a wide variety of languages and technologies. Read [our documentation](https://docs.launchdarkly.com/sdk) for a complete list.
- Explore LaunchDarkly
- [launchdarkly.com](https://www.launchdarkly.com/ 'LaunchDarkly Main Website') for more information
- [docs.launchdarkly.com](https://docs.launchdarkly.com/ 'LaunchDarkly Documentation') for our documentation and SDK reference guides
- [apidocs.launchdarkly.com](https://apidocs.launchdarkly.com/ 'LaunchDarkly API Documentation') for our API documentation
- [blog.launchdarkly.com](https://blog.launchdarkly.com/ 'LaunchDarkly Blog Documentation') for the latest product updates

[combined-browser-sdk-ci-badge]: https://github.com/launchdarkly/js-core/actions/workflows/combined-browser.yml/badge.svg
[combined-browser-sdk-ci]: https://github.com/launchdarkly/js-core/actions/workflows/combined-browser.yml
[combined-browser-sdk-npm-badge]: https://img.shields.io/npm/v/@launchdarkly/browser.svg?style=flat-square
[combined-browser-sdk-npm-link]: https://www.npmjs.com/package/@launchdarkly/browser
[combined-browser-sdk-ghp-badge]: https://img.shields.io/static/v1?label=GitHub+Pages&message=API+reference&color=00add8
[combined-browser-sdk-ghp-link]: https://launchdarkly.github.io/js-core/packages/sdk/combined-browser/docs/
[combined-browser-sdk-dm-badge]: https://img.shields.io/npm/dm/@launchdarkly/browser.svg?style=flat-square
[combined-browser-sdk-dt-badge]: https://img.shields.io/npm/dt/@launchdarkly/browser.svg?style=flat-square
4 changes: 4 additions & 0 deletions packages/sdk/combined-browser/__tests__/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Placeholder test to ensure the test suite is working`
it('runs tests', () => {
expect(true).toBe(true);
});
16 changes: 16 additions & 0 deletions packages/sdk/combined-browser/jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"verbose": true,
"testEnvironment": "jest-environment-jsdom",
"testPathIgnorePatterns": ["./dist", "./src"],
"testMatch": ["**.test.ts"],
"setupFiles": ["./setup-jest.js"],
"transform": {
"^.+\\.ts$": [
"ts-jest",
{
"tsConfig": "tsconfig.test.json"
}
],
"^.+.tsx?$": ["ts-jest", {}]
}
}
74 changes: 74 additions & 0 deletions packages/sdk/combined-browser/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"name": "@launchdarkly/browser",
"version": "0.0.0",
"description": "LaunchDarkly SDK for JavaScript in Browsers with Observability",
"homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/sdk/combined-browser",
"repository": {
"type": "git",
"url": "https://github.com/launchdarkly/js-core.git"
},
"license": "Apache-2.0",
"packageManager": "[email protected]",
"keywords": [
"launchdarkly",
"feature flags",
"feature toggles",
"feature management",
"sdk"
],
"type": "module",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"require": {
"types": "./dist/index.d.cts",
"require": "./dist/index.cjs"
},
"import": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
}
},
"files": [
"dist"
],
"scripts": {
"clean": "rimraf dist",
"build": "tsup",
"lint": "eslint . --ext .ts,.tsx",
"prettier": "prettier --write '**/*.@(js|ts|tsx|json|css)' --ignore-path ../../../.prettierignore",
"test": "npx jest --runInBand",
"coverage": "yarn test --coverage",
"check": "yarn prettier && yarn lint && yarn build && yarn test"
},
"dependencies": {
"@launchdarkly/js-client-sdk": "0.7.0",
"@launchdarkly/observability": "0.1.13",
"@launchdarkly/session-replay": "0.1.13"
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
"@types/jest": "^29.5.11",
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
"eslint": "^8.45.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.6.3",
"eslint-plugin-prettier": "^5.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "29.7.0",
"prettier": "^3.0.0",
"rimraf": "^5.0.5",
"ts-jest": "^29.1.1",
"tsup": "^8.3.5",
"typedoc": "0.25.0",
"typescript": "^5.5.3"
}
}
24 changes: 24 additions & 0 deletions packages/sdk/combined-browser/setup-jest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const { TextEncoder, TextDecoder } = require('node:util');
const crypto = require('node:crypto');

global.TextEncoder = TextEncoder;

Object.assign(window, { TextDecoder, TextEncoder });

// Based on:
// https://stackoverflow.com/a/71750830

Object.defineProperty(global.self, 'crypto', {
value: {
getRandomValues: (arr) => crypto.randomBytes(arr.length),
subtle: {
digest: (algorithm, data) => {
return new Promise((resolve) =>
resolve(
crypto.createHash(algorithm.toLowerCase().replace('-', '')).update(data).digest(),
),
);
},
},
},
});
Loading