@dvsa/cvs-feature-flags 1.1.0-canary.4 → 1.1.0-canary.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/feature-flags.js +5 -2
- package/package.json +1 -1
package/feature-flags.js
CHANGED
|
@@ -19,7 +19,9 @@ function resolveVariants(config, email) {
|
|
|
19
19
|
continue;
|
|
20
20
|
}
|
|
21
21
|
const normalisedEmail = email?.toLowerCase();
|
|
22
|
+
console.log('got emails', { emails, normalisedEmail });
|
|
22
23
|
const isTargeted = normalisedEmail && emails.map((e) => e.toLowerCase()).includes(normalisedEmail);
|
|
24
|
+
console.log('isTargeted', isTargeted);
|
|
23
25
|
resolved[key] = isTargeted ? flagValues : { ...flagValues, enabled: false };
|
|
24
26
|
}
|
|
25
27
|
console.log('Resolving Variants', { resolved });
|
|
@@ -27,15 +29,16 @@ function resolveVariants(config, email) {
|
|
|
27
29
|
}
|
|
28
30
|
class FeatureFlagsClient {
|
|
29
31
|
async get(clientName, email) {
|
|
32
|
+
const conf = email ? { ...config_1.defaultFeatureFlagConfig, maxAge: 0 } : config_1.defaultFeatureFlagConfig;
|
|
30
33
|
const config = await (0, appconfig_1.getAppConfig)(`${clientName}-profile`, {
|
|
31
|
-
...
|
|
34
|
+
...conf,
|
|
32
35
|
transform: 'json',
|
|
33
36
|
});
|
|
34
37
|
if (!email) {
|
|
35
38
|
console.log('no email returning config', { config });
|
|
36
39
|
return config;
|
|
37
40
|
}
|
|
38
|
-
console.log('Try to resolve variant', { config });
|
|
41
|
+
console.log('Try to resolve variant', { config, email });
|
|
39
42
|
return resolveVariants(config, email);
|
|
40
43
|
}
|
|
41
44
|
}
|