@mindful-web/marko-web-gtm 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +1 -0
- package/LICENSE +21 -0
- package/README.md +65 -0
- package/browser/.eslintrc.js +1 -0
- package/browser/index.js +14 -0
- package/browser/track-bus-event.vue +61 -0
- package/browser/track-in-view-event.vue +45 -0
- package/browser/track-load-more.vue +25 -0
- package/components/context/content.marko +97 -0
- package/components/context/content.marko.js +144 -0
- package/components/context/default.marko +9 -0
- package/components/context/default.marko.js +41 -0
- package/components/context/dynamic-page.marko +28 -0
- package/components/context/dynamic-page.marko.js +75 -0
- package/components/context/magazine-issue.marko +30 -0
- package/components/context/magazine-issue.marko.js +77 -0
- package/components/context/magazine-publication.marko +25 -0
- package/components/context/magazine-publication.marko.js +72 -0
- package/components/context/marko.json +44 -0
- package/components/context/native-x-story.marko +9 -0
- package/components/context/native-x-story.marko.js +41 -0
- package/components/context/website-section.marko +32 -0
- package/components/context/website-section.marko.js +79 -0
- package/components/init.marko +52 -0
- package/components/init.marko.js +104 -0
- package/components/marko.json +61 -0
- package/components/noscript.marko +11 -0
- package/components/noscript.marko.js +44 -0
- package/components/push.marko +7 -0
- package/components/push.marko.js +35 -0
- package/components/slot.marko +9 -0
- package/components/slot.marko.js +40 -0
- package/components/start.marko +7 -0
- package/components/start.marko.js +37 -0
- package/components/track-bus-event.marko +1 -0
- package/components/track-bus-event.marko.js +30 -0
- package/components/track-inview-event.marko +1 -0
- package/components/track-inview-event.marko.js +30 -0
- package/components/track-load-more.marko +1 -0
- package/components/track-load-more.marko.js +30 -0
- package/context/content.js +74 -0
- package/context/default.js +11 -0
- package/context/dynamic-page.js +17 -0
- package/context/index.js +17 -0
- package/context/magazine-issue.js +22 -0
- package/context/magazine-publication.js +15 -0
- package/context/native-x-story.js +37 -0
- package/context/website-section.js +24 -0
- package/marko.json +6 -0
- package/package.json +31 -0
- package/scss/slot.scss +7 -0
- package/utils/build-query-string.js +3 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-gtm$1.0.0/components/push.marko",
|
|
6
|
+
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
7
|
+
module_utils_module = require("@mindful-web/utils"),
|
|
8
|
+
utils_module = module_utils_module.default || module_utils_module,
|
|
9
|
+
asObject = module_utils_module.asObject,
|
|
10
|
+
helpers_escape_xml = require("marko/dist/runtime/html/helpers/escape-xml"),
|
|
11
|
+
marko_escapeXml = helpers_escape_xml.x,
|
|
12
|
+
marko_escapeScript = require("marko/dist/runtime/html/helpers/escape-script-placeholder");
|
|
13
|
+
|
|
14
|
+
function render(input, out, __component, component, state) {
|
|
15
|
+
var data = input;
|
|
16
|
+
|
|
17
|
+
const name = input.name || 'dataLayer';
|
|
18
|
+
|
|
19
|
+
const obj = asObject(input.data);
|
|
20
|
+
|
|
21
|
+
const script = `${name}.push(${JSON.stringify(obj)});`;
|
|
22
|
+
|
|
23
|
+
out.w("<script>" +
|
|
24
|
+
marko_escapeScript(script) +
|
|
25
|
+
"</script>");
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
marko_template._ = marko_renderer(render, {
|
|
29
|
+
d_: true,
|
|
30
|
+
e_: marko_componentType
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
marko_template.meta = {
|
|
34
|
+
id: "/@mindful-web/marko-web-gtm$1.0.0/components/push.marko"
|
|
35
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BEM } from "@mindful-web/utils";
|
|
2
|
+
import { dasherize } from "@mindful-web/inflector";
|
|
3
|
+
|
|
4
|
+
$ const { prefix, name } = input;
|
|
5
|
+
$ const blockName = "marko-web-gtm-slot";
|
|
6
|
+
$ const classNames = [blockName, ...BEM.applyModifiers(blockName, input.modifiers), input.class];
|
|
7
|
+
$ const id = prefix ? `${prefix}-${name}` : name;
|
|
8
|
+
|
|
9
|
+
<div id=dasherize(id) class=classNames />
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-gtm$1.0.0/components/slot.marko",
|
|
6
|
+
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
7
|
+
module_utils_module = require("@mindful-web/utils"),
|
|
8
|
+
utils_module = module_utils_module.default || module_utils_module,
|
|
9
|
+
BEM = module_utils_module.BEM,
|
|
10
|
+
module_inflector_module = require("@mindful-web/inflector"),
|
|
11
|
+
inflector_module = module_inflector_module.default || module_inflector_module,
|
|
12
|
+
dasherize = module_inflector_module.dasherize,
|
|
13
|
+
marko_attr = require("marko/dist/runtime/html/helpers/attr"),
|
|
14
|
+
marko_classAttr = require("marko/dist/runtime/html/helpers/class-attr");
|
|
15
|
+
|
|
16
|
+
function render(input, out, __component, component, state) {
|
|
17
|
+
var data = input;
|
|
18
|
+
|
|
19
|
+
const { prefix, name } = input;
|
|
20
|
+
|
|
21
|
+
const blockName = "marko-web-gtm-slot";
|
|
22
|
+
|
|
23
|
+
const classNames = [blockName, ...BEM.applyModifiers(blockName, input.modifiers), input.class];
|
|
24
|
+
|
|
25
|
+
const id = prefix ? `${prefix}-${name}` : name;
|
|
26
|
+
|
|
27
|
+
out.w("<div" +
|
|
28
|
+
marko_attr("id", dasherize(id)) +
|
|
29
|
+
marko_classAttr(classNames) +
|
|
30
|
+
"></div>");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
marko_template._ = marko_renderer(render, {
|
|
34
|
+
d_: true,
|
|
35
|
+
e_: marko_componentType
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
marko_template.meta = {
|
|
39
|
+
id: "/@mindful-web/marko-web-gtm$1.0.0/components/slot.marko"
|
|
40
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-gtm$1.0.0/components/start.marko",
|
|
6
|
+
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
7
|
+
marko_web_gtm_push_template = require("./push.marko"),
|
|
8
|
+
marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
|
|
9
|
+
marko_web_gtm_push_tag = marko_loadTag(marko_web_gtm_push_template);
|
|
10
|
+
|
|
11
|
+
function render(input, out, __component, component, state) {
|
|
12
|
+
var data = input;
|
|
13
|
+
|
|
14
|
+
const name = input.name || 'dataLayer';
|
|
15
|
+
|
|
16
|
+
const payload = {
|
|
17
|
+
'gtm.start': new Date().getTime(),
|
|
18
|
+
event: 'gtm.js',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
marko_web_gtm_push_tag({
|
|
22
|
+
name: name,
|
|
23
|
+
data: payload
|
|
24
|
+
}, out, __component, "0");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
marko_template._ = marko_renderer(render, {
|
|
28
|
+
d_: true,
|
|
29
|
+
e_: marko_componentType
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
marko_template.meta = {
|
|
33
|
+
id: "/@mindful-web/marko-web-gtm$1.0.0/components/start.marko",
|
|
34
|
+
tags: [
|
|
35
|
+
"./push.marko"
|
|
36
|
+
]
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<marko-web-browser-component name="GTMTrackBusEvent" props=input />
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-gtm$1.0.0/components/track-bus-event.marko",
|
|
6
|
+
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
7
|
+
marko_web_browser_component_template = require("@mindful-web/marko-web/components/browser-component.marko"),
|
|
8
|
+
marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
|
|
9
|
+
marko_web_browser_component_tag = marko_loadTag(marko_web_browser_component_template);
|
|
10
|
+
|
|
11
|
+
function render(input, out, __component, component, state) {
|
|
12
|
+
var data = input;
|
|
13
|
+
|
|
14
|
+
marko_web_browser_component_tag({
|
|
15
|
+
name: "GTMTrackBusEvent",
|
|
16
|
+
props: input
|
|
17
|
+
}, out, __component, "0");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
marko_template._ = marko_renderer(render, {
|
|
21
|
+
d_: true,
|
|
22
|
+
e_: marko_componentType
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
marko_template.meta = {
|
|
26
|
+
id: "/@mindful-web/marko-web-gtm$1.0.0/components/track-bus-event.marko",
|
|
27
|
+
tags: [
|
|
28
|
+
"@mindful-web/marko-web/components/browser-component.marko"
|
|
29
|
+
]
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<marko-web-browser-component name="GTMTrackInViewEvent" props=input />
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-gtm$1.0.0/components/track-inview-event.marko",
|
|
6
|
+
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
7
|
+
marko_web_browser_component_template = require("@mindful-web/marko-web/components/browser-component.marko"),
|
|
8
|
+
marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
|
|
9
|
+
marko_web_browser_component_tag = marko_loadTag(marko_web_browser_component_template);
|
|
10
|
+
|
|
11
|
+
function render(input, out, __component, component, state) {
|
|
12
|
+
var data = input;
|
|
13
|
+
|
|
14
|
+
marko_web_browser_component_tag({
|
|
15
|
+
name: "GTMTrackInViewEvent",
|
|
16
|
+
props: input
|
|
17
|
+
}, out, __component, "0");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
marko_template._ = marko_renderer(render, {
|
|
21
|
+
d_: true,
|
|
22
|
+
e_: marko_componentType
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
marko_template.meta = {
|
|
26
|
+
id: "/@mindful-web/marko-web-gtm$1.0.0/components/track-inview-event.marko",
|
|
27
|
+
tags: [
|
|
28
|
+
"@mindful-web/marko-web/components/browser-component.marko"
|
|
29
|
+
]
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<marko-web-browser-component name="GTMTrackLoadMore" props=input />
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Compiled using marko@4.20.2 - DO NOT EDIT
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
var marko_template = module.exports = require("marko/dist/html").t(__filename),
|
|
5
|
+
marko_componentType = "/@mindful-web/marko-web-gtm$1.0.0/components/track-load-more.marko",
|
|
6
|
+
marko_renderer = require("marko/dist/runtime/components/renderer"),
|
|
7
|
+
marko_web_browser_component_template = require("@mindful-web/marko-web/components/browser-component.marko"),
|
|
8
|
+
marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
|
|
9
|
+
marko_web_browser_component_tag = marko_loadTag(marko_web_browser_component_template);
|
|
10
|
+
|
|
11
|
+
function render(input, out, __component, component, state) {
|
|
12
|
+
var data = input;
|
|
13
|
+
|
|
14
|
+
marko_web_browser_component_tag({
|
|
15
|
+
name: "GTMTrackLoadMore",
|
|
16
|
+
props: input
|
|
17
|
+
}, out, __component, "0");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
marko_template._ = marko_renderer(render, {
|
|
21
|
+
d_: true,
|
|
22
|
+
e_: marko_componentType
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
marko_template.meta = {
|
|
26
|
+
id: "/@mindful-web/marko-web-gtm$1.0.0/components/track-load-more.marko",
|
|
27
|
+
tags: [
|
|
28
|
+
"@mindful-web/marko-web/components/browser-component.marko"
|
|
29
|
+
]
|
|
30
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const { getAsObject, getAsArray, get } = require('@mindful-web/object-path');
|
|
2
|
+
const { asObject } = require('@mindful-web/utils');
|
|
3
|
+
const buildQueryString = require('../utils/build-query-string');
|
|
4
|
+
|
|
5
|
+
module.exports = ({ obj, req }) => {
|
|
6
|
+
const content = asObject(obj);
|
|
7
|
+
const company = getAsObject(content, 'company');
|
|
8
|
+
const createdBy = getAsObject(content, 'createdBy');
|
|
9
|
+
const section = getAsObject(content, 'primarySection');
|
|
10
|
+
const userRegistration = getAsObject(content, 'userRegistration');
|
|
11
|
+
const hierarchy = getAsArray(section, 'hierarchy').map((s) => ({
|
|
12
|
+
id: s.id,
|
|
13
|
+
name: s.name,
|
|
14
|
+
alias: s.alias,
|
|
15
|
+
}));
|
|
16
|
+
const taxonomy = getAsArray(content, 'taxonomy.edges').map(({ node }) => ({
|
|
17
|
+
id: node.id,
|
|
18
|
+
type: node.type,
|
|
19
|
+
name: node.name,
|
|
20
|
+
fullName: node.fullName,
|
|
21
|
+
}));
|
|
22
|
+
const authors = getAsArray(content, 'authors.edges').map(({ node }) => ({
|
|
23
|
+
id: node.id,
|
|
24
|
+
name: node.name,
|
|
25
|
+
}));
|
|
26
|
+
const schedules = getAsArray(content, 'websiteSchedules').map(({ section: s }) => ({
|
|
27
|
+
id: s.id,
|
|
28
|
+
name: s.name,
|
|
29
|
+
}));
|
|
30
|
+
const emailSchedules = getAsArray(content, 'emailSchedules')
|
|
31
|
+
.map((schedule) => ({
|
|
32
|
+
name: schedule.newsletter.name,
|
|
33
|
+
deploymentDate: schedule.deploymentDate,
|
|
34
|
+
}))
|
|
35
|
+
.sort((a, b) => a.deploymentDate - b.deploymentDate);
|
|
36
|
+
const magazineSchedules = getAsArray(content, 'magazineSchedules')
|
|
37
|
+
.map(({ issue: i }) => ({ name: i.name, mailDate: i.mailDate }))
|
|
38
|
+
.sort((a, b) => new Date(a.mailDate) - new Date(b.mailDate));
|
|
39
|
+
return {
|
|
40
|
+
page_type: 'content',
|
|
41
|
+
canonical_path: get(content, 'siteContext.path'),
|
|
42
|
+
query_string: buildQueryString({ req }),
|
|
43
|
+
content: {
|
|
44
|
+
id: content.id,
|
|
45
|
+
type: content.type,
|
|
46
|
+
name: content.name,
|
|
47
|
+
published: content.published ? new Date(content.published).toISOString() : undefined,
|
|
48
|
+
labels: getAsArray(content, 'labels'),
|
|
49
|
+
userRegistration,
|
|
50
|
+
},
|
|
51
|
+
created_by: {
|
|
52
|
+
id: createdBy.id,
|
|
53
|
+
username: createdBy.username,
|
|
54
|
+
firstName: createdBy.firstName,
|
|
55
|
+
lastName: createdBy.lastName,
|
|
56
|
+
},
|
|
57
|
+
company: {
|
|
58
|
+
id: company.id,
|
|
59
|
+
name: company.name,
|
|
60
|
+
},
|
|
61
|
+
section: {
|
|
62
|
+
id: section.id,
|
|
63
|
+
name: section.name,
|
|
64
|
+
alias: section.alias,
|
|
65
|
+
fullName: section.fullName,
|
|
66
|
+
},
|
|
67
|
+
section_hierarchy: hierarchy,
|
|
68
|
+
taxonomy,
|
|
69
|
+
authors,
|
|
70
|
+
schedules,
|
|
71
|
+
emailSchedules,
|
|
72
|
+
magazineSchedules,
|
|
73
|
+
};
|
|
74
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const { asObject } = require('@mindful-web/utils');
|
|
2
|
+
const buildQueryString = require('../utils/build-query-string');
|
|
3
|
+
|
|
4
|
+
module.exports = ({ type, obj, req }) => {
|
|
5
|
+
const o = asObject(obj);
|
|
6
|
+
return {
|
|
7
|
+
page_type: type,
|
|
8
|
+
canonical_path: o.canonicalPath || req.path,
|
|
9
|
+
query_string: buildQueryString({ req }),
|
|
10
|
+
};
|
|
11
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const { get } = require('@mindful-web/object-path');
|
|
2
|
+
const { asObject } = require('@mindful-web/utils');
|
|
3
|
+
const buildQueryString = require('../utils/build-query-string');
|
|
4
|
+
|
|
5
|
+
module.exports = ({ obj, req }) => {
|
|
6
|
+
const page = asObject(obj);
|
|
7
|
+
return {
|
|
8
|
+
page_type: 'dynamic-page',
|
|
9
|
+
canonical_path: get(page, 'siteContext.path'),
|
|
10
|
+
query_string: buildQueryString({ req }),
|
|
11
|
+
page: {
|
|
12
|
+
id: page.id,
|
|
13
|
+
name: page.name,
|
|
14
|
+
alias: page.alias,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
};
|
package/context/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const defaultBuilder = require('./default');
|
|
2
|
+
const contentBuilder = require('./content');
|
|
3
|
+
const websiteSectionBuilder = require('./website-section');
|
|
4
|
+
const dynamicPageBuilder = require('./dynamic-page');
|
|
5
|
+
const magazineIssueBuilder = require('./magazine-issue');
|
|
6
|
+
const magazinePublicationBuilder = require('./magazine-publication');
|
|
7
|
+
const nativeXStoryBuilder = require('./native-x-story');
|
|
8
|
+
|
|
9
|
+
module.exports = {
|
|
10
|
+
defaultBuilder,
|
|
11
|
+
contentBuilder,
|
|
12
|
+
websiteSectionBuilder,
|
|
13
|
+
dynamicPageBuilder,
|
|
14
|
+
magazineIssueBuilder,
|
|
15
|
+
magazinePublicationBuilder,
|
|
16
|
+
nativeXStoryBuilder,
|
|
17
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const { getAsObject } = require('@mindful-web/object-path');
|
|
2
|
+
const { asObject } = require('@mindful-web/utils');
|
|
3
|
+
const buildQueryString = require('../utils/build-query-string');
|
|
4
|
+
|
|
5
|
+
module.exports = ({ obj, req }) => {
|
|
6
|
+
const issue = asObject(obj);
|
|
7
|
+
const publication = getAsObject(issue, 'publication');
|
|
8
|
+
return {
|
|
9
|
+
page_type: 'magazine-issue',
|
|
10
|
+
canonical_path: issue.canonicalPath,
|
|
11
|
+
query_string: buildQueryString({ req }),
|
|
12
|
+
issue: {
|
|
13
|
+
id: issue.id,
|
|
14
|
+
name: issue.name,
|
|
15
|
+
mailed: issue.mailed ? new Date(issue.mailed).toISOString() : undefined,
|
|
16
|
+
},
|
|
17
|
+
publication: {
|
|
18
|
+
id: publication.id,
|
|
19
|
+
name: publication.name,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const { asObject } = require('@mindful-web/utils');
|
|
2
|
+
const buildQueryString = require('../utils/build-query-string');
|
|
3
|
+
|
|
4
|
+
module.exports = ({ obj, req }) => {
|
|
5
|
+
const publication = asObject(obj);
|
|
6
|
+
return {
|
|
7
|
+
page_type: 'magazine-publication',
|
|
8
|
+
canonical_path: publication.canonicalPath,
|
|
9
|
+
query_string: buildQueryString({ req }),
|
|
10
|
+
publication: {
|
|
11
|
+
id: publication.id,
|
|
12
|
+
name: publication.name,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const { getAsObject, getAsArray, get } = require('@mindful-web/object-path');
|
|
2
|
+
const { asObject } = require('@mindful-web/utils');
|
|
3
|
+
const buildQueryString = require('../utils/build-query-string');
|
|
4
|
+
|
|
5
|
+
module.exports = ({ type, obj, req }) => {
|
|
6
|
+
const content = asObject(obj);
|
|
7
|
+
const company = getAsObject(content, 'company');
|
|
8
|
+
const section = getAsObject(content, 'primarySection');
|
|
9
|
+
const hierarchy = getAsArray(section, 'hierarchy').map((s) => ({
|
|
10
|
+
id: s.id,
|
|
11
|
+
name: s.name,
|
|
12
|
+
alias: s.alias,
|
|
13
|
+
}));
|
|
14
|
+
return {
|
|
15
|
+
page_type: type,
|
|
16
|
+
canonical_path: get(content, 'siteContext.path'),
|
|
17
|
+
query_string: buildQueryString({ req }),
|
|
18
|
+
content: {
|
|
19
|
+
id: content.id,
|
|
20
|
+
type: content.type,
|
|
21
|
+
name: content.name,
|
|
22
|
+
published: content.published ? new Date(content.published).toISOString() : undefined,
|
|
23
|
+
labels: getAsArray(content, 'labels'),
|
|
24
|
+
},
|
|
25
|
+
company: {
|
|
26
|
+
id: company.id,
|
|
27
|
+
name: company.name,
|
|
28
|
+
},
|
|
29
|
+
section: {
|
|
30
|
+
id: section.id,
|
|
31
|
+
name: section.name,
|
|
32
|
+
alias: section.alias,
|
|
33
|
+
fullName: section.fullName,
|
|
34
|
+
},
|
|
35
|
+
section_hierarchy: hierarchy,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const { getAsArray } = require('@mindful-web/object-path');
|
|
2
|
+
const { asObject } = require('@mindful-web/utils');
|
|
3
|
+
const buildQueryString = require('../utils/build-query-string');
|
|
4
|
+
|
|
5
|
+
module.exports = ({ obj, req }) => {
|
|
6
|
+
const section = asObject(obj);
|
|
7
|
+
const hierarchy = getAsArray(section, 'hierarchy').map((s) => ({
|
|
8
|
+
id: s.id,
|
|
9
|
+
name: s.name,
|
|
10
|
+
alias: s.alias,
|
|
11
|
+
}));
|
|
12
|
+
return {
|
|
13
|
+
page_type: 'website-section',
|
|
14
|
+
canonical_path: section.canonicalPath,
|
|
15
|
+
query_string: buildQueryString({ req }),
|
|
16
|
+
section: {
|
|
17
|
+
id: section.id,
|
|
18
|
+
name: section.name,
|
|
19
|
+
alias: section.alias,
|
|
20
|
+
fullName: section.fullName,
|
|
21
|
+
},
|
|
22
|
+
section_hierarchy: hierarchy,
|
|
23
|
+
};
|
|
24
|
+
};
|
package/marko.json
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mindful-web/marko-web-gtm",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Google Tag Manager (GAM) Marko components for Mindful Web websites",
|
|
5
|
+
"author": "Jacob Bare <jacob@parameter1.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": "https://github.com/parameter1/mindful-web/tree/main/packages/marko-web-gtm",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"lint:fix": "yarn lint --fix",
|
|
10
|
+
"lint": "eslint --ext .js --ext .vue --max-warnings 5 ./",
|
|
11
|
+
"compile": "mindful-web-marko-compile compile",
|
|
12
|
+
"prepublish": "yarn compile --silent",
|
|
13
|
+
"test": "yarn compile --no-clean && yarn lint"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@mindful-web/inflector": "^1.0.0",
|
|
17
|
+
"@mindful-web/marko-web-deferred-script-loader": "^1.0.0",
|
|
18
|
+
"@mindful-web/object-path": "^1.0.0",
|
|
19
|
+
"@mindful-web/utils": "^1.0.0",
|
|
20
|
+
"graphql": "^14.7.0",
|
|
21
|
+
"graphql-tag": "^2.12.6"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"@mindful-web/marko-core": "^0.0.0",
|
|
25
|
+
"@mindful-web/marko-web": "^0.0.0"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"gitHead": "0b77cab713eb5841202bb86c7119949866bc68b5"
|
|
31
|
+
}
|
package/scss/slot.scss
ADDED