@adobe/alloy 2.21.0-beta.7 → 2.21.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/libEs5/components/ActivityCollector/attachClickActivityCollector.js +4 -0
- package/libEs5/components/ActivityCollector/configValidators.js +17 -2
- package/libEs5/components/ActivityCollector/createClickActivityStorage.js +35 -0
- package/libEs5/components/ActivityCollector/createClickedElementProperties.js +215 -0
- package/libEs5/components/ActivityCollector/createGetClickedElementProperties.js +64 -0
- package/libEs5/components/ActivityCollector/createInjectClickedElementProperties.js +70 -0
- package/libEs5/components/ActivityCollector/createRecallAndInjectClickedElementProperties.js +46 -0
- package/libEs5/components/ActivityCollector/{createLinkClick.js → createStorePageViewProperties.js} +6 -21
- package/libEs5/components/ActivityCollector/getLinkName.js +9 -24
- package/libEs5/components/ActivityCollector/getLinkRegion.js +2 -2
- package/libEs5/components/ActivityCollector/index.js +54 -19
- package/libEs5/components/ActivityCollector/utils/activityMapExtensionEnabled.js +20 -0
- package/libEs5/components/ActivityCollector/utils/createTransientStorage.js +28 -0
- package/libEs5/components/ActivityCollector/utils/determineLinkType.js +28 -0
- package/libEs5/components/ActivityCollector/utils/dom/elementHasClickHandler.js +17 -0
- package/libEs5/components/ActivityCollector/utils/dom/extractDomain.js +22 -0
- package/libEs5/components/ActivityCollector/utils/dom/findClickableElement.js +28 -0
- package/libEs5/components/ActivityCollector/utils/dom/getAbsoluteUrlFromAnchorElement.js +42 -0
- package/libEs5/components/ActivityCollector/utils/dom/isButtonSubmitElement.js +17 -0
- package/libEs5/components/ActivityCollector/utils/dom/isDownloadLink.js +28 -0
- package/libEs5/components/ActivityCollector/utils/dom/isExitLink.js +25 -0
- package/libEs5/components/ActivityCollector/utils/dom/isInputSubmitElement.js +28 -0
- package/libEs5/components/ActivityCollector/utils/dom/isSupportedAnchorElement.js +20 -0
- package/libEs5/components/ActivityCollector/utils/dom/isSupportedTextNode.js +30 -0
- package/libEs5/components/ActivityCollector/utils/hasPageName.js +21 -0
- package/libEs5/components/ActivityCollector/utils/isDifferentDomains.js +20 -0
- package/libEs5/components/ActivityCollector/utils/trimQueryFromUrl.js +25 -0
- package/libEs5/components/ActivityCollector/utils/truncateWhiteSpace.js +24 -0
- package/libEs5/components/ActivityCollector/utils/urlStartsWithScheme.js +17 -0
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/constants/sessionDataKeys.js +15 -0
- package/libEs5/core/config/createCoreConfigs.js +1 -1
- package/libEs5/utils/validation/createDeprecatedValidator.js +8 -23
- package/libEs5/utils/validation/createRenamedValidator.js +44 -0
- package/libEs5/utils/validation/index.js +7 -3
- package/libEs6/components/ActivityCollector/attachClickActivityCollector.js +4 -0
- package/libEs6/components/ActivityCollector/configValidators.js +17 -2
- package/libEs6/components/ActivityCollector/createClickActivityStorage.js +34 -0
- package/libEs6/components/ActivityCollector/createClickedElementProperties.js +218 -0
- package/libEs6/components/ActivityCollector/createGetClickedElementProperties.js +69 -0
- package/libEs6/components/ActivityCollector/createInjectClickedElementProperties.js +69 -0
- package/libEs6/components/ActivityCollector/createRecallAndInjectClickedElementProperties.js +45 -0
- package/libEs6/components/ActivityCollector/{createLinkClick.js → createStorePageViewProperties.js} +7 -22
- package/libEs6/components/ActivityCollector/getLinkName.js +2 -16
- package/libEs6/components/ActivityCollector/getLinkRegion.js +1 -1
- package/libEs6/components/ActivityCollector/index.js +50 -14
- package/libEs6/components/ActivityCollector/utils/activityMapExtensionEnabled.js +14 -0
- package/libEs6/components/ActivityCollector/utils/createTransientStorage.js +26 -0
- package/libEs6/components/ActivityCollector/utils/determineLinkType.js +26 -0
- package/libEs6/components/ActivityCollector/utils/dom/elementHasClickHandler.js +15 -0
- package/libEs6/components/ActivityCollector/utils/dom/extractDomain.js +20 -0
- package/libEs6/components/ActivityCollector/utils/dom/findClickableElement.js +26 -0
- package/libEs6/components/ActivityCollector/utils/dom/getAbsoluteUrlFromAnchorElement.js +42 -0
- package/libEs6/components/ActivityCollector/utils/dom/isButtonSubmitElement.js +15 -0
- package/libEs6/components/ActivityCollector/utils/dom/isDownloadLink.js +26 -0
- package/libEs6/components/ActivityCollector/utils/dom/isExitLink.js +23 -0
- package/libEs6/components/ActivityCollector/utils/dom/isInputSubmitElement.js +26 -0
- package/libEs6/components/ActivityCollector/utils/dom/isSupportedAnchorElement.js +18 -0
- package/libEs6/components/ActivityCollector/utils/dom/isSupportedTextNode.js +27 -0
- package/libEs6/components/ActivityCollector/utils/hasPageName.js +19 -0
- package/libEs6/components/ActivityCollector/utils/isDifferentDomains.js +18 -0
- package/libEs6/components/ActivityCollector/utils/trimQueryFromUrl.js +23 -0
- package/libEs6/components/ActivityCollector/utils/truncateWhiteSpace.js +22 -0
- package/libEs6/components/ActivityCollector/utils/urlStartsWithScheme.js +15 -0
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/constants/sessionDataKeys.js +12 -0
- package/libEs6/core/config/createCoreConfigs.js +1 -1
- package/libEs6/utils/validation/createDeprecatedValidator.js +7 -20
- package/libEs6/utils/validation/createRenamedValidator.js +37 -0
- package/libEs6/utils/validation/index.js +7 -3
- package/package.json +15 -12
- package/libEs5/components/ActivityCollector/createGetLinkDetails.js +0 -68
- package/libEs5/components/ActivityCollector/utils.js +0 -104
- package/libEs6/components/ActivityCollector/createGetLinkDetails.js +0 -70
- package/libEs6/components/ActivityCollector/utils.js +0 -104
|
@@ -10,22 +10,8 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Determines if a node qualifies as a supported link text node.
|
|
18
|
-
* @param {*} node Node to determine support for.
|
|
19
|
-
* @returns {boolean}
|
|
20
|
-
*/
|
|
21
|
-
const isSupportedTextNode = node => {
|
|
22
|
-
if (node && node.nodeName) {
|
|
23
|
-
if (node.nodeName.match(unsupportedNodeNames)) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return true;
|
|
28
|
-
};
|
|
13
|
+
import truncateWhiteSpace from "./utils/truncateWhiteSpace.js";
|
|
14
|
+
import isSupportedTextNode from "./utils/dom/isSupportedTextNode.js";
|
|
29
15
|
|
|
30
16
|
/**
|
|
31
17
|
* Orders and returns specified node and its child nodes in arrays of supported
|
|
@@ -10,7 +10,7 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import
|
|
13
|
+
import truncateWhiteSpace from "./utils/truncateWhiteSpace.js";
|
|
14
14
|
import { isNonEmptyString } from "../../utils/index.js";
|
|
15
15
|
const semanticElements = /^(HEADER|MAIN|FOOTER|NAV)$/i;
|
|
16
16
|
const getAriaRegionLabel = node => {
|
|
@@ -12,29 +12,54 @@ governing permissions and limitations under the License.
|
|
|
12
12
|
|
|
13
13
|
import attachClickActivityCollector from "./attachClickActivityCollector.js";
|
|
14
14
|
import configValidators from "./configValidators.js";
|
|
15
|
-
import
|
|
16
|
-
import
|
|
15
|
+
import createInjectClickedElementProperties from "./createInjectClickedElementProperties.js";
|
|
16
|
+
import createRecallAndInjectClickedElementProperties from "./createRecallAndInjectClickedElementProperties.js";
|
|
17
|
+
import createGetClickedElementProperties from "./createGetClickedElementProperties.js";
|
|
18
|
+
import createClickActivityStorage from "./createClickActivityStorage.js";
|
|
19
|
+
import createStorePageViewProperties from "./createStorePageViewProperties.js";
|
|
17
20
|
import getLinkName from "./getLinkName.js";
|
|
18
21
|
import getLinkRegion from "./getLinkRegion.js";
|
|
19
|
-
import
|
|
20
|
-
|
|
22
|
+
import getAbsoluteUrlFromAnchorElement from "./utils/dom/getAbsoluteUrlFromAnchorElement.js";
|
|
23
|
+
import findClickableElement from "./utils/dom/findClickableElement.js";
|
|
24
|
+
import determineLinkType from "./utils/determineLinkType.js";
|
|
25
|
+
import hasPageName from "./utils/hasPageName.js";
|
|
26
|
+
import createTransientStorage from "./utils/createTransientStorage.js";
|
|
27
|
+
import { injectStorage } from "../../utils/index.js";
|
|
28
|
+
const getClickedElementProperties = createGetClickedElementProperties({
|
|
21
29
|
window,
|
|
22
30
|
getLinkName,
|
|
23
31
|
getLinkRegion,
|
|
24
32
|
getAbsoluteUrlFromAnchorElement,
|
|
25
|
-
|
|
33
|
+
findClickableElement,
|
|
26
34
|
determineLinkType
|
|
27
35
|
});
|
|
36
|
+
let clickActivityStorage;
|
|
28
37
|
const createActivityCollector = ({
|
|
29
38
|
config,
|
|
30
39
|
eventManager,
|
|
31
40
|
handleError,
|
|
32
41
|
logger
|
|
33
42
|
}) => {
|
|
34
|
-
const
|
|
35
|
-
|
|
43
|
+
const clickCollection = config.clickCollection;
|
|
44
|
+
const createNamespacedStorage = injectStorage(window);
|
|
45
|
+
const nameSpacedStorage = createNamespacedStorage(config.orgId || "");
|
|
46
|
+
// Use transient in-memory if sessionStorage is disabled
|
|
47
|
+
const transientStorage = createTransientStorage();
|
|
48
|
+
const storage = clickCollection.sessionStorageEnabled ? nameSpacedStorage.session : transientStorage;
|
|
49
|
+
clickActivityStorage = createClickActivityStorage({
|
|
50
|
+
storage
|
|
51
|
+
});
|
|
52
|
+
const injectClickedElementProperties = createInjectClickedElementProperties({
|
|
36
53
|
config,
|
|
37
|
-
logger
|
|
54
|
+
logger,
|
|
55
|
+
clickActivityStorage,
|
|
56
|
+
getClickedElementProperties
|
|
57
|
+
});
|
|
58
|
+
const recallAndInjectClickedElementProperties = createRecallAndInjectClickedElementProperties({
|
|
59
|
+
clickActivityStorage
|
|
60
|
+
});
|
|
61
|
+
const storePageViewProperties = createStorePageViewProperties({
|
|
62
|
+
clickActivityStorage
|
|
38
63
|
});
|
|
39
64
|
return {
|
|
40
65
|
lifecycle: {
|
|
@@ -53,10 +78,20 @@ const createActivityCollector = ({
|
|
|
53
78
|
event,
|
|
54
79
|
clickedElement
|
|
55
80
|
}) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
81
|
+
injectClickedElementProperties({
|
|
82
|
+
event,
|
|
83
|
+
clickedElement
|
|
59
84
|
});
|
|
85
|
+
},
|
|
86
|
+
onBeforeEvent({
|
|
87
|
+
event
|
|
88
|
+
}) {
|
|
89
|
+
if (hasPageName(event)) {
|
|
90
|
+
if (clickCollection.eventGroupingEnabled) {
|
|
91
|
+
recallAndInjectClickedElementProperties(event);
|
|
92
|
+
}
|
|
93
|
+
storePageViewProperties(event, logger, clickActivityStorage);
|
|
94
|
+
}
|
|
60
95
|
}
|
|
61
96
|
}
|
|
62
97
|
};
|
|
@@ -69,11 +104,12 @@ createActivityCollector.buildOnInstanceConfiguredExtraParams = ({
|
|
|
69
104
|
}) => {
|
|
70
105
|
return {
|
|
71
106
|
getLinkDetails: targetElement => {
|
|
72
|
-
return
|
|
73
|
-
|
|
107
|
+
return getClickedElementProperties({
|
|
108
|
+
clickActivityStorage,
|
|
109
|
+
clickedElement: targetElement,
|
|
74
110
|
config,
|
|
75
111
|
logger
|
|
76
|
-
});
|
|
112
|
+
}).properties;
|
|
77
113
|
}
|
|
78
114
|
};
|
|
79
115
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const ACTIVITY_MAP_EXTENSION_ID = "cppXYctnr";
|
|
14
|
+
export default ((context = document) => context.getElementById(ACTIVITY_MAP_EXTENSION_ID) !== null);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export default (() => {
|
|
14
|
+
const storage = {};
|
|
15
|
+
return {
|
|
16
|
+
getItem: key => {
|
|
17
|
+
return storage[key];
|
|
18
|
+
},
|
|
19
|
+
setItem: (key, value) => {
|
|
20
|
+
storage[key] = value;
|
|
21
|
+
},
|
|
22
|
+
removeItem: key => {
|
|
23
|
+
delete storage[key];
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import isDownloadLink from "./dom/isDownloadLink";
|
|
14
|
+
import isExitLink from "./dom/isExitLink";
|
|
15
|
+
import isNonEmptyString from "../../../utils/isNonEmptyString";
|
|
16
|
+
export default ((window, config, linkUrl, clickedObj) => {
|
|
17
|
+
let linkType = "other";
|
|
18
|
+
if (isNonEmptyString(linkUrl)) {
|
|
19
|
+
if (isDownloadLink(config.downloadLinkQualifier, linkUrl, clickedObj)) {
|
|
20
|
+
linkType = "download";
|
|
21
|
+
} else if (isExitLink(window, linkUrl)) {
|
|
22
|
+
linkType = "exit";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return linkType;
|
|
26
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export default (element => {
|
|
14
|
+
return !element ? false : !!element.onclick;
|
|
15
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export default (uri => {
|
|
14
|
+
let fullUrl = uri;
|
|
15
|
+
if (!/^https?:\/\//i.test(fullUrl)) {
|
|
16
|
+
fullUrl = `${window.location.protocol}//${uri}`;
|
|
17
|
+
}
|
|
18
|
+
const url = new URL(fullUrl);
|
|
19
|
+
return url.hostname;
|
|
20
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import isSupportedAnchorElement from "./isSupportedAnchorElement.js";
|
|
14
|
+
import elementHasClickHandler from "./elementHasClickHandler.js";
|
|
15
|
+
import isInputSubmitElement from "./isInputSubmitElement.js";
|
|
16
|
+
import isButtonSubmitElement from "./isButtonSubmitElement.js";
|
|
17
|
+
export default (element => {
|
|
18
|
+
let node = element;
|
|
19
|
+
while (node) {
|
|
20
|
+
if (isSupportedAnchorElement(node) || elementHasClickHandler(node) || isInputSubmitElement(node) || isButtonSubmitElement(node)) {
|
|
21
|
+
return node;
|
|
22
|
+
}
|
|
23
|
+
node = node.parentNode;
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import urlStartsWithScheme from "../urlStartsWithScheme";
|
|
14
|
+
export default ((window, element) => {
|
|
15
|
+
const loc = window.location;
|
|
16
|
+
let href = element.href || "";
|
|
17
|
+
// Some objects (like SVG animations) can contain a href object instead of a string
|
|
18
|
+
if (typeof href !== "string") {
|
|
19
|
+
href = "";
|
|
20
|
+
}
|
|
21
|
+
let {
|
|
22
|
+
protocol,
|
|
23
|
+
host
|
|
24
|
+
} = element;
|
|
25
|
+
if (href && !urlStartsWithScheme(href)) {
|
|
26
|
+
if (!protocol) {
|
|
27
|
+
protocol = loc.protocol ? loc.protocol : "";
|
|
28
|
+
}
|
|
29
|
+
protocol = protocol ? `${protocol}//` : "";
|
|
30
|
+
if (!host) {
|
|
31
|
+
host = loc.host ? loc.host : "";
|
|
32
|
+
}
|
|
33
|
+
let path = "";
|
|
34
|
+
if (href.substring(0, 1) !== "/") {
|
|
35
|
+
let indx = loc.pathname.lastIndexOf("/");
|
|
36
|
+
indx = indx < 0 ? 0 : indx;
|
|
37
|
+
path = loc.pathname.substring(0, indx);
|
|
38
|
+
}
|
|
39
|
+
href = `${protocol}${host}${path}/${href}`;
|
|
40
|
+
}
|
|
41
|
+
return href;
|
|
42
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export default (element => {
|
|
14
|
+
return element.tagName === "BUTTON" && element.type === "submit";
|
|
15
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import trimQueryFromUrl from "../trimQueryFromUrl";
|
|
14
|
+
export default ((downloadLinkQualifier, linkUrl, clickedObj) => {
|
|
15
|
+
let result = false;
|
|
16
|
+
if (linkUrl) {
|
|
17
|
+
if (clickedObj && clickedObj.download) {
|
|
18
|
+
result = true;
|
|
19
|
+
} else if (downloadLinkQualifier) {
|
|
20
|
+
const re = new RegExp(downloadLinkQualifier);
|
|
21
|
+
const trimmedLinkUrl = trimQueryFromUrl(linkUrl).toLowerCase();
|
|
22
|
+
result = re.test(trimmedLinkUrl);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return result;
|
|
26
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import trimQueryFromUrl from "../trimQueryFromUrl";
|
|
14
|
+
export default ((window, linkUrl) => {
|
|
15
|
+
let result = false;
|
|
16
|
+
// window.location.hostname should always be defined, but checking just in case
|
|
17
|
+
if (linkUrl && window.location.hostname) {
|
|
18
|
+
const currentHostname = window.location.hostname.toLowerCase();
|
|
19
|
+
const trimmedLinkUrl = trimQueryFromUrl(linkUrl).toLowerCase();
|
|
20
|
+
result = trimmedLinkUrl.indexOf(currentHostname) < 0;
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export default (element => {
|
|
14
|
+
if (element.tagName === "INPUT") {
|
|
15
|
+
const type = element.getAttribute("type");
|
|
16
|
+
if (type === "submit") {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
// Image type input elements are considered submit elements.
|
|
20
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/image
|
|
21
|
+
if (type === "image" && element.src) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export default (element => {
|
|
14
|
+
if (element.href && (element.tagName === "A" || element.tagName === "AREA") && (!element.onclick || !element.protocol || element.protocol.toLowerCase().indexOf("javascript") < 0)) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const unsupportedNodeNames = /^(SCRIPT|STYLE|LINK|CANVAS|NOSCRIPT|#COMMENT)$/i;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Determines if a node qualifies as a supported link text node.
|
|
17
|
+
* @param {*} node Node to determine support for.
|
|
18
|
+
* @returns {boolean}
|
|
19
|
+
*/
|
|
20
|
+
export default (node => {
|
|
21
|
+
if (node && node.nodeName) {
|
|
22
|
+
if (node.nodeName.match(unsupportedNodeNames)) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export default (event => {
|
|
14
|
+
const content = event.getContent();
|
|
15
|
+
return content.xdm !== undefined &&
|
|
16
|
+
// NOTE: A page view event should "ideally" include the pageViews type
|
|
17
|
+
// && event.xdm.eventType === "web.webpagedetails.pageViews"
|
|
18
|
+
content.xdm.web !== undefined && content.xdm.web.webPageDetails !== undefined && content.xdm.web.webPageDetails.name !== undefined;
|
|
19
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import extractDomain from "./dom/extractDomain";
|
|
14
|
+
export default ((uri1, uri2) => {
|
|
15
|
+
const domain1 = extractDomain(uri1);
|
|
16
|
+
const domain2 = extractDomain(uri2);
|
|
17
|
+
return domain1 !== domain2;
|
|
18
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export default (url => {
|
|
14
|
+
const questionMarkIndex = url.indexOf("?");
|
|
15
|
+
const hashIndex = url.indexOf("#");
|
|
16
|
+
if (questionMarkIndex >= 0 && (questionMarkIndex < hashIndex || hashIndex < 0)) {
|
|
17
|
+
return url.substring(0, questionMarkIndex);
|
|
18
|
+
}
|
|
19
|
+
if (hashIndex >= 0) {
|
|
20
|
+
return url.substring(0, hashIndex);
|
|
21
|
+
}
|
|
22
|
+
return url;
|
|
23
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Reduces repeated whitespace within a string. Whitespace surrounding the string
|
|
15
|
+
* is trimmed and any occurrence of whitespace within the string is replaced with
|
|
16
|
+
* a single space.
|
|
17
|
+
* @param {string} str String to be formatted.
|
|
18
|
+
* @returns {string} Formatted string.
|
|
19
|
+
*/
|
|
20
|
+
export default (str => {
|
|
21
|
+
return str && str.replace(/\s+/g, " ").trim();
|
|
22
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export default (url => {
|
|
14
|
+
return !url ? false : /^[a-z0-9]+:\/\//i.test(url);
|
|
15
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
export const CLICK_ACTIVITY_DATA = "clickData";
|
|
@@ -24,4 +24,4 @@ export default (() => objectOf({
|
|
|
24
24
|
orgId: string().unique().required(),
|
|
25
25
|
onBeforeEventSend: callback().default(noop),
|
|
26
26
|
edgeConfigOverrides: validateConfigOverride
|
|
27
|
-
}).
|
|
27
|
+
}).renamed("edgeConfigId", string().unique(), "datastreamId"));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright
|
|
2
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
3
3
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
5
|
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -9,29 +9,16 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
9
9
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const {
|
|
17
|
-
[oldField]: oldValue,
|
|
18
|
-
[newField]: newValue,
|
|
19
|
-
...otherValues
|
|
20
|
-
} = value;
|
|
21
|
-
const validatedOldValue = oldSchema(oldValue, path);
|
|
22
|
-
if (validatedOldValue !== undefined) {
|
|
23
|
-
let message = `The field '${oldField}' is deprecated. Use '${newField}' instead.`;
|
|
12
|
+
|
|
13
|
+
export default ((warning = "This field has been deprecated") => function deprecated(value, path) {
|
|
14
|
+
let message = warning;
|
|
15
|
+
if (value !== undefined) {
|
|
24
16
|
if (path) {
|
|
25
17
|
message = `'${path}': ${message}`;
|
|
26
18
|
}
|
|
27
|
-
if (
|
|
28
|
-
throw new Error(message);
|
|
29
|
-
} else if (this && this.logger) {
|
|
19
|
+
if (this && this.logger) {
|
|
30
20
|
this.logger.warn(message);
|
|
31
21
|
}
|
|
32
22
|
}
|
|
33
|
-
return
|
|
34
|
-
[newField]: newValue || validatedOldValue,
|
|
35
|
-
...otherValues
|
|
36
|
-
};
|
|
23
|
+
return value;
|
|
37
24
|
});
|