PromucFlow_constructor/app/client/src/actions/onboardingActions.ts

141 lines
3.0 KiB
TypeScript
Raw Normal View History

2020-12-30 07:31:20 +00:00
import { ReduxActionTypes } from "constants/ReduxActionConstants";
2022-01-25 13:56:52 +00:00
import { GUIDED_TOUR_STEPS } from "pages/Editor/GuidedTour/constants";
import { WidgetProps } from "widgets/BaseWidget";
2020-12-30 07:31:20 +00:00
2022-01-25 13:56:52 +00:00
export const enableGuidedTour = (payload: boolean) => {
2020-12-30 07:31:20 +00:00
return {
2022-01-25 13:56:52 +00:00
type: ReduxActionTypes.ENABLE_GUIDED_TOUR,
2020-12-30 07:31:20 +00:00
payload,
};
};
2022-01-25 13:56:52 +00:00
export const toggleInOnboardingWidgetSelection = (payload: boolean) => {
2020-12-30 07:31:20 +00:00
return {
2022-01-25 13:56:52 +00:00
type: ReduxActionTypes.TOGGLE_ONBOARDING_WIDGET_SELECTION,
payload,
2020-12-30 07:31:20 +00:00
};
};
2022-01-25 13:56:52 +00:00
export const firstTimeUserOnboardingInit = (
applicationId: string,
pageId: string,
) => {
2020-12-30 07:31:20 +00:00
return {
2022-01-25 13:56:52 +00:00
type: ReduxActionTypes.FIRST_TIME_USER_ONBOARDING_INIT,
payload: {
applicationId: applicationId,
pageId: pageId,
},
};
};
export const markStepComplete = () => {
return {
type: ReduxActionTypes.GUIDED_TOUR_MARK_STEP_COMPLETED,
};
};
export const tableWidgetWasSelected = (payload: boolean) => {
return {
type: ReduxActionTypes.TABLE_WIDGET_WAS_SELECTED,
2020-12-30 07:31:20 +00:00
payload,
};
};
2022-01-25 13:56:52 +00:00
export const setCurrentStepInit = (payload: GUIDED_TOUR_STEPS) => {
2020-12-30 07:31:20 +00:00
return {
2022-01-25 13:56:52 +00:00
type: ReduxActionTypes.SET_CURRENT_STEP_INIT,
2020-12-30 07:31:20 +00:00
payload,
};
};
2022-01-25 13:56:52 +00:00
export const setCurrentStep = (payload: GUIDED_TOUR_STEPS) => {
return {
2022-01-25 13:56:52 +00:00
type: ReduxActionTypes.SET_CURRENT_STEP,
payload,
};
};
2022-01-25 13:56:52 +00:00
export const addOnboardingWidget = (payload: Partial<WidgetProps>) => {
return {
2022-01-25 13:56:52 +00:00
type: ReduxActionTypes.GUIDED_TOUR_ADD_WIDGET,
payload,
};
};
2022-01-25 13:56:52 +00:00
export const setUpTourApp = () => {
return {
type: ReduxActionTypes.SET_UP_TOUR_APP,
};
};
export const toggleLoader = (payload: boolean) => {
return {
2022-01-25 13:56:52 +00:00
type: ReduxActionTypes.GUIDED_TOUR_TOGGLE_LOADER,
payload,
};
};
2022-01-25 13:56:52 +00:00
export const toggleShowDeviationDialog = (payload: boolean) => {
return {
2022-01-25 13:56:52 +00:00
type: ReduxActionTypes.TOGGLE_DEVIATION_DIALOG,
payload,
};
};
2022-01-25 13:56:52 +00:00
export const toggleShowEndTourDialog = (payload: boolean) => {
return {
2022-01-25 13:56:52 +00:00
type: ReduxActionTypes.TOGGLE_END_GUIDED_TOUR_DIALOG,
payload,
};
};
2022-01-25 13:56:52 +00:00
export const showPostCompletionMessage = (payload: boolean) => {
return {
2022-01-25 13:56:52 +00:00
type: ReduxActionTypes.TOGGLE_END_GUIDED_TOUR_DIALOG,
payload,
};
};
2022-01-25 13:56:52 +00:00
export const forceShowContent = (payload: GUIDED_TOUR_STEPS) => {
return {
2022-01-25 13:56:52 +00:00
type: ReduxActionTypes.FORCE_SHOW_CONTENT,
payload,
};
};
2022-01-25 13:56:52 +00:00
export const updateButtonWidgetText = () => {
return {
2022-01-25 13:56:52 +00:00
type: ReduxActionTypes.UPDATE_BUTTON_WIDGET_TEXT,
};
};
export const showInfoMessage = () => {
return {
type: ReduxActionTypes.SHOW_INFO_MESSAGE,
};
};
export const focusWidget = (widgetName: string, propertyName?: string) => {
return {
type: ReduxActionTypes.GUIDED_TOUR_FOCUS_WIDGET,
payload: {
2022-01-25 13:56:52 +00:00
widgetName,
propertyName,
},
};
};
2022-01-25 13:56:52 +00:00
export const focusWidgetProperty = (widgetName: string) => {
return {
type: ReduxActionTypes.FOCUS_WIDGET_PROPERTY,
payload: widgetName,
};
};
export const onboardingCreateApplication = () => {
return {
type: ReduxActionTypes.ONBOARDING_CREATE_APPLICATION,
};
};