Skip to content

Commit

Permalink
feat: rollout product tour (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
alangsto authored Dec 4, 2023
1 parent 2d03ede commit c22b3e4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
13 changes: 2 additions & 11 deletions src/components/ToggleXpertButton/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types';
import React, { useEffect, useState } from 'react';
import React, { useState } from 'react';

import { sendTrackEvent } from '@edx/frontend-platform/analytics';
import { getAuthenticatedUser } from '@edx/frontend-platform/auth';
Expand All @@ -12,7 +12,6 @@ import {
import { Close } from '@edx/paragon/icons';

import { ReactComponent as XpertLogo } from '../../assets/xpert-logo.svg';
import { activateProductTourExperiment, trackChatBotLaunchOptimizely } from '../../utils/optimizelyExperiment';
import './index.scss';

const ToggleXpert = ({
Expand All @@ -22,14 +21,8 @@ const ToggleXpert = ({
contentToolsEnabled,
}) => {
const [hasDismissed, setHasDismissed] = useState(false);
const [showProductTourExp, setShowProductTourExp] = useState(false);
const { userId } = getAuthenticatedUser();

useEffect(() => {
const showProductTour = activateProductTourExperiment(userId.toString());
setShowProductTourExp(showProductTour);
}, [userId, setShowProductTourExp]);

const handleClick = (event) => {
// log event if the tool is opened
if (!isOpen) {
Expand All @@ -41,7 +34,6 @@ const ToggleXpert = ({
source: event.target.id === 'toggle-button' ? 'toggle' : 'cta',
},
);
trackChatBotLaunchOptimizely(userId.toString());
}
setIsOpen(!isOpen);
};
Expand All @@ -68,14 +60,13 @@ const ToggleXpert = ({
source: 'product-tour',
},
);
trackChatBotLaunchOptimizely(userId.toString());
};

const learningAssistantTour = {
tourId: 'learningAssistantTour',
endButtonText: 'Check it out',
onEnd: () => { handleProductTourEnd(); },
enabled: !localStorage.getItem('completedLearningAssistantTour') && showProductTourExp,
enabled: !localStorage.getItem('completedLearningAssistantTour'),
checkpoints: [
{
placement: 'left',
Expand Down
5 changes: 0 additions & 5 deletions src/data/thunks.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
setDisclosureAcknowledged,
setSidebarIsOpen,
} from './slice';
import { trackChatBotMessageOptimizely } from '../utils/optimizelyExperiment';

export function addChatMessage(role, content, courseId) {
return (dispatch, getState) => {
Expand Down Expand Up @@ -41,10 +40,6 @@ export function addChatMessage(role, content, courseId) {
role: message.role,
content: message.content,
});

if (message.role === 'user') {
trackChatBotMessageOptimizely(userId.toString());
}
};
}

Expand Down

0 comments on commit c22b3e4

Please sign in to comment.