diff --git a/packages/insomnia-app/app/common/__tests__/constants.test.ts b/packages/insomnia-app/app/common/__tests__/constants.test.ts index c259451f9..82fedcf14 100644 --- a/packages/insomnia-app/app/common/__tests__/constants.test.ts +++ b/packages/insomnia-app/app/common/__tests__/constants.test.ts @@ -3,7 +3,6 @@ import { ACTIVITY_DEBUG, ACTIVITY_HOME, ACTIVITY_MIGRATION, - ACTIVITY_ONBOARDING, ACTIVITY_SPEC, ACTIVITY_UNIT_TEST, FLEXIBLE_URL_REGEX, @@ -45,7 +44,6 @@ describe('isWorkspaceActivity', () => { it('should return false', () => { expect(isWorkspaceActivity(ACTIVITY_HOME)).toBe(false); - expect(isWorkspaceActivity(ACTIVITY_ONBOARDING)).toBe(false); expect(isWorkspaceActivity(ACTIVITY_MIGRATION)).toBe(false); expect(isWorkspaceActivity(ACTIVITY_ANALYTICS)).toBe(false); }); @@ -57,7 +55,6 @@ describe('isValidActivity', () => { expect(isValidActivity(ACTIVITY_DEBUG)).toBe(true); expect(isValidActivity(ACTIVITY_UNIT_TEST)).toBe(true); expect(isValidActivity(ACTIVITY_HOME)).toBe(true); - expect(isValidActivity(ACTIVITY_ONBOARDING)).toBe(true); expect(isValidActivity(ACTIVITY_MIGRATION)).toBe(true); expect(isValidActivity(ACTIVITY_ANALYTICS)).toBe(true); }); diff --git a/packages/insomnia-app/app/common/constants.ts b/packages/insomnia-app/app/common/constants.ts index 3450f8b46..2f9ecafde 100644 --- a/packages/insomnia-app/app/common/constants.ts +++ b/packages/insomnia-app/app/common/constants.ts @@ -167,7 +167,6 @@ export const ACTIVITY_SPEC: GlobalActivity = 'spec'; export const ACTIVITY_DEBUG: GlobalActivity = 'debug'; export const ACTIVITY_UNIT_TEST: GlobalActivity = 'unittest'; export const ACTIVITY_HOME: GlobalActivity = 'home'; -export const ACTIVITY_ONBOARDING: GlobalActivity = 'onboarding'; export const ACTIVITY_MIGRATION: GlobalActivity = 'migration'; export const ACTIVITY_ANALYTICS: GlobalActivity = 'analytics'; export const DEPRECATED_ACTIVITY_INSOMNIA = 'insomnia'; @@ -183,7 +182,6 @@ export const isDesignActivity = (activity?: string): activity is GlobalActivity return true; case ACTIVITY_HOME: - case ACTIVITY_ONBOARDING: case ACTIVITY_MIGRATION: case ACTIVITY_ANALYTICS: default: @@ -199,7 +197,6 @@ export const isCollectionActivity = (activity?: string): activity is GlobalActiv case ACTIVITY_SPEC: case ACTIVITY_UNIT_TEST: case ACTIVITY_HOME: - case ACTIVITY_ONBOARDING: case ACTIVITY_MIGRATION: case ACTIVITY_ANALYTICS: default: @@ -213,7 +210,6 @@ export const isValidActivity = (activity: string): activity is GlobalActivity => case ACTIVITY_DEBUG: case ACTIVITY_UNIT_TEST: case ACTIVITY_HOME: - case ACTIVITY_ONBOARDING: case ACTIVITY_MIGRATION: case ACTIVITY_ANALYTICS: return true; diff --git a/packages/insomnia-app/app/common/migrate-from-designer.ts b/packages/insomnia-app/app/common/migrate-from-designer.ts index 495663480..219058f9a 100644 --- a/packages/insomnia-app/app/common/migrate-from-designer.ts +++ b/packages/insomnia-app/app/common/migrate-from-designer.ts @@ -189,7 +189,6 @@ export default async function migrateFromDesigner({ const coreSettings = await models.settings.getOrCreate(); const propertiesToPersist = [ '_id', - 'hasPromptedOnboarding', 'hasPromptedToMigrateFromDesigner', ]; propertiesToPersist.forEach(s => { diff --git a/packages/insomnia-app/app/main.development.ts b/packages/insomnia-app/app/main.development.ts index 784ae1791..74f067fe7 100644 --- a/packages/insomnia-app/app/main.development.ts +++ b/packages/insomnia-app/app/main.development.ts @@ -189,13 +189,8 @@ async function _createModelInstances() { async function _updateFlags({ launches }: Stats) { const firstLaunch = launches === 1; - if (firstLaunch) { - await models.settings.patch({ - hasPromptedOnboarding: false, - // Don't show the analytics preferences prompt as it is part of the onboarding flow - hasPromptedAnalytics: true, - }); + await models.settings.patch({ hasPromptedAnalytics: false }); } } diff --git a/packages/insomnia-app/app/models/settings.ts b/packages/insomnia-app/app/models/settings.ts index 895bbfb84..dcede96c6 100644 --- a/packages/insomnia-app/app/models/settings.ts +++ b/packages/insomnia-app/app/models/settings.ts @@ -52,12 +52,11 @@ export function init(): BaseSettings { fontVariantLigatures: false, forceVerticalLayout: false, - // Only existing users updating from an older version should see the analytics prompt. - // So by default this flag is set to false, and is toggled to true during initialization for new users. + /** + * Only existing users updating from an older version should see the analytics prompt. + * So by default this flag is set to false, and is toggled to true during initialization for new users. + */ hasPromptedAnalytics: false, - - // Users should only see onboarding during first launch, and anybody updating from an older version should not see it, so by default this flag is set to true, and is toggled to false during initialization - hasPromptedOnboarding: true, hasPromptedToMigrateFromDesigner: false, hotKeyRegistry: hotkeys.newDefaultRegistry(), httpProxy: '', diff --git a/packages/insomnia-app/app/ui/components/settings/general.tsx b/packages/insomnia-app/app/ui/components/settings/general.tsx index fb4d1d7ce..23d98845f 100644 --- a/packages/insomnia-app/app/ui/components/settings/general.tsx +++ b/packages/insomnia-app/app/ui/components/settings/general.tsx @@ -450,12 +450,6 @@ class General extends PureComponent { setting="hasPromptedToMigrateFromDesigner" /> -
- -
; - -interface Props extends ReduxProps { - wrapperProps: WrapperProps; -} - -interface State { - step: number; -} - -@autoBindMethodsForReact(AUTOBIND_CFG) -class WrapperOnboarding extends PureComponent { - state: State = { - step: 1, - }; - - componentDidMount() { - db.onChange(this._handleDbChange); - } - - componentWillUnmount() { - // Unsubscribe DB listener - db.offChange(this._handleDbChange); - } - - _handleDbChange(changes: [string, BaseModel, boolean][]) { - for (const change of changes) { - if (isWorkspace(change[1])) { - setTimeout(() => { - this._handleDone(); - }, 400); - } - } - } - - _handleDone() { - this._nextActivity(); - } - - _handleBackStep(e: React.SyntheticEvent) { - e.preventDefault(); - this.setState(state => ({ - step: state.step - 1, - })); - } - - async _handleCompleteAnalyticsStep() { - this.setState(state => ({ - step: state.step + 1, - })); - } - - _handleImportFile() { - this.props.handleImportFile({ - forceToWorkspace: ForceToWorkspace.new, - forceToScope: WorkspaceScopeKeys.design, - }); - } - - _handleImportUri(defaultValue: string) { - const { handleImportUri } = this.props; - showPrompt({ - title: 'Import From URI', - defaultValue: typeof defaultValue === 'string' ? defaultValue : '', - placeholder: 'https://example.com/openapi-spec.yaml', - label: 'URI to Import', - onComplete: value => { - handleImportUri(value, { - forceToWorkspace: ForceToWorkspace.new, - forceToScope: WorkspaceScopeKeys.design, - }); - }, - }); - } - - _handleImportPetstore() { - this._handleImportUri( - 'https://gist.githubusercontent.com/gschier/4e2278d5a50b4bbf1110755d9b48a9f9' + - '/raw/801c05266ae102bcb9288ab92c60f52d45557425/petstore-spec.yaml', - ); - } - - _handleSkipImport() { - this._nextActivity(); - } - - _nextActivity() { - this.props.wrapperProps.handleGoToNextActivity(); - } - - hasStep1() { - return this.props.wrapperProps.settings.incognitoMode === false; - } - - renderStep1() { - return ( - - ); - } - - renderStep2() { - const { - settings: { enableAnalytics }, - } = this.props.wrapperProps; - - const lastStep = this.hasStep1() ? ( -

- - Back - - {enableAnalytics - ? `Thanks for helping make ${getAppName()} better!` - : 'Opted out of analytics'} -

- ) : null; - - return ( - - {lastStep} -

Import an OpenAPI spec to get started:

- - - -
- ); - } - - render() { - const { step } = this.state; - let stepBody; - - if (step === 1 && this.hasStep1()) { - stepBody = this.renderStep1(); - } else { - stepBody = this.renderStep2(); - } - - return ( - - {stepBody} - - ); - } -} - -const mapDispatchToProps = dispatch => { - const bound = bindActionCreators({ - importFile, - importUri, - }, dispatch); - - return ({ - handleImportFile: bound.importFile, - handleImportUri: bound.importUri, - }); -}; - -export default connect(null, mapDispatchToProps)(WrapperOnboarding); diff --git a/packages/insomnia-app/app/ui/components/wrapper.tsx b/packages/insomnia-app/app/ui/components/wrapper.tsx index 744c8d14e..dff7af150 100644 --- a/packages/insomnia-app/app/ui/components/wrapper.tsx +++ b/packages/insomnia-app/app/ui/components/wrapper.tsx @@ -9,7 +9,6 @@ import { ACTIVITY_DEBUG, ACTIVITY_HOME, ACTIVITY_MIGRATION, - ACTIVITY_ONBOARDING, ACTIVITY_SPEC, ACTIVITY_UNIT_TEST, AUTOBIND_CFG, @@ -83,7 +82,6 @@ import { WrapperDebug } from './wrapper-debug'; import { WrapperDesign } from './wrapper-design'; import WrapperHome from './wrapper-home'; import { WrapperMigration } from './wrapper-migration'; -import WrapperOnboarding from './wrapper-onboarding'; import { WrapperUnitTest } from './wrapper-unit-test'; const spectral = initializeSpectral(); @@ -728,10 +726,8 @@ export class Wrapper extends PureComponent { {activity === ACTIVITY_MIGRATION && } - {activity === ACTIVITY_ANALYTICS && } - - {(activity === ACTIVITY_ONBOARDING || activity === null) && ( - + {(activity === ACTIVITY_ANALYTICS || activity === null) && ( + )} diff --git a/packages/insomnia-app/app/ui/redux/modules/__tests__/global.test.ts b/packages/insomnia-app/app/ui/redux/modules/__tests__/global.test.ts index 58f3e4bc8..ff4ea4a8a 100644 --- a/packages/insomnia-app/app/ui/redux/modules/__tests__/global.test.ts +++ b/packages/insomnia-app/app/ui/redux/modules/__tests__/global.test.ts @@ -9,7 +9,6 @@ import { ACTIVITY_DEBUG, ACTIVITY_HOME, ACTIVITY_MIGRATION, - ACTIVITY_ONBOARDING, ACTIVITY_SPEC, ACTIVITY_UNIT_TEST, DEPRECATED_ACTIVITY_INSOMNIA, @@ -43,11 +42,9 @@ const mockStore = configureMockStore(middlewares); const createSettings = ( hasPromptedMigration: boolean, - hasPromptedOnboarding: boolean, hasPromptedAnalytics: boolean, ) => { const settings = models.settings.init(); - settings.hasPromptedOnboarding = hasPromptedOnboarding; settings.hasPromptedToMigrateFromDesigner = hasPromptedMigration; settings.hasPromptedAnalytics = hasPromptedAnalytics; return settings; @@ -68,7 +65,6 @@ describe('global', () => { ACTIVITY_DEBUG, ACTIVITY_UNIT_TEST, ACTIVITY_HOME, - ACTIVITY_ONBOARDING, ACTIVITY_MIGRATION, ])('should update local storage and track event: %s', (activity: GlobalActivity) => { const expectedEvent = { @@ -82,36 +78,14 @@ describe('global', () => { ); }); - it('should update flag for onboarding prompted', async done => { - await models.settings.patch({ - hasPromptedToMigrateFromDesigner: false, - hasPromptedOnboarding: false, - }); - - async function onDatabaseChange() { - const settings = await models.settings.getOrCreate(); - expect(settings.hasPromptedToMigrateFromDesigner).toBe(false); - expect(settings.hasPromptedOnboarding).toBe(true); - - database.offChange(onDatabaseChange); - done(); - } - - database.onChange(onDatabaseChange); - - setActiveActivity(ACTIVITY_ONBOARDING); - }); - it('should update flag for migration prompted', async done => { await models.settings.patch({ hasPromptedToMigrateFromDesigner: false, - hasPromptedOnboarding: false, }); async function onDatabaseChange() { const settings = await models.settings.getOrCreate(); expect(settings.hasPromptedToMigrateFromDesigner).toBe(true); - expect(settings.hasPromptedOnboarding).toBe(false); database.offChange(onDatabaseChange); done(); } @@ -151,9 +125,9 @@ describe('global', () => { }); describe('goToNextActivity', () => { - it('should go from onboarding to home', async () => { - const settings = createSettings(false, false, true); - const activeActivity = ACTIVITY_ONBOARDING; + it('should go from analytics to home', async () => { + const settings = createSettings(false, true); + const activeActivity = ACTIVITY_ANALYTICS; const store = mockStore({ global: { activeActivity, @@ -171,28 +145,8 @@ describe('global', () => { ]); }); - it('should go from migration to onboarding', async () => { - const settings = createSettings(false, false, true); - const activeActivity = ACTIVITY_MIGRATION; - const store = mockStore({ - global: { - activeActivity, - }, - entities: { - settings: [settings], - }, - }); - await store.dispatch(goToNextActivity()); - expect(store.getActions()).toEqual([ - { - type: SET_ACTIVE_ACTIVITY, - activity: ACTIVITY_ONBOARDING, - }, - ]); - }); - it('should go from migration to analytics', async () => { - const settings = createSettings(false, true, false); + const settings = createSettings(false, false); const activeActivity = ACTIVITY_MIGRATION; const store = mockStore({ global: { @@ -212,7 +166,7 @@ describe('global', () => { }); it('should go from migration to home', async () => { - const settings = createSettings(true, true, true); + const settings = createSettings(true, true); const activeActivity = ACTIVITY_MIGRATION; const store = mockStore({ global: { @@ -234,7 +188,7 @@ describe('global', () => { it.each([ACTIVITY_SPEC, ACTIVITY_DEBUG, ACTIVITY_UNIT_TEST, ACTIVITY_HOME])( 'should not change activity from: %s', async (activeActivity: GlobalActivity) => { - const settings = createSettings(false, true, true); + const settings = createSettings(false, true); const store = mockStore({ global: { activeActivity, @@ -324,10 +278,9 @@ describe('global', () => { ACTIVITY_DEBUG, ACTIVITY_UNIT_TEST, ACTIVITY_HOME, - ACTIVITY_ONBOARDING, ACTIVITY_ANALYTICS, ])('should initialize %s from local storage', async activity => { - const settings = createSettings(true, true, true); + const settings = createSettings(true, true); const store = mockStore({ global: {}, entities: { @@ -344,7 +297,7 @@ describe('global', () => { }); it('should initialize from local storage and migrate deprecated activity', async () => { - const settings = createSettings(true, true, true); + const settings = createSettings(true, true); const store = mockStore({ global: {}, entities: { @@ -361,8 +314,8 @@ describe('global', () => { expect(store.getActions()).toEqual([expectedEvent]); }); - it('should go to onboarding if initialized at migration', async () => { - const settings = createSettings(true, false, true); + it('should go to home if initialized at migration', async () => { + const settings = createSettings(true, true); const store = mockStore({ global: {}, entities: { @@ -373,7 +326,7 @@ describe('global', () => { global.localStorage.setItem(`${LOCALSTORAGE_PREFIX}::activity`, JSON.stringify(activity)); const expectedEvent = { type: SET_ACTIVE_ACTIVITY, - activity: ACTIVITY_ONBOARDING, + activity: ACTIVITY_HOME, }; await store.dispatch(initActiveActivity()); expect(store.getActions()).toEqual([expectedEvent]); @@ -384,7 +337,7 @@ describe('global', () => { null, undefined, )('should go to home if initialized with an unsupported value: %s', async activity => { - const settings = createSettings(true, true, true); + const settings = createSettings(true, true); const store = mockStore({ global: {}, entities: { @@ -401,7 +354,7 @@ describe('global', () => { }); it('should go to home if local storage key not found', async () => { - const settings = createSettings(true, true, true); + const settings = createSettings(true, true); const store = mockStore({ global: {}, entities: { @@ -417,7 +370,7 @@ describe('global', () => { }); it('should go to home if initialized at migration and onboarding seen', async () => { - const settings = createSettings(true, true, true); + const settings = createSettings(true, true); const store = mockStore({ global: {}, entities: { @@ -435,7 +388,7 @@ describe('global', () => { }); it('should prompt to migrate', async () => { - const settings = createSettings(false, true, true); + const settings = createSettings(false, true); fsExistsSyncSpy.mockReturnValue(true); const store = mockStore({ global: {}, @@ -455,7 +408,7 @@ describe('global', () => { }); it('should not prompt to migrate if default directory not found', async () => { - const settings = createSettings(false, true, true); + const settings = createSettings(false, true); fsExistsSyncSpy.mockReturnValue(false); const store = mockStore({ global: {}, @@ -474,26 +427,8 @@ describe('global', () => { expect(fsExistsSyncSpy).toHaveBeenCalledWith(getDesignerDataDir()); }); - it('should prompt to onboard', async () => { - const settings = createSettings(true, false, true); - const store = mockStore({ - global: {}, - entities: { - settings: [settings], - }, - }); - const activity = ACTIVITY_HOME; - global.localStorage.setItem(`${LOCALSTORAGE_PREFIX}::activity`, JSON.stringify(activity)); - const expectedEvent = { - type: SET_ACTIVE_ACTIVITY, - activity: ACTIVITY_ONBOARDING, - }; - await store.dispatch(initActiveActivity()); - expect(store.getActions()).toEqual([expectedEvent]); - }); - it('should prompt to change analytics settings', async () => { - const settings = createSettings(true, true, false); + const settings = createSettings(true, false); const store = mockStore({ global: {}, entities: { diff --git a/packages/insomnia-app/app/ui/redux/modules/global.tsx b/packages/insomnia-app/app/ui/redux/modules/global.tsx index a45e41b6b..7d57be568 100644 --- a/packages/insomnia-app/app/ui/redux/modules/global.tsx +++ b/packages/insomnia-app/app/ui/redux/modules/global.tsx @@ -13,7 +13,6 @@ import { ACTIVITY_DEBUG, ACTIVITY_HOME, ACTIVITY_MIGRATION, - ACTIVITY_ONBOARDING, DEPRECATED_ACTIVITY_INSOMNIA, isValidActivity, } from '../../../common/constants'; @@ -299,14 +298,9 @@ export const loadRequestStop = (requestId: string) => ({ requestId, }); -function _getNextActivity(settings: Settings, currentActivity: GlobalActivity): GlobalActivity { +function _getNextActivity(settings: Settings, currentActivity: GlobalActivity) { switch (currentActivity) { case ACTIVITY_MIGRATION: - // Has not seen the onboarding step? Go to onboarding - if (!settings.hasPromptedOnboarding) { - return ACTIVITY_ONBOARDING; - } - // Has not seen the analytics prompt? Go to it if (!settings.hasPromptedAnalytics) { return ACTIVITY_ANALYTICS; @@ -315,8 +309,7 @@ function _getNextActivity(settings: Settings, currentActivity: GlobalActivity): // Otherwise, go to home return ACTIVITY_HOME; - case ACTIVITY_ONBOARDING: - // Always go to home after onboarding + case ACTIVITY_ANALYTICS: return ACTIVITY_HOME; default: @@ -354,14 +347,6 @@ export const setActiveActivity = (activity: GlobalActivity) => { }); break; - case ACTIVITY_ONBOARDING: - models.settings.patch({ - hasPromptedOnboarding: true, - // Don't show the analytics preferences prompt as it is part of the onboarding flow - hasPromptedAnalytics: true, - }); - break; - case ACTIVITY_ANALYTICS: models.settings.patch({ hasPromptedAnalytics: true, @@ -756,8 +741,6 @@ export const initActiveActivity = () => (dispatch, getState) => { if (!settings.hasPromptedToMigrateFromDesigner && fs.existsSync(getDesignerDataDir())) { trackEvent('Data', 'Migration', 'Auto'); overrideActivity = ACTIVITY_MIGRATION; - } else if (!settings.hasPromptedOnboarding) { - overrideActivity = ACTIVITY_ONBOARDING; } else if (!settings.hasPromptedAnalytics) { overrideActivity = ACTIVITY_ANALYTICS; } diff --git a/packages/insomnia-common/src/entities/settings.ts b/packages/insomnia-common/src/entities/settings.ts index 3ad2caf47..d7802d19e 100644 --- a/packages/insomnia-common/src/entities/settings.ts +++ b/packages/insomnia-common/src/entities/settings.ts @@ -56,7 +56,6 @@ export interface Settings { fontVariantLigatures: boolean; forceVerticalLayout: boolean; hasPromptedAnalytics: boolean; - hasPromptedOnboarding: boolean; hasPromptedToMigrateFromDesigner: boolean; hotKeyRegistry: HotKeyRegistry; httpProxy: string; diff --git a/packages/insomnia-smoke-test/modules/onboarding.ts b/packages/insomnia-smoke-test/modules/onboarding.ts index 2bb4767ad..1e6d61360 100644 --- a/packages/insomnia-smoke-test/modules/onboarding.ts +++ b/packages/insomnia-smoke-test/modules/onboarding.ts @@ -12,15 +12,7 @@ const clickDontShare = async app => { .then(e => e.click()); }; -const clickSkipImport = async app => { - await app.client - .$('.onboarding__content__body') - .then(e => e.$('button=Skip')) - .then(e => e.click()); -}; - export const skipOnboardingFlow = async app => { await analyticsMessageShown(app); await clickDontShare(app); - await clickSkipImport(app); };