@adobe/alloy 2.20.0 → 2.21.0-beta.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/Personalization/createApplyPropositions.js +27 -10
- package/libEs5/components/Personalization/createClickStorage.js +4 -4
- package/libEs5/components/Personalization/createInteractionStorage.js +102 -0
- package/libEs5/components/Personalization/createOnClickHandler.js +49 -21
- package/libEs5/components/Personalization/dom-actions/action.js +4 -4
- package/libEs5/components/Personalization/dom-actions/appendHtml.js +2 -1
- package/libEs5/components/Personalization/dom-actions/clicks/collectClicks.js +15 -33
- package/libEs5/components/Personalization/dom-actions/clicks/collectInteractions.js +81 -0
- package/libEs5/components/Personalization/dom-actions/collectInteractions.js +17 -0
- package/libEs5/components/Personalization/dom-actions/dom/isDomElement.js +17 -0
- package/libEs5/components/Personalization/dom-actions/initDomActionsModules.js +36 -19
- package/libEs5/components/Personalization/dom-actions/insertHtmlAfter.js +5 -2
- package/libEs5/components/Personalization/dom-actions/insertHtmlBefore.js +2 -1
- package/libEs5/components/Personalization/dom-actions/prependHtml.js +2 -1
- package/libEs5/components/Personalization/dom-actions/rearrangeChildren.js +3 -1
- package/libEs5/components/Personalization/dom-actions/remapCustomCodeOffers.js +2 -2
- package/libEs5/components/Personalization/dom-actions/remapHeadOffers.js +2 -2
- package/libEs5/components/Personalization/dom-actions/replaceHtml.js +4 -3
- package/libEs5/components/Personalization/dom-actions/setAttributes.js +2 -1
- package/libEs5/components/Personalization/dom-actions/setHtml.js +2 -2
- package/libEs5/components/Personalization/dom-actions/setStyles.js +2 -1
- package/libEs5/components/Personalization/dom-actions/setText.js +2 -1
- package/libEs5/components/Personalization/dom-actions/swapImage.js +2 -1
- package/libEs5/components/Personalization/handlers/createDecorateProposition.js +60 -0
- package/libEs5/components/Personalization/handlers/createProcessDomAction.js +10 -6
- package/libEs5/components/Personalization/handlers/createProcessHtmlContent.js +6 -2
- package/libEs5/components/Personalization/handlers/createProcessPropositions.js +1 -1
- package/libEs5/components/Personalization/handlers/injectCreateProposition.js +12 -1
- package/libEs5/components/Personalization/index.js +26 -7
- package/libEs5/components/Personalization/utils/metaUtils.js +33 -0
- package/libEs5/components/Personalization/validateApplyPropositionsOptions.js +12 -1
- package/libEs5/constants/decisionProvider.js +3 -2
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/constants/propositionInteractionType.js +18 -0
- package/libEs5/utils/dom/awaitSelector.js +5 -1
- package/libEs6/components/Personalization/createApplyPropositions.js +25 -10
- package/libEs6/components/Personalization/createClickStorage.js +4 -4
- package/libEs6/components/Personalization/createInteractionStorage.js +85 -0
- package/libEs6/components/Personalization/createOnClickHandler.js +49 -22
- package/libEs6/components/Personalization/dom-actions/action.js +4 -4
- package/libEs6/components/Personalization/dom-actions/appendHtml.js +3 -2
- package/libEs6/components/Personalization/dom-actions/clicks/collectClicks.js +8 -18
- package/libEs6/components/Personalization/dom-actions/clicks/collectInteractions.js +74 -0
- package/libEs6/components/Personalization/dom-actions/collectInteractions.js +15 -0
- package/libEs6/components/Personalization/dom-actions/dom/isDomElement.js +12 -0
- package/libEs6/components/Personalization/dom-actions/initDomActionsModules.js +46 -16
- package/libEs6/components/Personalization/dom-actions/insertHtmlAfter.js +5 -2
- package/libEs6/components/Personalization/dom-actions/insertHtmlBefore.js +3 -2
- package/libEs6/components/Personalization/dom-actions/prependHtml.js +3 -2
- package/libEs6/components/Personalization/dom-actions/rearrangeChildren.js +3 -1
- package/libEs6/components/Personalization/dom-actions/remapCustomCodeOffers.js +2 -2
- package/libEs6/components/Personalization/dom-actions/remapHeadOffers.js +2 -2
- package/libEs6/components/Personalization/dom-actions/replaceHtml.js +4 -3
- package/libEs6/components/Personalization/dom-actions/setAttributes.js +2 -1
- package/libEs6/components/Personalization/dom-actions/setHtml.js +2 -2
- package/libEs6/components/Personalization/dom-actions/setStyles.js +2 -1
- package/libEs6/components/Personalization/dom-actions/setText.js +2 -1
- package/libEs6/components/Personalization/dom-actions/swapImage.js +3 -2
- package/libEs6/components/Personalization/handlers/createDecorateProposition.js +59 -0
- package/libEs6/components/Personalization/handlers/createProcessDomAction.js +10 -4
- package/libEs6/components/Personalization/handlers/createProcessHtmlContent.js +6 -2
- package/libEs6/components/Personalization/handlers/createProcessPropositions.js +1 -1
- package/libEs6/components/Personalization/handlers/injectCreateProposition.js +12 -1
- package/libEs6/components/Personalization/index.js +32 -8
- package/libEs6/components/Personalization/utils/metaUtils.js +23 -0
- package/libEs6/components/Personalization/validateApplyPropositionsOptions.js +12 -1
- package/libEs6/constants/decisionProvider.js +2 -1
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/constants/propositionInteractionType.js +15 -0
- package/libEs6/utils/dom/awaitSelector.js +5 -1
- package/package.json +2 -2
|
@@ -11,15 +11,16 @@ governing permissions and limitations under the License.
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { SRC } from "../../../constants/elementAttribute.js";
|
|
14
|
-
import {
|
|
14
|
+
import { removeAttribute, setAttribute } from "./dom/index.js";
|
|
15
15
|
import { isImage, loadImage } from "./images.js";
|
|
16
|
-
export default ((container, url) => {
|
|
16
|
+
export default ((container, url, decorateProposition) => {
|
|
17
17
|
if (!isImage(container)) {
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
// Start downloading the image
|
|
22
22
|
loadImage(url);
|
|
23
|
+
decorateProposition(container);
|
|
23
24
|
|
|
24
25
|
// Remove "src" so there is no flicker
|
|
25
26
|
removeAttribute(container, SRC);
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
import { getAttribute, setAttribute } from "../dom-actions/dom/index.js";
|
|
13
|
+
import { includes, noop } from "../../../utils/index.js";
|
|
14
|
+
import { DOM_ACTION_CLICK } from "../dom-actions/initDomActionsModules.js";
|
|
15
|
+
import { ALWAYS, DECORATED_ELEMENTS_ONLY } from "../../../constants/propositionInteractionType.js";
|
|
16
|
+
export const INTERACT_ID_DATA_ATTRIBUTE = "data-aep-interact-id";
|
|
17
|
+
export const CLICK_LABEL_DATA_ATTRIBUTE = "data-aep-click-label";
|
|
18
|
+
export const CLICK_TOKEN_DATA_ATTRIBUTE = "data-aep-click-token";
|
|
19
|
+
let lastInteractId = 0;
|
|
20
|
+
const getInteractId = (propositionId, existingInteractId) => {
|
|
21
|
+
if (existingInteractId) {
|
|
22
|
+
return parseInt(existingInteractId, 10);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// eslint-disable-next-line no-plusplus
|
|
26
|
+
return ++lastInteractId;
|
|
27
|
+
};
|
|
28
|
+
const interactionTrackingSupported = (autoCollectPropositionInteractions, decisionProvider) => {
|
|
29
|
+
if (!autoCollectPropositionInteractions) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
if (!autoCollectPropositionInteractions[decisionProvider]) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
return includes([ALWAYS, DECORATED_ELEMENTS_ONLY], autoCollectPropositionInteractions[decisionProvider]);
|
|
36
|
+
};
|
|
37
|
+
const createDecorateProposition = (autoCollectPropositionInteractions, type, propositionId, itemId, trackingLabel, scopeType, notification, storeInteractionMeta) => {
|
|
38
|
+
const {
|
|
39
|
+
scopeDetails = {}
|
|
40
|
+
} = notification;
|
|
41
|
+
const {
|
|
42
|
+
decisionProvider
|
|
43
|
+
} = scopeDetails;
|
|
44
|
+
if (!interactionTrackingSupported(autoCollectPropositionInteractions, decisionProvider) && type !== DOM_ACTION_CLICK) {
|
|
45
|
+
return noop;
|
|
46
|
+
}
|
|
47
|
+
return element => {
|
|
48
|
+
if (!element.tagName) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const interactId = getInteractId(propositionId, getAttribute(element, INTERACT_ID_DATA_ATTRIBUTE));
|
|
52
|
+
storeInteractionMeta(propositionId, itemId, scopeType, notification, interactId);
|
|
53
|
+
setAttribute(element, INTERACT_ID_DATA_ATTRIBUTE, interactId);
|
|
54
|
+
if (trackingLabel && !getAttribute(element, CLICK_LABEL_DATA_ATTRIBUTE)) {
|
|
55
|
+
setAttribute(element, CLICK_LABEL_DATA_ATTRIBUTE, trackingLabel);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export default createDecorateProposition;
|
|
@@ -9,10 +9,15 @@ 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
|
+
import createDecorateProposition from "./createDecorateProposition.js";
|
|
14
|
+
import { DOM_ACTION_CLICK } from "../dom-actions/initDomActionsModules.js";
|
|
12
15
|
export default (({
|
|
13
16
|
modules,
|
|
14
17
|
logger,
|
|
15
|
-
|
|
18
|
+
storeInteractionMeta,
|
|
19
|
+
storeClickMeta,
|
|
20
|
+
autoCollectPropositionInteractions
|
|
16
21
|
}) => item => {
|
|
17
22
|
const {
|
|
18
23
|
type,
|
|
@@ -25,7 +30,7 @@ export default (({
|
|
|
25
30
|
includeInNotification: false
|
|
26
31
|
};
|
|
27
32
|
}
|
|
28
|
-
if (type ===
|
|
33
|
+
if (type === DOM_ACTION_CLICK) {
|
|
29
34
|
if (!selector) {
|
|
30
35
|
logger.warn("Invalid DOM action data: missing selector.", item.getData());
|
|
31
36
|
return {
|
|
@@ -33,7 +38,7 @@ export default (({
|
|
|
33
38
|
includeInNotification: false
|
|
34
39
|
};
|
|
35
40
|
}
|
|
36
|
-
|
|
41
|
+
storeClickMeta({
|
|
37
42
|
selector,
|
|
38
43
|
meta: {
|
|
39
44
|
...item.getProposition().getNotification(),
|
|
@@ -53,8 +58,9 @@ export default (({
|
|
|
53
58
|
includeInNotification: false
|
|
54
59
|
};
|
|
55
60
|
}
|
|
61
|
+
const decorateProposition = createDecorateProposition(autoCollectPropositionInteractions, type, item.getProposition().getId(), item.getId(), item.getTrackingLabel(), item.getProposition().getScopeType(), item.getProposition().getNotification(), storeInteractionMeta);
|
|
56
62
|
return {
|
|
57
|
-
render: () => modules[type](item.getData()),
|
|
63
|
+
render: () => modules[type](item.getData(), decorateProposition),
|
|
58
64
|
setRenderAttempted: true,
|
|
59
65
|
includeInNotification: true
|
|
60
66
|
};
|
|
@@ -9,9 +9,12 @@ 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 createDecorateProposition from "./createDecorateProposition.js";
|
|
12
13
|
export default (({
|
|
13
14
|
modules,
|
|
14
|
-
logger
|
|
15
|
+
logger,
|
|
16
|
+
storeInteractionMeta,
|
|
17
|
+
autoCollectPropositionInteractions
|
|
15
18
|
}) => item => {
|
|
16
19
|
const {
|
|
17
20
|
type,
|
|
@@ -30,9 +33,10 @@ export default (({
|
|
|
30
33
|
includeInNotification: false
|
|
31
34
|
};
|
|
32
35
|
}
|
|
36
|
+
const decorateProposition = createDecorateProposition(autoCollectPropositionInteractions, type, item.getProposition().getId(), item.getId(), item.getTrackingLabel(), item.getProposition().getScopeType(), item.getProposition().getNotification(), storeInteractionMeta);
|
|
33
37
|
return {
|
|
34
38
|
render: () => {
|
|
35
|
-
modules[type](item.getData());
|
|
39
|
+
return modules[type](item.getData(), decorateProposition);
|
|
36
40
|
},
|
|
37
41
|
setRenderAttempted: true,
|
|
38
42
|
includeInNotification: true
|
|
@@ -107,7 +107,7 @@ export default (({
|
|
|
107
107
|
const meta = atLeastOneWithNotification ? proposition.getNotification() : undefined;
|
|
108
108
|
renderers.push(() => renderItems(itemRenderers, meta));
|
|
109
109
|
} else if (atLeastOneWithNotification) {
|
|
110
|
-
renderers.push(() => proposition.getNotification());
|
|
110
|
+
renderers.push(() => Promise.resolve(proposition.getNotification()));
|
|
111
111
|
}
|
|
112
112
|
if (renderedItems.length > 0) {
|
|
113
113
|
proposition.addToReturnValues(returnedPropositions, returnedDecisions, renderedItems, true);
|
|
@@ -11,24 +11,32 @@ governing permissions and limitations under the License.
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import PAGE_WIDE_SCOPE from "../../../constants/pageWideScope.js";
|
|
14
|
-
import {
|
|
14
|
+
import { PAGE_SCOPE_TYPE, PROPOSITION_SCOPE_TYPE, VIEW_SCOPE_TYPE } from "../constants/scopeType.js";
|
|
15
15
|
export default (({
|
|
16
16
|
preprocess,
|
|
17
17
|
isPageWideSurface
|
|
18
18
|
}) => {
|
|
19
19
|
const createItem = (item, proposition) => {
|
|
20
20
|
const {
|
|
21
|
+
id,
|
|
21
22
|
schema,
|
|
22
23
|
data,
|
|
23
24
|
characteristics: {
|
|
24
25
|
trackingLabel
|
|
25
26
|
} = {}
|
|
26
27
|
} = item;
|
|
28
|
+
const schemaType = data ? data.type : undefined;
|
|
27
29
|
const processedData = preprocess(data);
|
|
28
30
|
return {
|
|
31
|
+
getId() {
|
|
32
|
+
return id;
|
|
33
|
+
},
|
|
29
34
|
getSchema() {
|
|
30
35
|
return schema;
|
|
31
36
|
},
|
|
37
|
+
getSchemaType() {
|
|
38
|
+
return schemaType;
|
|
39
|
+
},
|
|
32
40
|
getData() {
|
|
33
41
|
return processedData;
|
|
34
42
|
},
|
|
@@ -87,6 +95,9 @@ export default (({
|
|
|
87
95
|
scopeDetails
|
|
88
96
|
};
|
|
89
97
|
},
|
|
98
|
+
getId() {
|
|
99
|
+
return id;
|
|
100
|
+
},
|
|
90
101
|
toJSON() {
|
|
91
102
|
return payload;
|
|
92
103
|
},
|
|
@@ -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 { boolean, objectOf, string } from "../../utils/validation/index.js";
|
|
13
|
+
import { anyOf, boolean, literal, objectOf, string } from "../../utils/validation/index.js";
|
|
14
14
|
import createComponent from "./createComponent.js";
|
|
15
15
|
import { initDomActionsModules } from "./dom-actions/index.js";
|
|
16
16
|
import createCollect from "./createCollect.js";
|
|
@@ -23,6 +23,7 @@ import createOnClickHandler from "./createOnClickHandler.js";
|
|
|
23
23
|
import createViewCacheManager from "./createViewCacheManager.js";
|
|
24
24
|
import createViewChangeHandler from "./createViewChangeHandler.js";
|
|
25
25
|
import createClickStorage from "./createClickStorage.js";
|
|
26
|
+
import createInteractionStorage from "./createInteractionStorage.js";
|
|
26
27
|
import createApplyPropositions from "./createApplyPropositions.js";
|
|
27
28
|
import createGetPageLocation from "./createGetPageLocation.js";
|
|
28
29
|
import createSetTargetMigration from "./createSetTargetMigration.js";
|
|
@@ -44,6 +45,9 @@ import initInAppMessageActionsModules from "./in-app-message-actions/initInAppMe
|
|
|
44
45
|
import createRedirect from "./dom-actions/createRedirect.js";
|
|
45
46
|
import createNotificationHandler from "./createNotificationHandler.js";
|
|
46
47
|
import createHandleConsentFlicker from "./createHandleConsentFlicker.js";
|
|
48
|
+
import collectInteractions from "./dom-actions/clicks/collectInteractions.js";
|
|
49
|
+
import { ALWAYS, NEVER, PROPOSITION_INTERACTION_TYPES } from "../../constants/propositionInteractionType.js";
|
|
50
|
+
import { ADOBE_JOURNEY_OPTIMIZER, ADOBE_TARGET } from "../../constants/decisionProvider.js";
|
|
47
51
|
const createPersonalization = ({
|
|
48
52
|
config,
|
|
49
53
|
logger,
|
|
@@ -52,16 +56,21 @@ const createPersonalization = ({
|
|
|
52
56
|
}) => {
|
|
53
57
|
const {
|
|
54
58
|
targetMigrationEnabled,
|
|
55
|
-
prehidingStyle
|
|
59
|
+
prehidingStyle,
|
|
60
|
+
autoCollectPropositionInteractions
|
|
56
61
|
} = config;
|
|
57
62
|
const collect = createCollect({
|
|
58
63
|
eventManager,
|
|
59
64
|
mergeDecisionsMeta
|
|
60
65
|
});
|
|
61
66
|
const {
|
|
62
|
-
|
|
67
|
+
storeInteractionMeta,
|
|
68
|
+
getInteractionMetas
|
|
69
|
+
} = createInteractionStorage();
|
|
70
|
+
const {
|
|
71
|
+
storeClickMeta,
|
|
63
72
|
getClickSelectors,
|
|
64
|
-
|
|
73
|
+
getClickMetas
|
|
65
74
|
} = createClickStorage();
|
|
66
75
|
const getPageLocation = createGetPageLocation({
|
|
67
76
|
window
|
|
@@ -81,11 +90,15 @@ const createPersonalization = ({
|
|
|
81
90
|
[schema.DOM_ACTION]: createProcessDomAction({
|
|
82
91
|
modules: domActionsModules,
|
|
83
92
|
logger,
|
|
84
|
-
|
|
93
|
+
storeInteractionMeta,
|
|
94
|
+
storeClickMeta,
|
|
95
|
+
autoCollectPropositionInteractions
|
|
85
96
|
}),
|
|
86
97
|
[schema.HTML_CONTENT_ITEM]: createProcessHtmlContent({
|
|
87
98
|
modules: domActionsModules,
|
|
88
|
-
logger
|
|
99
|
+
logger,
|
|
100
|
+
storeInteractionMeta,
|
|
101
|
+
autoCollectPropositionInteractions
|
|
89
102
|
}),
|
|
90
103
|
[schema.REDIRECT_ITEM]: createProcessRedirect({
|
|
91
104
|
logger,
|
|
@@ -115,9 +128,12 @@ const createPersonalization = ({
|
|
|
115
128
|
});
|
|
116
129
|
const onClickHandler = createOnClickHandler({
|
|
117
130
|
mergeDecisionsMeta,
|
|
131
|
+
collectInteractions,
|
|
118
132
|
collectClicks,
|
|
133
|
+
getInteractionMetas,
|
|
134
|
+
getClickMetas,
|
|
119
135
|
getClickSelectors,
|
|
120
|
-
|
|
136
|
+
autoCollectPropositionInteractions
|
|
121
137
|
});
|
|
122
138
|
const viewChangeHandler = createViewChangeHandler({
|
|
123
139
|
processPropositions,
|
|
@@ -160,8 +176,16 @@ const createPersonalization = ({
|
|
|
160
176
|
});
|
|
161
177
|
};
|
|
162
178
|
createPersonalization.namespace = "Personalization";
|
|
179
|
+
const interactionConfigOptions = PROPOSITION_INTERACTION_TYPES.map(propositionInteractionType => literal(propositionInteractionType));
|
|
163
180
|
createPersonalization.configValidators = objectOf({
|
|
164
181
|
prehidingStyle: string().nonEmpty(),
|
|
165
|
-
targetMigrationEnabled: boolean().default(false)
|
|
182
|
+
targetMigrationEnabled: boolean().default(false),
|
|
183
|
+
autoCollectPropositionInteractions: objectOf({
|
|
184
|
+
[ADOBE_JOURNEY_OPTIMIZER]: anyOf(interactionConfigOptions).default(ALWAYS),
|
|
185
|
+
[ADOBE_TARGET]: anyOf(interactionConfigOptions).default(NEVER)
|
|
186
|
+
}).default({
|
|
187
|
+
[ADOBE_JOURNEY_OPTIMIZER]: ALWAYS,
|
|
188
|
+
[ADOBE_TARGET]: NEVER
|
|
189
|
+
}).noUnknownFields()
|
|
166
190
|
});
|
|
167
191
|
export default createPersonalization;
|
|
@@ -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
|
+
export const cleanMetas = metas => metas.map(meta => {
|
|
13
|
+
const {
|
|
14
|
+
trackingLabel,
|
|
15
|
+
scopeType,
|
|
16
|
+
...rest
|
|
17
|
+
} = meta;
|
|
18
|
+
return rest;
|
|
19
|
+
});
|
|
20
|
+
export const dedupeMetas = metas => metas.filter((meta, index) => {
|
|
21
|
+
const stringifiedMeta = JSON.stringify(meta);
|
|
22
|
+
return index === metas.findIndex(innerMeta => JSON.stringify(innerMeta) === stringifiedMeta);
|
|
23
|
+
});
|
|
@@ -18,7 +18,18 @@ export default (({
|
|
|
18
18
|
options
|
|
19
19
|
}) => {
|
|
20
20
|
const applyPropositionsOptionsValidator = objectOf({
|
|
21
|
-
propositions: arrayOf(objectOf(
|
|
21
|
+
propositions: arrayOf(objectOf({
|
|
22
|
+
id: string().required(),
|
|
23
|
+
scope: string().required(),
|
|
24
|
+
scopeDetails: objectOf({
|
|
25
|
+
decisionProvider: string().required()
|
|
26
|
+
}).required(),
|
|
27
|
+
items: arrayOf(objectOf({
|
|
28
|
+
id: string().required(),
|
|
29
|
+
schema: string().required(),
|
|
30
|
+
data: anything().required()
|
|
31
|
+
})).nonEmpty().required()
|
|
32
|
+
}).required()).nonEmpty().required(),
|
|
22
33
|
metadata: objectOf(anything()),
|
|
23
34
|
viewName: string()
|
|
24
35
|
}).required();
|
|
@@ -9,4 +9,5 @@ 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
|
-
export const ADOBE_JOURNEY_OPTIMIZER = "AJO";
|
|
12
|
+
export const ADOBE_JOURNEY_OPTIMIZER = "AJO";
|
|
13
|
+
export const ADOBE_TARGET = "TGT";
|
|
@@ -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
|
+
export const ALWAYS = "always";
|
|
13
|
+
export const NEVER = "never";
|
|
14
|
+
export const DECORATED_ELEMENTS_ONLY = "decoratedElementsOnly";
|
|
15
|
+
export const PROPOSITION_INTERACTION_TYPES = [ALWAYS, NEVER, DECORATED_ELEMENTS_ONLY];
|
|
@@ -34,14 +34,18 @@ export const canUseMutationObserver = win => {
|
|
|
34
34
|
};
|
|
35
35
|
export const awaitUsingMutationObserver = (win, doc, selector, timeout, selectFunc) => {
|
|
36
36
|
return createPromise((resolve, reject) => {
|
|
37
|
+
let timer;
|
|
37
38
|
const mutationObserver = new win[MUTATION_OBSERVER](() => {
|
|
38
39
|
const nodes = selectFunc(selector);
|
|
39
40
|
if (isNonEmptyArray(nodes)) {
|
|
40
41
|
mutationObserver.disconnect();
|
|
42
|
+
if (timer) {
|
|
43
|
+
clearTimeout(timer);
|
|
44
|
+
}
|
|
41
45
|
resolve(nodes);
|
|
42
46
|
}
|
|
43
47
|
});
|
|
44
|
-
setTimeout(() => {
|
|
48
|
+
timer = setTimeout(() => {
|
|
45
49
|
mutationObserver.disconnect();
|
|
46
50
|
reject(createError(selector));
|
|
47
51
|
}, timeout);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/alloy",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.21.0-beta.0",
|
|
4
4
|
"description": "Adobe Experience Platform Web SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "libEs5/index.js",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"uuid": "^9.0.1"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@adobe/alloy": "^2.20.0
|
|
78
|
+
"@adobe/alloy": "^2.20.0",
|
|
79
79
|
"@babel/cli": "^7.24.5",
|
|
80
80
|
"@babel/core": "^7.24.5",
|
|
81
81
|
"@babel/eslint-parser": "^7.24.5",
|