Skip to content

Commit

Permalink
feat: enable another iteration of onboarding guide experiment
Browse files Browse the repository at this point in the history
  • Loading branch information
BohdanOne committed Dec 18, 2024
1 parent 5d6f55c commit c973924
Show file tree
Hide file tree
Showing 25 changed files with 8 additions and 951 deletions.
2 changes: 1 addition & 1 deletion packages/init/src/SliceMachineInitProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ ${chalk.cyan("?")} Your Prismic repository name`.replace("\n", ""),
try {
const { value: onboardingExperimentVariant } =
(await this.manager.telemetry.getExperimentVariant(
"shared-onboarding",
"shared-onboarding-new",
)) ?? {};
if (onboardingExperimentVariant === "with-shared-onboarding") {
this.manager.prismicRepository.completeOnboardingStep(
Expand Down
23 changes: 0 additions & 23 deletions packages/manager/src/managers/telemetry/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ export const SegmentEventType = {
postPush_emptyStateCtaClicked: "post-push:empty-state-cta-clicked",
postPush_toastCtaClicked: "post-push:toast-cta-clicked",
experiment_exposure: "experiment:exposure",
onboarding_step_opened: "onboarding:step-opened",
onboarding_step_completed: "onboarding:step-completed",
onboarding_completed: "onboarding:completed",
sharedOnboarding_step_opened: "shared-onboarding:step-opened",
sharedOnboarding_step_completed: "shared-onboarding:step-completed",
sharedOnboarding_completed: "shared-onboarding:completed",
Expand Down Expand Up @@ -96,11 +93,6 @@ export const HumanSegmentEventType = {
[SegmentEventType.postPush_toastCtaClicked]:
"SliceMachine Post Push Toast CTA Clicked",
[SegmentEventType.experiment_exposure]: "$exposure",
[SegmentEventType.onboarding_step_opened]:
"SliceMachine Onboarding Step Opened",
[SegmentEventType.onboarding_step_completed]:
"SliceMachine Onboarding Step Completed",
[SegmentEventType.onboarding_completed]: "SliceMachine Onboarding Completed",
[SegmentEventType.sharedOnboarding_step_completed]:
"Prismic Onboarding Guide Step Completed",
[SegmentEventType.sharedOnboarding_step_opened]:
Expand Down Expand Up @@ -363,18 +355,6 @@ type SharedOnboardingProperties<T = Record<string, string>> = T & {
source: "SliceMachine";
};

type SliceMachineOnboardingStepOpened = SegmentEvent<
typeof SegmentEventType.onboarding_step_opened,
OnboardingCommonPayload
>;
type SliceMachineOnboardingStepCompleted = SegmentEvent<
typeof SegmentEventType.onboarding_step_completed,
OnboardingCommonPayload
>;
type SliceMachineOnboardingCompleted = SegmentEvent<
typeof SegmentEventType.onboarding_completed
>;

type SliceMachineSharedOnboardingStepOpened = SegmentEvent<
typeof SegmentEventType.sharedOnboarding_step_opened,
SharedOnboardingProperties<OnboardingCommonPayload>
Expand Down Expand Up @@ -435,9 +415,6 @@ export type SegmentEvents =
| SliceMachineStart
| SliceLibraryBetaModalOpened
| SliceLibraryBetaCodeOpened
| SliceMachineOnboardingStepOpened
| SliceMachineOnboardingStepCompleted
| SliceMachineOnboardingCompleted
| SliceMachineSharedOnboardingStepOpened
| SliceMachineSharedOnboardingStepCompleted
| SliceMachineSharedOnboardingCompleted
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,29 +1,24 @@
import { useMediaQuery } from "@prismicio/editor-ui";

import { useOnboardingExperiment } from "@/features/onboarding/useOnboardingExperiment";
import { useUpdateAvailable } from "@/hooks/useUpdateAvailable";

import { SharedOnboardingGuide } from "./SharedOnboardingGuide";
import { SliceMachineOnboardingGuide } from "./SliceMachineOnboardingGuide/SliceMachineOnboardingGuide";
import { useSharedOnboardingExperiment } from "./useSharedOnboardingExperiment";

export function OnboardingGuide() {
const isVisible = useIsOnboardingGuideVisible();
const isSharedExperimentEligible = useSharedOnboardingExperiment().eligible;

if (!isVisible) return null;
if (isSharedExperimentEligible) return <SharedOnboardingGuide />;
return <SliceMachineOnboardingGuide />;
return isSharedExperimentEligible ? <SharedOnboardingGuide /> : null;
}

function useIsOnboardingGuideVisible() {
const isMediaQueryVisible = useMediaQuery({ min: "medium" });
const isExperimentEligible = useOnboardingExperiment().eligible;
const updates = useUpdateAvailable();

return (
isMediaQueryVisible &&
isExperimentEligible &&
!updates.sliceMachineUpdateAvailable &&
!updates.adapterUpdateAvailable
);
Expand Down

This file was deleted.

Loading

0 comments on commit c973924

Please sign in to comment.