@adobe/alloy 2.11.0-alpha.5 → 2.11.0-alpha.8
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/Audiences/index.js +9 -1
- package/libEs5/components/Audiences/injectProcessDestinations.js +45 -45
- package/libEs5/components/Identity/createLegacyIdentity.js +18 -12
- package/libEs5/components/Identity/index.js +10 -2
- package/libEs5/components/Personalization/createApplyPropositions.js +111 -0
- package/libEs5/components/Personalization/createComponent.js +15 -1
- package/libEs5/components/Personalization/index.js +7 -1
- package/libEs5/components/Personalization/validateApplyPropositionsOptions.js +28 -0
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/core/createCookieTransfer.js +15 -5
- package/libEs5/core/index.js +12 -3
- package/libEs5/utils/createLoggingCookieJar.js +36 -0
- package/libEs5/utils/index.js +8 -8
- package/libEs6/components/Audiences/index.js +8 -1
- package/libEs6/components/Audiences/injectProcessDestinations.js +45 -35
- package/libEs6/components/Identity/createLegacyIdentity.js +11 -7
- package/libEs6/components/Identity/index.js +11 -3
- package/libEs6/components/Personalization/createApplyPropositions.js +102 -0
- package/libEs6/components/Personalization/createComponent.js +12 -1
- package/libEs6/components/Personalization/index.js +6 -1
- package/libEs6/components/Personalization/validateApplyPropositionsOptions.js +20 -0
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/core/createCookieTransfer.js +15 -4
- package/libEs6/core/index.js +11 -4
- package/libEs6/utils/{convertTimes.js → createLoggingCookieJar.js} +18 -10
- package/libEs6/utils/index.js +1 -1
- package/package.json +2 -2
- package/libEs5/utils/convertTimes.js +0 -37
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
exports.default = void 0;
|
|
4
4
|
|
|
5
|
+
var _utils = require("../../utils");
|
|
6
|
+
|
|
5
7
|
var _injectProcessDestinations = require("./injectProcessDestinations");
|
|
6
8
|
|
|
7
9
|
var _injectProcessResponse = require("./injectProcessResponse");
|
|
@@ -20,9 +22,15 @@ governing permissions and limitations under the License.
|
|
|
20
22
|
var createAudiences = function createAudiences(_ref) {
|
|
21
23
|
var logger = _ref.logger,
|
|
22
24
|
fireReferrerHideableImage = _ref.fireReferrerHideableImage;
|
|
25
|
+
var loggingCookieJar = (0, _utils.createLoggingCookieJar)({
|
|
26
|
+
logger: logger,
|
|
27
|
+
cookieJar: _utils.cookieJar
|
|
28
|
+
});
|
|
23
29
|
var processDestinations = (0, _injectProcessDestinations.default)({
|
|
24
30
|
fireReferrerHideableImage: fireReferrerHideableImage,
|
|
25
|
-
logger: logger
|
|
31
|
+
logger: logger,
|
|
32
|
+
cookieJar: loggingCookieJar,
|
|
33
|
+
isPageSsl: window.location.protocol === "https:"
|
|
26
34
|
});
|
|
27
35
|
var processResponse = (0, _injectProcessResponse.default)({
|
|
28
36
|
processDestinations: processDestinations
|
|
@@ -4,62 +4,62 @@ exports.default = void 0;
|
|
|
4
4
|
|
|
5
5
|
var _utils = require("../../utils");
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8
|
+
|
|
9
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
+
|
|
11
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
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
13
|
var createResultLogMessage = function createResultLogMessage(urlDestination, success) {
|
|
19
14
|
return "URL destination " + (success ? "succeeded" : "failed") + ": " + urlDestination.spec.url;
|
|
20
15
|
};
|
|
21
16
|
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// consider it a non-critical failure and therefore do not want it to
|
|
32
|
-
// reject the promise handed back to the customer.
|
|
33
|
-
logger.error(createResultLogMessage(urlDestination, false));
|
|
34
|
-
});
|
|
35
|
-
})).then(_utils.noop);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
var processCookies = function processCookies(destinations) {
|
|
39
|
-
var cookieDestinations = destinations.filter(function (dest) {
|
|
40
|
-
return dest.type === "cookie";
|
|
41
|
-
});
|
|
42
|
-
cookieDestinations.forEach(function (dest) {
|
|
43
|
-
var _dest$spec = dest.spec,
|
|
44
|
-
name = _dest$spec.name,
|
|
45
|
-
value = _dest$spec.value,
|
|
46
|
-
domain = _dest$spec.domain,
|
|
47
|
-
ttlDays = _dest$spec.ttlDays;
|
|
17
|
+
var _default = function _default(_ref) {
|
|
18
|
+
var fireReferrerHideableImage = _ref.fireReferrerHideableImage,
|
|
19
|
+
logger = _ref.logger,
|
|
20
|
+
cookieJar = _ref.cookieJar,
|
|
21
|
+
isPageSsl = _ref.isPageSsl;
|
|
22
|
+
var extraCookieOptions = isPageSsl ? {
|
|
23
|
+
sameSite: "none",
|
|
24
|
+
secure: true
|
|
25
|
+
} : {};
|
|
48
26
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
27
|
+
var processCookies = function processCookies(destinations) {
|
|
28
|
+
var cookieDestinations = destinations.filter(function (dest) {
|
|
29
|
+
return dest.type === "cookie";
|
|
30
|
+
});
|
|
31
|
+
cookieDestinations.forEach(function (dest) {
|
|
32
|
+
var _dest$spec = dest.spec,
|
|
33
|
+
name = _dest$spec.name,
|
|
34
|
+
value = _dest$spec.value,
|
|
35
|
+
domain = _dest$spec.domain,
|
|
36
|
+
ttlDays = _dest$spec.ttlDays;
|
|
37
|
+
cookieJar.set(name, value || "", _objectSpread({
|
|
38
|
+
domain: domain || "",
|
|
39
|
+
expires: ttlDays || 10
|
|
40
|
+
}, extraCookieOptions));
|
|
41
|
+
});
|
|
42
|
+
};
|
|
52
43
|
|
|
44
|
+
var processUrls = function processUrls(destinations) {
|
|
45
|
+
var urlDestinations = destinations.filter(function (dest) {
|
|
46
|
+
return dest.type === "url";
|
|
53
47
|
});
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
return Promise.all(urlDestinations.map(function (urlDestination) {
|
|
49
|
+
return fireReferrerHideableImage(urlDestination.spec).then(function () {
|
|
50
|
+
logger.info(createResultLogMessage(urlDestination, true));
|
|
51
|
+
}).catch(function () {
|
|
52
|
+
// We intentionally do not throw an error if destinations fail. We
|
|
53
|
+
// consider it a non-critical failure and therefore do not want it to
|
|
54
|
+
// reject the promise handed back to the customer.
|
|
55
|
+
logger.error(createResultLogMessage(urlDestination, false));
|
|
56
|
+
});
|
|
57
|
+
})).then(_utils.noop);
|
|
58
|
+
};
|
|
56
59
|
|
|
57
|
-
var _default = function _default(_ref) {
|
|
58
|
-
var fireReferrerHideableImage = _ref.fireReferrerHideableImage,
|
|
59
|
-
logger = _ref.logger;
|
|
60
60
|
return function (destinations) {
|
|
61
61
|
processCookies(destinations);
|
|
62
|
-
return processUrls(
|
|
62
|
+
return processUrls(destinations);
|
|
63
63
|
};
|
|
64
64
|
};
|
|
65
65
|
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
exports.default = void 0;
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
|
|
7
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
|
+
|
|
9
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
10
|
|
|
7
11
|
/*
|
|
8
12
|
Copyright 2019 Adobe. All rights reserved.
|
|
@@ -15,16 +19,16 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
15
19
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
20
|
governing permissions and limitations under the License.
|
|
17
21
|
*/
|
|
18
|
-
|
|
19
|
-
// Maybe default the domain in the cookieJar to apex while allowing overrides.
|
|
20
|
-
var apexDomain = (0, _utils.getApexDomain)(window, _utils.cookieJar);
|
|
22
|
+
|
|
21
23
|
/**
|
|
22
24
|
* Handles migration of ECID to and from Visitor.js.
|
|
23
25
|
*/
|
|
24
|
-
|
|
25
26
|
var _default = function _default(_ref) {
|
|
26
27
|
var config = _ref.config,
|
|
27
|
-
getEcidFromVisitor = _ref.getEcidFromVisitor
|
|
28
|
+
getEcidFromVisitor = _ref.getEcidFromVisitor,
|
|
29
|
+
apexDomain = _ref.apexDomain,
|
|
30
|
+
isPageSsl = _ref.isPageSsl,
|
|
31
|
+
cookieJar = _ref.cookieJar;
|
|
28
32
|
var idMigrationEnabled = config.idMigrationEnabled,
|
|
29
33
|
orgId = config.orgId;
|
|
30
34
|
var amcvCookieName = "AMCV_" + orgId;
|
|
@@ -32,8 +36,7 @@ var _default = function _default(_ref) {
|
|
|
32
36
|
var getEcidFromLegacyCookies = function getEcidFromLegacyCookies() {
|
|
33
37
|
var ecid = null;
|
|
34
38
|
var secidCookieName = "s_ecid";
|
|
35
|
-
|
|
36
|
-
var legacyEcidCookieValue = _utils.cookieJar.get(secidCookieName) || _utils.cookieJar.get(amcvCookieName);
|
|
39
|
+
var legacyEcidCookieValue = cookieJar.get(secidCookieName) || cookieJar.get(amcvCookieName);
|
|
37
40
|
|
|
38
41
|
if (legacyEcidCookieValue) {
|
|
39
42
|
var reg = /(^|\|)MCMID\|(\d+)($|\|)/;
|
|
@@ -64,12 +67,15 @@ var _default = function _default(_ref) {
|
|
|
64
67
|
},
|
|
65
68
|
setEcid: function setEcid(ecid) {
|
|
66
69
|
if (idMigrationEnabled && getEcidFromLegacyCookies() !== ecid) {
|
|
67
|
-
|
|
70
|
+
var extraOptions = isPageSsl ? {
|
|
71
|
+
sameSite: "none",
|
|
72
|
+
secure: true
|
|
73
|
+
} : {};
|
|
74
|
+
cookieJar.set(amcvCookieName, "MCMID|" + ecid, _objectSpread({
|
|
68
75
|
domain: apexDomain,
|
|
69
76
|
// Without `expires` this will be a session cookie.
|
|
70
|
-
expires: 390
|
|
71
|
-
|
|
72
|
-
});
|
|
77
|
+
expires: 390
|
|
78
|
+
}, extraOptions));
|
|
73
79
|
}
|
|
74
80
|
}
|
|
75
81
|
};
|
|
@@ -58,7 +58,8 @@ var createIdentity = function createIdentity(_ref) {
|
|
|
58
58
|
logger = _ref.logger,
|
|
59
59
|
consent = _ref.consent,
|
|
60
60
|
fireReferrerHideableImage = _ref.fireReferrerHideableImage,
|
|
61
|
-
sendEdgeNetworkRequest = _ref.sendEdgeNetworkRequest
|
|
61
|
+
sendEdgeNetworkRequest = _ref.sendEdgeNetworkRequest,
|
|
62
|
+
apexDomain = _ref.apexDomain;
|
|
62
63
|
var orgId = config.orgId,
|
|
63
64
|
thirdPartyCookiesEnabled = config.thirdPartyCookiesEnabled;
|
|
64
65
|
var getEcidFromVisitor = (0, _injectGetEcidFromVisitor.default)({
|
|
@@ -66,9 +67,16 @@ var createIdentity = function createIdentity(_ref) {
|
|
|
66
67
|
orgId: orgId,
|
|
67
68
|
awaitVisitorOptIn: _awaitVisitorOptIn.default
|
|
68
69
|
});
|
|
70
|
+
var loggingCookieJar = (0, _utils.createLoggingCookieJar)({
|
|
71
|
+
logger: logger,
|
|
72
|
+
cookieJar: _utils.cookieJar
|
|
73
|
+
});
|
|
69
74
|
var legacyIdentity = (0, _createLegacyIdentity.default)({
|
|
70
75
|
config: config,
|
|
71
|
-
getEcidFromVisitor: getEcidFromVisitor
|
|
76
|
+
getEcidFromVisitor: getEcidFromVisitor,
|
|
77
|
+
apexDomain: apexDomain,
|
|
78
|
+
cookieJar: loggingCookieJar,
|
|
79
|
+
isPageSsl: window.location.protocol === "https:"
|
|
72
80
|
});
|
|
73
81
|
var doesIdentityCookieExist = (0, _utils.injectDoesIdentityCookieExist)({
|
|
74
82
|
orgId: orgId
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = exports.SUPPORTED_SCHEMAS = void 0;
|
|
4
|
+
|
|
5
|
+
var _composePersonalizationResultingObject = require("./utils/composePersonalizationResultingObject");
|
|
6
|
+
|
|
7
|
+
var _utils = require("../../utils");
|
|
8
|
+
|
|
9
|
+
var _schema = require("./constants/schema");
|
|
10
|
+
|
|
11
|
+
var _scope = require("./constants/scope");
|
|
12
|
+
|
|
13
|
+
var _validateApplyPropositionsOptions = require("./validateApplyPropositionsOptions");
|
|
14
|
+
|
|
15
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16
|
+
|
|
17
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
+
|
|
19
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
20
|
+
|
|
21
|
+
var SUPPORTED_SCHEMAS = [_schema.DOM_ACTION, _schema.HTML_CONTENT_ITEM];
|
|
22
|
+
exports.SUPPORTED_SCHEMAS = SUPPORTED_SCHEMAS;
|
|
23
|
+
|
|
24
|
+
var _default = function _default(_ref) {
|
|
25
|
+
var executeDecisions = _ref.executeDecisions;
|
|
26
|
+
|
|
27
|
+
var filterItemsPredicate = function filterItemsPredicate(item) {
|
|
28
|
+
return SUPPORTED_SCHEMAS.includes(item.schema);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
var updatePropositionItems = function updatePropositionItems(_ref2) {
|
|
32
|
+
var items = _ref2.items,
|
|
33
|
+
metadataForScope = _ref2.metadataForScope;
|
|
34
|
+
return items.filter(filterItemsPredicate).map(function (item) {
|
|
35
|
+
if (item.schema !== _schema.HTML_CONTENT_ITEM) {
|
|
36
|
+
return _objectSpread({}, item);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if ((0, _utils.isObject)(metadataForScope)) {
|
|
40
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
41
|
+
data: _objectSpread(_objectSpread({}, item.data), {}, {
|
|
42
|
+
selector: metadataForScope.selector,
|
|
43
|
+
type: metadataForScope.actionType
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return undefined;
|
|
49
|
+
}).filter(function (item) {
|
|
50
|
+
return item;
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
var filterPropositionsPredicate = function filterPropositionsPredicate(proposition) {
|
|
55
|
+
return !(proposition.scope === _scope.default && proposition.renderAttempted);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
var preparePropositions = function preparePropositions(_ref3) {
|
|
59
|
+
var propositions = _ref3.propositions,
|
|
60
|
+
metadata = _ref3.metadata;
|
|
61
|
+
return propositions.filter(filterPropositionsPredicate).map(function (proposition) {
|
|
62
|
+
if ((0, _utils.isNonEmptyArray)(proposition.items)) {
|
|
63
|
+
var id = proposition.id,
|
|
64
|
+
scope = proposition.scope,
|
|
65
|
+
scopeDetails = proposition.scopeDetails;
|
|
66
|
+
return {
|
|
67
|
+
id: id,
|
|
68
|
+
scope: scope,
|
|
69
|
+
scopeDetails: scopeDetails,
|
|
70
|
+
items: updatePropositionItems({
|
|
71
|
+
items: proposition.items,
|
|
72
|
+
metadataForScope: metadata[proposition.scope]
|
|
73
|
+
})
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return proposition;
|
|
78
|
+
}).filter(function (proposition) {
|
|
79
|
+
return (0, _utils.isNonEmptyArray)(proposition.items);
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
var applyPropositions = function applyPropositions(_ref4) {
|
|
84
|
+
var propositions = _ref4.propositions,
|
|
85
|
+
metadata = _ref4.metadata;
|
|
86
|
+
var propositionsToExecute = preparePropositions({
|
|
87
|
+
propositions: propositions,
|
|
88
|
+
metadata: metadata
|
|
89
|
+
});
|
|
90
|
+
return executeDecisions(propositionsToExecute).then(function () {
|
|
91
|
+
return (0, _composePersonalizationResultingObject.default)(propositionsToExecute, true);
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
return function (_ref5) {
|
|
96
|
+
var propositions = _ref5.propositions,
|
|
97
|
+
_ref5$metadata = _ref5.metadata,
|
|
98
|
+
metadata = _ref5$metadata === void 0 ? {} : _ref5$metadata;
|
|
99
|
+
|
|
100
|
+
if ((0, _utils.isNonEmptyArray)(propositions)) {
|
|
101
|
+
return applyPropositions({
|
|
102
|
+
propositions: propositions,
|
|
103
|
+
metadata: metadata
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return Promise.resolve(_validateApplyPropositionsOptions.EMPTY_PROPOSITIONS);
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
exports.default = _default;
|
|
@@ -8,6 +8,8 @@ var _createPersonalizationDetails = require("./createPersonalizationDetails");
|
|
|
8
8
|
|
|
9
9
|
var _loggerMessage = require("./constants/loggerMessage");
|
|
10
10
|
|
|
11
|
+
var _validateApplyPropositionsOptions = require("./validateApplyPropositionsOptions");
|
|
12
|
+
|
|
11
13
|
/*
|
|
12
14
|
Copyright 2020 Adobe. All rights reserved.
|
|
13
15
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -27,7 +29,8 @@ var _default = function _default(_ref) {
|
|
|
27
29
|
isAuthoringModeEnabled = _ref.isAuthoringModeEnabled,
|
|
28
30
|
mergeQuery = _ref.mergeQuery,
|
|
29
31
|
viewCache = _ref.viewCache,
|
|
30
|
-
showContainers = _ref.showContainers
|
|
32
|
+
showContainers = _ref.showContainers,
|
|
33
|
+
applyPropositions = _ref.applyPropositions;
|
|
31
34
|
return {
|
|
32
35
|
lifecycle: {
|
|
33
36
|
onBeforeEvent: function onBeforeEvent(_ref2) {
|
|
@@ -98,6 +101,17 @@ var _default = function _default(_ref) {
|
|
|
98
101
|
clickedElement: clickedElement
|
|
99
102
|
});
|
|
100
103
|
}
|
|
104
|
+
},
|
|
105
|
+
commands: {
|
|
106
|
+
applyPropositions: {
|
|
107
|
+
optionsValidator: function optionsValidator(options) {
|
|
108
|
+
return (0, _validateApplyPropositionsOptions.default)({
|
|
109
|
+
logger: logger,
|
|
110
|
+
options: options
|
|
111
|
+
});
|
|
112
|
+
},
|
|
113
|
+
run: applyPropositions
|
|
114
|
+
}
|
|
101
115
|
}
|
|
102
116
|
};
|
|
103
117
|
};
|
|
@@ -40,6 +40,8 @@ var _createAutoRenderingHandler = require("./createAutoRenderingHandler");
|
|
|
40
40
|
|
|
41
41
|
var _createNonRenderingHandler = require("./createNonRenderingHandler");
|
|
42
42
|
|
|
43
|
+
var _createApplyPropositions = require("./createApplyPropositions");
|
|
44
|
+
|
|
43
45
|
/*
|
|
44
46
|
Copyright 2019 Adobe. All rights reserved.
|
|
45
47
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -84,6 +86,9 @@ var createPersonalization = function createPersonalization(_ref) {
|
|
|
84
86
|
showContainers: _flicker.showContainers,
|
|
85
87
|
collect: collect
|
|
86
88
|
});
|
|
89
|
+
var applyPropositions = (0, _createApplyPropositions.default)({
|
|
90
|
+
executeDecisions: executeDecisions
|
|
91
|
+
});
|
|
87
92
|
var nonRenderingHandler = (0, _createNonRenderingHandler.default)({
|
|
88
93
|
viewCache: viewCache
|
|
89
94
|
});
|
|
@@ -120,7 +125,8 @@ var createPersonalization = function createPersonalization(_ref) {
|
|
|
120
125
|
isAuthoringModeEnabled: _isAuthoringModeEnabled.default,
|
|
121
126
|
mergeQuery: _event.mergeQuery,
|
|
122
127
|
viewCache: viewCache,
|
|
123
|
-
showContainers: _flicker.showContainers
|
|
128
|
+
showContainers: _flicker.showContainers,
|
|
129
|
+
applyPropositions: applyPropositions
|
|
124
130
|
});
|
|
125
131
|
};
|
|
126
132
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = exports.EMPTY_PROPOSITIONS = void 0;
|
|
4
|
+
|
|
5
|
+
var _validation = require("../../utils/validation");
|
|
6
|
+
|
|
7
|
+
var EMPTY_PROPOSITIONS = {
|
|
8
|
+
propositions: []
|
|
9
|
+
};
|
|
10
|
+
exports.EMPTY_PROPOSITIONS = EMPTY_PROPOSITIONS;
|
|
11
|
+
|
|
12
|
+
var _default = function _default(_ref) {
|
|
13
|
+
var logger = _ref.logger,
|
|
14
|
+
options = _ref.options;
|
|
15
|
+
var applyPropositionsOptionsValidator = (0, _validation.objectOf)({
|
|
16
|
+
propositions: (0, _validation.arrayOf)((0, _validation.objectOf)((0, _validation.anything)())).nonEmpty(),
|
|
17
|
+
metadata: (0, _validation.objectOf)((0, _validation.anything)())
|
|
18
|
+
}).required();
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
return applyPropositionsOptionsValidator(options);
|
|
22
|
+
} catch (e) {
|
|
23
|
+
logger.warn("Invalid options for applyPropositions. No propositions will be applied.", e);
|
|
24
|
+
return EMPTY_PROPOSITIONS;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
exports.default = _default;
|
|
@@ -15,5 +15,5 @@ governing permissions and limitations under the License.
|
|
|
15
15
|
*/
|
|
16
16
|
// The __VERSION__ keyword will be replace at alloy build time with the package.json version.
|
|
17
17
|
// see babel-plugin-version
|
|
18
|
-
var _default = "2.11.0-alpha.
|
|
18
|
+
var _default = "2.11.0-alpha.8";
|
|
19
19
|
exports.default = _default;
|
|
@@ -4,8 +4,6 @@ exports.default = void 0;
|
|
|
4
4
|
|
|
5
5
|
var _utils = require("../utils");
|
|
6
6
|
|
|
7
|
-
var _convertTimes = require("../utils/convertTimes");
|
|
8
|
-
|
|
9
7
|
/*
|
|
10
8
|
Copyright 2019 Adobe. All rights reserved.
|
|
11
9
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -22,7 +20,8 @@ var STATE_STORE_HANDLE_TYPE = "state:store";
|
|
|
22
20
|
var _default = function _default(_ref) {
|
|
23
21
|
var cookieJar = _ref.cookieJar,
|
|
24
22
|
orgId = _ref.orgId,
|
|
25
|
-
apexDomain = _ref.apexDomain
|
|
23
|
+
apexDomain = _ref.apexDomain,
|
|
24
|
+
dateProvider = _ref.dateProvider;
|
|
26
25
|
return {
|
|
27
26
|
/**
|
|
28
27
|
* When sending to a third-party endpoint, the endpoint won't be able to
|
|
@@ -72,10 +71,21 @@ var _default = function _default(_ref) {
|
|
|
72
71
|
var options = {
|
|
73
72
|
domain: apexDomain
|
|
74
73
|
};
|
|
74
|
+
var sameSite = stateItem.attrs && stateItem.attrs.SameSite && stateItem.attrs.SameSite.toLowerCase();
|
|
75
75
|
|
|
76
76
|
if (stateItem.maxAge !== undefined) {
|
|
77
|
-
// cookieJar expects "expires"
|
|
78
|
-
options.expires = (
|
|
77
|
+
// cookieJar expects "expires" as a date object
|
|
78
|
+
options.expires = new Date(dateProvider().getTime() + stateItem.maxAge * 1000);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (sameSite !== undefined) {
|
|
82
|
+
options.sameSite = sameSite;
|
|
83
|
+
} // When sameSite is set to none, the secure flag must be set.
|
|
84
|
+
// Experience edge will not set the secure flag in these cases.
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
if (sameSite === "none") {
|
|
88
|
+
options.secure = true;
|
|
79
89
|
}
|
|
80
90
|
|
|
81
91
|
cookieJar.set(stateItem.key, stateItem.value, options);
|
package/libEs5/core/index.js
CHANGED
|
@@ -109,6 +109,11 @@ var createExecuteCommand = function createExecuteCommand(_ref) {
|
|
|
109
109
|
});
|
|
110
110
|
};
|
|
111
111
|
|
|
112
|
+
var loggingCookieJar = (0, _utils.createLoggingCookieJar)({
|
|
113
|
+
logger: logger,
|
|
114
|
+
cookieJar: _utils.cookieJar
|
|
115
|
+
});
|
|
116
|
+
|
|
112
117
|
var configureCommand = function configureCommand(options) {
|
|
113
118
|
var config = (0, _buildAndValidateConfig.default)({
|
|
114
119
|
options: options,
|
|
@@ -119,9 +124,12 @@ var createExecuteCommand = function createExecuteCommand(_ref) {
|
|
|
119
124
|
setDebugEnabled: setDebugEnabled
|
|
120
125
|
});
|
|
121
126
|
var cookieTransfer = (0, _createCookieTransfer.default)({
|
|
122
|
-
cookieJar:
|
|
127
|
+
cookieJar: loggingCookieJar,
|
|
123
128
|
orgId: config.orgId,
|
|
124
|
-
apexDomain: apexDomain
|
|
129
|
+
apexDomain: apexDomain,
|
|
130
|
+
dateProvider: function dateProvider() {
|
|
131
|
+
return new Date();
|
|
132
|
+
}
|
|
125
133
|
});
|
|
126
134
|
var sendBeaconRequest = (0, _utils.isFunction)(navigator.sendBeacon) ? (0, _injectSendBeaconRequest.default)({
|
|
127
135
|
// Without the bind(), the browser will complain about an
|
|
@@ -189,7 +197,8 @@ var createExecuteCommand = function createExecuteCommand(_ref) {
|
|
|
189
197
|
errorPrefix: "[" + instanceName + "] [" + componentName + "]",
|
|
190
198
|
logger: componentLogger
|
|
191
199
|
}),
|
|
192
|
-
createNamespacedStorage: createNamespacedStorage
|
|
200
|
+
createNamespacedStorage: createNamespacedStorage,
|
|
201
|
+
apexDomain: apexDomain
|
|
193
202
|
};
|
|
194
203
|
}
|
|
195
204
|
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
|
|
7
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8
|
+
|
|
9
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
Copyright 2022 Adobe. All rights reserved.
|
|
13
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
15
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
|
|
17
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
18
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
19
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
20
|
+
governing permissions and limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
var _default = function _default(_ref) {
|
|
23
|
+
var logger = _ref.logger,
|
|
24
|
+
cookieJar = _ref.cookieJar;
|
|
25
|
+
return _objectSpread(_objectSpread({}, cookieJar), {}, {
|
|
26
|
+
set: function set(key, value, options) {
|
|
27
|
+
logger.info("Setting cookie", _objectSpread({
|
|
28
|
+
name: key,
|
|
29
|
+
value: value
|
|
30
|
+
}, options));
|
|
31
|
+
cookieJar.set(key, value, options);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
exports.default = _default;
|
package/libEs5/utils/index.js
CHANGED
|
@@ -24,12 +24,6 @@ Object.defineProperty(exports, "clone", {
|
|
|
24
24
|
return _clone.default;
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
-
Object.defineProperty(exports, "convertTimes", {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
get: function get() {
|
|
30
|
-
return _convertTimes.default;
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
27
|
Object.defineProperty(exports, "cookieJar", {
|
|
34
28
|
enumerable: true,
|
|
35
29
|
get: function get() {
|
|
@@ -48,6 +42,12 @@ Object.defineProperty(exports, "createCallbackAggregator", {
|
|
|
48
42
|
return _createCallbackAggregator.default;
|
|
49
43
|
}
|
|
50
44
|
});
|
|
45
|
+
Object.defineProperty(exports, "createLoggingCookieJar", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function get() {
|
|
48
|
+
return _createLoggingCookieJar.default;
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
51
|
Object.defineProperty(exports, "createMerger", {
|
|
52
52
|
enumerable: true,
|
|
53
53
|
get: function get() {
|
|
@@ -321,14 +321,14 @@ var _assignIf = require("./assignIf");
|
|
|
321
321
|
|
|
322
322
|
var _clone = require("./clone");
|
|
323
323
|
|
|
324
|
-
var _convertTimes = require("./convertTimes");
|
|
325
|
-
|
|
326
324
|
var _cookieJar = require("./cookieJar");
|
|
327
325
|
|
|
328
326
|
var _createMerger = require("./createMerger");
|
|
329
327
|
|
|
330
328
|
var _createCallbackAggregator = require("./createCallbackAggregator");
|
|
331
329
|
|
|
330
|
+
var _createLoggingCookieJar = require("./createLoggingCookieJar");
|
|
331
|
+
|
|
332
332
|
var _createTaskQueue = require("./createTaskQueue");
|
|
333
333
|
|
|
334
334
|
var _crc = require("./crc32");
|
|
@@ -9,6 +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
|
+
import { createLoggingCookieJar, cookieJar } from "../../utils";
|
|
12
13
|
import injectProcessDestinations from "./injectProcessDestinations";
|
|
13
14
|
import injectProcessResponse from "./injectProcessResponse";
|
|
14
15
|
|
|
@@ -16,9 +17,15 @@ const createAudiences = ({
|
|
|
16
17
|
logger,
|
|
17
18
|
fireReferrerHideableImage
|
|
18
19
|
}) => {
|
|
20
|
+
const loggingCookieJar = createLoggingCookieJar({
|
|
21
|
+
logger,
|
|
22
|
+
cookieJar
|
|
23
|
+
});
|
|
19
24
|
const processDestinations = injectProcessDestinations({
|
|
20
25
|
fireReferrerHideableImage,
|
|
21
|
-
logger
|
|
26
|
+
logger,
|
|
27
|
+
cookieJar: loggingCookieJar,
|
|
28
|
+
isPageSsl: window.location.protocol === "https:"
|
|
22
29
|
});
|
|
23
30
|
const processResponse = injectProcessResponse({
|
|
24
31
|
processDestinations
|
|
@@ -9,47 +9,57 @@ 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 { noop } from "../../utils";
|
|
13
13
|
|
|
14
14
|
const createResultLogMessage = (urlDestination, success) => {
|
|
15
15
|
return `URL destination ${success ? "succeeded" : "failed"}: ${urlDestination.spec.url}`;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
});
|
|
29
|
-
})).then(noop);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const processCookies = destinations => {
|
|
33
|
-
const cookieDestinations = destinations.filter(dest => dest.type === "cookie");
|
|
34
|
-
cookieDestinations.forEach(dest => {
|
|
35
|
-
const {
|
|
36
|
-
name,
|
|
37
|
-
value,
|
|
38
|
-
domain,
|
|
39
|
-
ttlDays
|
|
40
|
-
} = dest.spec;
|
|
41
|
-
cookieJar.set(name, value || "", {
|
|
42
|
-
domain: domain || "",
|
|
43
|
-
expires: ttlDays || 10 // days
|
|
18
|
+
export default (({
|
|
19
|
+
fireReferrerHideableImage,
|
|
20
|
+
logger,
|
|
21
|
+
cookieJar,
|
|
22
|
+
isPageSsl
|
|
23
|
+
}) => {
|
|
24
|
+
const extraCookieOptions = isPageSsl ? {
|
|
25
|
+
sameSite: "none",
|
|
26
|
+
secure: true
|
|
27
|
+
} : {};
|
|
44
28
|
|
|
29
|
+
const processCookies = destinations => {
|
|
30
|
+
const cookieDestinations = destinations.filter(dest => dest.type === "cookie");
|
|
31
|
+
cookieDestinations.forEach(dest => {
|
|
32
|
+
const {
|
|
33
|
+
name,
|
|
34
|
+
value,
|
|
35
|
+
domain,
|
|
36
|
+
ttlDays
|
|
37
|
+
} = dest.spec;
|
|
38
|
+
cookieJar.set(name, value || "", {
|
|
39
|
+
domain: domain || "",
|
|
40
|
+
expires: ttlDays || 10,
|
|
41
|
+
// days
|
|
42
|
+
...extraCookieOptions
|
|
43
|
+
});
|
|
45
44
|
});
|
|
46
|
-
}
|
|
47
|
-
};
|
|
45
|
+
};
|
|
48
46
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
const processUrls = destinations => {
|
|
48
|
+
const urlDestinations = destinations.filter(dest => dest.type === "url");
|
|
49
|
+
return Promise.all(urlDestinations.map(urlDestination => {
|
|
50
|
+
return fireReferrerHideableImage(urlDestination.spec).then(() => {
|
|
51
|
+
logger.info(createResultLogMessage(urlDestination, true));
|
|
52
|
+
}).catch(() => {
|
|
53
|
+
// We intentionally do not throw an error if destinations fail. We
|
|
54
|
+
// consider it a non-critical failure and therefore do not want it to
|
|
55
|
+
// reject the promise handed back to the customer.
|
|
56
|
+
logger.error(createResultLogMessage(urlDestination, false));
|
|
57
|
+
});
|
|
58
|
+
})).then(noop);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return destinations => {
|
|
62
|
+
processCookies(destinations);
|
|
63
|
+
return processUrls(destinations);
|
|
64
|
+
};
|
|
55
65
|
});
|
|
@@ -9,17 +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 { getApexDomain, cookieJar } from "../../utils"; // TODO: We are already retrieving the apex in core; find a way to reuse it.
|
|
13
|
-
// Maybe default the domain in the cookieJar to apex while allowing overrides.
|
|
14
12
|
|
|
15
|
-
const apexDomain = getApexDomain(window, cookieJar);
|
|
16
13
|
/**
|
|
17
14
|
* Handles migration of ECID to and from Visitor.js.
|
|
18
15
|
*/
|
|
19
|
-
|
|
20
16
|
export default (({
|
|
21
17
|
config,
|
|
22
|
-
getEcidFromVisitor
|
|
18
|
+
getEcidFromVisitor,
|
|
19
|
+
apexDomain,
|
|
20
|
+
isPageSsl,
|
|
21
|
+
cookieJar
|
|
23
22
|
}) => {
|
|
24
23
|
const {
|
|
25
24
|
idMigrationEnabled,
|
|
@@ -62,11 +61,16 @@ export default (({
|
|
|
62
61
|
|
|
63
62
|
setEcid(ecid) {
|
|
64
63
|
if (idMigrationEnabled && getEcidFromLegacyCookies() !== ecid) {
|
|
64
|
+
const extraOptions = isPageSsl ? {
|
|
65
|
+
sameSite: "none",
|
|
66
|
+
secure: true
|
|
67
|
+
} : {};
|
|
65
68
|
cookieJar.set(amcvCookieName, `MCMID|${ecid}`, {
|
|
66
69
|
domain: apexDomain,
|
|
67
70
|
// Without `expires` this will be a session cookie.
|
|
68
|
-
expires: 390
|
|
69
|
-
|
|
71
|
+
expires: 390,
|
|
72
|
+
// days, or 13 months.
|
|
73
|
+
...extraOptions
|
|
70
74
|
});
|
|
71
75
|
}
|
|
72
76
|
}
|
|
@@ -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
|
-
import { areThirdPartyCookiesSupportedByDefault, injectDoesIdentityCookieExist } from "../../utils";
|
|
12
|
+
import { areThirdPartyCookiesSupportedByDefault, injectDoesIdentityCookieExist, createLoggingCookieJar, cookieJar } from "../../utils";
|
|
13
13
|
import injectProcessIdSyncs from "./injectProcessIdSyncs";
|
|
14
14
|
import configValidators from "./configValidators";
|
|
15
15
|
import createComponent from "./createComponent";
|
|
@@ -35,7 +35,8 @@ const createIdentity = ({
|
|
|
35
35
|
logger,
|
|
36
36
|
consent,
|
|
37
37
|
fireReferrerHideableImage,
|
|
38
|
-
sendEdgeNetworkRequest
|
|
38
|
+
sendEdgeNetworkRequest,
|
|
39
|
+
apexDomain
|
|
39
40
|
}) => {
|
|
40
41
|
const {
|
|
41
42
|
orgId,
|
|
@@ -46,9 +47,16 @@ const createIdentity = ({
|
|
|
46
47
|
orgId,
|
|
47
48
|
awaitVisitorOptIn
|
|
48
49
|
});
|
|
50
|
+
const loggingCookieJar = createLoggingCookieJar({
|
|
51
|
+
logger,
|
|
52
|
+
cookieJar
|
|
53
|
+
});
|
|
49
54
|
const legacyIdentity = createLegacyIdentity({
|
|
50
55
|
config,
|
|
51
|
-
getEcidFromVisitor
|
|
56
|
+
getEcidFromVisitor,
|
|
57
|
+
apexDomain,
|
|
58
|
+
cookieJar: loggingCookieJar,
|
|
59
|
+
isPageSsl: window.location.protocol === "https:"
|
|
52
60
|
});
|
|
53
61
|
const doesIdentityCookieExist = injectDoesIdentityCookieExist({
|
|
54
62
|
orgId
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2022 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 composePersonalizationResultingObject from "./utils/composePersonalizationResultingObject";
|
|
13
|
+
import { isNonEmptyArray, isObject } from "../../utils";
|
|
14
|
+
import { DOM_ACTION, HTML_CONTENT_ITEM } from "./constants/schema";
|
|
15
|
+
import PAGE_WIDE_SCOPE from "./constants/scope";
|
|
16
|
+
import { EMPTY_PROPOSITIONS } from "./validateApplyPropositionsOptions";
|
|
17
|
+
export const SUPPORTED_SCHEMAS = [DOM_ACTION, HTML_CONTENT_ITEM];
|
|
18
|
+
export default (({
|
|
19
|
+
executeDecisions
|
|
20
|
+
}) => {
|
|
21
|
+
const filterItemsPredicate = item => SUPPORTED_SCHEMAS.includes(item.schema);
|
|
22
|
+
|
|
23
|
+
const updatePropositionItems = ({
|
|
24
|
+
items,
|
|
25
|
+
metadataForScope
|
|
26
|
+
}) => {
|
|
27
|
+
return items.filter(filterItemsPredicate).map(item => {
|
|
28
|
+
if (item.schema !== HTML_CONTENT_ITEM) {
|
|
29
|
+
return { ...item
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (isObject(metadataForScope)) {
|
|
34
|
+
return { ...item,
|
|
35
|
+
data: { ...item.data,
|
|
36
|
+
selector: metadataForScope.selector,
|
|
37
|
+
type: metadataForScope.actionType
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return undefined;
|
|
43
|
+
}).filter(item => item);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const filterPropositionsPredicate = proposition => {
|
|
47
|
+
return !(proposition.scope === PAGE_WIDE_SCOPE && proposition.renderAttempted);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const preparePropositions = ({
|
|
51
|
+
propositions,
|
|
52
|
+
metadata
|
|
53
|
+
}) => {
|
|
54
|
+
return propositions.filter(filterPropositionsPredicate).map(proposition => {
|
|
55
|
+
if (isNonEmptyArray(proposition.items)) {
|
|
56
|
+
const {
|
|
57
|
+
id,
|
|
58
|
+
scope,
|
|
59
|
+
scopeDetails
|
|
60
|
+
} = proposition;
|
|
61
|
+
return {
|
|
62
|
+
id,
|
|
63
|
+
scope,
|
|
64
|
+
scopeDetails,
|
|
65
|
+
items: updatePropositionItems({
|
|
66
|
+
items: proposition.items,
|
|
67
|
+
metadataForScope: metadata[proposition.scope]
|
|
68
|
+
})
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return proposition;
|
|
73
|
+
}).filter(proposition => isNonEmptyArray(proposition.items));
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const applyPropositions = ({
|
|
77
|
+
propositions,
|
|
78
|
+
metadata
|
|
79
|
+
}) => {
|
|
80
|
+
const propositionsToExecute = preparePropositions({
|
|
81
|
+
propositions,
|
|
82
|
+
metadata
|
|
83
|
+
});
|
|
84
|
+
return executeDecisions(propositionsToExecute).then(() => {
|
|
85
|
+
return composePersonalizationResultingObject(propositionsToExecute, true);
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
return ({
|
|
90
|
+
propositions,
|
|
91
|
+
metadata = {}
|
|
92
|
+
}) => {
|
|
93
|
+
if (isNonEmptyArray(propositions)) {
|
|
94
|
+
return applyPropositions({
|
|
95
|
+
propositions,
|
|
96
|
+
metadata
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return Promise.resolve(EMPTY_PROPOSITIONS);
|
|
101
|
+
};
|
|
102
|
+
});
|
|
@@ -12,6 +12,7 @@ governing permissions and limitations under the License.
|
|
|
12
12
|
import { noop, defer } from "../../utils";
|
|
13
13
|
import createPersonalizationDetails from "./createPersonalizationDetails";
|
|
14
14
|
import { AUTHORING_ENABLED } from "./constants/loggerMessage";
|
|
15
|
+
import validateApplyPropositionsOptions from "./validateApplyPropositionsOptions";
|
|
15
16
|
export default (({
|
|
16
17
|
logger,
|
|
17
18
|
fetchDataHandler,
|
|
@@ -20,7 +21,8 @@ export default (({
|
|
|
20
21
|
isAuthoringModeEnabled,
|
|
21
22
|
mergeQuery,
|
|
22
23
|
viewCache,
|
|
23
|
-
showContainers
|
|
24
|
+
showContainers,
|
|
25
|
+
applyPropositions
|
|
24
26
|
}) => {
|
|
25
27
|
return {
|
|
26
28
|
lifecycle: {
|
|
@@ -87,6 +89,15 @@ export default (({
|
|
|
87
89
|
});
|
|
88
90
|
}
|
|
89
91
|
|
|
92
|
+
},
|
|
93
|
+
commands: {
|
|
94
|
+
applyPropositions: {
|
|
95
|
+
optionsValidator: options => validateApplyPropositionsOptions({
|
|
96
|
+
logger,
|
|
97
|
+
options
|
|
98
|
+
}),
|
|
99
|
+
run: applyPropositions
|
|
100
|
+
}
|
|
90
101
|
}
|
|
91
102
|
};
|
|
92
103
|
});
|
|
@@ -28,6 +28,7 @@ import createClickStorage from "./createClickStorage";
|
|
|
28
28
|
import createRedirectHandler from "./createRedirectHandler";
|
|
29
29
|
import createAutorenderingHandler from "./createAutoRenderingHandler";
|
|
30
30
|
import createNonRenderingHandler from "./createNonRenderingHandler";
|
|
31
|
+
import createApplyPropositions from "./createApplyPropositions";
|
|
31
32
|
|
|
32
33
|
const createPersonalization = ({
|
|
33
34
|
config,
|
|
@@ -62,6 +63,9 @@ const createPersonalization = ({
|
|
|
62
63
|
showContainers,
|
|
63
64
|
collect
|
|
64
65
|
});
|
|
66
|
+
const applyPropositions = createApplyPropositions({
|
|
67
|
+
executeDecisions
|
|
68
|
+
});
|
|
65
69
|
const nonRenderingHandler = createNonRenderingHandler({
|
|
66
70
|
viewCache
|
|
67
71
|
});
|
|
@@ -98,7 +102,8 @@ const createPersonalization = ({
|
|
|
98
102
|
isAuthoringModeEnabled,
|
|
99
103
|
mergeQuery,
|
|
100
104
|
viewCache,
|
|
101
|
-
showContainers
|
|
105
|
+
showContainers,
|
|
106
|
+
applyPropositions
|
|
102
107
|
});
|
|
103
108
|
};
|
|
104
109
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { anything, objectOf, arrayOf } from "../../utils/validation";
|
|
2
|
+
export const EMPTY_PROPOSITIONS = {
|
|
3
|
+
propositions: []
|
|
4
|
+
};
|
|
5
|
+
export default (({
|
|
6
|
+
logger,
|
|
7
|
+
options
|
|
8
|
+
}) => {
|
|
9
|
+
const applyPropositionsOptionsValidator = objectOf({
|
|
10
|
+
propositions: arrayOf(objectOf(anything())).nonEmpty(),
|
|
11
|
+
metadata: objectOf(anything())
|
|
12
|
+
}).required();
|
|
13
|
+
|
|
14
|
+
try {
|
|
15
|
+
return applyPropositionsOptionsValidator(options);
|
|
16
|
+
} catch (e) {
|
|
17
|
+
logger.warn("Invalid options for applyPropositions. No propositions will be applied.", e);
|
|
18
|
+
return EMPTY_PROPOSITIONS;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
@@ -10,12 +10,12 @@ 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 { endsWith, isNamespacedCookieName } from "../utils";
|
|
13
|
-
import convertTimes, { DAY, SECOND } from "../utils/convertTimes";
|
|
14
13
|
const STATE_STORE_HANDLE_TYPE = "state:store";
|
|
15
14
|
export default (({
|
|
16
15
|
cookieJar,
|
|
17
16
|
orgId,
|
|
18
|
-
apexDomain
|
|
17
|
+
apexDomain,
|
|
18
|
+
dateProvider
|
|
19
19
|
}) => {
|
|
20
20
|
return {
|
|
21
21
|
/**
|
|
@@ -66,10 +66,21 @@ export default (({
|
|
|
66
66
|
const options = {
|
|
67
67
|
domain: apexDomain
|
|
68
68
|
};
|
|
69
|
+
const sameSite = stateItem.attrs && stateItem.attrs.SameSite && stateItem.attrs.SameSite.toLowerCase();
|
|
69
70
|
|
|
70
71
|
if (stateItem.maxAge !== undefined) {
|
|
71
|
-
// cookieJar expects "expires"
|
|
72
|
-
options.expires =
|
|
72
|
+
// cookieJar expects "expires" as a date object
|
|
73
|
+
options.expires = new Date(dateProvider().getTime() + stateItem.maxAge * 1000);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (sameSite !== undefined) {
|
|
77
|
+
options.sameSite = sameSite;
|
|
78
|
+
} // When sameSite is set to none, the secure flag must be set.
|
|
79
|
+
// Experience edge will not set the secure flag in these cases.
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
if (sameSite === "none") {
|
|
83
|
+
options.secure = true;
|
|
73
84
|
}
|
|
74
85
|
|
|
75
86
|
cookieJar.set(stateItem.key, stateItem.value, options);
|
package/libEs6/core/index.js
CHANGED
|
@@ -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
|
import createInstanceFunction from "./createInstanceFunction";
|
|
13
|
-
import { getApexDomain, injectStorage, cookieJar, isFunction, injectFireReferrerHideableImage } from "../utils";
|
|
13
|
+
import { getApexDomain, injectStorage, cookieJar, isFunction, createLoggingCookieJar, injectFireReferrerHideableImage } from "../utils";
|
|
14
14
|
import createLogController from "./createLogController";
|
|
15
15
|
import createLifecycle from "./createLifecycle";
|
|
16
16
|
import createComponentRegistry from "./createComponentRegistry";
|
|
@@ -75,6 +75,11 @@ export const createExecuteCommand = ({
|
|
|
75
75
|
});
|
|
76
76
|
};
|
|
77
77
|
|
|
78
|
+
const loggingCookieJar = createLoggingCookieJar({
|
|
79
|
+
logger,
|
|
80
|
+
cookieJar
|
|
81
|
+
});
|
|
82
|
+
|
|
78
83
|
const configureCommand = options => {
|
|
79
84
|
const config = buildAndValidateConfig({
|
|
80
85
|
options,
|
|
@@ -85,9 +90,10 @@ export const createExecuteCommand = ({
|
|
|
85
90
|
setDebugEnabled
|
|
86
91
|
});
|
|
87
92
|
const cookieTransfer = createCookieTransfer({
|
|
88
|
-
cookieJar,
|
|
93
|
+
cookieJar: loggingCookieJar,
|
|
89
94
|
orgId: config.orgId,
|
|
90
|
-
apexDomain
|
|
95
|
+
apexDomain,
|
|
96
|
+
dateProvider: () => new Date()
|
|
91
97
|
});
|
|
92
98
|
const sendBeaconRequest = isFunction(navigator.sendBeacon) ? injectSendBeaconRequest({
|
|
93
99
|
// Without the bind(), the browser will complain about an
|
|
@@ -156,7 +162,8 @@ export const createExecuteCommand = ({
|
|
|
156
162
|
errorPrefix: `[${instanceName}] [${componentName}]`,
|
|
157
163
|
logger: componentLogger
|
|
158
164
|
}),
|
|
159
|
-
createNamespacedStorage
|
|
165
|
+
createNamespacedStorage,
|
|
166
|
+
apexDomain
|
|
160
167
|
};
|
|
161
168
|
}
|
|
162
169
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright
|
|
2
|
+
Copyright 2022 Adobe. All rights reserved.
|
|
3
3
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
5
|
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -9,12 +9,20 @@ 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
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
export default (({
|
|
13
|
+
logger,
|
|
14
|
+
cookieJar
|
|
15
|
+
}) => {
|
|
16
|
+
return { ...cookieJar,
|
|
17
|
+
|
|
18
|
+
set(key, value, options) {
|
|
19
|
+
logger.info("Setting cookie", {
|
|
20
|
+
name: key,
|
|
21
|
+
value,
|
|
22
|
+
...options
|
|
23
|
+
});
|
|
24
|
+
cookieJar.set(key, value, options);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
};
|
|
28
|
+
});
|
package/libEs6/utils/index.js
CHANGED
|
@@ -14,10 +14,10 @@ export { default as areThirdPartyCookiesSupportedByDefault } from "./areThirdPar
|
|
|
14
14
|
export { default as assign } from "./assign";
|
|
15
15
|
export { default as assignIf } from "./assignIf";
|
|
16
16
|
export { default as clone } from "./clone";
|
|
17
|
-
export { default as convertTimes } from "./convertTimes";
|
|
18
17
|
export { default as cookieJar } from "./cookieJar";
|
|
19
18
|
export { default as createMerger } from "./createMerger";
|
|
20
19
|
export { default as createCallbackAggregator } from "./createCallbackAggregator";
|
|
20
|
+
export { default as createLoggingCookieJar } from "./createLoggingCookieJar";
|
|
21
21
|
export { default as createTaskQueue } from "./createTaskQueue";
|
|
22
22
|
export { default as crc32 } from "./crc32";
|
|
23
23
|
export { default as defer } from "./defer";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/alloy",
|
|
3
|
-
"version": "2.11.0-alpha.
|
|
3
|
+
"version": "2.11.0-alpha.8",
|
|
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.11.0-alpha.
|
|
67
|
+
"@adobe/alloy": "^2.11.0-alpha.7",
|
|
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,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.default = exports.YEAR = exports.WEEK = exports.SECOND = exports.MONTH = exports.MINUTE = exports.MILLISECOND = exports.HOUR = exports.DAY = void 0;
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
Copyright 2019 Adobe. All rights reserved.
|
|
7
|
-
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
you may not use this file except in compliance with the License. You may obtain a copy
|
|
9
|
-
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
|
|
11
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
12
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
13
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
|
-
governing permissions and limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
var MILLISECOND = 1;
|
|
17
|
-
exports.MILLISECOND = MILLISECOND;
|
|
18
|
-
var SECOND = MILLISECOND * 1000;
|
|
19
|
-
exports.SECOND = SECOND;
|
|
20
|
-
var MINUTE = SECOND * 60;
|
|
21
|
-
exports.MINUTE = MINUTE;
|
|
22
|
-
var HOUR = MINUTE * 60;
|
|
23
|
-
exports.HOUR = HOUR;
|
|
24
|
-
var DAY = HOUR * 24;
|
|
25
|
-
exports.DAY = DAY;
|
|
26
|
-
var WEEK = DAY * 7;
|
|
27
|
-
exports.WEEK = WEEK;
|
|
28
|
-
var MONTH = DAY * 30;
|
|
29
|
-
exports.MONTH = MONTH;
|
|
30
|
-
var YEAR = DAY * 365;
|
|
31
|
-
exports.YEAR = YEAR;
|
|
32
|
-
|
|
33
|
-
var _default = function _default(fromUnit, toUnit, amount) {
|
|
34
|
-
return fromUnit * amount / toUnit;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
exports.default = _default;
|