Skip to content

Commit

Permalink
feat(onboarding): enable another iteration of onboarding guide experi…
Browse files Browse the repository at this point in the history
…ment (#1514)
  • Loading branch information
BohdanOne authored Dec 19, 2024
1 parent 5ded88e commit 847e00d
Show file tree
Hide file tree
Showing 25 changed files with 10 additions and 952 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 @@ -97,11 +94,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 @@ -366,18 +358,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 @@ -441,9 +421,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,25 @@
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 isVisible && 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 847e00d

Please sign in to comment.