Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
4e1a485
feat: client-side local evaluation
bgiori Jul 13, 2023
44146e2
typescript strict mode
bgiori Jul 14, 2023
d4c7f3d
fix lint
bgiori Jul 14, 2023
3d0fdfc
remove logging from evaluation
bgiori Jul 14, 2023
0e6d161
fix typescript, lint, use prod for integration tests
bgiori Jul 15, 2023
dcda5d7
fix cohort targeting, update tests
bgiori Jul 20, 2023
99f7336
WIP
bgiori Jul 27, 2023
cf42316
working
bgiori Jul 27, 2023
9f4d4cf
fix: tests; poller; cache
bgiori Jul 31, 2023
e5c25eb
fix: evaluate before tracking explicit exposure
bgiori Aug 4, 2023
d4d024d
add serverZone and flags configurations
bgiori Aug 7, 2023
2462118
quick fix
bgiori Aug 7, 2023
b40bf0c
fix: server zone and tests
bgiori Aug 7, 2023
51519a7
use different flag domain
bgiori Aug 8, 2023
c813c36
fix: variant access order logic
bgiori Aug 9, 2023
722f14e
fix set contains operators
bgiori Aug 14, 2023
17f8d12
remove test case
bgiori Aug 14, 2023
d2206c7
v2 variant
bgiori Aug 17, 2023
1cc7243
reversion dependencies
bgiori Aug 18, 2023
e8507e8
make core public
bgiori Aug 18, 2023
b546c2f
fix tests
bgiori Aug 18, 2023
c0ec5ce
range precision updates for local evaluation
bgiori Aug 18, 2023
4382825
release experiment-core 0.2.0
bgiori Aug 18, 2023
4b5f066
release: evaluation-core 0.3.0
bgiori Aug 21, 2023
24c4b55
release: experiment-js-client 1.9.0-beta.2
bgiori Aug 21, 2023
744031f
dont add 1 to distribution end range
bgiori Aug 22, 2023
8f3d152
release: experiment-core 0.4.0
bgiori Aug 22, 2023
3631ef5
release: experiment-core 0.5.0
bgiori Aug 22, 2023
3e4267a
release: experiment-js-client 1.9.0-beta.3
bgiori Aug 22, 2023
20182bf
fix exposure tracking and default variant handling
bgiori Aug 25, 2023
af80d70
update defaultVariant to variant in flag model
bgiori Aug 25, 2023
40b4954
udpate evaluation code to build
bgiori Aug 25, 2023
8fed138
remove max hash values
bgiori Aug 25, 2023
b781af1
minor comment changes
bgiori Aug 25, 2023
49d0782
release: evaluation-core 0.6.0
bgiori Aug 25, 2023
19f2ab7
release: evaluation-js-client 1.9.0-beta.4
bgiori Aug 25, 2023
85e7011
fix integration tests
bgiori Aug 25, 2023
d0a941c
added more variant fallback logic tests passing
bgiori Aug 26, 2023
b1e1255
release: experiment-js-client 1.9.0-beta.5
bgiori Aug 26, 2023
8142a9e
add startAndFetch
bgiori Aug 26, 2023
59b89a1
implement dynamic start fetching and add tests
bgiori Aug 26, 2023
91671ed
Merge branch 'main' into local-evaluation
bgiori Aug 26, 2023
e80ca8d
add tests for all function
bgiori Aug 28, 2023
e5e3720
fix lint
bgiori Aug 28, 2023
565b844
fix lint again
bgiori Aug 28, 2023
97cc3a0
use safeglobal with local storage
bgiori Aug 28, 2023
a8d304f
add timeout to test
bgiori Aug 28, 2023
bcc76f1
mock local storage
bgiori Aug 28, 2023
50a9b88
reset package vers
bgiori Aug 29, 2023
3b79485
add more mocks
bgiori Aug 29, 2023
6885c7b
fix lint, optimize tests
bgiori Aug 29, 2023
7c70256
move mocks to before each
bgiori Aug 29, 2023
b2c22c1
try returning from storage
bgiori Aug 29, 2023
3d186bc
fix tests
bgiori Aug 29, 2023
0d70534
fix tests again
bgiori Aug 29, 2023
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
2 changes: 1 addition & 1 deletion examples/react-app/amplitude-integration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@amplitude/analytics-browser": "^1.5.4",
"@amplitude/analytics-browser": "^1.12.1",
"@amplitude/experiment-js-client": "^1.5.6",
"@types/node": "^16.11.29",
"@types/react": "^18.0.7",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"eslint-plugin-jest": "^27.2.1",
"eslint-plugin-prettier": "^3.1.4",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"jest-environment-jsdom": "^29.6.4",
"lerna": "^6.6.1",
"node-fetch": "^2.6.0",
"prettier": "^2.0.5",
Expand Down
1 change: 1 addition & 0 deletions packages/experiment-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
},
"dependencies": {
"@amplitude/analytics-connector": "^1.5.0",
"@amplitude/experiment-core": "^0.6.0",
"@amplitude/ua-parser-js": "^0.7.31",
"base64-js": "1.5.1",
"unfetch": "4.1.0"
Expand Down
12 changes: 10 additions & 2 deletions packages/experiment-browser/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ const configs = [
entryFileNames: 'experiment.esm.js',
format: 'esm',
}),
external: ['@amplitude/ua-parser-js', '@amplitude/analytics-connector'],
external: [
'@amplitude/ua-parser-js',
'@amplitude/analytics-connector',
'@amplitude/experiment-core',
],
},

