Skip to content
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

feat: WebExperiment class #152

Draft
wants to merge 36 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
34c2cb6
update doFlags to take user object, update tag script to fetch remote…
tyiuhc Nov 5, 2024
a463740
fix applyVariants logic
tyiuhc Nov 6, 2024
348d857
create remote flag fetch test and clean up exisiting tests
tyiuhc Nov 13, 2024
936f27a
refactor unit tests code
tyiuhc Nov 13, 2024
27b71cd
add unit tests
tyiuhc Nov 13, 2024
987031e
update unit tests, update getFlags with deliveryMethod arg
tyiuhc Nov 18, 2024
f729fe4
fix lint
tyiuhc Nov 18, 2024
a93d63a
fix tests
tyiuhc Nov 18, 2024
6a91800
fix doFlags
tyiuhc Nov 18, 2024
d8a5109
fix web remote eval preview unit test
tyiuhc Nov 18, 2024
c40f7ed
remove unused util
tyiuhc Nov 19, 2024
7db6dd4
remove unused import
tyiuhc Nov 19, 2024
2285a9d
fix doFlags user creation
tyiuhc Nov 20, 2024
eea5ef4
fix web_exp_id generation for backwards compatability
tyiuhc Nov 20, 2024
a379647
nit: formatting
tyiuhc Nov 20, 2024
a2ad01e
refactor parsing initial flags, add antiflicker for remote blocking f…
tyiuhc Nov 25, 2024
bfce7c6
update getflags options, exclude x-amp-exp-user header when no user/d…
tyiuhc Nov 27, 2024
1a72974
Merge branch 'main' into web-remote-eval
tyiuhc Nov 27, 2024
ac60b53
fix: test
tyiuhc Nov 27, 2024
e8b064f
refactor and add comment for setting IDs
tyiuhc Dec 16, 2024
c8bd924
make all remote flags locally evaluable, only applyVariants present i…
tyiuhc Dec 18, 2024
b83f131
feat: modularized WebExperiment class
tyiuhc Dec 27, 2024
4ffb6fa
update tests
tyiuhc Dec 27, 2024
ba6e8b8
Add additional methods
tyiuhc Dec 30, 2024
718f02a
Refactor and add additional methods
tyiuhc Dec 30, 2024
73cd67f
Additional tests and config
tyiuhc Jan 2, 2025
99ad580
update tests
tyiuhc Jan 2, 2025
4cdabc7
update with index
tyiuhc Jan 2, 2025
b46f8bd
add server zone config
tyiuhc Jan 3, 2025
6e8e25b
merge main
tyiuhc Jan 6, 2025
3fcf8c7
add types, clean up functions, fix lint
tyiuhc Jan 7, 2025
ee29ce9
fix convertuserToContext util
tyiuhc Jan 7, 2025
46cb1ce
remove test
tyiuhc Jan 7, 2025
d6415e4
refactor initial flag parsing
tyiuhc Jan 7, 2025
af995a8
merge main
tyiuhc Jan 17, 2025
fabea17
fix lint
tyiuhc Jan 17, 2025
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: 5 additions & 2 deletions packages/experiment-browser/src/util/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ export const convertUserToContext = (
const context: Record<string, unknown> = { user: user };
// add page context
const globalScope = getGlobalScope();
if (globalScope) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const currentUrl = user.currentUrl || globalScope?.location.href;
if (currentUrl) {
context.page = {
url: globalScope.location.href,
url: currentUrl,
};
}
const groups: Record<string, Record<string, unknown>> = {};
Expand Down
17 changes: 17 additions & 0 deletions packages/experiment-tag/src/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { ExperimentConfig } from '@amplitude/experiment-js-client';

export interface WebExperimentConfig extends ExperimentConfig {
/**
* Determines whether variants actions should be reverted and reapplied on navigation events.
*/
reapplyVariantsOnNavigation?: boolean;
/**
* Determines whether anti-flicker CSS should be applied for remote blocking flags.
*/
applyAntiFlickerForRemoteBlocking?: boolean;
}

export const Defaults: WebExperimentConfig = {
reapplyVariantsOnNavigation: true,
applyAntiFlickerForRemoteBlocking: true,
};
Loading
Loading