From 8cc3be20e9f605ae8873e69476fe3643e27e55ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jenifer=20L=C3=B3pez?= Date: Tue, 25 Jun 2024 11:45:06 +0200 Subject: [PATCH] feat(packages/sui-pde): Add adapterId and shouldTrackExperimentViewed to Feature and Experiment comp --- packages/sui-pde/src/components/experiment.js | 15 ++++++++++++--- packages/sui-pde/src/components/feature.js | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/packages/sui-pde/src/components/experiment.js b/packages/sui-pde/src/components/experiment.js index 8b5871aa5..598d5fc99 100644 --- a/packages/sui-pde/src/components/experiment.js +++ b/packages/sui-pde/src/components/experiment.js @@ -2,12 +2,20 @@ import PropTypes from 'prop-types' import useExperiment from '../hooks/useExperiment.js' -export default function Experiment({experimentName, attributes, trackExperimentViewed, queryString, children}) { +export default function Experiment({ + adapterId, + experimentName, + attributes, + trackExperimentViewed, + queryString, + children +}) { const {variation} = useExperiment({ experimentName, attributes, trackExperimentViewed, - queryString + queryString, + adapterId }) return children({variation}) @@ -18,6 +26,7 @@ Experiment.propTypes = { attributes: PropTypes.object, trackExperimentViewed: PropTypes.func, queryString: PropTypes.string, - children: PropTypes.func + children: PropTypes.func, + adapterId: PropTypes.string } Experiment.displayName = 'Experiment' diff --git a/packages/sui-pde/src/components/feature.js b/packages/sui-pde/src/components/feature.js index f66d678c6..45fb5f4d1 100644 --- a/packages/sui-pde/src/components/feature.js +++ b/packages/sui-pde/src/components/feature.js @@ -2,8 +2,15 @@ import PropTypes from 'prop-types' import useFeature from '../hooks/useFeature.js' -export default function Feature({children, featureKey, attributes, queryString}) { - const {isActive, variables} = useFeature(featureKey, attributes, queryString) +export default function Feature({ + children, + featureKey, + attributes, + queryString, + adapterId, + shouldTrackExperimentViewed +}) { + const {isActive, variables} = useFeature(featureKey, attributes, queryString, adapterId, shouldTrackExperimentViewed) return children({isActive, variables}) } @@ -11,6 +18,8 @@ Feature.propTypes = { featureKey: PropTypes.string.isRequired, attributes: PropTypes.object, queryString: PropTypes.string, - children: PropTypes.func + children: PropTypes.func, + adapterId: PropTypes.string, + shouldTrackExperimentViewed: PropTypes.bool } Feature.displayName = 'Feature'