Skip to content

Commit

Permalink
feat(packages/sui-pde): Add adapterId and shouldTrackExperimentViewed…
Browse files Browse the repository at this point in the history
… to Feature and Experiment comp
  • Loading branch information
Jenifer López committed Jun 25, 2024
1 parent f7e13ee commit 8cc3be2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
15 changes: 12 additions & 3 deletions packages/sui-pde/src/components/experiment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand All @@ -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'
15 changes: 12 additions & 3 deletions packages/sui-pde/src/components/feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,24 @@ 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})
}

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'

0 comments on commit 8cc3be2

Please sign in to comment.