PromucFlow_constructor/app/client/src/sagas/OnboardingSagas.ts

442 lines
14 KiB
TypeScript
Raw Normal View History

2020-12-30 07:31:20 +00:00
import {
ReduxAction,
2020-12-30 07:31:20 +00:00
ReduxActionTypes,
WidgetReduxActionTypes,
2020-12-30 07:31:20 +00:00
} from "constants/ReduxActionConstants";
import {
all,
put,
select,
takeLatest,
2022-01-25 13:56:52 +00:00
delay,
call,
take,
2020-12-30 07:31:20 +00:00
} from "redux-saga/effects";
import {
2022-01-25 13:56:52 +00:00
setEnableFirstTimeUserOnboarding as storeEnableFirstTimeUserOnboarding,
setFirstTimeUserOnboardingApplicationId as storeFirstTimeUserOnboardingApplicationId,
setFirstTimeUserOnboardingIntroModalVisibility as storeFirstTimeUserOnboardingIntroModalVisibility,
} from "utils/storage";
import { getCurrentUser } from "selectors/usersSelectors";
import history from "utils/history";
import TourApp from "pages/Editor/GuidedTour/app.json";
import {
getFirstTimeUserOnboardingApplicationId,
2022-01-25 13:56:52 +00:00
getHadReachedStep,
getOnboardingOrganisations,
2022-01-25 13:56:52 +00:00
getQueryAction,
getTableWidget,
} from "selectors/onboardingSelectors";
2022-01-25 13:56:52 +00:00
import { Toaster } from "components/ads/Toast";
import { Variant } from "components/ads/common";
import { Organization } from "constants/orgConstants";
import {
2022-01-25 13:56:52 +00:00
enableGuidedTour,
focusWidgetProperty,
setCurrentStep,
toggleLoader,
} from "actions/onboardingActions";
import {
getCurrentApplicationId,
feat: adding slug names in urls (#10957) * Init commit clean urls * Changes to builder route * Refactored URLs * Remove default params from url builder functions. * Fixed more urls * Changed selector name * Minor url correction * Type fixes * Jest fixes * Fixed routing for old published apps * Fixed url slug replace * page-1 -> page1 as default page slug name * Remove application id from init editor calls * Use default page slug * Added comments and placeholder values for slug names * variable rename * Removed redirection and added back the old routes * Prevent page slug name recompute * Fixed home page load in view mode * Added null checks * Fixed jest test * Fixed jest test * Update URL slugs when app/page name changes * Added unit tests and updates types * Removed unused code * * Removed duplication fetch page call. * Fixes #11354 * Fixed sign up flow * Refactored initializeEditorSaga * Fixed warnings * Fixed integrations screen URL bugs * Cypress fixes * Fixed slug names in copy/move operations and pages screen * Minor refactor * Fixed page highlight bug in published apps * Added new url factory and middleware to store url params * Changed store to default export and fix unit tests * Fixed slugs unit test * Minor fixes * Fixes #11379 * Fixed set as home page feature * Updated types * app id adjustments for cypress * Fixed bad merge * Refactored routes to functional component * * Fixed EE active entity highlight. * Remove unused code in editor router. * jest fix * Mock history to prevent security errors * constant rename * Removed console logs * Fixed page id regex * Do not check for /pages in url * Fixed missing pageId on quick edit/deploy clicks * Missed files from previous commit * Fixed warnings * Fixed jest test * New api integration * feat: Add applicationVersion property to Application (#11626) Added a new property to Application object - applicationVersion. This property can be used to identity when there is a breaking change and can not be solved with migration. FE will use this property to detect such conditions. Another API is added to migrate the applicationVersion to latest version when user migrates the breaking changes. * Added manual upgrade modal. * Test fix * Fixed jest test * function rename * Fix deploy error * Added null check * Changes to persist URL search params when redirecting * Added updates tooltip * More unit test cases * Fixed git url redirection * Fix warning * Fixed evaluation on upgrade * Fixed warnings * File rename * Added cypress for clean urls * Fixed import/export/fork cypress * Cypress api server fixes * Fixed mongo spec * Fixed replay spec * Fixed comments spec * More cypress fixes * Fixed tooltip in update btn * Text size changes * Minor fixes * Jest test fix * Fixed type error * Fixed warnings * Fixed todo comments * Moved description to constants file * Fixed cypress CI run crash * Fixes git cypress failures * Import/Export cypress test fixes * Import export fork cypress fixes * Explorer test fix * Switch branch test fix * Added applicationVersion in export app json * Calls plugin forms in parallel * Fixed warnings * Fixed warning * Import export CI fixes * Reverts previous changes * Fixes import export * Fixed import export cypress URL verification * Pass applicationVersion when duplicating application * Cypress fix * Dummy commit Co-authored-by: Nayan <nayan@appsmith.com>
2022-03-25 10:43:26 +00:00
selectURLSlugs,
getCurrentPageId,
getIsEditorInitialized,
} from "selectors/editorSelectors";
2022-01-25 13:56:52 +00:00
import { WidgetProps } from "widgets/BaseWidget";
import { getNextWidgetName } from "./WidgetOperationUtils";
import WidgetFactory from "utils/WidgetFactory";
import { generateReactKey } from "utils/generators";
2022-01-25 13:56:52 +00:00
import { RenderModes } from "constants/WidgetConstants";
import log from "loglevel";
import { getDataTree } from "selectors/dataTreeSelectors";
import { getWidgets } from "./selectors";
import {
2022-01-25 13:56:52 +00:00
clearActionResponse,
setActionProperty,
} from "actions/pluginActionActions";
import { QueryAction } from "entities/Action";
import {
2022-01-25 13:56:52 +00:00
importApplication,
updateApplicationLayout,
} from "actions/applicationActions";
import { setPreviewModeAction } from "actions/editorActions";
import { FlattenedWidgetProps } from "widgets/constants";
import { ActionData } from "reducers/entityReducers/actionsReducer";
import { batchUpdateMultipleWidgetProperties } from "actions/controlActions";
import { setExplorerPinnedAction } from "actions/explorerActions";
import { selectWidgetInitAction } from "actions/widgetSelectionActions";
import { hideIndicator } from "pages/Editor/GuidedTour/utils";
import { updateWidgetName } from "actions/propertyPaneActions";
import AnalyticsUtil from "utils/AnalyticsUtil";
feat: adding slug names in urls (#10957) * Init commit clean urls * Changes to builder route * Refactored URLs * Remove default params from url builder functions. * Fixed more urls * Changed selector name * Minor url correction * Type fixes * Jest fixes * Fixed routing for old published apps * Fixed url slug replace * page-1 -> page1 as default page slug name * Remove application id from init editor calls * Use default page slug * Added comments and placeholder values for slug names * variable rename * Removed redirection and added back the old routes * Prevent page slug name recompute * Fixed home page load in view mode * Added null checks * Fixed jest test * Fixed jest test * Update URL slugs when app/page name changes * Added unit tests and updates types * Removed unused code * * Removed duplication fetch page call. * Fixes #11354 * Fixed sign up flow * Refactored initializeEditorSaga * Fixed warnings * Fixed integrations screen URL bugs * Cypress fixes * Fixed slug names in copy/move operations and pages screen * Minor refactor * Fixed page highlight bug in published apps * Added new url factory and middleware to store url params * Changed store to default export and fix unit tests * Fixed slugs unit test * Minor fixes * Fixes #11379 * Fixed set as home page feature * Updated types * app id adjustments for cypress * Fixed bad merge * Refactored routes to functional component * * Fixed EE active entity highlight. * Remove unused code in editor router. * jest fix * Mock history to prevent security errors * constant rename * Removed console logs * Fixed page id regex * Do not check for /pages in url * Fixed missing pageId on quick edit/deploy clicks * Missed files from previous commit * Fixed warnings * Fixed jest test * New api integration * feat: Add applicationVersion property to Application (#11626) Added a new property to Application object - applicationVersion. This property can be used to identity when there is a breaking change and can not be solved with migration. FE will use this property to detect such conditions. Another API is added to migrate the applicationVersion to latest version when user migrates the breaking changes. * Added manual upgrade modal. * Test fix * Fixed jest test * function rename * Fix deploy error * Added null check * Changes to persist URL search params when redirecting * Added updates tooltip * More unit test cases * Fixed git url redirection * Fix warning * Fixed evaluation on upgrade * Fixed warnings * File rename * Added cypress for clean urls * Fixed import/export/fork cypress * Cypress api server fixes * Fixed mongo spec * Fixed replay spec * Fixed comments spec * More cypress fixes * Fixed tooltip in update btn * Text size changes * Minor fixes * Jest test fix * Fixed type error * Fixed warnings * Fixed todo comments * Moved description to constants file * Fixed cypress CI run crash * Fixes git cypress failures * Import/Export cypress test fixes * Import export fork cypress fixes * Explorer test fix * Switch branch test fix * Added applicationVersion in export app json * Calls plugin forms in parallel * Fixed warnings * Fixed warning * Import export CI fixes * Reverts previous changes * Fixes import export * Fixed import export cypress URL verification * Pass applicationVersion when duplicating application * Cypress fix * Dummy commit Co-authored-by: Nayan <nayan@appsmith.com>
2022-03-25 10:43:26 +00:00
import { DataTree } from "entities/DataTree/dataTreeFactory";
import { builderURL, queryEditorIdURL } from "RouteBuilder";
import { GuidedTourEntityNames } from "pages/Editor/GuidedTour/constants";
import { navigateToCanvas } from "pages/Editor/Explorer/Widgets/utils";
function* createApplication() {
// If we are starting onboarding from the editor wait for the editor to reset.
const isEditorInitialised = yield select(getIsEditorInitialized);
let userOrgs: Organization[] = yield select(getOnboardingOrganisations);
if (isEditorInitialised) {
yield take(ReduxActionTypes.RESET_EDITOR_SUCCESS);
// If we haven't fetched the organisation list yet we wait for it to complete
// as we need an organisation where we create an application
if (!userOrgs.length) {
yield take(ReduxActionTypes.FETCH_USER_APPLICATIONS_ORGS_SUCCESS);
}
}
userOrgs = yield select(getOnboardingOrganisations);
2022-01-25 13:56:52 +00:00
const currentUser = yield select(getCurrentUser);
const currentOrganizationId = currentUser.currentOrganizationId;
let organization;
if (!currentOrganizationId) {
organization = userOrgs[0];
} else {
const filteredOrganizations = userOrgs.filter(
(org: any) => org.organization.id === currentOrganizationId,
);
organization = filteredOrganizations[0];
}
if (organization) {
2022-01-25 13:56:52 +00:00
const appFileObject = new File([JSON.stringify(TourApp)], "app.json", {
type: "application/json",
});
2022-01-25 13:56:52 +00:00
yield put(enableGuidedTour(true));
yield put(
importApplication({
orgId: organization.organization.id,
applicationFile: appFileObject,
}),
);
}
2022-01-25 13:56:52 +00:00
yield put(setPreviewModeAction(true));
}
2022-01-25 13:56:52 +00:00
function* setCurrentStepSaga(action: ReduxAction<number>) {
const hadReachedStep = yield select(getHadReachedStep);
// Log only once when we reach that step
if (action.payload > hadReachedStep) {
AnalyticsUtil.logEvent("GUIDED_TOUR_REACHED_STEP", {
step: action.payload,
});
2022-01-25 13:56:52 +00:00
}
2022-01-25 13:56:52 +00:00
yield put(setCurrentStep(action.payload));
}
2022-01-25 13:56:52 +00:00
function* setUpTourAppSaga() {
yield put(setPreviewModeAction(false));
// Delete the container widget
const widgets: { [widgetId: string]: FlattenedWidgetProps } = yield select(
getWidgets,
);
const containerWidget = Object.values(widgets).find(
(widget) => widget.type === "CONTAINER_WIDGET",
);
yield put({
type: WidgetReduxActionTypes.WIDGET_DELETE,
payload: {
widgetId: containerWidget?.widgetId,
parentId: containerWidget?.parentId,
disallowUndo: true,
},
});
2022-01-25 13:56:52 +00:00
yield delay(500);
const tableWidget = yield select(getTableWidget);
yield put(
batchUpdateMultipleWidgetProperties([
{
widgetId: tableWidget.widgetId,
updates: {
modify: {
tableData: "",
},
},
},
2022-01-25 13:56:52 +00:00
]),
);
// Update getCustomers query body
const query: ActionData | undefined = yield select(getQueryAction);
let body = (query?.config as QueryAction).actionConfiguration.body;
body = body?.replace("10", "20");
yield put(
setActionProperty({
actionId: query?.config.id ?? "",
propertyName: "actionConfiguration.body",
value: body,
}),
);
yield take(ReduxActionTypes.UPDATE_ACTION_SUCCESS);
yield put(clearActionResponse(query?.config.id ?? ""));
feat: adding slug names in urls (#10957) * Init commit clean urls * Changes to builder route * Refactored URLs * Remove default params from url builder functions. * Fixed more urls * Changed selector name * Minor url correction * Type fixes * Jest fixes * Fixed routing for old published apps * Fixed url slug replace * page-1 -> page1 as default page slug name * Remove application id from init editor calls * Use default page slug * Added comments and placeholder values for slug names * variable rename * Removed redirection and added back the old routes * Prevent page slug name recompute * Fixed home page load in view mode * Added null checks * Fixed jest test * Fixed jest test * Update URL slugs when app/page name changes * Added unit tests and updates types * Removed unused code * * Removed duplication fetch page call. * Fixes #11354 * Fixed sign up flow * Refactored initializeEditorSaga * Fixed warnings * Fixed integrations screen URL bugs * Cypress fixes * Fixed slug names in copy/move operations and pages screen * Minor refactor * Fixed page highlight bug in published apps * Added new url factory and middleware to store url params * Changed store to default export and fix unit tests * Fixed slugs unit test * Minor fixes * Fixes #11379 * Fixed set as home page feature * Updated types * app id adjustments for cypress * Fixed bad merge * Refactored routes to functional component * * Fixed EE active entity highlight. * Remove unused code in editor router. * jest fix * Mock history to prevent security errors * constant rename * Removed console logs * Fixed page id regex * Do not check for /pages in url * Fixed missing pageId on quick edit/deploy clicks * Missed files from previous commit * Fixed warnings * Fixed jest test * New api integration * feat: Add applicationVersion property to Application (#11626) Added a new property to Application object - applicationVersion. This property can be used to identity when there is a breaking change and can not be solved with migration. FE will use this property to detect such conditions. Another API is added to migrate the applicationVersion to latest version when user migrates the breaking changes. * Added manual upgrade modal. * Test fix * Fixed jest test * function rename * Fix deploy error * Added null check * Changes to persist URL search params when redirecting * Added updates tooltip * More unit test cases * Fixed git url redirection * Fix warning * Fixed evaluation on upgrade * Fixed warnings * File rename * Added cypress for clean urls * Fixed import/export/fork cypress * Cypress api server fixes * Fixed mongo spec * Fixed replay spec * Fixed comments spec * More cypress fixes * Fixed tooltip in update btn * Text size changes * Minor fixes * Jest test fix * Fixed type error * Fixed warnings * Fixed todo comments * Moved description to constants file * Fixed cypress CI run crash * Fixes git cypress failures * Import/Export cypress test fixes * Import export fork cypress fixes * Explorer test fix * Switch branch test fix * Added applicationVersion in export app json * Calls plugin forms in parallel * Fixed warnings * Fixed warning * Import export CI fixes * Reverts previous changes * Fixes import export * Fixed import export cypress URL verification * Pass applicationVersion when duplicating application * Cypress fix * Dummy commit Co-authored-by: Nayan <nayan@appsmith.com>
2022-03-25 10:43:26 +00:00
const applicationId: string = yield select(getCurrentApplicationId);
2022-01-25 13:56:52 +00:00
history.push(
feat: adding slug names in urls (#10957) * Init commit clean urls * Changes to builder route * Refactored URLs * Remove default params from url builder functions. * Fixed more urls * Changed selector name * Minor url correction * Type fixes * Jest fixes * Fixed routing for old published apps * Fixed url slug replace * page-1 -> page1 as default page slug name * Remove application id from init editor calls * Use default page slug * Added comments and placeholder values for slug names * variable rename * Removed redirection and added back the old routes * Prevent page slug name recompute * Fixed home page load in view mode * Added null checks * Fixed jest test * Fixed jest test * Update URL slugs when app/page name changes * Added unit tests and updates types * Removed unused code * * Removed duplication fetch page call. * Fixes #11354 * Fixed sign up flow * Refactored initializeEditorSaga * Fixed warnings * Fixed integrations screen URL bugs * Cypress fixes * Fixed slug names in copy/move operations and pages screen * Minor refactor * Fixed page highlight bug in published apps * Added new url factory and middleware to store url params * Changed store to default export and fix unit tests * Fixed slugs unit test * Minor fixes * Fixes #11379 * Fixed set as home page feature * Updated types * app id adjustments for cypress * Fixed bad merge * Refactored routes to functional component * * Fixed EE active entity highlight. * Remove unused code in editor router. * jest fix * Mock history to prevent security errors * constant rename * Removed console logs * Fixed page id regex * Do not check for /pages in url * Fixed missing pageId on quick edit/deploy clicks * Missed files from previous commit * Fixed warnings * Fixed jest test * New api integration * feat: Add applicationVersion property to Application (#11626) Added a new property to Application object - applicationVersion. This property can be used to identity when there is a breaking change and can not be solved with migration. FE will use this property to detect such conditions. Another API is added to migrate the applicationVersion to latest version when user migrates the breaking changes. * Added manual upgrade modal. * Test fix * Fixed jest test * function rename * Fix deploy error * Added null check * Changes to persist URL search params when redirecting * Added updates tooltip * More unit test cases * Fixed git url redirection * Fix warning * Fixed evaluation on upgrade * Fixed warnings * File rename * Added cypress for clean urls * Fixed import/export/fork cypress * Cypress api server fixes * Fixed mongo spec * Fixed replay spec * Fixed comments spec * More cypress fixes * Fixed tooltip in update btn * Text size changes * Minor fixes * Jest test fix * Fixed type error * Fixed warnings * Fixed todo comments * Moved description to constants file * Fixed cypress CI run crash * Fixes git cypress failures * Import/Export cypress test fixes * Import export fork cypress fixes * Explorer test fix * Switch branch test fix * Added applicationVersion in export app json * Calls plugin forms in parallel * Fixed warnings * Fixed warning * Import export CI fixes * Reverts previous changes * Fixes import export * Fixed import export cypress URL verification * Pass applicationVersion when duplicating application * Cypress fix * Dummy commit Co-authored-by: Nayan <nayan@appsmith.com>
2022-03-25 10:43:26 +00:00
queryEditorIdURL({
pageId: query?.config.pageId ?? "",
queryId: query?.config.id ?? "",
}),
2022-01-25 13:56:52 +00:00
);
yield put(
updateApplicationLayout(applicationId || "", {
appLayout: {
type: "DESKTOP",
},
2022-01-25 13:56:52 +00:00
}),
);
// Hide the explorer initialy
yield put(setExplorerPinnedAction(false));
yield put(toggleLoader(false));
}
2022-01-25 13:56:52 +00:00
function* addOnboardingWidget(action: ReduxAction<Partial<WidgetProps>>) {
const widgetConfig = action.payload;
2022-01-25 13:56:52 +00:00
if (!widgetConfig.type) return;
2022-01-25 13:56:52 +00:00
const defaultConfig = WidgetFactory.widgetConfigMap.get(widgetConfig.type);
feat: adding slug names in urls (#10957) * Init commit clean urls * Changes to builder route * Refactored URLs * Remove default params from url builder functions. * Fixed more urls * Changed selector name * Minor url correction * Type fixes * Jest fixes * Fixed routing for old published apps * Fixed url slug replace * page-1 -> page1 as default page slug name * Remove application id from init editor calls * Use default page slug * Added comments and placeholder values for slug names * variable rename * Removed redirection and added back the old routes * Prevent page slug name recompute * Fixed home page load in view mode * Added null checks * Fixed jest test * Fixed jest test * Update URL slugs when app/page name changes * Added unit tests and updates types * Removed unused code * * Removed duplication fetch page call. * Fixes #11354 * Fixed sign up flow * Refactored initializeEditorSaga * Fixed warnings * Fixed integrations screen URL bugs * Cypress fixes * Fixed slug names in copy/move operations and pages screen * Minor refactor * Fixed page highlight bug in published apps * Added new url factory and middleware to store url params * Changed store to default export and fix unit tests * Fixed slugs unit test * Minor fixes * Fixes #11379 * Fixed set as home page feature * Updated types * app id adjustments for cypress * Fixed bad merge * Refactored routes to functional component * * Fixed EE active entity highlight. * Remove unused code in editor router. * jest fix * Mock history to prevent security errors * constant rename * Removed console logs * Fixed page id regex * Do not check for /pages in url * Fixed missing pageId on quick edit/deploy clicks * Missed files from previous commit * Fixed warnings * Fixed jest test * New api integration * feat: Add applicationVersion property to Application (#11626) Added a new property to Application object - applicationVersion. This property can be used to identity when there is a breaking change and can not be solved with migration. FE will use this property to detect such conditions. Another API is added to migrate the applicationVersion to latest version when user migrates the breaking changes. * Added manual upgrade modal. * Test fix * Fixed jest test * function rename * Fix deploy error * Added null check * Changes to persist URL search params when redirecting * Added updates tooltip * More unit test cases * Fixed git url redirection * Fix warning * Fixed evaluation on upgrade * Fixed warnings * File rename * Added cypress for clean urls * Fixed import/export/fork cypress * Cypress api server fixes * Fixed mongo spec * Fixed replay spec * Fixed comments spec * More cypress fixes * Fixed tooltip in update btn * Text size changes * Minor fixes * Jest test fix * Fixed type error * Fixed warnings * Fixed todo comments * Moved description to constants file * Fixed cypress CI run crash * Fixes git cypress failures * Import/Export cypress test fixes * Import export fork cypress fixes * Explorer test fix * Switch branch test fix * Added applicationVersion in export app json * Calls plugin forms in parallel * Fixed warnings * Fixed warning * Import export CI fixes * Reverts previous changes * Fixes import export * Fixed import export cypress URL verification * Pass applicationVersion when duplicating application * Cypress fix * Dummy commit Co-authored-by: Nayan <nayan@appsmith.com>
2022-03-25 10:43:26 +00:00
const evalTree: DataTree = yield select(getDataTree);
2022-01-25 13:56:52 +00:00
const widgets = yield select(getWidgets);
2022-01-25 13:56:52 +00:00
const widgetName = getNextWidgetName(widgets, widgetConfig.type, evalTree, {
prefix: widgetConfig.widgetName,
});
try {
const newWidget = {
newWidgetId: generateReactKey(),
widgetId: "0",
parentId: "0",
renderMode: RenderModes.CANVAS,
isLoading: false,
2022-01-25 13:56:52 +00:00
...defaultConfig,
widgetName,
...widgetConfig,
};
yield put({
type: WidgetReduxActionTypes.WIDGET_ADD_CHILD,
payload: newWidget,
});
2022-01-25 13:56:52 +00:00
// Wait for widget names to be updated
// Updating widget names here as widget blueprints don't take widget names
yield take(ReduxActionTypes.SAVE_PAGE_SUCCESS);
const widgets: { [widgetId: string]: FlattenedWidgetProps } = yield select(
getWidgets,
);
2022-01-25 13:56:52 +00:00
const nameInput = Object.values(widgets).find(
(widget) => widget.widgetName === "Input1",
);
const emailInput = Object.values(widgets).find(
(widget) => widget.widgetName === "Input2",
);
const countryInput = Object.values(widgets).find(
(widget) => widget.widgetName === "Input3",
);
const imageWidget = Object.values(widgets).find(
(widget) => widget.widgetName === "Image1",
);
2022-01-25 13:56:52 +00:00
if (nameInput && emailInput && countryInput && imageWidget) {
yield put(updateWidgetName(nameInput.widgetId, "NameInput"));
yield take(ReduxActionTypes.FETCH_PAGE_DSL_SUCCESS);
yield put(updateWidgetName(emailInput.widgetId, "EmailInput"));
yield take(ReduxActionTypes.FETCH_PAGE_DSL_SUCCESS);
yield put(updateWidgetName(countryInput.widgetId, "CountryInput"));
yield take(ReduxActionTypes.FETCH_PAGE_DSL_SUCCESS);
yield put(updateWidgetName(imageWidget.widgetId, "ImageWidget"));
}
2022-01-25 13:56:52 +00:00
} catch (error) {
log.error(error);
}
}
2022-01-25 13:56:52 +00:00
// Update button widget text
function* updateWidgetTextSaga() {
const widgets: { [widgetId: string]: FlattenedWidgetProps } = yield select(
getWidgets,
);
const buttonWidget = Object.values(widgets).find(
(widget) => widget.type === "BUTTON_WIDGET",
);
if (buttonWidget) {
yield put(
2022-01-25 13:56:52 +00:00
batchUpdateMultipleWidgetProperties([
{
widgetId: buttonWidget.widgetId,
updates: {
modify: {
text: "Click to Update",
rightColumn: buttonWidget.leftColumn + 24,
bottomRow: buttonWidget.topRow + 5,
widgetName: GuidedTourEntityNames.BUTTON_WIDGET,
2022-01-25 13:56:52 +00:00
},
},
},
]),
);
}
}
2022-01-25 13:56:52 +00:00
function* focusWidgetPropertySaga(action: ReduxAction<string>) {
const input: HTMLElement | null = document.querySelector(
`[data-guided-tour-iid=${action.payload}] .CodeEditorTarget textarea`,
);
input?.focus();
}
2022-01-25 13:56:52 +00:00
function* endGuidedTourSaga(action: ReduxAction<boolean>) {
if (!action.payload) {
yield call(hideIndicator);
}
}
2022-01-25 13:56:52 +00:00
function* selectWidgetSaga(
action: ReduxAction<{ widgetName: string; propertyName?: string }>,
) {
const widgets: { [widgetId: string]: FlattenedWidgetProps } = yield select(
getWidgets,
);
const pageId = yield select(getCurrentPageId);
2022-01-25 13:56:52 +00:00
const widget = Object.values(widgets).find((widget) => {
return widget.widgetName === action.payload.widgetName;
});
2022-01-25 13:56:52 +00:00
if (widget) {
// Navigate to the widget as well, usefull especially when we are not on the canvas
feat: adding slug names in urls (#10957) * Init commit clean urls * Changes to builder route * Refactored URLs * Remove default params from url builder functions. * Fixed more urls * Changed selector name * Minor url correction * Type fixes * Jest fixes * Fixed routing for old published apps * Fixed url slug replace * page-1 -> page1 as default page slug name * Remove application id from init editor calls * Use default page slug * Added comments and placeholder values for slug names * variable rename * Removed redirection and added back the old routes * Prevent page slug name recompute * Fixed home page load in view mode * Added null checks * Fixed jest test * Fixed jest test * Update URL slugs when app/page name changes * Added unit tests and updates types * Removed unused code * * Removed duplication fetch page call. * Fixes #11354 * Fixed sign up flow * Refactored initializeEditorSaga * Fixed warnings * Fixed integrations screen URL bugs * Cypress fixes * Fixed slug names in copy/move operations and pages screen * Minor refactor * Fixed page highlight bug in published apps * Added new url factory and middleware to store url params * Changed store to default export and fix unit tests * Fixed slugs unit test * Minor fixes * Fixes #11379 * Fixed set as home page feature * Updated types * app id adjustments for cypress * Fixed bad merge * Refactored routes to functional component * * Fixed EE active entity highlight. * Remove unused code in editor router. * jest fix * Mock history to prevent security errors * constant rename * Removed console logs * Fixed page id regex * Do not check for /pages in url * Fixed missing pageId on quick edit/deploy clicks * Missed files from previous commit * Fixed warnings * Fixed jest test * New api integration * feat: Add applicationVersion property to Application (#11626) Added a new property to Application object - applicationVersion. This property can be used to identity when there is a breaking change and can not be solved with migration. FE will use this property to detect such conditions. Another API is added to migrate the applicationVersion to latest version when user migrates the breaking changes. * Added manual upgrade modal. * Test fix * Fixed jest test * function rename * Fix deploy error * Added null check * Changes to persist URL search params when redirecting * Added updates tooltip * More unit test cases * Fixed git url redirection * Fix warning * Fixed evaluation on upgrade * Fixed warnings * File rename * Added cypress for clean urls * Fixed import/export/fork cypress * Cypress api server fixes * Fixed mongo spec * Fixed replay spec * Fixed comments spec * More cypress fixes * Fixed tooltip in update btn * Text size changes * Minor fixes * Jest test fix * Fixed type error * Fixed warnings * Fixed todo comments * Moved description to constants file * Fixed cypress CI run crash * Fixes git cypress failures * Import/Export cypress test fixes * Import export fork cypress fixes * Explorer test fix * Switch branch test fix * Added applicationVersion in export app json * Calls plugin forms in parallel * Fixed warnings * Fixed warning * Import export CI fixes * Reverts previous changes * Fixes import export * Fixed import export cypress URL verification * Pass applicationVersion when duplicating application * Cypress fix * Dummy commit Co-authored-by: Nayan <nayan@appsmith.com>
2022-03-25 10:43:26 +00:00
navigateToCanvas({ pageId, widgetId: widget.widgetId });
2022-01-25 13:56:52 +00:00
yield put(selectWidgetInitAction(widget.widgetId));
// Delay to wait for the fields to render
yield delay(1000);
// If the propertyName exist then we focus the respective input field as well
if (action.payload.propertyName)
yield put(focusWidgetProperty(action.payload.propertyName));
}
}
2022-01-25 13:56:52 +00:00
// Signposting sagas
function* setEnableFirstTimeUserOnboarding(action: ReduxAction<boolean>) {
yield storeEnableFirstTimeUserOnboarding(action.payload);
}
function* setFirstTimeUserOnboardingApplicationId(action: ReduxAction<string>) {
yield storeFirstTimeUserOnboardingApplicationId(action.payload);
}
function* setFirstTimeUserOnboardingIntroModalVisibility(
action: ReduxAction<boolean>,
) {
yield storeFirstTimeUserOnboardingIntroModalVisibility(action.payload);
}
function* endFirstTimeUserOnboardingSaga() {
feat: adding slug names in urls (#10957) * Init commit clean urls * Changes to builder route * Refactored URLs * Remove default params from url builder functions. * Fixed more urls * Changed selector name * Minor url correction * Type fixes * Jest fixes * Fixed routing for old published apps * Fixed url slug replace * page-1 -> page1 as default page slug name * Remove application id from init editor calls * Use default page slug * Added comments and placeholder values for slug names * variable rename * Removed redirection and added back the old routes * Prevent page slug name recompute * Fixed home page load in view mode * Added null checks * Fixed jest test * Fixed jest test * Update URL slugs when app/page name changes * Added unit tests and updates types * Removed unused code * * Removed duplication fetch page call. * Fixes #11354 * Fixed sign up flow * Refactored initializeEditorSaga * Fixed warnings * Fixed integrations screen URL bugs * Cypress fixes * Fixed slug names in copy/move operations and pages screen * Minor refactor * Fixed page highlight bug in published apps * Added new url factory and middleware to store url params * Changed store to default export and fix unit tests * Fixed slugs unit test * Minor fixes * Fixes #11379 * Fixed set as home page feature * Updated types * app id adjustments for cypress * Fixed bad merge * Refactored routes to functional component * * Fixed EE active entity highlight. * Remove unused code in editor router. * jest fix * Mock history to prevent security errors * constant rename * Removed console logs * Fixed page id regex * Do not check for /pages in url * Fixed missing pageId on quick edit/deploy clicks * Missed files from previous commit * Fixed warnings * Fixed jest test * New api integration * feat: Add applicationVersion property to Application (#11626) Added a new property to Application object - applicationVersion. This property can be used to identity when there is a breaking change and can not be solved with migration. FE will use this property to detect such conditions. Another API is added to migrate the applicationVersion to latest version when user migrates the breaking changes. * Added manual upgrade modal. * Test fix * Fixed jest test * function rename * Fix deploy error * Added null check * Changes to persist URL search params when redirecting * Added updates tooltip * More unit test cases * Fixed git url redirection * Fix warning * Fixed evaluation on upgrade * Fixed warnings * File rename * Added cypress for clean urls * Fixed import/export/fork cypress * Cypress api server fixes * Fixed mongo spec * Fixed replay spec * Fixed comments spec * More cypress fixes * Fixed tooltip in update btn * Text size changes * Minor fixes * Jest test fix * Fixed type error * Fixed warnings * Fixed todo comments * Moved description to constants file * Fixed cypress CI run crash * Fixes git cypress failures * Import/Export cypress test fixes * Import export fork cypress fixes * Explorer test fix * Switch branch test fix * Added applicationVersion in export app json * Calls plugin forms in parallel * Fixed warnings * Fixed warning * Import export CI fixes * Reverts previous changes * Fixes import export * Fixed import export cypress URL verification * Pass applicationVersion when duplicating application * Cypress fix * Dummy commit Co-authored-by: Nayan <nayan@appsmith.com>
2022-03-25 10:43:26 +00:00
const firstTimeUserExperienceAppId: string = yield select(
getFirstTimeUserOnboardingApplicationId,
);
yield put({
type: ReduxActionTypes.SET_ENABLE_FIRST_TIME_USER_ONBOARDING,
payload: false,
});
yield put({
type: ReduxActionTypes.SET_FIRST_TIME_USER_ONBOARDING_APPLICATION_ID,
payload: "",
});
Toaster.show({
text: "Skipped First time user experience",
hideProgressBar: false,
variant: Variant.success,
dispatchableAction: {
type: ReduxActionTypes.UNDO_END_FIRST_TIME_USER_ONBOARDING,
payload: firstTimeUserExperienceAppId,
},
});
}
function* undoEndFirstTimeUserOnboardingSaga(action: ReduxAction<string>) {
yield put({
type: ReduxActionTypes.SET_ENABLE_FIRST_TIME_USER_ONBOARDING,
payload: true,
});
yield put({
type: ReduxActionTypes.SET_FIRST_TIME_USER_ONBOARDING_APPLICATION_ID,
payload: action.payload,
});
}
function* firstTimeUserOnboardingInitSaga(
action: ReduxAction<{ applicationId: string; pageId: string }>,
) {
yield put({
type: ReduxActionTypes.SET_ENABLE_FIRST_TIME_USER_ONBOARDING,
payload: true,
});
yield put({
type: ReduxActionTypes.SET_FIRST_TIME_USER_ONBOARDING_APPLICATION_ID,
payload: action.payload.applicationId,
});
yield put({
type: ReduxActionTypes.SET_SHOW_FIRST_TIME_USER_ONBOARDING_MODAL,
payload: true,
});
feat: adding slug names in urls (#10957) * Init commit clean urls * Changes to builder route * Refactored URLs * Remove default params from url builder functions. * Fixed more urls * Changed selector name * Minor url correction * Type fixes * Jest fixes * Fixed routing for old published apps * Fixed url slug replace * page-1 -> page1 as default page slug name * Remove application id from init editor calls * Use default page slug * Added comments and placeholder values for slug names * variable rename * Removed redirection and added back the old routes * Prevent page slug name recompute * Fixed home page load in view mode * Added null checks * Fixed jest test * Fixed jest test * Update URL slugs when app/page name changes * Added unit tests and updates types * Removed unused code * * Removed duplication fetch page call. * Fixes #11354 * Fixed sign up flow * Refactored initializeEditorSaga * Fixed warnings * Fixed integrations screen URL bugs * Cypress fixes * Fixed slug names in copy/move operations and pages screen * Minor refactor * Fixed page highlight bug in published apps * Added new url factory and middleware to store url params * Changed store to default export and fix unit tests * Fixed slugs unit test * Minor fixes * Fixes #11379 * Fixed set as home page feature * Updated types * app id adjustments for cypress * Fixed bad merge * Refactored routes to functional component * * Fixed EE active entity highlight. * Remove unused code in editor router. * jest fix * Mock history to prevent security errors * constant rename * Removed console logs * Fixed page id regex * Do not check for /pages in url * Fixed missing pageId on quick edit/deploy clicks * Missed files from previous commit * Fixed warnings * Fixed jest test * New api integration * feat: Add applicationVersion property to Application (#11626) Added a new property to Application object - applicationVersion. This property can be used to identity when there is a breaking change and can not be solved with migration. FE will use this property to detect such conditions. Another API is added to migrate the applicationVersion to latest version when user migrates the breaking changes. * Added manual upgrade modal. * Test fix * Fixed jest test * function rename * Fix deploy error * Added null check * Changes to persist URL search params when redirecting * Added updates tooltip * More unit test cases * Fixed git url redirection * Fix warning * Fixed evaluation on upgrade * Fixed warnings * File rename * Added cypress for clean urls * Fixed import/export/fork cypress * Cypress api server fixes * Fixed mongo spec * Fixed replay spec * Fixed comments spec * More cypress fixes * Fixed tooltip in update btn * Text size changes * Minor fixes * Jest test fix * Fixed type error * Fixed warnings * Fixed todo comments * Moved description to constants file * Fixed cypress CI run crash * Fixes git cypress failures * Import/Export cypress test fixes * Import export fork cypress fixes * Explorer test fix * Switch branch test fix * Added applicationVersion in export app json * Calls plugin forms in parallel * Fixed warnings * Fixed warning * Import export CI fixes * Reverts previous changes * Fixes import export * Fixed import export cypress URL verification * Pass applicationVersion when duplicating application * Cypress fix * Dummy commit Co-authored-by: Nayan <nayan@appsmith.com>
2022-03-25 10:43:26 +00:00
const { applicationSlug, pageSlug } = yield select(selectURLSlugs);
history.replace(
feat: adding slug names in urls (#10957) * Init commit clean urls * Changes to builder route * Refactored URLs * Remove default params from url builder functions. * Fixed more urls * Changed selector name * Minor url correction * Type fixes * Jest fixes * Fixed routing for old published apps * Fixed url slug replace * page-1 -> page1 as default page slug name * Remove application id from init editor calls * Use default page slug * Added comments and placeholder values for slug names * variable rename * Removed redirection and added back the old routes * Prevent page slug name recompute * Fixed home page load in view mode * Added null checks * Fixed jest test * Fixed jest test * Update URL slugs when app/page name changes * Added unit tests and updates types * Removed unused code * * Removed duplication fetch page call. * Fixes #11354 * Fixed sign up flow * Refactored initializeEditorSaga * Fixed warnings * Fixed integrations screen URL bugs * Cypress fixes * Fixed slug names in copy/move operations and pages screen * Minor refactor * Fixed page highlight bug in published apps * Added new url factory and middleware to store url params * Changed store to default export and fix unit tests * Fixed slugs unit test * Minor fixes * Fixes #11379 * Fixed set as home page feature * Updated types * app id adjustments for cypress * Fixed bad merge * Refactored routes to functional component * * Fixed EE active entity highlight. * Remove unused code in editor router. * jest fix * Mock history to prevent security errors * constant rename * Removed console logs * Fixed page id regex * Do not check for /pages in url * Fixed missing pageId on quick edit/deploy clicks * Missed files from previous commit * Fixed warnings * Fixed jest test * New api integration * feat: Add applicationVersion property to Application (#11626) Added a new property to Application object - applicationVersion. This property can be used to identity when there is a breaking change and can not be solved with migration. FE will use this property to detect such conditions. Another API is added to migrate the applicationVersion to latest version when user migrates the breaking changes. * Added manual upgrade modal. * Test fix * Fixed jest test * function rename * Fix deploy error * Added null check * Changes to persist URL search params when redirecting * Added updates tooltip * More unit test cases * Fixed git url redirection * Fix warning * Fixed evaluation on upgrade * Fixed warnings * File rename * Added cypress for clean urls * Fixed import/export/fork cypress * Cypress api server fixes * Fixed mongo spec * Fixed replay spec * Fixed comments spec * More cypress fixes * Fixed tooltip in update btn * Text size changes * Minor fixes * Jest test fix * Fixed type error * Fixed warnings * Fixed todo comments * Moved description to constants file * Fixed cypress CI run crash * Fixes git cypress failures * Import/Export cypress test fixes * Import export fork cypress fixes * Explorer test fix * Switch branch test fix * Added applicationVersion in export app json * Calls plugin forms in parallel * Fixed warnings * Fixed warning * Import export CI fixes * Reverts previous changes * Fixes import export * Fixed import export cypress URL verification * Pass applicationVersion when duplicating application * Cypress fix * Dummy commit Co-authored-by: Nayan <nayan@appsmith.com>
2022-03-25 10:43:26 +00:00
builderURL({
applicationSlug,
pageSlug,
pageId: action.payload.pageId,
}),
);
}
2022-01-25 13:56:52 +00:00
export default function* onboardingActionSagas() {
2020-12-30 07:31:20 +00:00
yield all([
takeLatest(
ReduxActionTypes.ONBOARDING_CREATE_APPLICATION,
createApplication,
),
2022-01-25 13:56:52 +00:00
takeLatest(ReduxActionTypes.SET_UP_TOUR_APP, setUpTourAppSaga),
takeLatest(ReduxActionTypes.GUIDED_TOUR_ADD_WIDGET, addOnboardingWidget),
takeLatest(ReduxActionTypes.SET_CURRENT_STEP_INIT, setCurrentStepSaga),
takeLatest(
ReduxActionTypes.UPDATE_BUTTON_WIDGET_TEXT,
updateWidgetTextSaga,
),
takeLatest(ReduxActionTypes.ENABLE_GUIDED_TOUR, endGuidedTourSaga),
takeLatest(ReduxActionTypes.GUIDED_TOUR_FOCUS_WIDGET, selectWidgetSaga),
takeLatest(ReduxActionTypes.FOCUS_WIDGET_PROPERTY, focusWidgetPropertySaga),
takeLatest(
ReduxActionTypes.SET_ENABLE_FIRST_TIME_USER_ONBOARDING,
setEnableFirstTimeUserOnboarding,
),
takeLatest(
ReduxActionTypes.SET_FIRST_TIME_USER_ONBOARDING_APPLICATION_ID,
setFirstTimeUserOnboardingApplicationId,
),
takeLatest(
ReduxActionTypes.SET_SHOW_FIRST_TIME_USER_ONBOARDING_MODAL,
setFirstTimeUserOnboardingIntroModalVisibility,
),
takeLatest(
ReduxActionTypes.END_FIRST_TIME_USER_ONBOARDING,
endFirstTimeUserOnboardingSaga,
),
takeLatest(
ReduxActionTypes.UNDO_END_FIRST_TIME_USER_ONBOARDING,
undoEndFirstTimeUserOnboardingSaga,
),
takeLatest(
ReduxActionTypes.FIRST_TIME_USER_ONBOARDING_INIT,
firstTimeUserOnboardingInitSaga,
),
2020-12-30 07:31:20 +00:00
]);
}