PromucFlow_constructor/app/client/src/utils/AnalyticsUtil.tsx

317 lines
8.7 KiB
TypeScript
Raw Normal View History

2020-03-03 07:02:53 +00:00
// Events
import * as log from "loglevel";
2020-05-28 18:10:26 +00:00
import FeatureFlag from "./featureFlags";
import smartlookClient from "smartlook-client";
import { getAppsmithConfigs } from "configs";
import * as Sentry from "@sentry/react";
import { ANONYMOUS_USERNAME, User } from "../constants/userConstants";
import { sha256 } from "js-sha256";
export type EventLocation =
| "LIGHTNING_MENU"
| "API_PANE"
| "QUERY_PANE"
[Feature] Unified New Nav (#5558) * temp commit * using onsubmit to continue using action on form * added recaptcha site key to env example file * moved the recaptcha lib loading logic to signup page * removed unnecessary edit * handle the case where the recaptcha token is not provided as env var * added proper env var config for client * recaptcha config for ansible * recaptcha config for heroku * recaptcha config for k8s * updated app.json * fixed the typos * added more description for env vars * removed api key * minor typo fix * added new integration button * updated the add int default link * added active and create new tabs * added the empty components to tabs. will control the section manually. * added proper grid for integrations page * added vertical tabs * Added secondary tabs to integrations page * added separate page for new apis * classname changes * added new components for active queries, new queries etc. * added a separate component for data source list * adding screen component conditionally, to be showing upon user's choice * 1. Added grid styling to datasource home 2. Added connect buttons to em * fixed data source security banner * updated the styling for new api page * added tertiary menu for active integrations * updated styling for active connections * updated collapse component to work properly * added show more option to active data sources * Slash commands feature init commit * Added more commands * Introduced JSX to render custom commands * Merge conflict fix * Spacing changes * removed apis/db tabs and replaced em with integrations tab * removed the unnecessary + integrations btn * Added slash commands button * Adjust styles for better ui * Ordered the action entries under integrations * Added new datasource command * updated the getURL with proper params * updated the link of create datasource btn * updated the back btn link from data source editor * Show connect data cta in property pane * Styling fixes * Fix margin * added scrollable content to create new * added on click scroll to create new page * fixed a bug, creating new datasource twice * added new action creator for integrations. * Minor changes to add new bindings command. Changed ui behaviour of / button * UI style change * updated the query editor to match the over all theme * updated the query editor tabs * Added the run btn to empty response screens * minor fix * updated the bg color of api type drop down * updated the url being visited after delete api/query * removed log * Insert binding command UI change * More UI changes * removed unnecessary junk from integrations editor index * clean up, removed unnecessary files * removed useless routes * for debugger only checking if integrations editor * Removed all the links for api/query home pages * Move command actions to a saga Added support to binding the data back to the widget when are new API is created from widget * Added reverse binding for DB queries * Show / button only on hover * not routing to integrations on create query/api * Hide actions from suggestions in action pages * removed the query/datasource/api home pages * Changes widget.data to widget in slash commands * Show dependencies in property pane * Fix warning * fixed scrolling issue * will show a list of queries and apis for action picker * showing icons for each action under integrations * Fix dropdown not showing up * Minor refactoring. Changed commands * added a way to list data sources in action creators * Update query page url * cam show icons for datasources * Removed unused code * Feature/slash commands (#5002) * Slash commands feature init commit * Added more commands * Introduced JSX to render custom commands * Merge conflict fix * Spacing changes * Added slash commands button * Adjust styles for better ui * Added new datasource command * Minor changes to add new bindings command. Changed ui behaviour of / button * UI style change * Insert binding command UI change * More UI changes * Move command actions to a saga Added support to binding the data back to the widget when are new API is created from widget * Added reverse binding for DB queries * Show / button only on hover * Hide actions from suggestions in action pages * Changes widget.data to widget in slash commands * Minor refactoring. Changed commands * Removed unused code * remove more unusued code * Added support to generate new api from a datasource in quick commands * Code correction to use types * Refactored commands code * Minor bug fixes * Remove new integrations command for actions. Fixed autocomplete not showing up * Changes to prevent autocomplete trigger for navigation commands * Prevent hinter execution when show hint is open already. * Show hinter on focus * Update text to be called in the omnibar * updated the copy for empty active datasources * Update url * Fix text decoration * updated the redirection for back btns * Use themes * Add cypress test * fixed back btn nav * fetching form configs for datasources * a callback fixed * Fix slash command not executed on click (#5540) * Replace the value if not a string else append * Log commands menu events * updated mock data base navigation * updated mock data base navigation * updated the close editors and back buttons * All back btns from editors will go back to data sources and back from data source will go back to canvas * fixed bg colors * minor styled updates * removed margin from header of generic datasource * warnings fixes * If user is already on the location not redirecting em * when editing, will check if the coming from data source and redirect accordingly * updated redirection for newly created api/queries * updated back btn for newly created datasources * back for new curl goes to data sources * Revert "[Fix] revert new nav (#5533)" This reverts commit 1647815d * remaining original reverted chagnes * fixed the width of incoming/outgoing entity bar in property pane * removing residue from resolved merge conflicts * Fix widget icons not visible in dropdown menu * minor fix to use proper integration URL * updated the URLs for unified datasources * converted back and close to btns from banners * on accessing data source from sidebar, it'll always go to view mode * updated the edit path for saas editors * Added saved state for google sheet * on google sheet delete redirecting to create new * minor fix * fixed the redirection call on saving a datasource * removed save and test cmd as it wasn't needed * Removing test cases to be fixed by Arun * commenting more tests to be fixed by Arun * updated call api cy command * Fix extra margin issue * fixed the update datasource saga * fixed video spec * Revert "commenting more tests to be fixed by Arun" This reverts commit 42087a95ad77107401a1619e4c2d4c541a81d6c3. * Revert "Removing test cases to be fixed by Arun" This reverts commit f6fad67e558d22045114a90409428ef9b737478f. * fixed the entity explorer query datasource spec * cautious fix * update widget locators * fixed leave org test * fixes for FormWidgets * updated the image spec * Use memo * Fix debugger url checks * for copy and delete widget pointing directly to svgs * Fix entity text * Fix styling and show tooltip for property pane dependencies * removed the unnecessary callback * added a separate saga to to redirect to new integrations using onSuccess * Bug Fixes - New nav (#5629) * will show scrollbar only on hover * made mock data cards clickable * fixed the grid view * fixed the cursor position when clicking on / btn * updated the hint for `/` command * binding prompt will close on focus change * hiding / command for api body * hiding / command for query pane * Added 2 new icons * Fix cursor position on selecting a binding and clicking on the slash menu button * trying out fix to copyWidget cy command * removing zero width space characters from the property pane text Co-authored-by: arunvjn <arun@appsmith.com> Co-authored-by: Akash N <akash@codemonk.in> Co-authored-by: arunvjn <32433245+arunvjn@users.noreply.github.com> Co-authored-by: Rishabh Saxena <rishabh.robben@gmail.com>
2021-07-07 03:46:16 +00:00
| "QUERY_TEMPLATE"
| "QUICK_COMMANDS";
2019-09-09 09:08:54 +00:00
export type EventName =
2020-03-11 13:59:46 +00:00
| "LOGIN_CLICK"
| "SIGNUP_CLICK"
2019-09-09 09:08:54 +00:00
| "PAGE_VIEW"
| "ADD_COMPONENT"
| "DELETE_COMPONENT"
2020-03-03 07:02:53 +00:00
| "RESIZE_COMPONENT"
| "WIDGET_DRAG"
| "WIDGET_DROP"
| "WIDGET_DELETE"
| "WIDGET_RESIZE_START"
| "WIDGET_RESIZE_END"
| "WIDGET_PROPERTY_UPDATE"
| "WIDGET_TOGGLE_JS_PROP"
| "WIDGET_CARD_DRAG"
| "WIDGET_CARD_DROP"
| "CREATE_PAGE"
| "PAGE_RENAME"
| "PAGE_SWITCH"
2020-03-06 04:59:24 +00:00
| "DELETE_PAGE"
| "SIDEBAR_NAVIGATION"
| "PUBLISH_APP"
| "PREVIEW_APP"
| "EDITOR_OPEN"
| "CREATE_ACTION"
Introducing Google Sheets Plugin (#3517) * cherry pick -make new * revert to enable fix from release * attempt to hook into existing datasource editor * gSheets plugin skeleton from Rest API * Changes for database migration * fix for auth code * separate it out * action page loads! * add to explorer * create action from datasource * Editor JSON WIP * working query form * Editor JSON WIP * import to * fix toast message * redirect from datasource and editor pages * fix onboarding * fix imports and constants * refactor form out * refactor queryForm * Merge branch 'release' into feature/google-sheets * Merge branch 'release' into feature/google-sheets * initial values from settings, editor and form * Check * remove dangling code around lightTheme * Safety net * remove class * try mouseover solve * force click * changes from review * fix action form name on import * Merge branch 'release' into feature/google-sheets * minor cleanup * Merge branch 'release' into feature/google-sheets * WIP * Google sheets changes * Merge conflicts * Merging and fixes, needs refactoring * Check * Merge branch 'release' into feature/google-sheets * Fixed tests * Add cloud services env variable * Clean up saga * Clean up * Refactoring * Deleted svg file * Minor fixes * Modified design to allow behaviour in google sheets methods (#3486) * Modified design to allow behaviour in google sheets methods * Review changes * Removed sysout * Added handling of edge cases with table data * Merge branch 'release' into feature/google-sheets * Fixes * Fixes * Added validations * Improved tests * Removed extraneous injected bean * Review changes * Fixed bug with method * Changes to Google sheets plugin's request and response structures (#3692) * Method changes * Removed logging * Renaming options * Reverting pom version * Modified type of collection variables, fixed errors * Converted row offset field to one that supports dynamic bindings * Review changes * List SAAS plugin type actions under lightning menu apis (#3820) * list saas plugin type actions under lightning menu apis * combine saas plugin type actions in the other sub menu of lightning menu Co-authored-by: Hetu Nandu <hetunandu@gmail.com> * Fix merge issues * Prettified query editor and a few fixes w/ ux * Test fixes * Reformatting request * code for REST added (#3876) Co-authored-by: hetunandu <hetu@appsmith.com> * Renamed body to row object * Renamed placeholder for range * Renamed range heading * Modifications to handle range semantics * Use spreadsheet Url instead of id * Ordering of methods * Removed logging * Add tests for Dynamic text controls * Add tests for url helpers * Fix coverage config * Nevermind * Interface changes * There is no body here * Yay to hints * Delete row field is separately handled as row index * placeholder support (#4001) * Fixed tests, typos and creating new sheets with random rows * Switched to using 'rowIndex' throughout * binding path added for query input field (#4016) * - Fixed QA bugs (#4032) - Split delete sheet into two - Removed dynamic query input types from hidden keys * Proper exceptions * Removed extra logging * Throw exception if update method does not match any of the columns * Same for bulk update * Zero-indexed delete row * I'm a space bound rocket ship * Logic to register installations with cs (#4062) * Logic to register installations with cs * Clean up * Casting to string * Checking to see if this makes the test pass * Added an extra null check Co-authored-by: Piyush <piyush@codeitout.com> Co-authored-by: hetunandu <hetu@appsmith.com> Co-authored-by: Hetu Nandu <hetunandu@gmail.com> Co-authored-by: Apeksha Bhosale <7846888+ApekshaBhosale@users.noreply.github.com>
2021-04-22 03:30:09 +00:00
| "SAVE_SAAS"
| "DELETE_SAAS"
| "RUN_SAAS_API"
2020-03-06 04:59:24 +00:00
| "SAVE_API"
2020-03-11 13:59:46 +00:00
| "SAVE_API_CLICK"
2020-03-06 04:59:24 +00:00
| "RUN_API"
2020-03-11 13:59:46 +00:00
| "RUN_API_CLICK"
| "RUN_API_SHORTCUT"
2020-03-06 04:59:24 +00:00
| "DELETE_API"
2020-03-11 13:59:46 +00:00
| "DELETE_API_CLICK"
| "IMPORT_API"
| "EXPAND_API"
| "IMPORT_API_CLICK"
| "MOVE_API_CLICK"
| "ADD_API_PAGE"
2020-03-06 04:59:24 +00:00
| "DUPLICATE_API"
| "DUPLICATE_API_CLICK"
| "RUN_QUERY"
| "RUN_QUERY_CLICK"
| "RUN_QUERY_SHORTCUT"
| "DELETE_QUERY"
| "SAVE_QUERY"
2020-03-06 04:59:24 +00:00
| "MOVE_API"
| "3P_PROVIDER_CLICK"
2020-03-06 04:59:24 +00:00
| "API_SELECT"
| "CREATE_API_CLICK"
[Feature] Unified New Nav (#5558) * temp commit * using onsubmit to continue using action on form * added recaptcha site key to env example file * moved the recaptcha lib loading logic to signup page * removed unnecessary edit * handle the case where the recaptcha token is not provided as env var * added proper env var config for client * recaptcha config for ansible * recaptcha config for heroku * recaptcha config for k8s * updated app.json * fixed the typos * added more description for env vars * removed api key * minor typo fix * added new integration button * updated the add int default link * added active and create new tabs * added the empty components to tabs. will control the section manually. * added proper grid for integrations page * added vertical tabs * Added secondary tabs to integrations page * added separate page for new apis * classname changes * added new components for active queries, new queries etc. * added a separate component for data source list * adding screen component conditionally, to be showing upon user's choice * 1. Added grid styling to datasource home 2. Added connect buttons to em * fixed data source security banner * updated the styling for new api page * added tertiary menu for active integrations * updated styling for active connections * updated collapse component to work properly * added show more option to active data sources * Slash commands feature init commit * Added more commands * Introduced JSX to render custom commands * Merge conflict fix * Spacing changes * removed apis/db tabs and replaced em with integrations tab * removed the unnecessary + integrations btn * Added slash commands button * Adjust styles for better ui * Ordered the action entries under integrations * Added new datasource command * updated the getURL with proper params * updated the link of create datasource btn * updated the back btn link from data source editor * Show connect data cta in property pane * Styling fixes * Fix margin * added scrollable content to create new * added on click scroll to create new page * fixed a bug, creating new datasource twice * added new action creator for integrations. * Minor changes to add new bindings command. Changed ui behaviour of / button * UI style change * updated the query editor to match the over all theme * updated the query editor tabs * Added the run btn to empty response screens * minor fix * updated the bg color of api type drop down * updated the url being visited after delete api/query * removed log * Insert binding command UI change * More UI changes * removed unnecessary junk from integrations editor index * clean up, removed unnecessary files * removed useless routes * for debugger only checking if integrations editor * Removed all the links for api/query home pages * Move command actions to a saga Added support to binding the data back to the widget when are new API is created from widget * Added reverse binding for DB queries * Show / button only on hover * not routing to integrations on create query/api * Hide actions from suggestions in action pages * removed the query/datasource/api home pages * Changes widget.data to widget in slash commands * Show dependencies in property pane * Fix warning * fixed scrolling issue * will show a list of queries and apis for action picker * showing icons for each action under integrations * Fix dropdown not showing up * Minor refactoring. Changed commands * added a way to list data sources in action creators * Update query page url * cam show icons for datasources * Removed unused code * Feature/slash commands (#5002) * Slash commands feature init commit * Added more commands * Introduced JSX to render custom commands * Merge conflict fix * Spacing changes * Added slash commands button * Adjust styles for better ui * Added new datasource command * Minor changes to add new bindings command. Changed ui behaviour of / button * UI style change * Insert binding command UI change * More UI changes * Move command actions to a saga Added support to binding the data back to the widget when are new API is created from widget * Added reverse binding for DB queries * Show / button only on hover * Hide actions from suggestions in action pages * Changes widget.data to widget in slash commands * Minor refactoring. Changed commands * Removed unused code * remove more unusued code * Added support to generate new api from a datasource in quick commands * Code correction to use types * Refactored commands code * Minor bug fixes * Remove new integrations command for actions. Fixed autocomplete not showing up * Changes to prevent autocomplete trigger for navigation commands * Prevent hinter execution when show hint is open already. * Show hinter on focus * Update text to be called in the omnibar * updated the copy for empty active datasources * Update url * Fix text decoration * updated the redirection for back btns * Use themes * Add cypress test * fixed back btn nav * fetching form configs for datasources * a callback fixed * Fix slash command not executed on click (#5540) * Replace the value if not a string else append * Log commands menu events * updated mock data base navigation * updated mock data base navigation * updated the close editors and back buttons * All back btns from editors will go back to data sources and back from data source will go back to canvas * fixed bg colors * minor styled updates * removed margin from header of generic datasource * warnings fixes * If user is already on the location not redirecting em * when editing, will check if the coming from data source and redirect accordingly * updated redirection for newly created api/queries * updated back btn for newly created datasources * back for new curl goes to data sources * Revert "[Fix] revert new nav (#5533)" This reverts commit 1647815d * remaining original reverted chagnes * fixed the width of incoming/outgoing entity bar in property pane * removing residue from resolved merge conflicts * Fix widget icons not visible in dropdown menu * minor fix to use proper integration URL * updated the URLs for unified datasources * converted back and close to btns from banners * on accessing data source from sidebar, it'll always go to view mode * updated the edit path for saas editors * Added saved state for google sheet * on google sheet delete redirecting to create new * minor fix * fixed the redirection call on saving a datasource * removed save and test cmd as it wasn't needed * Removing test cases to be fixed by Arun * commenting more tests to be fixed by Arun * updated call api cy command * Fix extra margin issue * fixed the update datasource saga * fixed video spec * Revert "commenting more tests to be fixed by Arun" This reverts commit 42087a95ad77107401a1619e4c2d4c541a81d6c3. * Revert "Removing test cases to be fixed by Arun" This reverts commit f6fad67e558d22045114a90409428ef9b737478f. * fixed the entity explorer query datasource spec * cautious fix * update widget locators * fixed leave org test * fixes for FormWidgets * updated the image spec * Use memo * Fix debugger url checks * for copy and delete widget pointing directly to svgs * Fix entity text * Fix styling and show tooltip for property pane dependencies * removed the unnecessary callback * added a separate saga to to redirect to new integrations using onSuccess * Bug Fixes - New nav (#5629) * will show scrollbar only on hover * made mock data cards clickable * fixed the grid view * fixed the cursor position when clicking on / btn * updated the hint for `/` command * binding prompt will close on focus change * hiding / command for api body * hiding / command for query pane * Added 2 new icons * Fix cursor position on selecting a binding and clicking on the slash menu button * trying out fix to copyWidget cy command * removing zero width space characters from the property pane text Co-authored-by: arunvjn <arun@appsmith.com> Co-authored-by: Akash N <akash@codemonk.in> Co-authored-by: arunvjn <32433245+arunvjn@users.noreply.github.com> Co-authored-by: Rishabh Saxena <rishabh.robben@gmail.com>
2021-07-07 03:46:16 +00:00
| "AUTO_COMPLETE_SHOW"
2020-03-06 04:59:24 +00:00
| "AUTO_COMPLETE_SELECT"
| "CREATE_APP_CLICK"
| "CREATE_APP"
| "CREATE_DATA_SOURCE_CLICK"
2020-03-11 13:59:46 +00:00
| "SAVE_DATA_SOURCE"
| "SAVE_DATA_SOURCE_CLICK"
| "TEST_DATA_SOURCE_SUCCESS"
| "TEST_DATA_SOURCE_CLICK"
| "CREATE_QUERY_CLICK"
2020-03-11 13:59:46 +00:00
| "NAVIGATE"
| "PAGE_LOAD"
2020-03-18 14:31:30 +00:00
| "NAVIGATE_EDITOR"
| "PROPERTY_PANE_OPEN"
| "PROPERTY_PANE_CLOSE"
| "PROPERTY_PANE_OPEN_CLICK"
| "PROPERTY_PANE_CLOSE_CLICK"
| "WIDGET_DELETE_UNDO"
| "WIDGET_COPY_VIA_SHORTCUT"
| "WIDGET_COPY"
| "WIDGET_CUT_VIA_SHORTCUT"
| "WIDGET_PASTE"
| "WIDGET_DELETE_VIA_SHORTCUT"
| "OPEN_HELP"
| "INVITE_USER"
| "ROUTE_CHANGE"
| "PROPERTY_PANE_CLOSE_CLICK"
2020-10-07 11:19:56 +00:00
| "APPLICATIONS_PAGE_LOAD"
2020-12-30 07:31:20 +00:00
| "EXECUTE_ACTION"
| "WELCOME_TOUR_CLICK"
2020-12-30 07:31:20 +00:00
| "ONBOARDING_WELCOME"
| "ONBOARDING_START_BUILDING"
| "ONBOARDING_INTRODUCTION"
2021-01-08 06:06:09 +00:00
| "ONBOARDING_ADD_QUERY"
2020-12-30 07:31:20 +00:00
| "ONBOARDING_RUN_QUERY"
| "ONBOARDING_ADD_WIDGET_CLICK"
| "ONBOARDING_ADD_WIDGET_TABLE"
| "ONBOARDING_ADD_WIDGET_INPUT"
| "ONBOARDING_ONSUBMIT_SUCCESS"
| "ONBOARDING_BINDING_HINT"
| "ONBOARDING_CHEAT"
2020-12-30 07:31:20 +00:00
| "ONBOARDING_SUCCESSFUL_BINDING"
| "ONBOARDING_DEPLOY"
| "ONBOARDING_SKIP_NOW"
| "ONBOARDING_NEXT_MISSION"
| "ONBOARDING_GO_HOME"
| "END_ONBOARDING"
2021-03-08 08:24:12 +00:00
| "ONBOARDING_COMPLETE"
| "OPEN_OMNIBAR"
| "CLOSE_OMNIBAR"
| "NAVIGATE_TO_ENTITY_FROM_OMNIBAR"
| "PAGE_SAVE"
2021-04-23 13:50:55 +00:00
| "CORRECT_BAD_BINDING"
| "OPEN_DEBUGGER"
| "DEBUGGER_TAB_SWITCH"
| "DEBUGGER_ENTITY_NAVIGATION"
| "GSHEET_AUTH_INIT"
| "GSHEET_AUTH_COMPLETE"
| "CYCLICAL_DEPENDENCY_ERROR"
| "DISCORD_LINK_CLICK"
[Feature] Unified New Nav (#5558) * temp commit * using onsubmit to continue using action on form * added recaptcha site key to env example file * moved the recaptcha lib loading logic to signup page * removed unnecessary edit * handle the case where the recaptcha token is not provided as env var * added proper env var config for client * recaptcha config for ansible * recaptcha config for heroku * recaptcha config for k8s * updated app.json * fixed the typos * added more description for env vars * removed api key * minor typo fix * added new integration button * updated the add int default link * added active and create new tabs * added the empty components to tabs. will control the section manually. * added proper grid for integrations page * added vertical tabs * Added secondary tabs to integrations page * added separate page for new apis * classname changes * added new components for active queries, new queries etc. * added a separate component for data source list * adding screen component conditionally, to be showing upon user's choice * 1. Added grid styling to datasource home 2. Added connect buttons to em * fixed data source security banner * updated the styling for new api page * added tertiary menu for active integrations * updated styling for active connections * updated collapse component to work properly * added show more option to active data sources * Slash commands feature init commit * Added more commands * Introduced JSX to render custom commands * Merge conflict fix * Spacing changes * removed apis/db tabs and replaced em with integrations tab * removed the unnecessary + integrations btn * Added slash commands button * Adjust styles for better ui * Ordered the action entries under integrations * Added new datasource command * updated the getURL with proper params * updated the link of create datasource btn * updated the back btn link from data source editor * Show connect data cta in property pane * Styling fixes * Fix margin * added scrollable content to create new * added on click scroll to create new page * fixed a bug, creating new datasource twice * added new action creator for integrations. * Minor changes to add new bindings command. Changed ui behaviour of / button * UI style change * updated the query editor to match the over all theme * updated the query editor tabs * Added the run btn to empty response screens * minor fix * updated the bg color of api type drop down * updated the url being visited after delete api/query * removed log * Insert binding command UI change * More UI changes * removed unnecessary junk from integrations editor index * clean up, removed unnecessary files * removed useless routes * for debugger only checking if integrations editor * Removed all the links for api/query home pages * Move command actions to a saga Added support to binding the data back to the widget when are new API is created from widget * Added reverse binding for DB queries * Show / button only on hover * not routing to integrations on create query/api * Hide actions from suggestions in action pages * removed the query/datasource/api home pages * Changes widget.data to widget in slash commands * Show dependencies in property pane * Fix warning * fixed scrolling issue * will show a list of queries and apis for action picker * showing icons for each action under integrations * Fix dropdown not showing up * Minor refactoring. Changed commands * added a way to list data sources in action creators * Update query page url * cam show icons for datasources * Removed unused code * Feature/slash commands (#5002) * Slash commands feature init commit * Added more commands * Introduced JSX to render custom commands * Merge conflict fix * Spacing changes * Added slash commands button * Adjust styles for better ui * Added new datasource command * Minor changes to add new bindings command. Changed ui behaviour of / button * UI style change * Insert binding command UI change * More UI changes * Move command actions to a saga Added support to binding the data back to the widget when are new API is created from widget * Added reverse binding for DB queries * Show / button only on hover * Hide actions from suggestions in action pages * Changes widget.data to widget in slash commands * Minor refactoring. Changed commands * Removed unused code * remove more unusued code * Added support to generate new api from a datasource in quick commands * Code correction to use types * Refactored commands code * Minor bug fixes * Remove new integrations command for actions. Fixed autocomplete not showing up * Changes to prevent autocomplete trigger for navigation commands * Prevent hinter execution when show hint is open already. * Show hinter on focus * Update text to be called in the omnibar * updated the copy for empty active datasources * Update url * Fix text decoration * updated the redirection for back btns * Use themes * Add cypress test * fixed back btn nav * fetching form configs for datasources * a callback fixed * Fix slash command not executed on click (#5540) * Replace the value if not a string else append * Log commands menu events * updated mock data base navigation * updated mock data base navigation * updated the close editors and back buttons * All back btns from editors will go back to data sources and back from data source will go back to canvas * fixed bg colors * minor styled updates * removed margin from header of generic datasource * warnings fixes * If user is already on the location not redirecting em * when editing, will check if the coming from data source and redirect accordingly * updated redirection for newly created api/queries * updated back btn for newly created datasources * back for new curl goes to data sources * Revert "[Fix] revert new nav (#5533)" This reverts commit 1647815d * remaining original reverted chagnes * fixed the width of incoming/outgoing entity bar in property pane * removing residue from resolved merge conflicts * Fix widget icons not visible in dropdown menu * minor fix to use proper integration URL * updated the URLs for unified datasources * converted back and close to btns from banners * on accessing data source from sidebar, it'll always go to view mode * updated the edit path for saas editors * Added saved state for google sheet * on google sheet delete redirecting to create new * minor fix * fixed the redirection call on saving a datasource * removed save and test cmd as it wasn't needed * Removing test cases to be fixed by Arun * commenting more tests to be fixed by Arun * updated call api cy command * Fix extra margin issue * fixed the update datasource saga * fixed video spec * Revert "commenting more tests to be fixed by Arun" This reverts commit 42087a95ad77107401a1619e4c2d4c541a81d6c3. * Revert "Removing test cases to be fixed by Arun" This reverts commit f6fad67e558d22045114a90409428ef9b737478f. * fixed the entity explorer query datasource spec * cautious fix * update widget locators * fixed leave org test * fixes for FormWidgets * updated the image spec * Use memo * Fix debugger url checks * for copy and delete widget pointing directly to svgs * Fix entity text * Fix styling and show tooltip for property pane dependencies * removed the unnecessary callback * added a separate saga to to redirect to new integrations using onSuccess * Bug Fixes - New nav (#5629) * will show scrollbar only on hover * made mock data cards clickable * fixed the grid view * fixed the cursor position when clicking on / btn * updated the hint for `/` command * binding prompt will close on focus change * hiding / command for api body * hiding / command for query pane * Added 2 new icons * Fix cursor position on selecting a binding and clicking on the slash menu button * trying out fix to copyWidget cy command * removing zero width space characters from the property pane text Co-authored-by: arunvjn <arun@appsmith.com> Co-authored-by: Akash N <akash@codemonk.in> Co-authored-by: arunvjn <32433245+arunvjn@users.noreply.github.com> Co-authored-by: Rishabh Saxena <rishabh.robben@gmail.com>
2021-07-07 03:46:16 +00:00
| "BINDING_SUCCESS"
2021-07-08 05:31:08 +00:00
| "SLASH_COMMAND"
| "DEBUGGER_NEW_ERROR"
| "DEBUGGER_RESOLVED_ERROR";
2020-03-03 07:02:53 +00:00
function getApplicationId(location: Location) {
const pathSplit = location.pathname.split("/");
const applicationsIndex = pathSplit.findIndex(
2020-12-24 04:32:25 +00:00
(path) => path === "applications",
);
const appId = pathSplit[applicationsIndex + 1];
return appId;
}
2019-08-30 11:23:42 +00:00
class AnalyticsUtil {
2020-11-06 06:27:36 +00:00
static cachedAnonymoustId: string;
static cachedUserId: string;
static user?: User = undefined;
static initializeSmartLook(id: string) {
smartlookClient.init(id);
2019-09-09 09:08:54 +00:00
}
2019-08-30 11:23:42 +00:00
static initializeSegment(key: string) {
2019-09-09 09:08:54 +00:00
(function init(window: any) {
const analytics = (window.analytics = window.analytics || []);
if (!analytics.initialize) {
if (analytics.invoked) {
window.console &&
console.error &&
console.error("Segment snippet included twice.");
} else {
analytics.invoked = !0;
analytics.methods = [
"trackSubmit",
"trackClick",
"trackLink",
"trackForm",
"pageview",
"identify",
"reset",
"group",
"track",
"ready",
"alias",
"debug",
"page",
"once",
"off",
"on",
];
analytics.factory = function(t: any) {
return function() {
const e = Array.prototype.slice.call(arguments); //eslint-disable-line prefer-rest-params
e.unshift(t);
analytics.push(e);
return analytics;
};
};
}
for (let t: any = 0; t < analytics.methods.length; t++) {
const e = analytics.methods[t];
analytics[e] = analytics.factory(e);
}
analytics.load = function(t: any, e: any) {
const n = document.createElement("script");
n.type = "text/javascript";
n.async = !0;
n.src =
"https://cdn.segment.com/analytics.js/v1/" +
t +
"/analytics.min.js";
const a: any = document.getElementsByTagName("script")[0];
a.parentNode.insertBefore(n, a);
analytics._loadOptions = e;
};
analytics.SNIPPET_VERSION = "4.1.0";
analytics.load(key);
2019-09-09 09:08:54 +00:00
analytics.page();
}
})(window);
}
2019-08-30 11:23:42 +00:00
2020-10-07 11:19:56 +00:00
static logEvent(eventName: EventName, eventData: any = {}) {
2019-09-09 09:08:54 +00:00
const windowDoc: any = window;
2020-03-06 04:59:24 +00:00
let finalEventData = eventData;
const userData = AnalyticsUtil.user;
const appId = getApplicationId(windowDoc.location);
2020-03-06 04:59:24 +00:00
if (userData) {
const { segment } = getAppsmithConfigs();
2020-03-11 13:59:46 +00:00
const app = (userData.applications || []).find(
(app: any) => app.id === appId,
);
let user: any = {};
2020-11-05 16:51:22 +00:00
if (segment.enabled && segment.apiKey) {
user = {
userId: userData.username,
email: userData.email,
currentOrgId: userData.currentOrganizationId,
appId: appId,
appName: app ? app.name : undefined,
2020-11-23 13:17:12 +00:00
source: "cloud",
};
} else {
const userId = userData.username;
if (userId !== AnalyticsUtil.cachedUserId) {
AnalyticsUtil.cachedAnonymoustId = sha256(userId);
AnalyticsUtil.cachedUserId = userId;
}
user = {
userId: AnalyticsUtil.cachedAnonymoustId,
source: "ce",
};
}
2020-03-06 04:59:24 +00:00
finalEventData = {
...eventData,
userData: user.userId === ANONYMOUS_USERNAME ? undefined : user,
2020-03-06 04:59:24 +00:00
};
}
2020-12-30 07:31:20 +00:00
2020-03-03 07:02:53 +00:00
if (windowDoc.analytics) {
2020-11-05 16:51:22 +00:00
log.debug("Event fired", eventName, finalEventData);
2020-03-06 04:59:24 +00:00
windowDoc.analytics.track(eventName, finalEventData);
2021-04-27 12:53:08 +00:00
} else {
log.debug("Event fired locally", eventName, finalEventData);
2020-03-03 07:02:53 +00:00
}
2019-09-09 09:08:54 +00:00
}
2019-08-30 11:23:42 +00:00
static identifyUser(userData: User) {
2020-11-05 16:51:22 +00:00
const { segment, smartLook } = getAppsmithConfigs();
2019-09-09 09:08:54 +00:00
const windowDoc: any = window;
2020-11-06 06:27:36 +00:00
const userId = userData.username;
2020-05-28 18:10:26 +00:00
FeatureFlag.identify(userData);
2020-03-03 07:02:53 +00:00
if (windowDoc.analytics) {
// This flag is only set on Appsmith Cloud. In this case, we get more detailed analytics of the user
2020-11-05 06:11:29 +00:00
if (segment.apiKey) {
const userProperties = {
email: userData.email,
name: userData.name,
userId: userId,
2020-11-23 13:17:12 +00:00
source: "cloud",
};
AnalyticsUtil.user = userData;
2020-11-05 16:51:22 +00:00
log.debug("Identify User " + userId);
windowDoc.analytics.identify(userId, userProperties);
2020-11-05 16:51:22 +00:00
} else if (segment.ceKey) {
// This is a self-hosted instance. Only send data if the analytics are NOT disabled by the user
// This is done by setting environment variable APPSMITH_DISABLE_TELEMETRY in the docker.env file
2020-11-06 06:27:36 +00:00
if (userId !== AnalyticsUtil.cachedUserId) {
AnalyticsUtil.cachedAnonymoustId = sha256(userId);
AnalyticsUtil.cachedUserId = userId;
}
2020-11-23 13:17:12 +00:00
const userProperties = {
2020-11-24 15:40:50 +00:00
userId: AnalyticsUtil.cachedUserId,
2020-11-23 13:17:12 +00:00
source: "ce",
};
2020-11-06 06:27:36 +00:00
log.debug(
"Identify Anonymous User " + AnalyticsUtil.cachedAnonymoustId,
);
2020-11-23 13:17:12 +00:00
windowDoc.analytics.identify(
AnalyticsUtil.cachedAnonymoustId,
userProperties,
);
}
2020-03-03 07:02:53 +00:00
}
Sentry.configureScope(function(scope) {
scope.setUser({
id: userId,
username: userData.username,
email: userData.email,
});
});
2020-11-05 02:31:01 +00:00
if (smartLook.enabled) {
smartlookClient.identify(userId, { email: userData.email });
2020-08-21 08:13:59 +00:00
}
2019-09-09 09:08:54 +00:00
}
static reset() {
const windowDoc: any = window;
if (windowDoc.Intercom) {
windowDoc.Intercom("shutdown");
}
2020-04-15 14:19:39 +00:00
windowDoc.analytics && windowDoc.analytics.reset();
windowDoc.mixpanel && windowDoc.mixpanel.reset();
}
2019-08-30 11:23:42 +00:00
}
2019-09-09 09:08:54 +00:00
export default AnalyticsUtil;