Skip to content

Commit

Permalink
chore: remove strategy form feedback (#6769)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaanus committed Apr 3, 2024
1 parent e0ea257 commit a664a44
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
import { formatStrategyName } from 'utils/strategyNames';
import { Badge } from 'component/common/Badge/Badge';
import EnvironmentIcon from 'component/common/EnvironmentIcon/EnvironmentIcon';
import { useFeedback } from 'component/feedbackNew/useFeedback';
import { useUiFlag } from 'hooks/useUiFlag';

interface IFeatureStrategyFormProps {
feature: IFeatureToggle;
Expand Down Expand Up @@ -187,8 +185,6 @@ const StyledBadge = styled(Badge)(({ theme }) => ({
marginLeft: theme.spacing(1),
}));

const feedbackCategory = 'newStrategyForm';

export const FeatureStrategyForm = ({
projectId,
feature,
Expand All @@ -207,10 +203,6 @@ export const FeatureStrategyForm = ({
setTab,
StrategyVariants,
}: IFeatureStrategyFormProps) => {
const { openFeedback, hasSubmittedFeedback } = useFeedback(
feedbackCategory,
'manual',
);
const { trackEvent } = usePlausibleTracker();
const [showProdGuard, setShowProdGuard] = useState(false);
const hasValidConstraints = useConstraintsValidation(strategy.constraints);
Expand All @@ -221,9 +213,6 @@ export const FeatureStrategyForm = ({
environmentId,
);
const { strategyDefinition } = useStrategy(strategy?.name);
const newStrategyConfigurationFeedback = useUiFlag(
'newStrategyConfigurationFeedback',
);

useEffect(() => {
trackEvent('new-strategy-form', {
Expand Down Expand Up @@ -312,15 +301,6 @@ export const FeatureStrategyForm = ({
navigate(formatFeaturePath(feature.project, feature.name));
};

const createFeedbackContext = () => {
openFeedback({
title: 'How easy was it to work with the new strategy form?',
positiveLabel: 'What do you like most about the new strategy form?',
areasForImprovementsLabel:
'What should be improved the new strategy form?',
});
};

const onSubmitWithValidation = async (event: React.FormEvent) => {
if (Array.isArray(strategy.variants) && strategy.variants?.length > 0) {
trackEvent('strategy-variants', {
Expand All @@ -343,19 +323,7 @@ export const FeatureStrategyForm = ({
if (enableProdGuard && !isChangeRequest) {
setShowProdGuard(true);
} else {
await onSubmitWithFeedback();
}
};

const onSubmitWithFeedback = async () => {
try {
await onSubmit();

if (newStrategyConfigurationFeedback && !hasSubmittedFeedback) {
createFeedbackContext();
}
} catch (e) {
console.error(e);
onSubmit();
}
};

Expand Down Expand Up @@ -584,7 +552,7 @@ export const FeatureStrategyForm = ({
<FeatureStrategyProdGuard
open={showProdGuard}
onClose={() => setShowProdGuard(false)}
onClick={onSubmitWithFeedback}
onClick={onSubmit}
loading={loading}
label='Save strategy'
/>
Expand Down
1 change: 0 additions & 1 deletion frontend/src/hooks/useSubmittedFeedback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { createLocalStorage } from '../utils/createLocalStorage';

export type IFeedbackCategory =
| 'search'
| 'newStrategyForm'
| 'insights'
| 'applicationOverview'
| 'newProjectOverview';
Expand Down
1 change: 0 additions & 1 deletion frontend/src/interfaces/uiConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export type UiFlags = {
celebrateUnleash?: boolean;
featureSearchFeedback?: Variant;
enableLicense?: boolean;
newStrategyConfigurationFeedback?: boolean;
adminTokenKillSwitch?: boolean;
executiveDashboardUI?: boolean;
feedbackComments?: Variant;
Expand Down
1 change: 0 additions & 1 deletion src/lib/__snapshots__/create-config.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ exports[`should create default config 1`] = `
},
"migrationLock": true,
"newContextFieldsUI": false,
"newStrategyConfigurationFeedback": false,
"outdatedSdksBanner": false,
"personalAccessTokensKillSwitch": false,
"projectOverviewRefactor": false,
Expand Down
5 changes: 0 additions & 5 deletions src/lib/types/experimental.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export type IFlagKey =
| 'celebrateUnleash'
| 'featureSearchFeedback'
| 'featureSearchFeedbackPosting'
| 'newStrategyConfigurationFeedback'
| 'edgeBulkMetrics'
| 'extendedUsageMetrics'
| 'adminTokenKillSwitch'
Expand Down Expand Up @@ -165,10 +164,6 @@ const flags: IFlags = {
process.env.UNLEASH_EXPERIMENTAL_FEATURE_SEARCH_FEEDBACK_POSTING,
false,
),
newStrategyConfigurationFeedback: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_NEW_STRATEGY_CONFIGURATION_FEEDBACK,
false,
),
encryptEmails: parseEnvVarBoolean(
process.env.UNLEASH_EXPERIMENTAL_ENCRYPT_EMAILS,
false,
Expand Down
1 change: 0 additions & 1 deletion src/server-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ process.nextTick(async () => {
stripClientHeadersOn304: true,
stripHeadersOnAPI: true,
celebrateUnleash: true,
newStrategyConfigurationFeedback: true,
featureSearchFeedbackPosting: true,
executiveDashboard: true,
executiveDashboardUI: true,
Expand Down

0 comments on commit a664a44

Please sign in to comment.