@adobe/alloy 2.22.0-alpha.0 → 2.22.0-alpha.1
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/Personalization/createFetchDataHandler.js +34 -0
- package/libEs5/components/Personalization/createViewChangeHandler.js +11 -1
- package/libEs5/components/Personalization/flicker/index.js +47 -33
- package/libEs5/components/Personalization/handlers/createProcessPropositions.js +29 -9
- package/libEs5/components/Personalization/handlers/createProcessRedirect.js +9 -0
- package/libEs5/components/Personalization/handlers/injectCreateProposition.js +0 -3
- package/libEs5/components/Personalization/index.js +10 -6
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/core/createLogger.js +13 -0
- package/libEs6/components/Personalization/createFetchDataHandler.js +35 -1
- package/libEs6/components/Personalization/createViewChangeHandler.js +11 -1
- package/libEs6/components/Personalization/flicker/index.js +44 -30
- package/libEs6/components/Personalization/handlers/createProcessPropositions.js +29 -9
- package/libEs6/components/Personalization/handlers/createProcessRedirect.js +9 -0
- package/libEs6/components/Personalization/handlers/injectCreateProposition.js +0 -3
- package/libEs6/components/Personalization/index.js +7 -3
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/core/createLogger.js +13 -0
- package/package.json +2 -2
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports.default = void 0;
|
|
4
4
|
var _index = require("../../utils/index.js");
|
|
5
|
+
var _pageWideScope = require("../../constants/pageWideScope.js");
|
|
5
6
|
/*
|
|
6
7
|
Copyright 2023 Adobe. All rights reserved.
|
|
7
8
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -16,6 +17,7 @@ governing permissions and limitations under the License.
|
|
|
16
17
|
|
|
17
18
|
const DECISIONS_HANDLE = "personalization:decisions";
|
|
18
19
|
var _default = ({
|
|
20
|
+
logger,
|
|
19
21
|
prehidingStyle,
|
|
20
22
|
showContainers,
|
|
21
23
|
hideContainers,
|
|
@@ -51,6 +53,16 @@ var _default = ({
|
|
|
51
53
|
response
|
|
52
54
|
}) => {
|
|
53
55
|
const handles = response.getPayloadsByType(DECISIONS_HANDLE);
|
|
56
|
+
if (!(0, _index.isNonEmptyArray)(handles)) {
|
|
57
|
+
logger.logOnContentRendering({
|
|
58
|
+
status: "no-offers",
|
|
59
|
+
message: "No offers were returned.",
|
|
60
|
+
logLevel: "info",
|
|
61
|
+
detail: {
|
|
62
|
+
query: personalizationDetails.createQueryDetails()
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
54
66
|
const propositions = handles.map(handle => createProposition(handle));
|
|
55
67
|
const {
|
|
56
68
|
page: pagePropositions = [],
|
|
@@ -67,6 +79,28 @@ var _default = ({
|
|
|
67
79
|
returnedPropositions,
|
|
68
80
|
returnedDecisions
|
|
69
81
|
} = processPropositions([...pagePropositions, ...currentViewPropositions], nonRenderedPropositions));
|
|
82
|
+
if ((0, _index.isNonEmptyArray)(pagePropositions)) {
|
|
83
|
+
logger.logOnContentRendering({
|
|
84
|
+
status: "rendering-started",
|
|
85
|
+
message: "Started rendering propositions for page-wide scope.",
|
|
86
|
+
logLevel: "info",
|
|
87
|
+
detail: {
|
|
88
|
+
scope: _pageWideScope.default,
|
|
89
|
+
propositions: pagePropositions.map(proposition => proposition.toJSON())
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
if ((0, _index.isNonEmptyArray)(currentViewPropositions)) {
|
|
94
|
+
logger.logOnContentRendering({
|
|
95
|
+
status: "rendering-started",
|
|
96
|
+
message: "Rendering propositions started for view scope - " + personalizationDetails.getViewName() + ".",
|
|
97
|
+
logLevel: "info",
|
|
98
|
+
detail: {
|
|
99
|
+
scope: personalizationDetails.getViewName(),
|
|
100
|
+
propositions: currentViewPropositions.map(proposition => proposition.toJSON())
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
70
104
|
render().then(handleNotifications);
|
|
71
105
|
|
|
72
106
|
// Render could take a long time especially if one of the renders
|
|
@@ -14,7 +14,8 @@ governing permissions and limitations under the License.
|
|
|
14
14
|
*/
|
|
15
15
|
var _default = ({
|
|
16
16
|
processPropositions,
|
|
17
|
-
viewCache
|
|
17
|
+
viewCache,
|
|
18
|
+
logger
|
|
18
19
|
}) => {
|
|
19
20
|
return ({
|
|
20
21
|
personalizationDetails,
|
|
@@ -37,6 +38,15 @@ var _default = ({
|
|
|
37
38
|
returnedPropositions,
|
|
38
39
|
returnedDecisions
|
|
39
40
|
} = processPropositions(propositions));
|
|
41
|
+
logger.logOnContentRendering({
|
|
42
|
+
status: "rendering-started",
|
|
43
|
+
message: "Started rendering propositions for view scope - " + viewName + ".",
|
|
44
|
+
logLevel: "info",
|
|
45
|
+
detail: {
|
|
46
|
+
scope: viewName,
|
|
47
|
+
propositions: propositions.map(proposition => proposition.toJSON())
|
|
48
|
+
}
|
|
49
|
+
});
|
|
40
50
|
return render();
|
|
41
51
|
}
|
|
42
52
|
({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
exports.showElements = exports.
|
|
3
|
+
exports.showElements = exports.hideElements = exports.createShowContainers = exports.createHideContainers = void 0;
|
|
4
4
|
var _index = require("../../../utils/dom/index.js");
|
|
5
5
|
var _tagName = require("../../../constants/tagName.js");
|
|
6
6
|
var _index2 = require("../dom-actions/dom/index.js");
|
|
@@ -51,39 +51,53 @@ const showElements = prehidingSelector => {
|
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
exports.showElements = showElements;
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
const createHideContainers = logger => {
|
|
55
|
+
return prehidingStyle => {
|
|
56
|
+
if (!prehidingStyle) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
60
|
+
// If containers prehiding style has been added
|
|
61
|
+
// by customer's prehiding snippet we don't
|
|
62
|
+
// want to add the same node
|
|
63
|
+
const node = (0, _index2.getElementById)(PREHIDING_ID);
|
|
64
|
+
if (node) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const nonce = (0, _index2.getNonce)();
|
|
68
|
+
const attrs = {
|
|
69
|
+
id: PREHIDING_ID,
|
|
70
|
+
...(nonce && {
|
|
71
|
+
nonce
|
|
72
|
+
})
|
|
73
|
+
};
|
|
74
|
+
const props = {
|
|
75
|
+
textContent: prehidingStyle
|
|
76
|
+
};
|
|
77
|
+
const styleNode = (0, _index.createNode)(_tagName.STYLE, attrs, props);
|
|
78
|
+
logger.logOnContentHiding({
|
|
79
|
+
status: "hide-containers",
|
|
80
|
+
message: "Prehiding style applied to hide containers.",
|
|
81
|
+
logLevel: "info"
|
|
82
|
+
});
|
|
83
|
+
(0, _index.appendNode)(document.head, styleNode);
|
|
75
84
|
};
|
|
76
|
-
const styleNode = (0, _index.createNode)(_tagName.STYLE, attrs, props);
|
|
77
|
-
(0, _index.appendNode)(document.head, styleNode);
|
|
78
85
|
};
|
|
79
|
-
exports.
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
exports.createHideContainers = createHideContainers;
|
|
87
|
+
const createShowContainers = logger => {
|
|
88
|
+
return () => {
|
|
89
|
+
// If containers prehiding style exists
|
|
90
|
+
// we will remove it
|
|
91
|
+
const node = (0, _index2.getElementById)(PREHIDING_ID);
|
|
92
|
+
if (!node) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
logger.logOnContentHiding({
|
|
96
|
+
status: "show-containers",
|
|
97
|
+
message: "Prehiding style removed to show containers.",
|
|
98
|
+
logLevel: "info"
|
|
99
|
+
});
|
|
100
|
+
(0, _index.removeNode)(node);
|
|
101
|
+
};
|
|
88
102
|
};
|
|
89
|
-
exports.
|
|
103
|
+
exports.createShowContainers = createShowContainers;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.default = void 0;
|
|
4
|
+
var _index = require("../../../utils/index.js");
|
|
4
5
|
/*
|
|
5
6
|
Copyright 2023 Adobe. All rights reserved.
|
|
6
7
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -23,14 +24,21 @@ var _default = ({
|
|
|
23
24
|
}
|
|
24
25
|
return true;
|
|
25
26
|
}).catch(error => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
const {
|
|
28
|
+
message,
|
|
29
|
+
stack
|
|
30
|
+
} = error;
|
|
31
|
+
const warning = "Failed to execute action " + item.toString() + ". " + message + " " + stack;
|
|
32
|
+
logger.logOnContentRendering({
|
|
33
|
+
status: "rendering-failed",
|
|
34
|
+
detail: {
|
|
35
|
+
propositionDetails: item.getProposition().getNotification(),
|
|
36
|
+
item: item.toJSON()
|
|
37
|
+
},
|
|
38
|
+
error,
|
|
39
|
+
message: warning,
|
|
40
|
+
logLevel: "warn"
|
|
41
|
+
});
|
|
34
42
|
return false;
|
|
35
43
|
});
|
|
36
44
|
};
|
|
@@ -166,7 +174,19 @@ var _default = ({
|
|
|
166
174
|
p.addToReturnValues(returnedPropositions, returnedDecisions, p.getItems(), false);
|
|
167
175
|
});
|
|
168
176
|
const render = () => {
|
|
169
|
-
return Promise.all(renderers.map(renderer => renderer())).then(metas =>
|
|
177
|
+
return Promise.all(renderers.map(renderer => renderer())).then(metas => {
|
|
178
|
+
const renderedPropositions = metas.filter(meta => meta);
|
|
179
|
+
const propsByScope = (0, _index.groupBy)(renderedPropositions, p => p.scope);
|
|
180
|
+
logger.logOnContentRendering({
|
|
181
|
+
status: "rendering-succeeded",
|
|
182
|
+
detail: {
|
|
183
|
+
...propsByScope
|
|
184
|
+
},
|
|
185
|
+
message: "Scopes: " + propsByScope + " successfully executed.",
|
|
186
|
+
logLevel: "info"
|
|
187
|
+
});
|
|
188
|
+
return renderedPropositions;
|
|
189
|
+
});
|
|
170
190
|
};
|
|
171
191
|
return {
|
|
172
192
|
returnedPropositions,
|
|
@@ -29,6 +29,15 @@ var _default = ({
|
|
|
29
29
|
decisionsMeta: [item.getProposition().getNotification()],
|
|
30
30
|
documentMayUnload: true
|
|
31
31
|
}).then(() => {
|
|
32
|
+
logger.logOnContentRendering({
|
|
33
|
+
status: "rendering-redirect",
|
|
34
|
+
detail: {
|
|
35
|
+
propositionDetails: item.getProposition().getNotification(),
|
|
36
|
+
redirect: content
|
|
37
|
+
},
|
|
38
|
+
message: "Redirect action " + item.toString() + " executed.",
|
|
39
|
+
logLevel: "info"
|
|
40
|
+
});
|
|
32
41
|
return executeRedirect(content);
|
|
33
42
|
// Execute redirect will never resolve. If there are bottom of page events that are waiting
|
|
34
43
|
// for display notifications from this request, they will never run because this promise will
|
|
@@ -66,6 +66,8 @@ const createPersonalization = ({
|
|
|
66
66
|
eventManager,
|
|
67
67
|
mergeDecisionsMeta: _event.mergeDecisionsMeta
|
|
68
68
|
});
|
|
69
|
+
const showContainers = (0, _index3.createShowContainers)(logger);
|
|
70
|
+
const hideContainers = (0, _index3.createHideContainers)(logger);
|
|
69
71
|
const {
|
|
70
72
|
storeInteractionMeta,
|
|
71
73
|
getInteractionMetas
|
|
@@ -121,13 +123,14 @@ const createPersonalization = ({
|
|
|
121
123
|
const notificationHandler = (0, _createNotificationHandler.default)(collect, renderedPropositions);
|
|
122
124
|
const fetchDataHandler = (0, _createFetchDataHandler.default)({
|
|
123
125
|
prehidingStyle,
|
|
124
|
-
showContainers
|
|
125
|
-
hideContainers
|
|
126
|
+
showContainers,
|
|
127
|
+
hideContainers,
|
|
126
128
|
mergeQuery: _event.mergeQuery,
|
|
127
129
|
processPropositions,
|
|
128
130
|
createProposition,
|
|
129
131
|
notificationHandler,
|
|
130
|
-
consent
|
|
132
|
+
consent,
|
|
133
|
+
logger
|
|
131
134
|
});
|
|
132
135
|
const onClickHandler = (0, _createOnClickHandler.default)({
|
|
133
136
|
mergeDecisionsMeta: _event.mergeDecisionsMeta,
|
|
@@ -140,7 +143,8 @@ const createPersonalization = ({
|
|
|
140
143
|
});
|
|
141
144
|
const viewChangeHandler = (0, _createViewChangeHandler.default)({
|
|
142
145
|
processPropositions,
|
|
143
|
-
viewCache
|
|
146
|
+
viewCache,
|
|
147
|
+
logger
|
|
144
148
|
});
|
|
145
149
|
const applyPropositions = (0, _createApplyPropositions.default)({
|
|
146
150
|
processPropositions,
|
|
@@ -157,7 +161,7 @@ const createPersonalization = ({
|
|
|
157
161
|
notificationHandler
|
|
158
162
|
});
|
|
159
163
|
const handleConsentFlicker = (0, _createHandleConsentFlicker.default)({
|
|
160
|
-
showContainers
|
|
164
|
+
showContainers,
|
|
161
165
|
consent
|
|
162
166
|
});
|
|
163
167
|
return (0, _createComponent.default)({
|
|
@@ -169,7 +173,7 @@ const createPersonalization = ({
|
|
|
169
173
|
isAuthoringModeEnabled: _isAuthoringModeEnabled.default,
|
|
170
174
|
mergeQuery: _event.mergeQuery,
|
|
171
175
|
viewCache,
|
|
172
|
-
showContainers
|
|
176
|
+
showContainers,
|
|
173
177
|
applyPropositions,
|
|
174
178
|
setTargetMigration,
|
|
175
179
|
mergeDecisionsMeta: _event.mergeDecisionsMeta,
|
|
@@ -14,4 +14,4 @@ governing permissions and limitations under the License.
|
|
|
14
14
|
*/
|
|
15
15
|
// The __VERSION__ keyword will be replace at alloy build time with the package.json version.
|
|
16
16
|
// see babel-plugin-version
|
|
17
|
-
var _default = exports.default = "2.22.0-alpha.
|
|
17
|
+
var _default = exports.default = "2.22.0-alpha.1";
|
|
@@ -82,6 +82,19 @@ var _default = ({
|
|
|
82
82
|
notifyMonitors("onNetworkError", data);
|
|
83
83
|
log("error", "Request " + data.requestId + ": Network request failed.", data.error);
|
|
84
84
|
},
|
|
85
|
+
logOnContentHiding(data) {
|
|
86
|
+
notifyMonitors("onContentHiding", {
|
|
87
|
+
status: data.status
|
|
88
|
+
});
|
|
89
|
+
log(data.logLevel, data.message);
|
|
90
|
+
},
|
|
91
|
+
logOnContentRendering(data) {
|
|
92
|
+
notifyMonitors("onContentRendering", {
|
|
93
|
+
status: data.status,
|
|
94
|
+
payload: data.detail
|
|
95
|
+
});
|
|
96
|
+
log(data.logLevel, data.message);
|
|
97
|
+
},
|
|
85
98
|
/**
|
|
86
99
|
* Outputs informational message to the web console. In some
|
|
87
100
|
* browsers a small "i" icon is displayed next to these items
|
|
@@ -9,9 +9,11 @@ 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
|
-
import { groupBy } from "../../utils/index.js";
|
|
12
|
+
import { groupBy, isNonEmptyArray } from "../../utils/index.js";
|
|
13
|
+
import PAGE_WIDE_SCOPE from "../../constants/pageWideScope.js";
|
|
13
14
|
const DECISIONS_HANDLE = "personalization:decisions";
|
|
14
15
|
export default (({
|
|
16
|
+
logger,
|
|
15
17
|
prehidingStyle,
|
|
16
18
|
showContainers,
|
|
17
19
|
hideContainers,
|
|
@@ -47,6 +49,16 @@ export default (({
|
|
|
47
49
|
response
|
|
48
50
|
}) => {
|
|
49
51
|
const handles = response.getPayloadsByType(DECISIONS_HANDLE);
|
|
52
|
+
if (!isNonEmptyArray(handles)) {
|
|
53
|
+
logger.logOnContentRendering({
|
|
54
|
+
status: "no-offers",
|
|
55
|
+
message: "No offers were returned.",
|
|
56
|
+
logLevel: "info",
|
|
57
|
+
detail: {
|
|
58
|
+
query: personalizationDetails.createQueryDetails()
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
50
62
|
const propositions = handles.map(handle => createProposition(handle));
|
|
51
63
|
const {
|
|
52
64
|
page: pagePropositions = [],
|
|
@@ -63,6 +75,28 @@ export default (({
|
|
|
63
75
|
returnedPropositions,
|
|
64
76
|
returnedDecisions
|
|
65
77
|
} = processPropositions([...pagePropositions, ...currentViewPropositions], nonRenderedPropositions));
|
|
78
|
+
if (isNonEmptyArray(pagePropositions)) {
|
|
79
|
+
logger.logOnContentRendering({
|
|
80
|
+
status: "rendering-started",
|
|
81
|
+
message: "Started rendering propositions for page-wide scope.",
|
|
82
|
+
logLevel: "info",
|
|
83
|
+
detail: {
|
|
84
|
+
scope: PAGE_WIDE_SCOPE,
|
|
85
|
+
propositions: pagePropositions.map(proposition => proposition.toJSON())
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (isNonEmptyArray(currentViewPropositions)) {
|
|
90
|
+
logger.logOnContentRendering({
|
|
91
|
+
status: "rendering-started",
|
|
92
|
+
message: `Rendering propositions started for view scope - ${personalizationDetails.getViewName()}.`,
|
|
93
|
+
logLevel: "info",
|
|
94
|
+
detail: {
|
|
95
|
+
scope: personalizationDetails.getViewName(),
|
|
96
|
+
propositions: currentViewPropositions.map(proposition => proposition.toJSON())
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
66
100
|
render().then(handleNotifications);
|
|
67
101
|
|
|
68
102
|
// Render could take a long time especially if one of the renders
|
|
@@ -12,7 +12,8 @@ governing permissions and limitations under the License.
|
|
|
12
12
|
|
|
13
13
|
export default (({
|
|
14
14
|
processPropositions,
|
|
15
|
-
viewCache
|
|
15
|
+
viewCache,
|
|
16
|
+
logger
|
|
16
17
|
}) => {
|
|
17
18
|
return ({
|
|
18
19
|
personalizationDetails,
|
|
@@ -35,6 +36,15 @@ export default (({
|
|
|
35
36
|
returnedPropositions,
|
|
36
37
|
returnedDecisions
|
|
37
38
|
} = processPropositions(propositions));
|
|
39
|
+
logger.logOnContentRendering({
|
|
40
|
+
status: "rendering-started",
|
|
41
|
+
message: `Started rendering propositions for view scope - ${viewName}.`,
|
|
42
|
+
logLevel: "info",
|
|
43
|
+
detail: {
|
|
44
|
+
scope: viewName,
|
|
45
|
+
propositions: propositions.map(proposition => proposition.toJSON())
|
|
46
|
+
}
|
|
47
|
+
});
|
|
38
48
|
return render();
|
|
39
49
|
}
|
|
40
50
|
({
|
|
@@ -46,37 +46,51 @@ export const showElements = prehidingSelector => {
|
|
|
46
46
|
delete styleNodes[prehidingSelector];
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
export const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
export const createHideContainers = logger => {
|
|
50
|
+
return prehidingStyle => {
|
|
51
|
+
if (!prehidingStyle) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
53
54
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
55
|
+
// If containers prehiding style has been added
|
|
56
|
+
// by customer's prehiding snippet we don't
|
|
57
|
+
// want to add the same node
|
|
58
|
+
const node = getElementById(PREHIDING_ID);
|
|
59
|
+
if (node) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const nonce = getNonce();
|
|
63
|
+
const attrs = {
|
|
64
|
+
id: PREHIDING_ID,
|
|
65
|
+
...(nonce && {
|
|
66
|
+
nonce
|
|
67
|
+
})
|
|
68
|
+
};
|
|
69
|
+
const props = {
|
|
70
|
+
textContent: prehidingStyle
|
|
71
|
+
};
|
|
72
|
+
const styleNode = createNode(STYLE, attrs, props);
|
|
73
|
+
logger.logOnContentHiding({
|
|
74
|
+
status: "hide-containers",
|
|
75
|
+
message: "Prehiding style applied to hide containers.",
|
|
76
|
+
logLevel: "info"
|
|
77
|
+
});
|
|
78
|
+
appendNode(document.head, styleNode);
|
|
70
79
|
};
|
|
71
|
-
const styleNode = createNode(STYLE, attrs, props);
|
|
72
|
-
appendNode(document.head, styleNode);
|
|
73
80
|
};
|
|
74
|
-
export const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
export const createShowContainers = logger => {
|
|
82
|
+
return () => {
|
|
83
|
+
// If containers prehiding style exists
|
|
84
|
+
// we will remove it
|
|
85
|
+
const node = getElementById(PREHIDING_ID);
|
|
86
|
+
if (!node) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
logger.logOnContentHiding({
|
|
90
|
+
status: "show-containers",
|
|
91
|
+
message: "Prehiding style removed to show containers.",
|
|
92
|
+
logLevel: "info"
|
|
93
|
+
});
|
|
94
|
+
removeNode(node);
|
|
95
|
+
};
|
|
82
96
|
};
|
|
@@ -10,6 +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 { groupBy } from "../../../utils/index.js";
|
|
13
14
|
export default (({
|
|
14
15
|
schemaProcessors,
|
|
15
16
|
logger
|
|
@@ -21,14 +22,21 @@ export default (({
|
|
|
21
22
|
}
|
|
22
23
|
return true;
|
|
23
24
|
}).catch(error => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
const {
|
|
26
|
+
message,
|
|
27
|
+
stack
|
|
28
|
+
} = error;
|
|
29
|
+
const warning = `Failed to execute action ${item.toString()}. ${message} ${stack}`;
|
|
30
|
+
logger.logOnContentRendering({
|
|
31
|
+
status: "rendering-failed",
|
|
32
|
+
detail: {
|
|
33
|
+
propositionDetails: item.getProposition().getNotification(),
|
|
34
|
+
item: item.toJSON()
|
|
35
|
+
},
|
|
36
|
+
error,
|
|
37
|
+
message: warning,
|
|
38
|
+
logLevel: "warn"
|
|
39
|
+
});
|
|
32
40
|
return false;
|
|
33
41
|
});
|
|
34
42
|
};
|
|
@@ -164,7 +172,19 @@ export default (({
|
|
|
164
172
|
p.addToReturnValues(returnedPropositions, returnedDecisions, p.getItems(), false);
|
|
165
173
|
});
|
|
166
174
|
const render = () => {
|
|
167
|
-
return Promise.all(renderers.map(renderer => renderer())).then(metas =>
|
|
175
|
+
return Promise.all(renderers.map(renderer => renderer())).then(metas => {
|
|
176
|
+
const renderedPropositions = metas.filter(meta => meta);
|
|
177
|
+
const propsByScope = groupBy(renderedPropositions, p => p.scope);
|
|
178
|
+
logger.logOnContentRendering({
|
|
179
|
+
status: "rendering-succeeded",
|
|
180
|
+
detail: {
|
|
181
|
+
...propsByScope
|
|
182
|
+
},
|
|
183
|
+
message: `Scopes: ${propsByScope} successfully executed.`,
|
|
184
|
+
logLevel: "info"
|
|
185
|
+
});
|
|
186
|
+
return renderedPropositions;
|
|
187
|
+
});
|
|
168
188
|
};
|
|
169
189
|
return {
|
|
170
190
|
returnedPropositions,
|
|
@@ -26,6 +26,15 @@ export default (({
|
|
|
26
26
|
decisionsMeta: [item.getProposition().getNotification()],
|
|
27
27
|
documentMayUnload: true
|
|
28
28
|
}).then(() => {
|
|
29
|
+
logger.logOnContentRendering({
|
|
30
|
+
status: "rendering-redirect",
|
|
31
|
+
detail: {
|
|
32
|
+
propositionDetails: item.getProposition().getNotification(),
|
|
33
|
+
redirect: content
|
|
34
|
+
},
|
|
35
|
+
message: `Redirect action ${item.toString()} executed.`,
|
|
36
|
+
logLevel: "info"
|
|
37
|
+
});
|
|
29
38
|
return executeRedirect(content);
|
|
30
39
|
// Execute redirect will never resolve. If there are bottom of page events that are waiting
|
|
31
40
|
// for display notifications from this request, they will never run because this promise will
|
|
@@ -14,7 +14,7 @@ import { anyOf, boolean, literal, objectOf, string } from "../../utils/validatio
|
|
|
14
14
|
import createComponent from "./createComponent.js";
|
|
15
15
|
import { initDomActionsModules } from "./dom-actions/index.js";
|
|
16
16
|
import createCollect from "../../utils/createCollect.js";
|
|
17
|
-
import {
|
|
17
|
+
import { createHideContainers, createShowContainers } from "./flicker/index.js";
|
|
18
18
|
import createFetchDataHandler from "./createFetchDataHandler.js";
|
|
19
19
|
import collectClicks from "./dom-actions/clicks/collectClicks.js";
|
|
20
20
|
import isAuthoringModeEnabled from "./utils/isAuthoringModeEnabled.js";
|
|
@@ -63,6 +63,8 @@ const createPersonalization = ({
|
|
|
63
63
|
eventManager,
|
|
64
64
|
mergeDecisionsMeta
|
|
65
65
|
});
|
|
66
|
+
const showContainers = createShowContainers(logger);
|
|
67
|
+
const hideContainers = createHideContainers(logger);
|
|
66
68
|
const {
|
|
67
69
|
storeInteractionMeta,
|
|
68
70
|
getInteractionMetas
|
|
@@ -124,7 +126,8 @@ const createPersonalization = ({
|
|
|
124
126
|
processPropositions,
|
|
125
127
|
createProposition,
|
|
126
128
|
notificationHandler,
|
|
127
|
-
consent
|
|
129
|
+
consent,
|
|
130
|
+
logger
|
|
128
131
|
});
|
|
129
132
|
const onClickHandler = createOnClickHandler({
|
|
130
133
|
mergeDecisionsMeta,
|
|
@@ -137,7 +140,8 @@ const createPersonalization = ({
|
|
|
137
140
|
});
|
|
138
141
|
const viewChangeHandler = createViewChangeHandler({
|
|
139
142
|
processPropositions,
|
|
140
|
-
viewCache
|
|
143
|
+
viewCache,
|
|
144
|
+
logger
|
|
141
145
|
});
|
|
142
146
|
const applyPropositions = createApplyPropositions({
|
|
143
147
|
processPropositions,
|
|
@@ -80,6 +80,19 @@ export default (({
|
|
|
80
80
|
notifyMonitors("onNetworkError", data);
|
|
81
81
|
log("error", `Request ${data.requestId}: Network request failed.`, data.error);
|
|
82
82
|
},
|
|
83
|
+
logOnContentHiding(data) {
|
|
84
|
+
notifyMonitors("onContentHiding", {
|
|
85
|
+
status: data.status
|
|
86
|
+
});
|
|
87
|
+
log(data.logLevel, data.message);
|
|
88
|
+
},
|
|
89
|
+
logOnContentRendering(data) {
|
|
90
|
+
notifyMonitors("onContentRendering", {
|
|
91
|
+
status: data.status,
|
|
92
|
+
payload: data.detail
|
|
93
|
+
});
|
|
94
|
+
log(data.logLevel, data.message);
|
|
95
|
+
},
|
|
83
96
|
/**
|
|
84
97
|
* Outputs informational message to the web console. In some
|
|
85
98
|
* browsers a small "i" icon is displayed next to these items
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/alloy",
|
|
3
|
-
"version": "2.22.0-alpha.
|
|
3
|
+
"version": "2.22.0-alpha.1",
|
|
4
4
|
"description": "Adobe Experience Platform Web SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "libEs5/index.js",
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"uuid": "^10.0.0"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
|
-
"@adobe/alloy": "^2.
|
|
98
|
+
"@adobe/alloy": "^2.22.0-alpha.0",
|
|
99
99
|
"@babel/cli": "^7.24.8",
|
|
100
100
|
"@babel/plugin-transform-runtime": "^7.24.7",
|
|
101
101
|
"@eslint/js": "^9.7.0",
|