// modern build for field "es2015" - not ie, esm, es2015 syntax
Expand All @@ -81,7 +85,11 @@ const configs = [
entryFileNames: 'experiment.es2015.js',
format: 'esm',
}),
external: ['@amplitude/ua-parser-js', '@amplitude/analytics-connector'],
external: [
'@amplitude/ua-parser-js',
'@amplitude/analytics-connector',
'@amplitude/experiment-core',
],
},
];

Expand Down
37 changes: 36 additions & 1 deletion packages/experiment-browser/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,22 @@ export interface ExperimentConfig {
source?: Source;

/**
* The server endpoint from which to request variants.
* The domain from which to request variants using remote evaluation.
*/
serverUrl?: string;

/**
* The domain to request flag configurations used in local evaluation from.
*/
flagsServerUrl?: string;

/**
* The amplitude data center to fetch flags and variants from. If set,
* automatically sets the {@link serverUrl} and {@link flagsServerUrl}
* configurations.
*/
serverZone?: string;

/**
* The request timeout, in milliseconds, when fetching variants.
*/
Expand All @@ -65,6 +77,21 @@ export interface ExperimentConfig {
*/
automaticExposureTracking?: boolean;

/**
* Enable or disable local evaluation flag configuration polling on `start()`.
*/
pollOnStart?: boolean;

/**
* Explicitly enable or disable calling {@link fetch()} on {@link start()}:
*
* - `true`: fetch will always be called on start.
* - `false`: fetch will never be called on start.
* - `undefined`: the SDK will determine whether to call fetch based on the
* flags returned in the result.
*/
fetchOnStart?: boolean;

/**
* This config only matters if you are using the amplitude analytics SDK
* integration initialized by calling
Expand Down Expand Up @@ -120,9 +147,13 @@ export interface ExperimentConfig {
| **initialVariants** | `null` |
| **source** | `Source.LocalStorage` |
| **serverUrl** | `"https://api.lab.amplitude.com"` |
| **flagsServerUrl** | `"https://flag.lab.amplitude.com"` |
| **serverZone** | `"US"` |
| **assignmentTimeoutMillis** | `10000` |
| **retryFailedAssignment** | `true` |
| **automaticExposureTracking** | `true` |
| **pollOnStart** | `true` |
| **fetchOnStart** | `undefined` |
| **automaticFetchOnAmplitudeIdentityChange** | `false` |
| **userProvider** | `null` |
| **analyticsProvider** | `null` |
Expand All @@ -138,9 +169,13 @@ export const Defaults: ExperimentConfig = {
initialVariants: {},
source: Source.LocalStorage,
serverUrl: 'https://api.lab.amplitude.com',
flagsServerUrl: 'https://flag.lab.amplitude.com',
serverZone: 'US',
fetchTimeoutMillis: 10000,
retryFetchOnFailure: true,
automaticExposureTracking: true,
pollOnStart: true,
fetchOnStart: undefined,
automaticFetchOnAmplitudeIdentityChange: false,
userProvider: null,
analyticsProvider: null,
Expand Down
Loading