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

Subscribe to newsletter form response #245 #253

Merged
merged 16 commits into from
Nov 27, 2023
Merged

Conversation

manuel-vara
Copy link
Collaborator

@manuel-vara manuel-vara commented Nov 15, 2023

Please always provide the GitHub issue(s) your PR is for, as well as test URLs where your change can be observed (before and after):

Fix #245

Test URLs:

New Block
Fully authorable form block with form definition in spreadsheet format.

Updated Blocks
Includes the update of v2-forms & v2-newsletter to manage Form Handler responses.
New custom forms would need to include v2-forms + specific handling response.

@manuel-vara manuel-vara self-assigned this Nov 15, 2023
@manuel-vara manuel-vara linked an issue Nov 15, 2023 that may be closed by this pull request
Copy link
Contributor

aem-code-sync bot commented Nov 15, 2023

Hello, I'm the AEM Code Sync Bot and I will run some test suites that validate the page speed.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-run PSI Checks

Copy link
Contributor

aem-code-sync bot commented Nov 15, 2023

Page Scores Audits Google
/ PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@manuel-vara manuel-vara marked this pull request as draft November 15, 2023 12:24
Copy link
Contributor

aem-code-sync bot commented Nov 15, 2023

Page Scores Audits Google
/ PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

Copy link
Contributor

aem-code-sync bot commented Nov 15, 2023

Page Scores Audits Google
/ PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

Copy link
Contributor

aem-code-sync bot commented Nov 16, 2023

Page Scores Audits Google
/ PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

Copy link
Contributor

aem-code-sync bot commented Nov 16, 2023

Page Scores Audits Google
/ PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

Copy link
Contributor

aem-code-sync bot commented Nov 16, 2023

Page Scores Audits Google
/ PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@cogniSyb cogniSyb changed the title 245 subs form response Subscribe to newsletter form response #245 Nov 17, 2023
@cogniSyb cogniSyb changed the base branch from main to develop November 17, 2023 08:40
Copy link
Contributor

aem-code-sync bot commented Nov 17, 2023

Page Scores Audits Google
/ PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

Copy link
Contributor

aem-code-sync bot commented Nov 17, 2023

Page Scores Audits Google
/ PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@manuel-vara manuel-vara added the FR Functional requirement label Nov 17, 2023
@manuel-vara manuel-vara marked this pull request as ready for review November 17, 2023 10:40
import { loadScript, sampleRUM } from '../../scripts/lib-franklin.js';
import { getTextLabel } from '../../scripts/common.js';

const thankyouMessage = `<p class='pardot-forms-thanks-title'>${getTextLabel('Successful submission title')}</p>
Copy link
Collaborator

Choose a reason for hiding this comment

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

As 'success' is used elsewhere, please rename thankyouMessage to successMessage

sampleRUM('form:submit');
const thankyouDiv = document.createElement('div');
thankyouDiv.innerHTML = thankyouMessage;
const form = document.querySelector('form');
Copy link
Collaborator

Choose a reason for hiding this comment

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

We could have multiple forms on the page, so this should be made more specific

import { loadScript, sampleRUM } from '../../scripts/lib-franklin.js';
import { getTextLabel } from '../../scripts/common.js';

const thankyouMessage = `<p class='pardot-forms-thanks-title'>${getTextLabel('Successful submission title')}</p>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rename class pardot-forms-thanks-title to pardot-form__title pardot-form__title--success

import { getTextLabel } from '../../scripts/common.js';

const thankyouMessage = `<p class='pardot-forms-thanks-title'>${getTextLabel('Successful submission title')}</p>
<p class='pardot-forms-thanks-text'>${getTextLabel('Successful submission text')}</p>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rename class pardot-forms-thanks-text to pardot-form__text pardot-form__text--success

`;

