Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for button click tracking not working #14

Merged
merged 8 commits into from
Aug 14, 2021

Conversation

adiux
Copy link
Collaborator

@adiux adiux commented Aug 12, 2021

@cla-bot cla-bot bot added the cla-signed label Aug 12, 2021
@adiux
Copy link
Collaborator Author

adiux commented Aug 13, 2021

mautic/mautic#10331

@adiux adiux requested a review from RCheesley August 13, 2021 14:09
Copy link
Member

@RCheesley RCheesley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superficial review for grammar etc.

A few suggestions to make sure the messages we show to users/output to logs are consistent with our style guide. Main things to look for (as some I could not update with this review) are:

  • Capitalise the first word
  • Capitalise any Mautic features, for example Dynamic Content, and ensure they are written out fully and correctly (a few places have used DynamicContent without a space)
  • Capitalise any abbreviations such as HTML and MJML

dist/commands.js Outdated
}); // {token} to slot
editor.Commands.add('preset-mautic:dynamic-content-components-to-tokens', {
run: edtr => dynamicContentCmd.convertDynamicContentComponentsToTokens(edtr)
}); // Link store to compoennt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}); // Link store to compoennt
}); // Link store to component


dynamicContent.set('content', dynConToken);
if (!decId) {
this.logger.debug('Expected a dynamic content component', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this.logger.debug('Expected a dynamic content component', {
this.logger.debug('Expected a Dynamic Content component', {

this.logger.debug('Expected a dynamic content component', {
dynamicContent
});
throw new Error('no dynamic content component');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
throw new Error('no dynamic content component');
throw new Error('No Dynamic Content component');

this.logger.debug('Created a new dynamic content item', {
dcName,
component.set('content', `Dynamic Content ${decId}`);
this.logger.debug('Created a new dynamic content item in store', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this.logger.debug('Created a new dynamic content item in store', {
this.logger.debug('Created a new Dynamic Content item in store', {

@@ -46,12 +49,14 @@ export default class MjmlService {

static mjmlToHtml(mjml) {
try {
if (typeof mjml !== 'string') {
if (typeof mjml !== 'string' || !mjml.includes('<mjml>')) {
throw new Error('no valid mjml string');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
throw new Error('no valid mjml string');
throw new Error('No valid MJML string');

@@ -18,7 +18,7 @@ export default class ButtonCloseCommands {
throw new Error('no email-html editor');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
throw new Error('no email-html editor');
throw new Error('No email-HTML editor');

@@ -31,7 +31,7 @@ export default class ButtonCloseCommands {
throw new Error('no email-mjml editor');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
throw new Error('no email-mjml editor');
throw new Error('No email-MJML editor');

const dynConToken = `{dynamiccontent="${dynConName}"}`; // Clear id because it's reloaded by Mautic and this prevent slot to be destroyed by GrapesJs destroy event on close.
// dynamicContent.addAttributes({ 'data-param-dec-id': '' });

this.logger.debug('Replaced components content with its token', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this.logger.debug('Replaced components content with its token', {
this.logger.debug('Replaced component's content with its token', {

@adiux adiux requested a review from RCheesley August 14, 2021 05:54
@adiux adiux mentioned this pull request Aug 14, 2021
Copy link
Member

@dennisameling dennisameling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Appreciate the comments in the code so that it's easier for future contributors to see what's going on 👍🏼

@dennisameling dennisameling dismissed RCheesley’s stale review August 14, 2021 08:48

Suggestions applied by Adrian

@dennisameling dennisameling merged commit e092ff6 into mautic:master Aug 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mautic does not track MJML button clicks (mj-button)
3 participants