@atlaskit/tmp-editor-statsig 5.11.0 → 5.12.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @atlaskit/editor-statsig-tmp
2
2
 
3
+ ## 5.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#165835](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/165835)
8
+ [`b7143f7822214`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b7143f7822214) -
9
+ Deprecate editorExperiments in favour of expValEquals
10
+
11
+ ## 5.11.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [#165694](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/165694)
16
+ [`2e1b7ff8a2e49`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2e1b7ff8a2e49) -
17
+ refactor: align expValEquals and expValEqualsNoExposure to jira and confluence APIs
18
+
3
19
  ## 5.11.0
4
20
 
5
21
  ### Minor Changes
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.expValEqualsInternal = expValEqualsInternal;
8
+ var _featureGateJsClient = _interopRequireDefault(require("@atlaskit/feature-gate-js-client"));
9
+ var _setup = require("./setup");
10
+ /**
11
+ * Check the value if an editor experiment.
12
+ * Internal method that is shared between expValEquals and expValEqualsNoExposure.
13
+ *
14
+ * @example
15
+ * exportValEqualsInternal('example-boolean', 'paramName', true, null, true);
16
+ *
17
+ * @param experimentName - experiment key
18
+ * @param experimentParam - the name of the parameter to fetch from the experiment config
19
+ * @param experimentExpectedValue - expected value to compare with
20
+ * @param experimentDefaultValue - default value to use if the experiment is not set
21
+ * @param experimentExposure - whether to fire an exposure event or not
22
+ *
23
+ * @returns boolean
24
+ */
25
+ function expValEqualsInternal(experimentName, experimentParam, experimentExpectedValue, experimentDefaultValue, experimentExposure) {
26
+ // @ts-ignore need to loosen the type here to allow for any experiment name
27
+ if (_setup._overrides[experimentName] !== undefined) {
28
+ // This will be hit in the case of a test setting an override
29
+ // @ts-ignore need to loosen the type here to allow for any experiment name
30
+ return _setup._overrides[experimentName] === experimentExpectedValue;
31
+ }
32
+
33
+ // eslint-disable-next-line @atlaskit/platform/use-recommended-utils
34
+ var experimentValue = _featureGateJsClient.default.getExperimentValue(experimentName, experimentParam, experimentDefaultValue, {
35
+ fireExperimentExposure: experimentExposure
36
+ });
37
+ return experimentValue === experimentExpectedValue;
38
+ }
@@ -4,33 +4,32 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.expValEqualsNoExposure = expValEqualsNoExposure;
7
- var _experiments = require("./experiments");
7
+ var _expValEqualsInternal = require("./exp-val-equals-internal");
8
8
  /**
9
- * Check the value if an editor experiment and without exposure.
9
+ * Check the value if an editor experiment without firing exposure.
10
10
  *
11
11
  * !!! Note: This method never fires exposure. !!!
12
12
  *
13
13
  * @example Boolean experiment
14
- * if (expValEqualsNoExposure('example-boolean', true)) {
14
+ * if (expValEqualsNoExposure('example-boolean', 'isEnabled', true)) {
15
15
  * // Run code for on variant
16
16
  * } else {
17
17
  * // Run code for off variant
18
18
  * }
19
19
  *
20
20
  * @example Multivariate experiment
21
- * if (expValEqualsNoExposure('example-multivariate', 'one')) {
21
+ * if (expValEqualsNoExposure('example-multivariate', 'cohort', 'one')) {
22
22
  * // Run code for 'one' variant
23
23
  * } else {
24
24
  * // Run code for control
25
25
  * }
26
26
  *
27
27
  * @param experimentName - experiment key
28
+ * @param experimentParam - the name of the parameter to fetch from the experiment config
28
29
  * @param experimentExpectedValue - expected value to compare with
29
30
  *
30
31
  * @returns boolean
31
32
  */
