Skip to content

Commit 641bb50

Browse files
author
Rene Davila
committed
Merge branch 'stage' into ecommerce-multi-env
2 parents 71765ee + acad647 commit 641bb50

7 files changed

Lines changed: 112 additions & 74 deletions

File tree

‎blocks/form/form.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { readBlockConfig } from '../../scripts/aem.js';
44
import { sendDigitalDataEvent } from '../../scripts/martech.js';
55
import { getFormName } from './utils.js';
66
import { resolveServiceLine } from './ecommerce.js';
7+
import { buildLeadFormFields } from './submit.js';
78

89
export default async function decorate(block) {
910
const { container, formDef } = await extractSheetDefinition(block);
@@ -71,7 +72,9 @@ export default async function decorate(block) {
7172
form.addEventListener('focusin', () => {
7273
sendDigitalDataEvent({
7374
event: 'formStart',
75+
eventName: 'formStart',
7476
formName: getFormName(form),
77+
...buildLeadFormFields(form),
7578
});
7679
}, { once: true });
7780

‎blocks/form/submit.js‎

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@ function readFieldsetLabel(form, classFragment) {
3535
}
3636

3737
/** modal vs inline, from the form's placement. */
38-
function getFormType(form) {
38+
export function getFormType(form) {
3939
return form.closest('.modal') ? 'modal' : 'inline';
4040
}
4141

42-
/** header / footer / body, from the form's placement. */
43-
function getFormSource(form) {
42+
/** header / footer / body, from the carried opener origin or the form's placement. */
43+
export function getFormSource(form) {
44+
const carried = form.closest('[data-form-source]')?.dataset.formSource;
45+
if (carried === 'header' || carried === 'footer' || carried === 'body') return carried;
4446
if (form.closest('header, .header')) return 'header';
4547
if (form.closest('footer, .footer')) return 'footer';
4648
return 'body';
@@ -60,6 +62,23 @@ function collectLeadDataPoints(form) {
6062
};
6163
}
6264

65+
/**
66+
* The BR.430 field set shared by `formStart` and `formSubmit` — same shape, read fresh at
67+
* whatever point the caller fires. PII fields are Y/N presence flags only.
68+
* @param {HTMLFormElement} form
69+
* @returns {{formType:string, formSource:string, leadId:null, eCommEntryPoint:'N', pageUrl:string}}
70+
*/
71+
export function buildLeadFormFields(form) {
72+
return {
73+
formType: getFormType(form),
74+
formSource: getFormSource(form),
75+
leadId: null,
76+
eCommEntryPoint: 'N',
77+
pageUrl: window.location.href,
78+
...collectLeadDataPoints(form),
79+
};
80+
}
81+
6382
/**
6483
* Fire the `formSubmit` analytics event with the lead-form data points. PII is emitted as Y/N
6584
* presence flags only. `leadId` is passed through (currently null until the backend returns it).
@@ -100,12 +119,9 @@ function sendDataToAnalytics(form, options = {}) {
100119
formElement: form,
101120
quoteType,
102121
serviceType,
103-
formType: getFormType(form),
104-
formSource: getFormSource(form),
122+
...buildLeadFormFields(form),
105123
leadId,
106124
eCommEntryPoint,
107-
pageUrl: window.location.href,
108-
...collectLeadDataPoints(form),
109125
});
110126
}
111127

‎blocks/modal/modal.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ export async function createModal(contentNodes, config) {
1616
const dialog = document.createElement('dialog');
1717
const dialogContent = document.createElement('div');
1818
dialogContent.classList.add('modal-content');
19+
if (config?.formSource) {
20+
dialogContent.dataset.formSource = config.formSource;
21+
}
1922
dialogContent.append(...contentNodes);
2023
dialog.append(dialogContent);
2124

‎en-ca/sitemap.xml‎

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@
262262
</url>
263263
<url>
264264
<loc>https://www.shredit.com/en-ca/blog/10-most-dangerous-ways-to-dispose-of-hard-drives</loc>
265-
<lastmod>2025-07-16</lastmod>
265+
<lastmod>2026-09-09</lastmod>
266266
</url>
267267
<url>
268268
<loc>https://www.shredit.com/en-ca/blog/10-reasons-why-all-businesses-need-safeguards</loc>
@@ -280,10 +280,6 @@
280280
<loc>https://www.shredit.com/en-ca/blog/12-months-until-gdpr-starts</loc>
281281
<lastmod>2025-07-16</lastmod>
282282
</url>
283-
<url>
284-
<loc>https://www.shredit.com/en-ca/blog/12-simple-ways-to-improve-information-security</loc>
285-
<lastmod>2025-07-16</lastmod>
286-
</url>
287283
<url>
288284
<loc>https://www.shredit.com/en-ca/blog/12-ways-to-make-your-home-office-cyber-secure</loc>
289285
<lastmod>2025-07-16</lastmod>
@@ -448,10 +444,6 @@
448444
<loc>https://www.shredit.com/en-ca/blog/9-reasons-why-we-need-a-national-data-breach-law</loc>
449445
<lastmod>2025-07-16</lastmod>
450446
</url>
451-
<url>
452-
<loc>https://www.shredit.com/en-ca/blog/9-reasons-an-organizations-reputation-is-important</loc>
453-
<lastmod>2025-07-16</lastmod>
454-
</url>
455447
<url>
456448
<loc>https://www.shredit.com/en-ca/blog/9-surprising-facts-about-medical-identity-theft</loc>
457449
<lastmod>2025-07-16</lastmod>
@@ -546,7 +538,7 @@
546538
</url>
547539
<url>
548540
<loc>https://www.shredit.com/en-ca/blog/best-ways-to-protect-confidential-information</loc>
549-
<lastmod>2025-07-16</lastmod>
541+
<lastmod>2026-10-05</lastmod>
550542
</url>
551543
<url>
552544
<loc>https://www.shredit.com/en-ca/blog/ceo-is-not-the-only-one-to-blame-for-a-data-breach</loc>
@@ -904,10 +896,6 @@
904896
<loc>https://www.shredit.com/en-ca/blog/how-millennials-affect-the-workplace-data-security</loc>
905897
<lastmod>2025-07-16</lastmod>
906898
</url>
907-
<url>
908-
<loc>https://www.shredit.com/en-ca/blog/essential-data-protection-strategies-for-small-businesses</loc>
909-
<lastmod>2025-07-16</lastmod>
910-
</url>
911899
<url>
912900
<loc>https://www.shredit.com/en-ca/blog/employee-retention-and-recruitment-strategy-update</loc>
913901
<lastmod>2025-07-16</lastmod>

0 commit comments

Comments
 (0)