@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
|
@@ -4,6 +4,7 @@ exports.default = void 0;
|
|
|
4
4
|
var _index = require("../../utils/index.js");
|
|
5
5
|
var _schema = require("../../constants/schema.js");
|
|
6
6
|
var _pageWideScope = require("../../constants/pageWideScope.js");
|
|
7
|
+
var _initDomActionsModules = require("./dom-actions/initDomActionsModules.js");
|
|
7
8
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
8
9
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
9
10
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -26,27 +27,43 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
26
27
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
27
28
|
governing permissions and limitations under the License.
|
|
28
29
|
*/
|
|
29
|
-
var
|
|
30
|
+
var isInteractionTrackingItem = function isInteractionTrackingItem(schema, actionType) {
|
|
31
|
+
return schema === _schema.JSON_CONTENT_ITEM && actionType === _initDomActionsModules.DOM_ACTION_COLLECT_INTERACTIONS;
|
|
32
|
+
};
|
|
33
|
+
var SUPPORTED_SCHEMAS = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, _schema.DOM_ACTION, function () {
|
|
34
|
+
return true;
|
|
35
|
+
}), _schema.HTML_CONTENT_ITEM, function () {
|
|
36
|
+
return true;
|
|
37
|
+
}), _schema.JSON_CONTENT_ITEM, isInteractionTrackingItem), _schema.MESSAGE_IN_APP, function () {
|
|
38
|
+
return true;
|
|
39
|
+
});
|
|
40
|
+
var filterItemsPredicate = function filterItemsPredicate(schema, actionType) {
|
|
41
|
+
return typeof SUPPORTED_SCHEMAS[schema] === "function" && SUPPORTED_SCHEMAS[schema](schema, actionType);
|
|
42
|
+
};
|
|
30
43
|
var _default = exports.default = function _default(_ref) {
|
|
31
44
|
var processPropositions = _ref.processPropositions,
|
|
32
45
|
createProposition = _ref.createProposition,
|
|
33
46
|
renderedPropositions = _ref.renderedPropositions,
|
|
34
47
|
viewCache = _ref.viewCache;
|
|
35
|
-
var filterItemsPredicate = function filterItemsPredicate(item) {
|
|
36
|
-
return SUPPORTED_SCHEMAS.indexOf(item.schema) > -1;
|
|
37
|
-
};
|
|
38
48
|
var updatePropositionItems = function updatePropositionItems(_ref2) {
|
|
39
49
|
var items = _ref2.items,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
50
|
+
_ref2$metadataForScop = _ref2.metadataForScope,
|
|
51
|
+
metadataForScope = _ref2$metadataForScop === void 0 ? {} : _ref2$metadataForScop;
|
|
52
|
+
var actionType = metadataForScope.actionType,
|
|
53
|
+
selector = metadataForScope.selector;
|
|
54
|
+
return items.filter(function (item) {
|
|
55
|
+
return filterItemsPredicate(item.schema, actionType);
|
|
56
|
+
}).map(function (item) {
|
|
57
|
+
var schema = item.schema;
|
|
58
|
+
if (schema !== _schema.HTML_CONTENT_ITEM && !isInteractionTrackingItem(schema, actionType)) {
|
|
43
59
|
return _objectSpread({}, item);
|
|
44
60
|
}
|
|
45
|
-
if ((0, _index.
|
|
61
|
+
if (!(0, _index.isEmptyObject)(metadataForScope)) {
|
|
46
62
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
63
|
+
schema: isInteractionTrackingItem(schema, actionType) ? _schema.DOM_ACTION : schema,
|
|
47
64
|
data: _objectSpread(_objectSpread({}, item.data), {}, {
|
|
48
|
-
selector:
|
|
49
|
-
type:
|
|
65
|
+
selector: selector,
|
|
66
|
+
type: actionType
|
|
50
67
|
})
|
|
51
68
|
});
|
|
52
69
|
}
|
|
@@ -28,7 +28,7 @@ var metasToArray = function metasToArray(metas) {
|
|
|
28
28
|
};
|
|
29
29
|
var _default = exports.default = function _default() {
|
|
30
30
|
var clickStorage = {};
|
|
31
|
-
var
|
|
31
|
+
var storeClickMeta = function storeClickMeta(_ref) {
|
|
32
32
|
var selector = _ref.selector,
|
|
33
33
|
_ref$meta = _ref.meta,
|
|
34
34
|
id = _ref$meta.id,
|
|
@@ -49,7 +49,7 @@ var _default = exports.default = function _default() {
|
|
|
49
49
|
var getClickSelectors = function getClickSelectors() {
|
|
50
50
|
return Object.keys(clickStorage);
|
|
51
51
|
};
|
|
52
|
-
var
|
|
52
|
+
var getClickMetas = function getClickMetas(selector) {
|
|
53
53
|
var metas = clickStorage[selector];
|
|
54
54
|
if (!metas) {
|
|
55
55
|
return {};
|
|
@@ -57,8 +57,8 @@ var _default = exports.default = function _default() {
|
|
|
57
57
|
return metasToArray(clickStorage[selector]);
|
|
58
58
|
};
|
|
59
59
|
return {
|
|
60
|
-
|
|
60
|
+
storeClickMeta: storeClickMeta,
|
|
61
61
|
getClickSelectors: getClickSelectors,
|
|
62
|
-
|
|
62
|
+
getClickMetas: getClickMetas
|
|
63
63
|
};
|
|
64
64
|
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
5
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
6
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
9
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
15
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
16
|
+
/*
|
|
17
|
+
Copyright 2020 Adobe. All rights reserved.
|
|
18
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
19
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
20
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
+
|
|
22
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
23
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
24
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
25
|
+
governing permissions and limitations under the License.
|
|
26
|
+
*/
|
|
27
|
+
var _default = exports.default = function _default() {
|
|
28
|
+
var clickMetaStorage = {};
|
|
29
|
+
/*
|
|
30
|
+
clickMetaStorage example.
|
|
31
|
+
`abc' and 'def' are proposition IDs. 1 is an interact id. The object with an id, scope and scopeDetails
|
|
32
|
+
is the notification.
|
|
33
|
+
{
|
|
34
|
+
1: {
|
|
35
|
+
"abc": { "id": "abc", "scope": "proposition", "scopeDetails": {} },
|
|
36
|
+
"def": { "id": "def", "scope": "proposition", "scopeDetails": {} }
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
var clickItemStorage = {};
|
|
42
|
+
/*
|
|
43
|
+
clickItemStorage example.
|
|
44
|
+
`abc' and 'def' are proposition IDs. 1 is an interact id. The sets contain proposition-item IDs which
|
|
45
|
+
are used in notifications that are sent.
|
|
46
|
+
{
|
|
47
|
+
1: {
|
|
48
|
+
abc: new Set(["itemAAA", "itemCCC"]),
|
|
49
|
+
def: new Set(["itemEEE", "itemFFF"]),
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
var storeInteractionMeta = function storeInteractionMeta(propositionId, itemId, scopeType, notification, interactId) {
|
|
55
|
+
// eslint-disable-next-line no-param-reassign
|
|
56
|
+
interactId = parseInt(interactId, 10);
|
|
57
|
+
if (!clickMetaStorage[interactId]) {
|
|
58
|
+
clickMetaStorage[interactId] = {};
|
|
59
|
+
clickItemStorage[interactId] = {};
|
|
60
|
+
}
|
|
61
|
+
if (!clickItemStorage[interactId][propositionId]) {
|
|
62
|
+
clickItemStorage[interactId][propositionId] = new Set();
|
|
63
|
+
}
|
|
64
|
+
clickItemStorage[interactId][propositionId].add(itemId);
|
|
65
|
+
clickMetaStorage[interactId][propositionId] = _objectSpread(_objectSpread({}, notification), {}, {
|
|
66
|
+
scopeType: scopeType
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
var getInteractionMetas = function getInteractionMetas(interactIds) {
|
|
70
|
+
if (!Array.isArray(interactIds) || interactIds.length === 0) {
|
|
71
|
+
return [];
|
|
72
|
+
}
|
|
73
|
+
return Object.values(interactIds.map(function (value) {
|
|
74
|
+
return parseInt(value, 10);
|
|
75
|
+
}).reduce(function (metaMap, interactId) {
|
|
76
|
+
Object.keys(clickMetaStorage[interactId] || {}).forEach(function (propositionId) {
|
|
77
|
+
if (!metaMap[propositionId]) {
|
|
78
|
+
metaMap[propositionId] = {
|
|
79
|
+
proposition: clickMetaStorage[interactId][propositionId],
|
|
80
|
+
items: new Set()
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
metaMap[propositionId].items = new Set([].concat(_toConsumableArray(metaMap[propositionId].items), _toConsumableArray(clickItemStorage[interactId][propositionId])));
|
|
84
|
+
});
|
|
85
|
+
return metaMap;
|
|
86
|
+
}, {})).map(function (_ref) {
|
|
87
|
+
var proposition = _ref.proposition,
|
|
88
|
+
items = _ref.items;
|
|
89
|
+
return _objectSpread(_objectSpread({}, proposition), {}, {
|
|
90
|
+
items: Array.from(items).map(function (id) {
|
|
91
|
+
return {
|
|
92
|
+
id: id
|
|
93
|
+
};
|
|
94
|
+
})
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
return {
|
|
99
|
+
storeInteractionMeta: storeInteractionMeta,
|
|
100
|
+
getInteractionMetas: getInteractionMetas
|
|
101
|
+
};
|
|
102
|
+
};
|
|
@@ -15,37 +15,65 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
15
15
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
16
|
governing permissions and limitations under the License.
|
|
17
17
|
*/
|
|
18
|
+
|
|
19
|
+
var createPropositionAction = function createPropositionAction(clickLabel, clickToken) {
|
|
20
|
+
if (!clickToken && !clickLabel) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
var propositionAction = {};
|
|
24
|
+
if (clickLabel) {
|
|
25
|
+
propositionAction.label = clickLabel;
|
|
26
|
+
}
|
|
27
|
+
if (clickToken) {
|
|
28
|
+
propositionAction.tokens = [clickToken];
|
|
29
|
+
}
|
|
30
|
+
return propositionAction;
|
|
31
|
+
};
|
|
18
32
|
var _default = exports.default = function _default(_ref) {
|
|
19
33
|
var mergeDecisionsMeta = _ref.mergeDecisionsMeta,
|
|
34
|
+
collectInteractions = _ref.collectInteractions,
|
|
20
35
|
collectClicks = _ref.collectClicks,
|
|
36
|
+
getInteractionMetas = _ref.getInteractionMetas,
|
|
37
|
+
getClickMetas = _ref.getClickMetas,
|
|
21
38
|
getClickSelectors = _ref.getClickSelectors,
|
|
22
|
-
|
|
39
|
+
autoCollectPropositionInteractions = _ref.autoCollectPropositionInteractions;
|
|
23
40
|
// Called when an element qualifying for conversion within an offer is clicked.
|
|
24
41
|
return function (_ref2) {
|
|
25
42
|
var event = _ref2.event,
|
|
26
43
|
clickedElement = _ref2.clickedElement;
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
44
|
+
var decisionsMeta = [];
|
|
45
|
+
var propositionActionLabel;
|
|
46
|
+
var propositionActionToken;
|
|
47
|
+
var viewName;
|
|
48
|
+
[collectInteractions(clickedElement, getInteractionMetas, autoCollectPropositionInteractions), collectClicks(clickedElement, getClickSelectors(), getClickMetas)].forEach(function (_ref3) {
|
|
49
|
+
var curDecisionsMeta = _ref3.decisionsMeta,
|
|
50
|
+
curPropositionActionLabel = _ref3.propositionActionLabel,
|
|
51
|
+
curPropositionActionToken = _ref3.propositionActionToken,
|
|
52
|
+
curViewName = _ref3.viewName;
|
|
53
|
+
Array.prototype.push.apply(decisionsMeta, curDecisionsMeta);
|
|
54
|
+
if (!propositionActionLabel && curPropositionActionLabel) {
|
|
55
|
+
propositionActionLabel = curPropositionActionLabel;
|
|
56
|
+
}
|
|
57
|
+
if (!propositionActionToken && curPropositionActionToken) {
|
|
58
|
+
propositionActionToken = curPropositionActionToken;
|
|
59
|
+
}
|
|
60
|
+
if (!viewName && curViewName) {
|
|
61
|
+
viewName = curViewName;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
if ((0, _index.isNonEmptyArray)(decisionsMeta)) {
|
|
65
|
+
var xdm = {
|
|
66
|
+
eventType: _eventType.INTERACT
|
|
67
|
+
};
|
|
68
|
+
if (viewName) {
|
|
69
|
+
xdm.web = {
|
|
70
|
+
webPageDetails: {
|
|
71
|
+
viewName: viewName
|
|
72
|
+
}
|
|
36
73
|
};
|
|
37
|
-
if (viewName) {
|
|
38
|
-
xdm.web = {
|
|
39
|
-
webPageDetails: {
|
|
40
|
-
viewName: viewName
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
event.mergeXdm(xdm);
|
|
45
|
-
mergeDecisionsMeta(event, decisionsMeta, [_propositionEventType.PropositionEventType.INTERACT], eventLabel ? {
|
|
46
|
-
label: eventLabel
|
|
47
|
-
} : undefined);
|
|
48
74
|
}
|
|
75
|
+
event.mergeXdm(xdm);
|
|
76
|
+
mergeDecisionsMeta(event, decisionsMeta, [_propositionEventType.PropositionEventType.INTERACT], createPropositionAction(propositionActionLabel, propositionActionToken));
|
|
49
77
|
}
|
|
50
78
|
};
|
|
51
79
|
};
|
|
@@ -93,20 +93,20 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
93
93
|
governing permissions and limitations under the License.
|
|
94
94
|
*/
|
|
95
95
|
|
|
96
|
-
var renderContent = function renderContent(elements, content, renderFunc) {
|
|
96
|
+
var renderContent = function renderContent(elements, content, decorateProposition, renderFunc) {
|
|
97
97
|
var executions = elements.map(function (element) {
|
|
98
|
-
return renderFunc(element, content);
|
|
98
|
+
return renderFunc(element, content, decorateProposition);
|
|
99
99
|
});
|
|
100
100
|
return Promise.all(executions);
|
|
101
101
|
};
|
|
102
102
|
var createAction = exports.createAction = function createAction(renderFunc) {
|
|
103
|
-
return function (itemData) {
|
|
103
|
+
return function (itemData, decorateProposition) {
|
|
104
104
|
var selector = itemData.selector,
|
|
105
105
|
prehidingSelector = itemData.prehidingSelector,
|
|
106
106
|
content = itemData.content;
|
|
107
107
|
(0, _index2.hideElements)(prehidingSelector);
|
|
108
108
|
return (0, _index.awaitSelector)(selector, _index3.selectNodesWithEq).then(function (elements) {
|
|
109
|
-
return renderContent(elements, content, renderFunc);
|
|
109
|
+
return renderContent(elements, content, decorateProposition, renderFunc);
|
|
110
110
|
}).then(function () {
|
|
111
111
|
// if everything is OK, show elements
|
|
112
112
|
(0, _index2.showElements)(prehidingSelector);
|
|
@@ -17,7 +17,7 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
17
17
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
18
18
|
governing permissions and limitations under the License.
|
|
19
19
|
*/
|
|
20
|
-
var _default = exports.default = function _default(container, html) {
|
|
20
|
+
var _default = exports.default = function _default(container, html, decorateProposition) {
|
|
21
21
|
var fragment = (0, _index2.createFragment)(html);
|
|
22
22
|
(0, _addNonceToInlineStyleElements.default)(fragment);
|
|
23
23
|
var elements = (0, _index2.getChildNodes)(fragment);
|
|
@@ -27,6 +27,7 @@ var _default = exports.default = function _default(container, html) {
|
|
|
27
27
|
elements.forEach(function (element) {
|
|
28
28
|
(0, _index.appendNode)(container, element);
|
|
29
29
|
});
|
|
30
|
+
decorateProposition(container);
|
|
30
31
|
(0, _scripts.executeInlineScripts)(container, scripts);
|
|
31
32
|
return (0, _scripts.executeRemoteScripts)(scriptsUrls);
|
|
32
33
|
};
|
|
@@ -3,8 +3,13 @@
|
|
|
3
3
|
exports.default = void 0;
|
|
4
4
|
var _matchesSelectorWithEq = require("../dom/matchesSelectorWithEq.js");
|
|
5
5
|
var _scopeType = require("../../constants/scopeType.js");
|
|
6
|
-
var
|
|
7
|
-
|
|
6
|
+
var _metaUtils = require("../../utils/metaUtils.js");
|
|
7
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
10
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
11
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
12
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } /*
|
|
8
13
|
Copyright 2019 Adobe. All rights reserved.
|
|
9
14
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
10
15
|
you may not use this file except in compliance with the License. You may obtain a copy
|
|
@@ -15,22 +20,14 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
15
20
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
21
|
governing permissions and limitations under the License.
|
|
17
22
|
*/
|
|
18
|
-
|
|
19
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
20
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
21
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
22
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
23
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
24
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
25
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
|
26
|
-
var getMetasIfMatches = function getMetasIfMatches(clickedElement, selector, getClickMetasBySelector) {
|
|
23
|
+
var getMetasIfMatches = function getMetasIfMatches(clickedElement, selector, getClickMetas) {
|
|
27
24
|
var _document = document,
|
|
28
25
|
documentElement = _document.documentElement;
|
|
29
26
|
var element = clickedElement;
|
|
30
27
|
var i = 0;
|
|
31
28
|
while (element && element !== documentElement) {
|
|
32
29
|
if ((0, _matchesSelectorWithEq.default)(selector, element)) {
|
|
33
|
-
var matchedMetas =
|
|
30
|
+
var matchedMetas = getClickMetas(selector);
|
|
34
31
|
var returnValue = {
|
|
35
32
|
metas: matchedMetas
|
|
36
33
|
};
|
|
@@ -57,23 +54,7 @@ var getMetasIfMatches = function getMetasIfMatches(clickedElement, selector, get
|
|
|
57
54
|
metas: null
|
|
58
55
|
};
|
|
59
56
|
};
|
|
60
|
-
var
|
|
61
|
-
return metas.map(function (meta) {
|
|
62
|
-
var trackingLabel = meta.trackingLabel,
|
|
63
|
-
scopeType = meta.scopeType,
|
|
64
|
-
rest = _objectWithoutProperties(meta, _excluded);
|
|
65
|
-
return rest;
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
var dedupMetas = function dedupMetas(metas) {
|
|
69
|
-
return metas.filter(function (meta, index) {
|
|
70
|
-
var stringifiedMeta = JSON.stringify(meta);
|
|
71
|
-
return index === metas.findIndex(function (innerMeta) {
|
|
72
|
-
return JSON.stringify(innerMeta) === stringifiedMeta;
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
var _default = exports.default = function _default(clickedElement, selectors, getClickMetasBySelector) {
|
|
57
|
+
var _default = exports.default = function _default(clickedElement, selectors, getClickMetas) {
|
|
77
58
|
var result = [];
|
|
78
59
|
var resultLabel = "";
|
|
79
60
|
var resultLabelWeight = Number.MAX_SAFE_INTEGER;
|
|
@@ -82,7 +63,7 @@ var _default = exports.default = function _default(clickedElement, selectors, ge
|
|
|
82
63
|
|
|
83
64
|
/* eslint-disable no-continue */
|
|
84
65
|
for (var i = 0; i < selectors.length; i += 1) {
|
|
85
|
-
var _getMetasIfMatches = getMetasIfMatches(clickedElement, selectors[i],
|
|
66
|
+
var _getMetasIfMatches = getMetasIfMatches(clickedElement, selectors[i], getClickMetas),
|
|
86
67
|
metas = _getMetasIfMatches.metas,
|
|
87
68
|
label = _getMetasIfMatches.label,
|
|
88
69
|
weight = _getMetasIfMatches.weight,
|
|
@@ -98,11 +79,12 @@ var _default = exports.default = function _default(clickedElement, selectors, ge
|
|
|
98
79
|
resultViewName = viewName;
|
|
99
80
|
resultViewNameWeight = weight;
|
|
100
81
|
}
|
|
101
|
-
result.push.apply(result, _toConsumableArray(cleanMetas(metas)));
|
|
82
|
+
result.push.apply(result, _toConsumableArray((0, _metaUtils.cleanMetas)(metas)));
|
|
102
83
|
}
|
|
103
84
|
return {
|
|
104
|
-
decisionsMeta:
|
|
105
|
-
|
|
85
|
+
decisionsMeta: (0, _metaUtils.dedupeMetas)(result),
|
|
86
|
+
propositionActionLabel: resultLabel,
|
|
87
|
+
propositionActionToken: undefined,
|
|
106
88
|
viewName: resultViewName
|
|
107
89
|
};
|
|
108
90
|
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
var _scopeType = require("../../constants/scopeType.js");
|
|
5
|
+
var _getAttribute = require("../dom/getAttribute.js");
|
|
6
|
+
var _createDecorateProposition = require("../../handlers/createDecorateProposition.js");
|
|
7
|
+
var _metaUtils = require("../../utils/metaUtils.js");
|
|
8
|
+
var _propositionInteractionType = require("../../../../constants/propositionInteractionType.js");
|
|
9
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
10
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
13
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
14
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } /*
|
|
15
|
+
Copyright 2019 Adobe. All rights reserved.
|
|
16
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
17
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
18
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
+
|
|
20
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
21
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
22
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
23
|
+
governing permissions and limitations under the License.
|
|
24
|
+
*/
|
|
25
|
+
var getInteractionDetail = function getInteractionDetail(clickedElement) {
|
|
26
|
+
var _document = document,
|
|
27
|
+
documentElement = _document.documentElement;
|
|
28
|
+
var element = clickedElement;
|
|
29
|
+
var interactIds = new Set();
|
|
30
|
+
var clickLabel;
|
|
31
|
+
var clickToken;
|
|
32
|
+
while (element && element !== documentElement) {
|
|
33
|
+
var interactId = (0, _getAttribute.default)(element, _createDecorateProposition.INTERACT_ID_DATA_ATTRIBUTE);
|
|
34
|
+
if (interactId) {
|
|
35
|
+
interactIds.add(interactId);
|
|
36
|
+
}
|
|
37
|
+
clickLabel = clickLabel || (0, _getAttribute.default)(element, _createDecorateProposition.CLICK_LABEL_DATA_ATTRIBUTE);
|
|
38
|
+
clickToken = clickToken || (0, _getAttribute.default)(element, _createDecorateProposition.CLICK_TOKEN_DATA_ATTRIBUTE);
|
|
39
|
+
element = element.parentNode;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
interactIds: _toConsumableArray(interactIds),
|
|
43
|
+
clickLabel: clickLabel,
|
|
44
|
+
clickToken: clickToken
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
var extractViewName = function extractViewName(metas) {
|
|
48
|
+
var foundMetaWithScopeTypeView = metas.find(function (meta) {
|
|
49
|
+
return meta.scopeType === _scopeType.VIEW_SCOPE_TYPE;
|
|
50
|
+
});
|
|
51
|
+
return foundMetaWithScopeTypeView ? foundMetaWithScopeTypeView.scope : undefined;
|
|
52
|
+
};
|
|
53
|
+
var createMetaFilter = function createMetaFilter(autoCollectPropositionInteractions, clickLabel, clickToken) {
|
|
54
|
+
return function (meta) {
|
|
55
|
+
var _meta$scopeDetails = meta.scopeDetails,
|
|
56
|
+
scopeDetails = _meta$scopeDetails === void 0 ? {} : _meta$scopeDetails;
|
|
57
|
+
var decisionProvider = scopeDetails.decisionProvider;
|
|
58
|
+
if (autoCollectPropositionInteractions[decisionProvider] === _propositionInteractionType.ALWAYS) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
return autoCollectPropositionInteractions[decisionProvider] === _propositionInteractionType.DECORATED_ELEMENTS_ONLY && (clickLabel || clickToken);
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
var _default = exports.default = function _default(clickedElement, getInteractionMetas, autoCollectPropositionInteractions) {
|
|
65
|
+
var _getInteractionDetail = getInteractionDetail(clickedElement),
|
|
66
|
+
interactIds = _getInteractionDetail.interactIds,
|
|
67
|
+
_getInteractionDetail2 = _getInteractionDetail.clickLabel,
|
|
68
|
+
clickLabel = _getInteractionDetail2 === void 0 ? "" : _getInteractionDetail2,
|
|
69
|
+
clickToken = _getInteractionDetail.clickToken;
|
|
70
|
+
var metasMatchingConfigurationOptions = createMetaFilter(autoCollectPropositionInteractions, clickLabel, clickToken);
|
|
71
|
+
if (interactIds.length === 0) {
|
|
72
|
+
return {};
|
|
73
|
+
}
|
|
74
|
+
var metas = getInteractionMetas(interactIds).filter(metasMatchingConfigurationOptions);
|
|
75
|
+
return {
|
|
76
|
+
decisionsMeta: (0, _metaUtils.cleanMetas)(metas),
|
|
77
|
+
propositionActionLabel: clickLabel,
|
|
78
|
+
propositionActionToken: clickToken,
|
|
79
|
+
viewName: extractViewName(metas)
|
|
80
|
+
};
|
|
81
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
/*
|
|
5
|
+
Copyright 2019 Adobe. All rights reserved.
|
|
6
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
8
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
11
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
12
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
|
+
governing permissions and limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
var _default = exports.default = function _default(container, content, decorateProposition) {
|
|
16
|
+
decorateProposition(container);
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
/*
|
|
5
|
+
Copyright 2024 Adobe. All rights reserved.
|
|
6
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
8
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
11
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
12
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
|
+
governing permissions and limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
var _default = exports.default = function _default(element) {
|
|
16
|
+
return element instanceof Element || element instanceof HTMLDocument;
|
|
17
|
+
};
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
exports.default = void 0;
|
|
3
|
+
exports.default = exports.DOM_ACTION_SET_TEXT = exports.DOM_ACTION_SET_STYLE = exports.DOM_ACTION_SET_IMAGE_SOURCE = exports.DOM_ACTION_SET_HTML = exports.DOM_ACTION_SET_ATTRIBUTE = exports.DOM_ACTION_RESIZE = exports.DOM_ACTION_REPLACE_HTML = exports.DOM_ACTION_REMOVE = exports.DOM_ACTION_REARRANGE = exports.DOM_ACTION_PREPEND_HTML = exports.DOM_ACTION_MOVE = exports.DOM_ACTION_INSERT_BEFORE = exports.DOM_ACTION_INSERT_AFTER = exports.DOM_ACTION_CUSTOM_CODE = exports.DOM_ACTION_COLLECT_INTERACTIONS = exports.DOM_ACTION_CLICK = exports.DOM_ACTION_APPEND_HTML = void 0;
|
|
4
4
|
var _index = require("../../../utils/dom/index.js");
|
|
5
|
+
var _setHtml = require("./setHtml.js");
|
|
6
|
+
var _prependHtml = require("./prependHtml.js");
|
|
5
7
|
var _action = require("./action.js");
|
|
6
|
-
|
|
8
|
+
var _setText = require("./setText.js");
|
|
9
|
+
var _setAttributes = require("./setAttributes.js");
|
|
10
|
+
var _swapImage = require("./swapImage.js");
|
|
11
|
+
var _setStyles = require("./setStyles.js");
|
|
12
|
+
var _rearrangeChildren = require("./rearrangeChildren.js");
|
|
13
|
+
var _insertHtmlAfter = require("./insertHtmlAfter.js");
|
|
14
|
+
var _insertHtmlBefore = require("./insertHtmlBefore.js");
|
|
15
|
+
var _replaceHtml = require("./replaceHtml.js");
|
|
16
|
+
var _appendHtml = require("./appendHtml.js");
|
|
17
|
+
var _collectInteractions = require("./collectInteractions.js");
|
|
18
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
19
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
20
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
21
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*
|
|
7
22
|
Copyright 2019 Adobe. All rights reserved.
|
|
8
23
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
9
24
|
you may not use this file except in compliance with the License. You may obtain a copy
|
|
@@ -14,22 +29,24 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
14
29
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
15
30
|
governing permissions and limitations under the License.
|
|
16
31
|
*/
|
|
32
|
+
var DOM_ACTION_SET_HTML = exports.DOM_ACTION_SET_HTML = "setHtml";
|
|
33
|
+
var DOM_ACTION_CUSTOM_CODE = exports.DOM_ACTION_CUSTOM_CODE = "customCode";
|
|
34
|
+
var DOM_ACTION_SET_TEXT = exports.DOM_ACTION_SET_TEXT = "setText";
|
|
35
|
+
var DOM_ACTION_SET_ATTRIBUTE = exports.DOM_ACTION_SET_ATTRIBUTE = "setAttribute";
|
|
36
|
+
var DOM_ACTION_SET_IMAGE_SOURCE = exports.DOM_ACTION_SET_IMAGE_SOURCE = "setImageSource";
|
|
37
|
+
var DOM_ACTION_SET_STYLE = exports.DOM_ACTION_SET_STYLE = "setStyle";
|
|
38
|
+
var DOM_ACTION_MOVE = exports.DOM_ACTION_MOVE = "move";
|
|
39
|
+
var DOM_ACTION_RESIZE = exports.DOM_ACTION_RESIZE = "resize";
|
|
40
|
+
var DOM_ACTION_REARRANGE = exports.DOM_ACTION_REARRANGE = "rearrange";
|
|
41
|
+
var DOM_ACTION_REMOVE = exports.DOM_ACTION_REMOVE = "remove";
|
|
42
|
+
var DOM_ACTION_INSERT_AFTER = exports.DOM_ACTION_INSERT_AFTER = "insertAfter";
|
|
43
|
+
var DOM_ACTION_INSERT_BEFORE = exports.DOM_ACTION_INSERT_BEFORE = "insertBefore";
|
|
44
|
+
var DOM_ACTION_REPLACE_HTML = exports.DOM_ACTION_REPLACE_HTML = "replaceHtml";
|
|
45
|
+
var DOM_ACTION_PREPEND_HTML = exports.DOM_ACTION_PREPEND_HTML = "prependHtml";
|
|
46
|
+
var DOM_ACTION_APPEND_HTML = exports.DOM_ACTION_APPEND_HTML = "appendHtml";
|
|
47
|
+
var DOM_ACTION_CLICK = exports.DOM_ACTION_CLICK = "click";
|
|
48
|
+
var DOM_ACTION_COLLECT_INTERACTIONS = exports.DOM_ACTION_COLLECT_INTERACTIONS = "collectInteractions";
|
|
17
49
|
var _default = exports.default = function _default() {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
customCode: (0, _action.createAction)(_action.prependHtml),
|
|
21
|
-
setText: (0, _action.createAction)(_action.setText),
|
|
22
|
-
setAttribute: (0, _action.createAction)(_action.setAttributes),
|
|
23
|
-
setImageSource: (0, _action.createAction)(_action.swapImage),
|
|
24
|
-
setStyle: (0, _action.createAction)(_action.setStyles),
|
|
25
|
-
move: (0, _action.createAction)(_action.setStyles),
|
|
26
|
-
resize: (0, _action.createAction)(_action.setStyles),
|
|
27
|
-
rearrange: (0, _action.createAction)(_action.rearrangeChildren),
|
|
28
|
-
remove: (0, _action.createAction)(_index.removeNode),
|
|
29
|
-
insertAfter: (0, _action.createAction)(_action.insertHtmlAfter),
|
|
30
|
-
insertBefore: (0, _action.createAction)(_action.insertHtmlBefore),
|
|
31
|
-
replaceHtml: (0, _action.createAction)(_action.replaceHtml),
|
|
32
|
-
prependHtml: (0, _action.createAction)(_action.prependHtml),
|
|
33
|
-
appendHtml: (0, _action.createAction)(_action.appendHtml)
|
|
34
|
-
};
|
|
50
|
+
var _ref;
|
|
51
|
+
return _ref = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ref, DOM_ACTION_SET_HTML, (0, _action.createAction)(_setHtml.default)), DOM_ACTION_CUSTOM_CODE, (0, _action.createAction)(_prependHtml.default)), DOM_ACTION_SET_TEXT, (0, _action.createAction)(_setText.default)), DOM_ACTION_SET_ATTRIBUTE, (0, _action.createAction)(_setAttributes.default)), DOM_ACTION_SET_IMAGE_SOURCE, (0, _action.createAction)(_swapImage.default)), DOM_ACTION_SET_STYLE, (0, _action.createAction)(_setStyles.default)), DOM_ACTION_MOVE, (0, _action.createAction)(_setStyles.default)), DOM_ACTION_RESIZE, (0, _action.createAction)(_setStyles.default)), DOM_ACTION_REARRANGE, (0, _action.createAction)(_rearrangeChildren.default)), DOM_ACTION_REMOVE, (0, _action.createAction)(_index.removeNode)), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ref, DOM_ACTION_INSERT_AFTER, (0, _action.createAction)(_insertHtmlAfter.default)), DOM_ACTION_INSERT_BEFORE, (0, _action.createAction)(_insertHtmlBefore.default)), DOM_ACTION_REPLACE_HTML, (0, _action.createAction)(_replaceHtml.default)), DOM_ACTION_PREPEND_HTML, (0, _action.createAction)(_prependHtml.default)), DOM_ACTION_APPEND_HTML, (0, _action.createAction)(_appendHtml.default)), DOM_ACTION_COLLECT_INTERACTIONS, (0, _action.createAction)(_collectInteractions.default));
|
|
35
52
|
};
|
|
@@ -16,15 +16,18 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
16
16
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
17
17
|
governing permissions and limitations under the License.
|
|
18
18
|
*/
|
|
19
|
-
var _default = exports.default = function _default(container, html) {
|
|
19
|
+
var _default = exports.default = function _default(container, html, decorateProposition) {
|
|
20
20
|
var fragment = (0, _index.createFragment)(html);
|
|
21
21
|
(0, _addNonceToInlineStyleElements.default)(fragment);
|
|
22
22
|
var elements = (0, _index.getChildNodes)(fragment);
|
|
23
23
|
var scripts = (0, _scripts.getInlineScripts)(fragment);
|
|
24
24
|
var scriptsUrls = (0, _scripts.getRemoteScriptsUrls)(fragment);
|
|
25
25
|
(0, _images.loadImages)(fragment);
|
|
26
|
+
var insertionPoint = container;
|
|
26
27
|
elements.forEach(function (element) {
|
|
27
|
-
(
|
|
28
|
+
decorateProposition(element);
|
|
29
|
+
(0, _index.insertAfter)(insertionPoint, element);
|
|
30
|
+
insertionPoint = element;
|
|
28
31
|
});
|
|
29
32
|
(0, _scripts.executeInlineScripts)(container, scripts);
|
|
30
33
|
return (0, _scripts.executeRemoteScripts)(scriptsUrls);
|