32
- function expValEqualsNoExposure(experimentName, experimentExpectedValue) {
33
- return (0, _experiments.editorExperiment)(experimentName, experimentExpectedValue, {
34
- exposure: false
35
- });
33
+ function expValEqualsNoExposure(experimentName, experimentParam, experimentExpectedValue) {
34
+ return (0, _expValEqualsInternal.expValEqualsInternal)(experimentName, experimentParam, experimentExpectedValue, null, false);
36
35
  }
@@ -4,33 +4,32 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.expValEquals = expValEquals;
7
- var _experiments = require("./experiments");
7
+ var _expValEqualsInternal = require("./exp-val-equals-internal");
8
8
  /**
9
9
  * Check the value if an editor experiment and fire exposure.
10
10
  *
11
11
  * !!! Note: This method always fires exposure. !!!
12
12
  *
13
13
  * @example Boolean experiment
14
- * if (expValEquals('example-boolean', true)) {
14
+ * if (expValEquals('example-boolean', 'isEnabled', true)) {
15
15
  * // Run code for on variant
16
16
  * } else {
17
17
  * // Run code for off variant
18
18
  * }
19
19
  *
20
20
  * @example Multivariate experiment
21
- * if (expValEquals('example-multivariate', 'one')) {
21
+ * if (expValEquals('example-multivariate', 'cohort', 'one')) {
22
22
  * // Run code for 'one' variant
23
23
  * } else {
24
24
  * // Run code for control
25
25
  * }
26
26
  *
27
27
  * @param experimentName - experiment key
28
+ * @param experimentParam - the name of the parameter to fetch from the experiment config
28
29
  * @param experimentExpectedValue - expected value to compare with
29
30
  *
30
31
  * @returns boolean
31
32
  */
32
- function expValEquals(experimentName, experimentExpectedValue) {
33
- return (0, _experiments.editorExperiment)(experimentName, experimentExpectedValue, {
34
- exposure: true
35
- });
33
+ function expValEquals(experimentName, experimentParam, experimentExpectedValue) {
34
+ return (0, _expValEqualsInternal.expValEqualsInternal)(experimentName, experimentParam, experimentExpectedValue, null, true);
36
35
  }
@@ -53,6 +53,12 @@ var _setup = require("./setup");
53
53
  * // Run code for off variant
54
54
  * }
55
55
  * ```
56
+ *
57
+ * @private
58
+ * @deprecated This utility is deprecated in favour of using `expValEquals` from `@atlaskit/tmp-editor-statsig/exp-val-equals`.
59
+ * ExpValEquals fires exposure events by default preventing cases when consumers of exitorExperiment forget to pass the `exposure` option.
60
+ * It also closely aligns with similar utilities in other Atlassian products.
61
+ * For no expisure option use `expValEqualsNoExposure` from `@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure`.
56
62
  */
57
63
  function editorExperiment(experimentName, expectedExperimentValue) {
58
64
  var _experimentConfig$pro;
@@ -0,0 +1,32 @@
1
+ import FeatureGates from '@atlaskit/feature-gate-js-client';
2
+ import { _overrides } from './setup';
3
+
4
+ /**
5
+ * Check the value if an editor experiment.
6
+ * Internal method that is shared between expValEquals and expValEqualsNoExposure.
7
+ *
8
+ * @example
9
+ * exportValEqualsInternal('example-boolean', 'paramName', true, null, true);
10
+ *
11
+ * @param experimentName - experiment key
12
+ * @param experimentParam - the name of the parameter to fetch from the experiment config
13
+ * @param experimentExpectedValue - expected value to compare with
14
+ * @param experimentDefaultValue - default value to use if the experiment is not set
15
+ * @param experimentExposure - whether to fire an exposure event or not
16
+ *
17
+ * @returns boolean
18
+ */
19
+ export function expValEqualsInternal(experimentName, experimentParam, experimentExpectedValue, experimentDefaultValue, experimentExposure) {
20
+ // @ts-ignore need to loosen the type here to allow for any experiment name
21
+ if (_overrides[experimentName] !== undefined) {
22
+ // This will be hit in the case of a test setting an override
23
+ // @ts-ignore need to loosen the type here to allow for any experiment name
24
+ return _overrides[experimentName] === experimentExpectedValue;
25
+ }
26
+
27
+ // eslint-disable-next-line @atlaskit/platform/use-recommended-utils
28
+ const experimentValue = FeatureGates.getExperimentValue(experimentName, experimentParam, experimentDefaultValue, {
29
+ fireExperimentExposure: experimentExposure
30
+ });
31
+ return experimentValue === experimentExpectedValue;
32
+ }
@@ -1,31 +1,29 @@
1
- import { editorExperiment } from './experiments';
2
-
1
+ import { expValEqualsInternal } from './exp-val-equals-internal';
3
2
  /**
4
- * Check the value if an editor experiment and without exposure.
3
+ * Check the value if an editor experiment without firing exposure.
5
4
  *
6
5
  * !!! Note: This method never fires exposure. !!!
7
6
  *
8
7
  * @example Boolean experiment
9
- * if (expValEqualsNoExposure('example-boolean', true)) {
8
+ * if (expValEqualsNoExposure('example-boolean', 'isEnabled', true)) {
10
9
  * // Run code for on variant
11
10
  * } else {
12
11
  * // Run code for off variant
13
12
  * }
14
13
  *
15
14
  * @example Multivariate experiment
16
- * if (expValEqualsNoExposure('example-multivariate', 'one')) {
15
+ * if (expValEqualsNoExposure('example-multivariate', 'cohort', 'one')) {
17
16
  * // Run code for 'one' variant
18
17
  * } else {
19
18
  * // Run code for control
20
19
  * }
21
20
  *
22
21
  * @param experimentName - experiment key
22
+ * @param experimentParam - the name of the parameter to fetch from the experiment config
23
23
  * @param experimentExpectedValue - expected value to compare with
24
24
  *
25
25
  * @returns boolean
26
26
  */
27
- export function expValEqualsNoExposure(experimentName, experimentExpectedValue) {
28
- return editorExperiment(experimentName, experimentExpectedValue, {
29
- exposure: false
30
- });
27
+ export function expValEqualsNoExposure(experimentName, experimentParam, experimentExpectedValue) {
28
+ return expValEqualsInternal(experimentName, experimentParam, experimentExpectedValue, null, false);
31
29
  }
@@ -1,31 +1,29 @@
1
- import { editorExperiment } from './experiments';
2
-
1
+ import { expValEqualsInternal } from './exp-val-equals-internal';
3
2
  /**
4
3
  * Check the value if an editor experiment and fire exposure.
5
4
  *
6
5
  * !!! Note: This method always fires exposure. !!!
7
6
  *
8
7
  * @example Boolean experiment
9
- * if (expValEquals('example-boolean', true)) {
8
+ * if (expValEquals('example-boolean', 'isEnabled', true)) {
10
9
  * // Run code for on variant
11
10
  * } else {
12
11
  * // Run code for off variant
13
12
  * }
14
13
  *
15
14
  * @example Multivariate experiment
16
- * if (expValEquals('example-multivariate', 'one')) {
15
+ * if (expValEquals('example-multivariate', 'cohort', 'one')) {
17
16
  * // Run code for 'one' variant
18
17
  * } else {
19
18
  * // Run code for control
20
19
  * }
21
20
  *
22
21
  * @param experimentName - experiment key
22
+ * @param experimentParam - the name of the parameter to fetch from the experiment config
23
23
  * @param experimentExpectedValue - expected value to compare with
24
24
  *
25
25
  * @returns boolean
26
26
  */
27
- export function expValEquals(experimentName, experimentExpectedValue) {
28
- return editorExperiment(experimentName, experimentExpectedValue, {
29
- exposure: true
30
- });
27
+ export function expValEquals(experimentName, experimentParam, experimentExpectedValue) {
28
+ return expValEqualsInternal(experimentName, experimentParam, experimentExpectedValue, null, true);
31
29
  }
@@ -46,6 +46,12 @@ import { _overrides, _paramOverrides, _product } from './setup';
46
46
  * // Run code for off variant
47
47
  * }
48
48
  * ```
49
+ *
50
+ * @private
51
+ * @deprecated This utility is deprecated in favour of using `expValEquals` from `@atlaskit/tmp-editor-statsig/exp-val-equals`.
52
+ * ExpValEquals fires exposure events by default preventing cases when consumers of exitorExperiment forget to pass the `exposure` option.
53
+ * It also closely aligns with similar utilities in other Atlassian products.
54
+ * For no expisure option use `expValEqualsNoExposure` from `@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure`.
49
55
  */
50
56
  export function editorExperiment(experimentName, expectedExperimentValue, options = {
51
57
  exposure: false
@@ -0,0 +1,32 @@
1
+ import FeatureGates from '@atlaskit/feature-gate-js-client';
2
+ import { _overrides } from './setup';
3
+
4
+ /**
5
+ * Check the value if an editor experiment.
6
+ * Internal method that is shared between expValEquals and expValEqualsNoExposure.
7
+ *
8
+ * @example
9
+ * exportValEqualsInternal('example-boolean', 'paramName', true, null, true);
10
+ *
11
+ * @param experimentName - experiment key
12
+ * @param experimentParam - the name of the parameter to fetch from the experiment config
13
+ * @param experimentExpectedValue - expected value to compare with
14
+ * @param experimentDefaultValue - default value to use if the experiment is not set
15
+ * @param experimentExposure - whether to fire an exposure event or not
16
+ *
17
+ * @returns boolean
18
+ */
19
+ export function expValEqualsInternal(experimentName, experimentParam, experimentExpectedValue, experimentDefaultValue, experimentExposure) {
20
+ // @ts-ignore need to loosen the type here to allow for any experiment name
21
+ if (_overrides[experimentName] !== undefined) {
22
+ // This will be hit in the case of a test setting an override
23
+ // @ts-ignore need to loosen the type here to allow for any experiment name
24
+ return _overrides[experimentName] === experimentExpectedValue;
25
+ }
26
+
27
+ // eslint-disable-next-line @atlaskit/platform/use-recommended-utils
28
+ var experimentValue = FeatureGates.getExperimentValue(experimentName, experimentParam, experimentDefaultValue, {
29
+ fireExperimentExposure: experimentExposure
30
+ });
31
+ return experimentValue === experimentExpectedValue;
32
+ }
@@ -1,31 +1,29 @@
1
- import { editorExperiment } from './experiments';
2
-
1
+ import { expValEqualsInternal } from './exp-val-equals-internal';
3
2
  /**
4
- * Check the value if an editor experiment and without exposure.
3
+ * Check the value if an editor experiment without firing exposure.
5
4
  *
6
5
  * !!! Note: This method never fires exposure. !!!
7
6
  *
8
7
  * @example Boolean experiment
9
- * if (expValEqualsNoExposure('example-boolean', true)) {
8
+ * if (expValEqualsNoExposure('example-boolean', 'isEnabled', true)) {
10
9
  * // Run code for on variant
11
10
  * } else {
12
11
  * // Run code for off variant
13
12
  * }
14
13
  *
15
14
  * @example Multivariate experiment
16
- * if (expValEqualsNoExposure('example-multivariate', 'one')) {
15
+ * if (expValEqualsNoExposure('example-multivariate', 'cohort', 'one')) {
17
16
  * // Run code for 'one' variant
18
17
  * } else {
19
18
  * // Run code for control
20
19
  * }
21
20
  *
22
21
  * @param experimentName - experiment key
22
+ * @param experimentParam - the name of the parameter to fetch from the experiment config
23
23
  * @param experimentExpectedValue - expected value to compare with
24
24
  *
25
25
  * @returns boolean
26
26
  */
27
- export function expValEqualsNoExposure(experimentName, experimentExpectedValue) {
28
- return editorExperiment(experimentName, experimentExpectedValue, {
29
- exposure: false
30
- });
27
+ export function expValEqualsNoExposure(experimentName, experimentParam, experimentExpectedValue) {
28
+ return expValEqualsInternal(experimentName, experimentParam, experimentExpectedValue, null, false);
31
29
  }
@@ -1,31 +1,29 @@
1
- import { editorExperiment } from './experiments';
2
-
1
+ import { expValEqualsInternal } from './exp-val-equals-internal';
3
2
  /**
4
3
  * Check the value if an editor experiment and fire exposure.
5
4
  *
6
5
  * !!! Note: This method always fires exposure. !!!
7
6
  *
8
7
  * @example Boolean experiment
9
- * if (expValEquals('example-boolean', true)) {
8
+ * if (expValEquals('example-boolean', 'isEnabled', true)) {
10
9
  * // Run code for on variant
11
10
  * } else {
12
11
  * // Run code for off variant
13
12
  * }
14
13
  *
15
14
  * @example Multivariate experiment
16
- * if (expValEquals('example-multivariate', 'one')) {
15
+ * if (expValEquals('example-multivariate', 'cohort', 'one')) {
17
16
  * // Run code for 'one' variant
18
17
  * } else {
19
18
  * // Run code for control
20
19
  * }
21
20
  *
22
21
  * @param experimentName - experiment key
22
+ * @param experimentParam - the name of the parameter to fetch from the experiment config
23
23
  * @param experimentExpectedValue - expected value to compare with
24
24
  *
25
25
  * @returns boolean
26
26
  */
27
- export function expValEquals(experimentName, experimentExpectedValue) {
28
- return editorExperiment(experimentName, experimentExpectedValue, {
29
- exposure: true
30
- });
27
+ export function expValEquals(experimentName, experimentParam, experimentExpectedValue) {
28
+ return expValEqualsInternal(experimentName, experimentParam, experimentExpectedValue, null, true);
31
29
  }
@@ -46,6 +46,12 @@ import { _overrides, _paramOverrides, _product } from './setup';
46
46
  * // Run code for off variant
47
47
  * }
48
48
  * ```
49
+ *
50
+ * @private
51
+ * @deprecated This utility is deprecated in favour of using `expValEquals` from `@atlaskit/tmp-editor-statsig/exp-val-equals`.
52
+ * ExpValEquals fires exposure events by default preventing cases when consumers of exitorExperiment forget to pass the `exposure` option.
53
+ * It also closely aligns with similar utilities in other Atlassian products.
54
+ * For no expisure option use `expValEqualsNoExposure` from `@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure`.
49
55
  */
50
56
  export function editorExperiment(experimentName, expectedExperimentValue) {
51
57
  var _experimentConfig$pro;
@@ -0,0 +1,17 @@
1
+ import { type EditorExperimentsConfig } from './experiments-config';
2
+ /**
3
+ * Check the value if an editor experiment.
4
+ * Internal method that is shared between expValEquals and expValEqualsNoExposure.
5
+ *
6
+ * @example
7
+ * exportValEqualsInternal('example-boolean', 'paramName', true, null, true);
8
+ *
9
+ * @param experimentName - experiment key
10
+ * @param experimentParam - the name of the parameter to fetch from the experiment config
11
+ * @param experimentExpectedValue - expected value to compare with
12
+ * @param experimentDefaultValue - default value to use if the experiment is not set
13
+ * @param experimentExposure - whether to fire an exposure event or not
14
+ *
15
+ * @returns boolean
16
+ */
17
+ export declare function expValEqualsInternal<ExperimentName extends keyof EditorExperimentsConfig>(experimentName: ExperimentName, experimentParam: EditorExperimentsConfig[ExperimentName]['param'], experimentExpectedValue: EditorExperimentsConfig[ExperimentName]['defaultValue'], experimentDefaultValue: boolean | string | null, experimentExposure: boolean): boolean;
@@ -1,26 +1,27 @@
1
1
  import { type EditorExperimentsConfig } from './experiments-config';
2
2
  /**
3
- * Check the value if an editor experiment and without exposure.
3
+ * Check the value if an editor experiment without firing exposure.
4
4
  *
5
5
  * !!! Note: This method never fires exposure. !!!
6
6
  *
7
7
  * @example Boolean experiment
8
- * if (expValEqualsNoExposure('example-boolean', true)) {
8
+ * if (expValEqualsNoExposure('example-boolean', 'isEnabled', true)) {
9
9
  * // Run code for on variant
10
10
  * } else {
11
11
  * // Run code for off variant
12
12
  * }
13
13
  *
14
14
  * @example Multivariate experiment
15
- * if (expValEqualsNoExposure('example-multivariate', 'one')) {
15
+ * if (expValEqualsNoExposure('example-multivariate', 'cohort', 'one')) {
16
16
  * // Run code for 'one' variant
17
17
  * } else {
18
18
  * // Run code for control
19
19
  * }
20
20
  *
21
21
  * @param experimentName - experiment key
22
+ * @param experimentParam - the name of the parameter to fetch from the experiment config
22
23
  * @param experimentExpectedValue - expected value to compare with
23
24
  *
24
25
  * @returns boolean
25
26
  */
26
- export declare function expValEqualsNoExposure<ExperimentName extends keyof EditorExperimentsConfig, ExperimentValue extends EditorExperimentsConfig[ExperimentName]['defaultValue']>(experimentName: ExperimentName, experimentExpectedValue: ExperimentValue): boolean;
27
+ export declare function expValEqualsNoExposure<ExperimentName extends keyof EditorExperimentsConfig>(experimentName: ExperimentName, experimentParam: EditorExperimentsConfig[ExperimentName]['param'], experimentExpectedValue: EditorExperimentsConfig[ExperimentName]['defaultValue']): boolean;
@@ -5,22 +5,23 @@ import { type EditorExperimentsConfig } from './experiments-config';
5
5
  * !!! Note: This method always fires exposure. !!!
6
6
  *
7
7
  * @example Boolean experiment
8
- * if (expValEquals('example-boolean', true)) {
8
+ * if (expValEquals('example-boolean', 'isEnabled', true)) {
9
9
  * // Run code for on variant
10
10
  * } else {
11
11
  * // Run code for off variant
12
12
  * }
13
13
  *
14
14
  * @example Multivariate experiment
15
- * if (expValEquals('example-multivariate', 'one')) {
15
+ * if (expValEquals('example-multivariate', 'cohort', 'one')) {
16
16
  * // Run code for 'one' variant
17
17
  * } else {
18
18
  * // Run code for control
19
19
  * }
20
20
  *
21
21
  * @param experimentName - experiment key
22
+ * @param experimentParam - the name of the parameter to fetch from the experiment config
22
23
  * @param experimentExpectedValue - expected value to compare with
23
24
  *
24
25
  * @returns boolean
25
26
  */
26
- export declare function expValEquals<ExperimentName extends keyof EditorExperimentsConfig, ExperimentValue extends EditorExperimentsConfig[ExperimentName]['defaultValue']>(experimentName: ExperimentName, experimentExpectedValue: ExperimentValue): boolean;
27
+ export declare function expValEquals<ExperimentName extends keyof EditorExperimentsConfig>(experimentName: ExperimentName, experimentParam: EditorExperimentsConfig[ExperimentName]['param'], experimentExpectedValue: EditorExperimentsConfig[ExperimentName]['defaultValue']): boolean;
@@ -40,6 +40,12 @@ import { type EditorExperimentsConfig } from './experiments-config';
40
40
  * // Run code for off variant
41
41
  * }
42
42
  * ```
43
+ *
44
+ * @private
45
+ * @deprecated This utility is deprecated in favour of using `expValEquals` from `@atlaskit/tmp-editor-statsig/exp-val-equals`.
46
+ * ExpValEquals fires exposure events by default preventing cases when consumers of exitorExperiment forget to pass the `exposure` option.
47
+ * It also closely aligns with similar utilities in other Atlassian products.
48
+ * For no expisure option use `expValEqualsNoExposure` from `@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure`.
43
49
  */
44
50
  export declare function editorExperiment<ExperimentName extends keyof EditorExperimentsConfig>(experimentName: ExperimentName, expectedExperimentValue: EditorExperimentsConfig[ExperimentName]['defaultValue'], options?: {
45
51
  exposure: boolean;
@@ -0,0 +1,17 @@
1
+ import { type EditorExperimentsConfig } from './experiments-config';
2
+ /**
3
+ * Check the value if an editor experiment.
4
+ * Internal method that is shared between expValEquals and expValEqualsNoExposure.
5
+ *
6
+ * @example
7
+ * exportValEqualsInternal('example-boolean', 'paramName', true, null, true);
8
+ *
9
+ * @param experimentName - experiment key
10
+ * @param experimentParam - the name of the parameter to fetch from the experiment config
11
+ * @param experimentExpectedValue - expected value to compare with
12
+ * @param experimentDefaultValue - default value to use if the experiment is not set
13
+ * @param experimentExposure - whether to fire an exposure event or not
14
+ *
15
+ * @returns boolean
16
+ */
17
+ export declare function expValEqualsInternal<ExperimentName extends keyof EditorExperimentsConfig>(experimentName: ExperimentName, experimentParam: EditorExperimentsConfig[ExperimentName]['param'], experimentExpectedValue: EditorExperimentsConfig[ExperimentName]['defaultValue'], experimentDefaultValue: boolean | string | null, experimentExposure: boolean): boolean;
@@ -1,26 +1,27 @@
1
1
  import { type EditorExperimentsConfig } from './experiments-config';
2
2
  /**
3
- * Check the value if an editor experiment and without exposure.
3
+ * Check the value if an editor experiment without firing exposure.
4
4
  *
5
5
  * !!! Note: This method never fires exposure. !!!
6
6
  *
7
7
  * @example Boolean experiment
8
- * if (expValEqualsNoExposure('example-boolean', true)) {
8
+ * if (expValEqualsNoExposure('example-boolean', 'isEnabled', true)) {
9
9
  * // Run code for on variant
10
10
  * } else {
11
11
  * // Run code for off variant
12
12
  * }
13
13
  *
14
14
  * @example Multivariate experiment
15
- * if (expValEqualsNoExposure('example-multivariate', 'one')) {
15
+ * if (expValEqualsNoExposure('example-multivariate', 'cohort', 'one')) {
16
16
  * // Run code for 'one' variant
17
17
  * } else {
18
18
  * // Run code for control
19
19
  * }
20
20
  *
21
21
  * @param experimentName - experiment key
22
+ * @param experimentParam - the name of the parameter to fetch from the experiment config
22
23
  * @param experimentExpectedValue - expected value to compare with
23
24
  *
24
25
  * @returns boolean
25
26
  */
26
- export declare function expValEqualsNoExposure<ExperimentName extends keyof EditorExperimentsConfig, ExperimentValue extends EditorExperimentsConfig[ExperimentName]['defaultValue']>(experimentName: ExperimentName, experimentExpectedValue: ExperimentValue): boolean;
27
+ export declare function expValEqualsNoExposure<ExperimentName extends keyof EditorExperimentsConfig>(experimentName: ExperimentName, experimentParam: EditorExperimentsConfig[ExperimentName]['param'], experimentExpectedValue: EditorExperimentsConfig[ExperimentName]['defaultValue']): boolean;
@@ -5,22 +5,23 @@ import { type EditorExperimentsConfig } from './experiments-config';
5
5
  * !!! Note: This method always fires exposure. !!!
6
6
  *
7
7
  * @example Boolean experiment
8
- * if (expValEquals('example-boolean', true)) {
8
+ * if (expValEquals('example-boolean', 'isEnabled', true)) {
9
9
  * // Run code for on variant
10
10
  * } else {
11
11
  * // Run code for off variant
12
12
  * }
13
13
  *
14
14
  * @example Multivariate experiment
15
- * if (expValEquals('example-multivariate', 'one')) {
15
+ * if (expValEquals('example-multivariate', 'cohort', 'one')) {
16
16
  * // Run code for 'one' variant
17
17
  * } else {
18
18
  * // Run code for control
19
19
  * }
20
20
  *
21
21
  * @param experimentName - experiment key
22
+ * @param experimentParam - the name of the parameter to fetch from the experiment config
22
23
  * @param experimentExpectedValue - expected value to compare with
23
24
  *
24
25
  * @returns boolean
25
26
  */
26
- export declare function expValEquals<ExperimentName extends keyof EditorExperimentsConfig, ExperimentValue extends EditorExperimentsConfig[ExperimentName]['defaultValue']>(experimentName: ExperimentName, experimentExpectedValue: ExperimentValue): boolean;
27
+ export declare function expValEquals<ExperimentName extends keyof EditorExperimentsConfig>(experimentName: ExperimentName, experimentParam: EditorExperimentsConfig[ExperimentName]['param'], experimentExpectedValue: EditorExperimentsConfig[ExperimentName]['defaultValue']): boolean;
@@ -40,6 +40,12 @@ import { type EditorExperimentsConfig } from './experiments-config';
40
40
  * // Run code for off variant
41
41
  * }
42
42
  * ```
43
+ *
44
+ * @private
45
+ * @deprecated This utility is deprecated in favour of using `expValEquals` from `@atlaskit/tmp-editor-statsig/exp-val-equals`.
46
+ * ExpValEquals fires exposure events by default preventing cases when consumers of exitorExperiment forget to pass the `exposure` option.
47
+ * It also closely aligns with similar utilities in other Atlassian products.
48
+ * For no expisure option use `expValEqualsNoExposure` from `@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure`.
43
49
  */
44
50
  export declare function editorExperiment<ExperimentName extends keyof EditorExperimentsConfig>(experimentName: ExperimentName, expectedExperimentValue: EditorExperimentsConfig[ExperimentName]['defaultValue'], options?: {
45
51
  exposure: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/tmp-editor-statsig",
3
- "version": "5.11.0",
3
+ "version": "5.12.0",
4
4
  "description": "Temp plugin to ease use of statsig feature flags until platform feature flags are available",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",