-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: alternative refactoring variant for event segments
- Loading branch information
1 parent
2d5d06a
commit 03d8133
Showing
14 changed files
with
105 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +0,0 @@ | ||
/** | ||
* Events are identified by the following structured pattern: | ||
* openedx.paragon.event_environment.event_name.event_action. | ||
* | ||
*/ | ||
|
||
export const sendSelectedIconCopy = (context) => { | ||
global.analytics.track('openedx.paragon.docs.icons-table.selected-icon.copied', context); | ||
}; | ||
|
||
export const sendLeaveFeedbackClick = () => { | ||
global.analytics.track('openedx.paragon.docs.leave_feedback.clicked'); | ||
}; | ||
|
||
export const sendPlaygroundClick = () => { | ||
global.analytics.track('openedx.paragon.docs.menu.playground.visit_playground.clicked'); | ||
}; | ||
|
||
export const sendContrastCheckerClick = () => { | ||
global.analytics.track('openedx.paragon.docs.menu.tools.visit_contrast_checker.clicked'); | ||
}; | ||
|
||
export const sendPlaygroundUrlCopy = () => { | ||
global.analytics.track('openedx.paragon.docs.playground.copy-url.copied'); | ||
}; | ||
|
||
export const sendPageEditBtnClick = () => { | ||
global.analytics.track('openedx.paragon.docs.page_edit.clicked'); | ||
}; | ||
|
||
export const sendShadowGeneratorLayerEnabled = () => { | ||
global.analytics.track('openedx.paragon.docs.elevation.shadow-generator.layer.enabled'); | ||
}; | ||
|
||
export const sendShadowGeneratorLayerDisabled = () => { | ||
global.analytics.track('openedx.paragon.docs.elevation.shadow-generator.layer.disabled'); | ||
}; | ||
|
||
export const sendShadowGeneratorLayerRemoved = () => { | ||
global.analytics.track('openedx.paragon.docs.elevation.shadow-generator.layer.removed'); | ||
}; | ||
|
||
export const sendShadowGeneratorLayerAdded = () => { | ||
global.analytics.track('openedx.paragon.docs.elevation.shadow-generator.layer.added'); | ||
}; | ||
|
||
export const sendShadowGeneratorUpdated = (context) => { | ||
global.analytics.track('openedx.paragon.docs.elevation.shadow-generator.updated', context); | ||
}; | ||
|
||
export const sendInsightsTabClick = (tabTitle) => { | ||
global.analytics.track(`openedx.paragon.docs.insights.tabs.${tabTitle.toLowerCase().trim()}.clicked`); | ||
}; | ||
|
||
export const sendComponentUsageLinkClick = (context) => { | ||
global.analytics.track('openedx.paragon.docs.usage-insights.component-usage-link.clicked', context); | ||
}; | ||
|
||
export const sendSettingsVisibility = (isOpen) => { | ||
global.analytics.track(`openedx.paragon.docs.settings.${isOpen ? 'opened' : 'closed'}`); | ||
}; | ||
|
||
export const sendSettingsChange = (settingName, context) => { | ||
global.analytics.track(`openedx.paragon.docs.settings.${settingName}.changed`, context); | ||
}; | ||
|
||
export const sendExampleWithHeading = (collapseIsOpen, context) => { | ||
global.analytics.track(`openedx.paragon.docs.ui.example-code-block.${collapseIsOpen ? 'closed' : 'opened'}`, context); | ||
}; | ||
|
||
export const sendExampleWithoutHeading = (collapseIsOpen, context) => { | ||
global.analytics.track(`openedx.paragon.docs.ui.example-code-block.${collapseIsOpen ? 'closed' : 'opened'}`, context); | ||
}; | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Events are identified by the following structured pattern: | ||
* openedx.paragon.event_environment.event_name.event_action. | ||
*/ | ||
|
||
export const ICON_COPIED = 'openedx.paragon.docs.icons-table.selected-icon.copied'; | ||
export const LEAVE_FEEDBACK_CLICKED = 'openedx.paragon.docs.leave_feedback.clicked'; | ||
export const PLAYGROUND_CLICKED = 'openedx.paragon.docs.menu.playground.visit_playground.clicked'; | ||
export const CONTRAST_CHECKER_CLICKED = 'openedx.paragon.docs.menu.tools.visit_contrast_checker.clicked'; | ||
export const PLAYGROUND_URL_COPIED = 'openedx.paragon.docs.playground.copy-url.copied'; | ||
export const PAGE_EDIT_BTN_CLICKED = 'openedx.paragon.docs.page_edit.clicked'; | ||
export const SHADOW_GENERATOR_LAYER_ENABLED = 'openedx.paragon.docs.elevation.shadow-generator.layer.enabled'; | ||
export const SHADOW_GENERATOR_LAYER_DISABLED = 'openedx.paragon.docs.elevation.shadow-generator.layer.disabled'; | ||
export const SHADOW_GENERATOR_LAYER_REMOVED = 'openedx.paragon.docs.elevation.shadow-generator.layer.removed'; | ||
export const SHADOW_GENERATOR_LAYER_ADDED = 'openedx.paragon.docs.elevation.shadow-generator.layer.added'; | ||
export const SHADOW_GENERATOR_LAYER_UPDATED = 'openedx.paragon.docs.elevation.shadow-generator.layer.updated'; | ||
export const COMPONENT_USAGE_LINK_CLICKED = 'openedx.paragon.docs.usage-insights.component-usage-link.clicked'; | ||
export const INSIGHTS_TAB_CLICKED = 'openedx.paragon.docs.insights.tab.clicked'; | ||
export const SETTINGS_OPENED = 'openedx.paragon.docs.settings.opened'; | ||
export const SETTINGS_CLOSED = 'openedx.paragon.docs.settings.closed'; | ||
export const SETTINGS_CHANGED = 'openedx.paragon.docs.setting.changed'; | ||
export const EXAMPLE_CODE_BLOCK_WITH_HEADING_CLOSED = 'openedx.paragon.docs.ui.example-code-block.closed'; | ||
export const EXAMPLE_CODE_BLOCK_WITH_HEADING_OPENED = 'openedx.paragon.docs.ui.example-code-block.opened'; | ||
|
||
export const EXAMPLE_CODE_BLOCK_WITHOUT_HEADING_CLOSED = 'openedx.paragon.docs.ui.example-code-block.without-heading.closed'; | ||
export const EXAMPLE_CODE_BLOCK_WITHOUT_HEADING_OPENED = 'openedx.paragon.docs.ui.example-code-block.without-heading.opened'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
export { | ||
ICON_COPIED, | ||
LEAVE_FEEDBACK_CLICKED, | ||
PLAYGROUND_CLICKED, | ||
CONTRAST_CHECKER_CLICKED, | ||
PLAYGROUND_URL_COPIED, | ||
PAGE_EDIT_BTN_CLICKED, | ||
SHADOW_GENERATOR_LAYER_ENABLED, | ||
SHADOW_GENERATOR_LAYER_DISABLED, | ||
SHADOW_GENERATOR_LAYER_REMOVED, | ||
SHADOW_GENERATOR_LAYER_ADDED, | ||
SHADOW_GENERATOR_LAYER_UPDATED, | ||
COMPONENT_USAGE_LINK_CLICKED, | ||
INSIGHTS_TAB_CLICKED, | ||
SETTINGS_OPENED, | ||
SETTINGS_CLOSED, | ||
SETTINGS_CHANGED, | ||
EXAMPLE_CODE_BLOCK_WITH_HEADING_CLOSED, | ||
EXAMPLE_CODE_BLOCK_WITH_HEADING_OPENED, | ||
EXAMPLE_CODE_BLOCK_WITHOUT_HEADING_CLOSED, | ||
EXAMPLE_CODE_BLOCK_WITHOUT_HEADING_OPENED, | ||
} from './constants'; | ||
|
||
export { sendUserAnalyticsEvent } from './utils'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
function sendUserAnalyticsEvent(eventName, context) { | ||
if (context) { | ||
return global.analytics.track(eventName, context); | ||
} | ||
|
||
return global.analytics.track(eventName); | ||
} | ||
|
||
module.exports = { sendUserAnalyticsEvent }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters