@@ -20,14 +20,13 @@ export interface FlexibleRolloutParameters {
20
20
export class FlexibleRolloutStrategy implements UnleashStrategy {
21
21
name = 'flexibleRollout'
22
22
23
- constructor ( private readonly context : UnleashContext ) { }
24
-
25
23
// eslint-disable-next-line complexity
26
24
resolveStickiness (
27
25
stickiness : UnleashStickiness | undefined ,
26
+ context : UnleashContext ,
28
27
) : string | undefined {
29
- const userId = this . context . getUserId ( )
30
- const sessionId = this . context . getSessionId ( )
28
+ const userId = context . getUserId ( )
29
+ const sessionId = context . getSessionId ( )
31
30
32
31
switch ( stickiness ) {
33
32
case UnleashStickiness . userId :
@@ -42,11 +41,14 @@ export class FlexibleRolloutStrategy implements UnleashStrategy {
42
41
}
43
42
44
43
// eslint-disable-next-line complexity
45
- isEnabled ( parameters : FlexibleRolloutParameters ) : boolean {
44
+ isEnabled (
45
+ parameters : FlexibleRolloutParameters ,
46
+ context : UnleashContext ,
47
+ ) : boolean {
46
48
const groupId = parameters . groupId
47
49
const percentage = Number ( parameters . rollout )
48
50
const stickiness = parameters . stickiness || UnleashStickiness . default
49
- const stickinessId = this . resolveStickiness ( stickiness )
51
+ const stickinessId = this . resolveStickiness ( stickiness , context )
50
52
51
53
if ( ! stickinessId ) {
52
54
return false
0 commit comments