@adobe/alloy 2.9.0-alpha.3 → 2.9.0-alpha.6
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/DataCollector/index.js +1 -1
- package/libEs5/components/Personalization/constants/schema.js +3 -1
- package/libEs5/components/Personalization/constants/scopeType.js +17 -0
- package/libEs5/components/Personalization/createAutoRenderingHandler.js +66 -39
- package/libEs5/components/Personalization/createCollect.js +23 -6
- package/libEs5/components/Personalization/createComponent.js +3 -1
- package/libEs5/components/Personalization/createExecuteDecisions.js +9 -12
- package/libEs5/components/Personalization/createPersonalizationDetails.js +1 -1
- package/libEs5/components/Personalization/createViewChangeHandler.js +28 -18
- package/libEs5/components/Personalization/dom-actions/initDomActionsModules.js +5 -0
- package/libEs5/components/Personalization/groupDecisions.js +37 -18
- package/libEs5/components/Personalization/index.js +6 -24
- package/libEs5/components/Personalization/utils/composePersonalizationResultingObject.js +24 -0
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/core/buildAndValidateConfig.js +1 -1
- package/libEs5/core/validateCommandOptions.js +1 -1
- package/libEs6/components/DataCollector/index.js +1 -1
- package/libEs6/components/Personalization/constants/schema.js +1 -0
- package/libEs6/components/Personalization/constants/scopeType.js +12 -0
- package/libEs6/components/Personalization/createAutoRenderingHandler.js +59 -33
- package/libEs6/components/Personalization/createCollect.js +21 -6
- package/libEs6/components/Personalization/createComponent.js +3 -1
- package/libEs6/components/Personalization/createExecuteDecisions.js +9 -13
- package/libEs6/components/Personalization/createPersonalizationDetails.js +2 -2
- package/libEs6/components/Personalization/createViewChangeHandler.js +27 -18
- package/libEs6/components/Personalization/dom-actions/initDomActionsModules.js +4 -1
- package/libEs6/components/Personalization/groupDecisions.js +32 -20
- package/libEs6/components/Personalization/index.js +6 -22
- package/libEs6/components/Personalization/utils/composePersonalizationResultingObject.js +15 -0
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/core/buildAndValidateConfig.js +1 -1
- package/libEs6/core/validateCommandOptions.js +1 -1
- package/package.json +2 -2
- package/libEs5/components/Personalization/createExecuteCachedViewDecisions.js +0 -47
- package/libEs5/components/Personalization/createViewCollect.js +0 -48
- package/libEs6/components/Personalization/createExecuteCachedViewDecisions.js +0 -41
- package/libEs6/components/Personalization/createViewCollect.js +0 -42
|
@@ -10,49 +10,75 @@ 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
|
import addRenderAttemptedToDecisions from "./utils/addRenderAttemptedToDecisions";
|
|
13
|
+
import isNonEmptyArray from "../../utils/isNonEmptyArray";
|
|
14
|
+
|
|
15
|
+
const getPropositions = ({
|
|
16
|
+
viewCache,
|
|
17
|
+
viewName,
|
|
18
|
+
pageWideScopeDecisions
|
|
19
|
+
}) => {
|
|
20
|
+
if (!viewName) {
|
|
21
|
+
return {
|
|
22
|
+
pageWideScopeDecisions,
|
|
23
|
+
viewPropositions: []
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return viewCache.getView(viewName).then(viewPropositions => {
|
|
28
|
+
return {
|
|
29
|
+
pageWideScopeDecisions,
|
|
30
|
+
viewPropositions
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
13
35
|
export default (({
|
|
14
36
|
viewCache,
|
|
15
37
|
executeDecisions,
|
|
16
|
-
|
|
17
|
-
|
|
38
|
+
showContainers,
|
|
39
|
+
collect
|
|
18
40
|
}) => {
|
|
19
41
|
return ({
|
|
20
42
|
viewName,
|
|
21
43
|
pageWideScopeDecisions,
|
|
22
44
|
nonAutoRenderableDecisions
|
|
23
45
|
}) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
renderAttempted: true
|
|
37
|
-
}), ...addRenderAttemptedToDecisions({
|
|
38
|
-
decisions: nonAutoRenderableDecisions,
|
|
39
|
-
renderAttempted: false
|
|
40
|
-
})]
|
|
41
|
-
};
|
|
46
|
+
return Promise.resolve(pageWideScopeDecisions).then(propositions => getPropositions({
|
|
47
|
+
viewCache,
|
|
48
|
+
viewName,
|
|
49
|
+
executeDecisions,
|
|
50
|
+
pageWideScopeDecisions: propositions
|
|
51
|
+
})).then(propositions => {
|
|
52
|
+
executeDecisions(propositions.pageWideScopeDecisions).then(decisionsMeta => {
|
|
53
|
+
if (isNonEmptyArray(decisionsMeta)) {
|
|
54
|
+
collect({
|
|
55
|
+
decisionsMeta
|
|
56
|
+
});
|
|
57
|
+
}
|
|
42
58
|
});
|
|
43
|
-
}
|
|
44
59
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
60
|
+
if (viewName) {
|
|
61
|
+
executeDecisions(propositions.viewPropositions).then(decisionsMeta => {
|
|
62
|
+
collect({
|
|
63
|
+
decisionsMeta,
|
|
64
|
+
viewName
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
showContainers();
|
|
70
|
+
return [...propositions.pageWideScopeDecisions, ...propositions.viewPropositions];
|
|
71
|
+
}).then(renderablePropositions => {
|
|
72
|
+
return {
|
|
73
|
+
decisions: [...nonAutoRenderableDecisions],
|
|
74
|
+
propositions: [...addRenderAttemptedToDecisions({
|
|
75
|
+
decisions: renderablePropositions,
|
|
76
|
+
renderAttempted: true
|
|
77
|
+
}), ...addRenderAttemptedToDecisions({
|
|
78
|
+
decisions: nonAutoRenderableDecisions,
|
|
79
|
+
renderAttempted: false
|
|
80
|
+
})]
|
|
81
|
+
};
|
|
82
|
+
});
|
|
57
83
|
};
|
|
58
84
|
});
|
|
@@ -10,20 +10,35 @@ 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
|
import { DISPLAY } from "./constants/eventType";
|
|
13
|
+
import { isNonEmptyArray } from "../../utils";
|
|
13
14
|
export default (({
|
|
14
15
|
eventManager,
|
|
15
16
|
mergeDecisionsMeta
|
|
16
17
|
}) => {
|
|
17
|
-
// Called when a decision is auto-rendered for the __view__ scope
|
|
18
|
+
// Called when a decision is auto-rendered for the __view__ scope or a SPA view(display and empty display notification)
|
|
18
19
|
return ({
|
|
19
|
-
decisionsMeta,
|
|
20
|
-
documentMayUnload = false
|
|
20
|
+
decisionsMeta = [],
|
|
21
|
+
documentMayUnload = false,
|
|
22
|
+
viewName
|
|
21
23
|
}) => {
|
|
22
24
|
const event = eventManager.createEvent();
|
|
23
|
-
|
|
25
|
+
const data = {
|
|
24
26
|
eventType: DISPLAY
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
if (viewName) {
|
|
30
|
+
data.web = {
|
|
31
|
+
webPageDetails: {
|
|
32
|
+
viewName
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (isNonEmptyArray(decisionsMeta)) {
|
|
38
|
+
mergeDecisionsMeta(event, decisionsMeta);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
event.mergeXdm(data);
|
|
27
42
|
|
|
28
43
|
if (documentMayUnload) {
|
|
29
44
|
event.documentMayUnload();
|
|
@@ -67,8 +67,10 @@ export default (({
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
if (personalizationDetails.shouldUseCachedData()) {
|
|
70
|
-
|
|
70
|
+
// eslint-disable-next-line consistent-return
|
|
71
|
+
return viewChangeHandler({
|
|
71
72
|
personalizationDetails,
|
|
73
|
+
event,
|
|
72
74
|
onResponse,
|
|
73
75
|
onRequestFailure
|
|
74
76
|
});
|
|
@@ -9,7 +9,8 @@ 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 { assign, flatMap
|
|
12
|
+
import { assign, flatMap } from "../../utils";
|
|
13
|
+
const DEFAULT_ACTION_TYPE = "defaultContent";
|
|
13
14
|
|
|
14
15
|
const identity = item => item;
|
|
15
16
|
|
|
@@ -19,12 +20,14 @@ const buildActions = decision => {
|
|
|
19
20
|
scope: decision.scope,
|
|
20
21
|
scopeDetails: decision.scopeDetails
|
|
21
22
|
};
|
|
22
|
-
return decision.items.map(item => assign({
|
|
23
|
+
return decision.items.map(item => assign({
|
|
24
|
+
type: DEFAULT_ACTION_TYPE
|
|
25
|
+
}, item.data, {
|
|
23
26
|
meta
|
|
24
27
|
}));
|
|
25
28
|
};
|
|
26
29
|
|
|
27
|
-
const processMetas = (
|
|
30
|
+
const processMetas = (logger, actionResults) => {
|
|
28
31
|
const results = flatMap(actionResults, identity);
|
|
29
32
|
const finalMetas = [];
|
|
30
33
|
const set = new Set();
|
|
@@ -50,27 +53,20 @@ const processMetas = (collect, logger, actionResults) => {
|
|
|
50
53
|
set.add(meta.id);
|
|
51
54
|
finalMetas.push(meta);
|
|
52
55
|
});
|
|
53
|
-
|
|
54
|
-
if (isNonEmptyArray(finalMetas)) {
|
|
55
|
-
// collect here can either be the function from createCollect or createViewCollect.
|
|
56
|
-
collect({
|
|
57
|
-
decisionsMeta: finalMetas
|
|
58
|
-
});
|
|
59
|
-
}
|
|
56
|
+
return finalMetas;
|
|
60
57
|
};
|
|
61
58
|
|
|
62
59
|
export default (({
|
|
63
60
|
modules,
|
|
64
61
|
logger,
|
|
65
|
-
executeActions
|
|
66
|
-
collect
|
|
62
|
+
executeActions
|
|
67
63
|
}) => {
|
|
68
64
|
return decisions => {
|
|
69
65
|
const actionResultsPromises = decisions.map(decision => {
|
|
70
66
|
const actions = buildActions(decision);
|
|
71
67
|
return executeActions(actions, modules, logger);
|
|
72
68
|
});
|
|
73
|
-
return Promise.all(actionResultsPromises).then(results => processMetas(
|
|
69
|
+
return Promise.all(actionResultsPromises).then(results => processMetas(logger, results)).catch(error => {
|
|
74
70
|
logger.error(error);
|
|
75
71
|
});
|
|
76
72
|
};
|
|
@@ -11,7 +11,7 @@ governing permissions and limitations under the License.
|
|
|
11
11
|
*/
|
|
12
12
|
import { includes } from "../../utils";
|
|
13
13
|
import PAGE_WIDE_SCOPE from "./constants/scope";
|
|
14
|
-
import { DOM_ACTION, HTML_CONTENT_ITEM, JSON_CONTENT_ITEM, REDIRECT_ITEM } from "./constants/schema";
|
|
14
|
+
import { DEFAULT_CONTENT_ITEM, DOM_ACTION, HTML_CONTENT_ITEM, JSON_CONTENT_ITEM, REDIRECT_ITEM } from "./constants/schema";
|
|
15
15
|
import isNonEmptyString from "../../utils/isNonEmptyString";
|
|
16
16
|
export default (({
|
|
17
17
|
renderDecisions,
|
|
@@ -44,7 +44,7 @@ export default (({
|
|
|
44
44
|
scopes.push(PAGE_WIDE_SCOPE);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
const schemas = [HTML_CONTENT_ITEM, JSON_CONTENT_ITEM, REDIRECT_ITEM];
|
|
47
|
+
const schemas = [DEFAULT_CONTENT_ITEM, HTML_CONTENT_ITEM, JSON_CONTENT_ITEM, REDIRECT_ITEM];
|
|
48
48
|
|
|
49
49
|
if (includes(scopes, PAGE_WIDE_SCOPE)) {
|
|
50
50
|
schemas.push(DOM_ACTION);
|
|
@@ -9,38 +9,47 @@ 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
|
|
12
|
+
import composePersonalizationResultingObject from "./utils/composePersonalizationResultingObject";
|
|
13
|
+
import { isNonEmptyArray } from "../../utils";
|
|
13
14
|
export default (({
|
|
14
|
-
|
|
15
|
+
mergeDecisionsMeta,
|
|
16
|
+
collect,
|
|
17
|
+
executeDecisions,
|
|
15
18
|
viewCache
|
|
16
19
|
}) => {
|
|
17
20
|
return ({
|
|
18
21
|
personalizationDetails,
|
|
22
|
+
event,
|
|
19
23
|
onResponse
|
|
20
24
|
}) => {
|
|
21
25
|
const viewName = personalizationDetails.getViewName();
|
|
22
|
-
return viewCache.getView(viewName).then(
|
|
26
|
+
return viewCache.getView(viewName).then(viewDecisions => {
|
|
23
27
|
if (personalizationDetails.isRenderDecisions()) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
return executeDecisions(viewDecisions).then(decisionsMeta => {
|
|
29
|
+
// if there are decisions to be rendered we render them and attach the result in experience.decisions.propositions
|
|
30
|
+
if (isNonEmptyArray(decisionsMeta)) {
|
|
31
|
+
mergeDecisionsMeta(event, decisionsMeta);
|
|
32
|
+
onResponse(() => {
|
|
33
|
+
return composePersonalizationResultingObject(viewDecisions, true);
|
|
34
|
+
});
|
|
35
|
+
return;
|
|
36
|
+
} // if there are no decisions in cache for this view, we will send a empty notification
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
onResponse(() => {
|
|
40
|
+
collect({
|
|
41
|
+
decisionsMeta: [],
|
|
42
|
+
viewName
|
|
43
|
+
});
|
|
44
|
+
return composePersonalizationResultingObject(viewDecisions, true);
|
|
45
|
+
});
|
|
27
46
|
});
|
|
28
47
|
}
|
|
29
48
|
|
|
30
49
|
onResponse(() => {
|
|
31
|
-
return
|
|
32
|
-
propositions: addRenderAttemptedToDecisions({
|
|
33
|
-
decisions: currentViewDecisions,
|
|
34
|
-
renderAttempted: true
|
|
35
|
-
})
|
|
36
|
-
} : {
|
|
37
|
-
decisions: currentViewDecisions,
|
|
38
|
-
propositions: addRenderAttemptedToDecisions({
|
|
39
|
-
decisions: currentViewDecisions,
|
|
40
|
-
renderAttempted: false
|
|
41
|
-
})
|
|
42
|
-
};
|
|
50
|
+
return composePersonalizationResultingObject(viewDecisions, false);
|
|
43
51
|
});
|
|
52
|
+
return {};
|
|
44
53
|
});
|
|
45
54
|
};
|
|
46
55
|
});
|
|
@@ -28,6 +28,9 @@ export default (store => {
|
|
|
28
28
|
replaceHtml: createAction(replaceHtml),
|
|
29
29
|
prependHtml: createAction(prependHtml),
|
|
30
30
|
appendHtml: createAction(appendHtml),
|
|
31
|
-
click: settings => click(settings, store)
|
|
31
|
+
click: settings => click(settings, store),
|
|
32
|
+
defaultContent: settings => Promise.resolve({
|
|
33
|
+
meta: settings.meta
|
|
34
|
+
})
|
|
32
35
|
};
|
|
33
36
|
});
|
|
@@ -9,15 +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
|
-
import { isNonEmptyArray } from "../../utils";
|
|
13
|
-
import { DOM_ACTION, REDIRECT_ITEM } from "./constants/schema";
|
|
12
|
+
import { isNonEmptyArray, includes } from "../../utils";
|
|
13
|
+
import { DOM_ACTION, REDIRECT_ITEM, DEFAULT_CONTENT_ITEM } from "./constants/schema";
|
|
14
|
+
import { VIEW_SCOPE_TYPE } from "./constants/scopeType";
|
|
14
15
|
import PAGE_WIDE_SCOPE from "./constants/scope";
|
|
15
16
|
|
|
16
|
-
const splitItems = (items,
|
|
17
|
+
const splitItems = (items, schemas) => {
|
|
17
18
|
const matched = [];
|
|
18
19
|
const nonMatched = [];
|
|
19
20
|
items.forEach(item => {
|
|
20
|
-
if (item.schema
|
|
21
|
+
if (includes(schemas, item.schema)) {
|
|
21
22
|
matched.push(item);
|
|
22
23
|
} else {
|
|
23
24
|
nonMatched.push(item);
|
|
@@ -35,14 +36,14 @@ const createDecision = (decision, items) => {
|
|
|
35
36
|
};
|
|
36
37
|
};
|
|
37
38
|
|
|
38
|
-
const splitDecisions = (decisions,
|
|
39
|
+
const splitDecisions = (decisions, ...schemas) => {
|
|
39
40
|
const matchedDecisions = [];
|
|
40
41
|
const unmatchedDecisions = [];
|
|
41
42
|
decisions.forEach(decision => {
|
|
42
43
|
const {
|
|
43
44
|
items = []
|
|
44
45
|
} = decision;
|
|
45
|
-
const [matchedItems, nonMatchedItems] = splitItems(items,
|
|
46
|
+
const [matchedItems, nonMatchedItems] = splitItems(items, schemas);
|
|
46
47
|
|
|
47
48
|
if (isNonEmptyArray(matchedItems)) {
|
|
48
49
|
matchedDecisions.push(createDecision(decision, matchedItems));
|
|
@@ -58,42 +59,53 @@ const splitDecisions = (decisions, schema) => {
|
|
|
58
59
|
};
|
|
59
60
|
};
|
|
60
61
|
|
|
61
|
-
const
|
|
62
|
+
const appendScopeDecision = (scopeDecisions, decision) => {
|
|
63
|
+
if (!scopeDecisions[decision.scope]) {
|
|
64
|
+
scopeDecisions[decision.scope] = [];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
scopeDecisions[decision.scope].push(decision);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const isViewScope = scopeDetails => scopeDetails.characteristics && scopeDetails.characteristics.scopeType && scopeDetails.characteristics.scopeType === VIEW_SCOPE_TYPE;
|
|
71
|
+
|
|
72
|
+
const extractDecisionsByScope = decisions => {
|
|
62
73
|
const pageWideScopeDecisions = [];
|
|
63
|
-
const nonPageWideScopeDecisions =
|
|
74
|
+
const nonPageWideScopeDecisions = [];
|
|
75
|
+
const viewScopeDecisions = {};
|
|
64
76
|
|
|
65
77
|
if (isNonEmptyArray(decisions)) {
|
|
66
78
|
decisions.forEach(decision => {
|
|
67
|
-
if (decision.scope ===
|
|
79
|
+
if (decision.scope === PAGE_WIDE_SCOPE) {
|
|
68
80
|
pageWideScopeDecisions.push(decision);
|
|
81
|
+
} else if (isViewScope(decision.scopeDetails)) {
|
|
82
|
+
appendScopeDecision(viewScopeDecisions, decision);
|
|
69
83
|
} else {
|
|
70
|
-
|
|
71
|
-
nonPageWideScopeDecisions[decision.scope] = [];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
nonPageWideScopeDecisions[decision.scope].push(decision);
|
|
84
|
+
nonPageWideScopeDecisions.push(decision);
|
|
75
85
|
}
|
|
76
86
|
});
|
|
77
87
|
}
|
|
78
88
|
|
|
79
89
|
return {
|
|
80
90
|
pageWideScopeDecisions,
|
|
81
|
-
nonPageWideScopeDecisions
|
|
91
|
+
nonPageWideScopeDecisions,
|
|
92
|
+
viewScopeDecisions
|
|
82
93
|
};
|
|
83
94
|
};
|
|
84
95
|
|
|
85
96
|
const groupDecisions = unprocessedDecisions => {
|
|
86
97
|
const decisionsGroupedByRedirectItemSchema = splitDecisions(unprocessedDecisions, REDIRECT_ITEM);
|
|
87
|
-
const
|
|
98
|
+
const decisionsGroupedByRenderableSchemas = splitDecisions(decisionsGroupedByRedirectItemSchema.unmatchedDecisions, DOM_ACTION, DEFAULT_CONTENT_ITEM);
|
|
88
99
|
const {
|
|
89
100
|
pageWideScopeDecisions,
|
|
90
|
-
nonPageWideScopeDecisions
|
|
91
|
-
|
|
101
|
+
nonPageWideScopeDecisions,
|
|
102
|
+
viewScopeDecisions
|
|
103
|
+
} = extractDecisionsByScope(decisionsGroupedByRenderableSchemas.matchedDecisions);
|
|
92
104
|
return {
|
|
93
105
|
redirectDecisions: decisionsGroupedByRedirectItemSchema.matchedDecisions,
|
|
94
106
|
pageWideScopeDecisions,
|
|
95
|
-
viewDecisions:
|
|
96
|
-
nonAutoRenderableDecisions:
|
|
107
|
+
viewDecisions: viewScopeDecisions,
|
|
108
|
+
nonAutoRenderableDecisions: decisionsGroupedByRenderableSchemas.unmatchedDecisions.concat(nonPageWideScopeDecisions)
|
|
97
109
|
};
|
|
98
110
|
};
|
|
99
111
|
|
|
@@ -13,7 +13,6 @@ import { string } from "../../utils/validation";
|
|
|
13
13
|
import createComponent from "./createComponent";
|
|
14
14
|
import { initDomActionsModules, executeActions } from "./dom-actions";
|
|
15
15
|
import createCollect from "./createCollect";
|
|
16
|
-
import createViewCollect from "./createViewCollect";
|
|
17
16
|
import createExecuteDecisions from "./createExecuteDecisions";
|
|
18
17
|
import { hideContainers, showContainers } from "./flicker";
|
|
19
18
|
import createFetchDataHandler from "./createFetchDataHandler";
|
|
@@ -21,7 +20,6 @@ import collectClicks from "./dom-actions/clicks/collectClicks";
|
|
|
21
20
|
import isAuthoringModeEnabled from "./utils/isAuthoringModeEnabled";
|
|
22
21
|
import { mergeDecisionsMeta, mergeQuery } from "./event";
|
|
23
22
|
import createOnClickHandler from "./createOnClickHandler";
|
|
24
|
-
import createExecuteCachedViewDecisions from "./createExecuteCachedViewDecisions";
|
|
25
23
|
import createViewCacheManager from "./createViewCacheManager";
|
|
26
24
|
import createViewChangeHandler from "./createViewChangeHandler";
|
|
27
25
|
import groupDecisions from "./groupDecisions";
|
|
@@ -40,10 +38,6 @@ const createPersonalization = ({
|
|
|
40
38
|
eventManager,
|
|
41
39
|
mergeDecisionsMeta
|
|
42
40
|
});
|
|
43
|
-
const viewCollect = createViewCollect({
|
|
44
|
-
eventManager,
|
|
45
|
-
mergeDecisionsMeta
|
|
46
|
-
});
|
|
47
41
|
const {
|
|
48
42
|
getClickMetasBySelector,
|
|
49
43
|
getClickSelectors,
|
|
@@ -54,14 +48,7 @@ const createPersonalization = ({
|
|
|
54
48
|
const executeDecisions = createExecuteDecisions({
|
|
55
49
|
modules,
|
|
56
50
|
logger,
|
|
57
|
-
executeActions
|
|
58
|
-
collect
|
|
59
|
-
});
|
|
60
|
-
const executeViewDecisions = createExecuteDecisions({
|
|
61
|
-
modules,
|
|
62
|
-
logger,
|
|
63
|
-
executeActions,
|
|
64
|
-
collect: viewCollect
|
|
51
|
+
executeActions
|
|
65
52
|
});
|
|
66
53
|
const handleRedirectDecisions = createRedirectHandler({
|
|
67
54
|
collect,
|
|
@@ -69,16 +56,11 @@ const createPersonalization = ({
|
|
|
69
56
|
logger,
|
|
70
57
|
showContainers
|
|
71
58
|
});
|
|
72
|
-
const executeCachedViewDecisions = createExecuteCachedViewDecisions({
|
|
73
|
-
viewCache,
|
|
74
|
-
executeViewDecisions,
|
|
75
|
-
collect: viewCollect
|
|
76
|
-
});
|
|
77
59
|
const autoRenderingHandler = createAutorenderingHandler({
|
|
78
60
|
viewCache,
|
|
79
61
|
executeDecisions,
|
|
80
|
-
|
|
81
|
-
|
|
62
|
+
showContainers,
|
|
63
|
+
collect
|
|
82
64
|
});
|
|
83
65
|
const nonRenderingHandler = createNonRenderingHandler({
|
|
84
66
|
viewCache
|
|
@@ -103,7 +85,9 @@ const createPersonalization = ({
|
|
|
103
85
|
getClickMetasBySelector
|
|
104
86
|
});
|
|
105
87
|
const viewChangeHandler = createViewChangeHandler({
|
|
106
|
-
|
|
88
|
+
mergeDecisionsMeta,
|
|
89
|
+
collect,
|
|
90
|
+
executeDecisions,
|
|
107
91
|
viewCache
|
|
108
92
|
});
|
|
109
93
|
return createComponent({
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import addRenderAttemptedToDecisions from "./addRenderAttemptedToDecisions";
|
|
2
|
+
export default ((decisions = [], renderDecisions) => {
|
|
3
|
+
const resultingObject = {
|
|
4
|
+
propositions: addRenderAttemptedToDecisions({
|
|
5
|
+
decisions,
|
|
6
|
+
renderAttempted: renderDecisions
|
|
7
|
+
})
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
if (!renderDecisions) {
|
|
11
|
+
resultingObject.decisions = decisions;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return resultingObject;
|
|
15
|
+
});
|
|
@@ -11,7 +11,7 @@ governing permissions and limitations under the License.
|
|
|
11
11
|
*/
|
|
12
12
|
import { assign } from "../utils";
|
|
13
13
|
import { objectOf } from "../utils/validation";
|
|
14
|
-
const CONFIG_DOC_URI = "https://adobe.ly/
|
|
14
|
+
const CONFIG_DOC_URI = "https://adobe.ly/3sHh553";
|
|
15
15
|
|
|
16
16
|
const buildSchema = (coreConfigValidators, componentCreators) => {
|
|
17
17
|
const schema = {};
|
|
@@ -9,7 +9,7 @@ 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
|
-
const COMMAND_DOC_URI = "https://adobe.ly/
|
|
12
|
+
const COMMAND_DOC_URI = "https://adobe.ly/3sHgQHb";
|
|
13
13
|
export default (({
|
|
14
14
|
command,
|
|
15
15
|
options
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/alloy",
|
|
3
|
-
"version": "2.9.0-alpha.
|
|
3
|
+
"version": "2.9.0-alpha.6",
|
|
4
4
|
"description": "Adobe Experience Platform Web SDK",
|
|
5
5
|
"main": "libEs5/index.js",
|
|
6
6
|
"module": "libEs6/index.js",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"uuid": "^3.3.2"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@adobe/alloy": "^2.9.0-alpha.
|
|
67
|
+
"@adobe/alloy": "^2.9.0-alpha.5",
|
|
68
68
|
"@babel/cli": "^7.12.8",
|
|
69
69
|
"@babel/core": "^7.2.2",
|
|
70
70
|
"@babel/plugin-proposal-object-rest-spread": "^7.3.2",
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.default = void 0;
|
|
4
|
-
|
|
5
|
-
var _isNonEmptyArray = require("../../utils/isNonEmptyArray");
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
Copyright 2020 Adobe. All rights reserved.
|
|
9
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
10
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
11
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
|
|
13
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
14
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
15
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
|
-
governing permissions and limitations under the License.
|
|
17
|
-
*/
|
|
18
|
-
var _default = function _default(_ref) {
|
|
19
|
-
var executeViewDecisions = _ref.executeViewDecisions,
|
|
20
|
-
collect = _ref.collect;
|
|
21
|
-
return function (_ref2) {
|
|
22
|
-
var viewName = _ref2.viewName,
|
|
23
|
-
viewDecisions = _ref2.viewDecisions;
|
|
24
|
-
|
|
25
|
-
// if there are viewDecisions for current view we will execute them and then send the collect call
|
|
26
|
-
if ((0, _isNonEmptyArray.default)(viewDecisions)) {
|
|
27
|
-
executeViewDecisions(viewDecisions);
|
|
28
|
-
return; // return here is to avoid the following code to be executed, that one is meant for the condition when viewDecisions is empty
|
|
29
|
-
} // if there are no viewDecisions for current view we will send a collect call
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var xdm = {
|
|
33
|
-
web: {
|
|
34
|
-
webPageDetails: {
|
|
35
|
-
viewName: viewName
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}; // This collect function is not from createCollect. It's the function from createViewCollect.
|
|
39
|
-
|
|
40
|
-
collect({
|
|
41
|
-
decisionsMeta: [],
|
|
42
|
-
xdm: xdm
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
exports.default = _default;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.default = void 0;
|
|
4
|
-
|
|
5
|
-
var _utils = require("../../utils");
|
|
6
|
-
|
|
7
|
-
var _eventType = require("./constants/eventType");
|
|
8
|
-
|
|
9
|
-
/*
|
|
10
|
-
Copyright 2020 Adobe. All rights reserved.
|
|
11
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
13
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
|
|
15
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
16
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
17
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
18
|
-
governing permissions and limitations under the License.
|
|
19
|
-
*/
|
|
20
|
-
var _default = function _default(_ref) {
|
|
21
|
-
var eventManager = _ref.eventManager,
|
|
22
|
-
mergeDecisionsMeta = _ref.mergeDecisionsMeta;
|
|
23
|
-
// Called when an offer for a specific SPA view is auto-rendered.
|
|
24
|
-
return function (_ref2) {
|
|
25
|
-
var decisionsMeta = _ref2.decisionsMeta,
|
|
26
|
-
xdm = _ref2.xdm;
|
|
27
|
-
var data = {
|
|
28
|
-
eventType: _eventType.DISPLAY
|
|
29
|
-
};
|
|
30
|
-
var event = eventManager.createEvent();
|
|
31
|
-
|
|
32
|
-
if ((0, _utils.isNonEmptyArray)(decisionsMeta)) {
|
|
33
|
-
var viewName = decisionsMeta[0].scope;
|
|
34
|
-
data.web = {
|
|
35
|
-
webPageDetails: {
|
|
36
|
-
viewName: viewName
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
mergeDecisionsMeta(event, decisionsMeta);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
event.mergeXdm(data);
|
|
43
|
-
event.mergeXdm(xdm);
|
|
44
|
-
return eventManager.sendEvent(event);
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
exports.default = _default;
|