const errorMessage = `<p class='pardot-forms-error-title'>${getTextLabel('Error submission title')}</p>
<p class='pardot-forms-error-text'>${getTextLabel('Error submission text')}</p>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Change this class and the one of the title in the same way as above


const blockName = 'v2-newsletter';

const thankyouMessage = `<p class='pardot-forms-thanks-title'>${getTextLabel('Successful submission title')}</p>
Copy link
Collaborator

Choose a reason for hiding this comment

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

In order to end up with the design:

const successTitle = `${getTextLabel('Successful submission title')}`;
const successText = `${getTextLabel('Successful submission text')}`;

async function submissionSuccess() {
  sampleRUM('form:submit');
  const form = document.querySelector('form');
  const title = document.querySelector(`.${blockName}__title`);
  const message = document.createElement('p');
  message.textContent = successText;
  title.textContent = successTitle;
  form.replaceWith(message);
}

Copy link
Contributor

aem-code-sync bot commented Nov 21, 2023

Page Scores Audits Google
/drafts/manuel.vara/homepage-test PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

Copy link
Contributor

aem-code-sync bot commented Nov 21, 2023

Page Scores Audits Google
/drafts/manuel.vara/homepage-test PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

Copy link
Collaborator

@cogniSyb cogniSyb left a comment

Choose a reason for hiding this comment

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

In v2-newsletter.css add the following declaration

.v2-newsletter__form-container p {
  margin: 0;
  max-width: var(--text-block-max-width);
  text-align: center;
}

At the level of .v2-newsletter__form-container .button and remove this entire redundant declaration:

.v2-newsletter__form-container .button {
  text-transform: uppercase;
}

Thanks.
Should we add new css classes to handle validation/response errors? It seems subscribe component has some designs for it.


const blockName = 'v2-newsletter';

//* init response handling *
const successTitle = `${getTextLabel('Success newsletter title')}`;
Copy link
Collaborator

Choose a reason for hiding this comment

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

My bad over here, this should be const successTitle = getTextLabel('Successful submission title'); instead. Same pattern for the line below

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That's fine, I believe. I've just created 2 new placeholder entries with those keys to align subscribe to newsletter messages provided in Figma designs. In that way we can show different messages depending on the custom block where v2-forms block is used, giving us an extra level of response feedback.

}
//* end response handling *

// eslint-disable-next-line func-names
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove comment, we can solve it like this:

window.logResult = function logResult(json) {
  if (json.result === 'success') {
    submissionSuccess();
  } else if (json.result === 'error') {
    submissionFailure();
  }
};

Copy link
Contributor

aem-code-sync bot commented Nov 21, 2023

Page Scores Audits Google
/drafts/manuel.vara/homepage-test PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

Copy link
Contributor

aem-code-sync bot commented Nov 22, 2023

Page Scores Audits Google
/drafts/manuel.vara/homepage-test PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

Copy link
Contributor

aem-code-sync bot commented Nov 22, 2023

Page Scores Audits Google
/drafts/manuel.vara/homepage-test PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

Copy link
Contributor

aem-code-sync bot commented Nov 22, 2023

Page Scores Audits Google
/drafts/manuel.vara/homepage-test PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

Copy link
Contributor

aem-code-sync bot commented Nov 22, 2023

Page Scores Audits Google
/drafts/manuel.vara/homepage-test PERFORMANCE A11Y SEO BEST PRACTICES SI FCP LCP TBT CLS PSI

@cogniSyb cogniSyb merged commit addae98 into develop Nov 27, 2023
2 checks passed
cogniSyb pushed a commit that referenced this pull request Dec 4, 2023
* Pardot form block - callback response
* Updated with placeholders Thank you & Error messages
* Include honeypot pardot extra field
cogniSyb pushed a commit that referenced this pull request Dec 12, 2023
* Pardot form block - callback response
* Updated with placeholders Thank you & Error messages
* Include honeypot pardot extra field
cogniSyb pushed a commit that referenced this pull request Dec 12, 2023
* Pardot form block - callback response
* Updated with placeholders Thank you & Error messages
* Include honeypot pardot extra field
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FR Functional requirement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Subscribe to newsletter form response
3 participants