@adobe/alloy 2.10.1-beta.0 → 2.11.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/libEs5/components/Identity/appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js +28 -0
  2. package/libEs5/components/Identity/appendIdentityToUrl/injectAppendIdentityToUrl.js +60 -0
  3. package/libEs5/components/Identity/configValidators.js +2 -1
  4. package/libEs5/components/Identity/createComponent.js +22 -1
  5. package/libEs5/components/Identity/createLegacyIdentity.js +1 -1
  6. package/libEs5/components/Identity/getIdentity/createIdentityRequestPayload.js +2 -1
  7. package/libEs5/components/Identity/index.js +26 -3
  8. package/libEs5/components/Identity/injectAddLegacyEcidToPayload.js +8 -0
  9. package/libEs5/components/Identity/injectAddQueryStringIdentityToPayload.js +80 -0
  10. package/libEs5/components/Personalization/dom-actions/dom/selectNodesWithEq.js +2 -9
  11. package/libEs5/components/Privacy/createConsentRequestPayload.js +3 -0
  12. package/libEs5/constants/libraryVersion.js +1 -1
  13. package/libEs5/constants/queryStringIdentityParam.js +17 -0
  14. package/libEs5/core/consent/createConsent.js +3 -0
  15. package/libEs5/core/consent/createConsentStateMachine.js +9 -2
  16. package/libEs5/utils/dom/querySelectorAll.js +15 -1
  17. package/libEs5/utils/request/createDataCollectionRequestPayload.js +4 -1
  18. package/libEs5/utils/request/createHasIdentity.js +22 -0
  19. package/libEs5/utils/request/createRequestPayload.js +3 -1
  20. package/libEs5/utils/request/index.js +8 -0
  21. package/libEs6/components/Identity/appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js +21 -0
  22. package/libEs6/components/Identity/appendIdentityToUrl/injectAppendIdentityToUrl.js +35 -0
  23. package/libEs6/components/Identity/configValidators.js +2 -1
  24. package/libEs6/components/Identity/createComponent.js +21 -1
  25. package/libEs6/components/Identity/createLegacyIdentity.js +1 -1
  26. package/libEs6/components/Identity/getIdentity/createIdentityRequestPayload.js +3 -2
  27. package/libEs6/components/Identity/index.js +20 -3
  28. package/libEs6/components/Identity/injectAddLegacyEcidToPayload.js +7 -0
  29. package/libEs6/components/Identity/injectAddQueryStringIdentityToPayload.js +55 -0
  30. package/libEs6/components/Personalization/dom-actions/dom/selectNodesWithEq.js +2 -7
  31. package/libEs6/components/Privacy/createConsentRequestPayload.js +3 -0
  32. package/libEs6/constants/libraryVersion.js +1 -1
  33. package/libEs6/constants/queryStringIdentityParam.js +12 -0
  34. package/libEs6/core/consent/createConsent.js +4 -0
  35. package/libEs6/core/consent/createConsentStateMachine.js +11 -2
  36. package/libEs6/utils/dom/querySelectorAll.js +16 -1
  37. package/libEs6/utils/request/createDataCollectionRequestPayload.js +3 -1
  38. package/libEs6/utils/request/createHasIdentity.js +14 -0
  39. package/libEs6/utils/request/createRequestPayload.js +3 -1
  40. package/libEs6/utils/request/index.js +1 -0
  41. package/package.json +2 -2
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+
5
+ var _validation = require("../../../utils/validation");
6
+
7
+ /*
8
+ Copyright 2022 Adobe. All rights reserved.
9
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
10
+ you may not use this file except in compliance with the License. You may obtain a copy
11
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software distributed under
14
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
15
+ OF ANY KIND, either express or implied. See the License for the specific language
16
+ governing permissions and limitations under the License.
17
+ */
18
+
19
+ /**
20
+ * Verifies user provided event options.
21
+ * @param {*} options The user event options to validate
22
+ * @returns {*} Validated options
23
+ */
24
+ var _default = (0, _validation.objectOf)({
25
+ url: (0, _validation.string)().required().nonEmpty()
26
+ }).required().noUnknownFields();
27
+
28
+ exports.default = _default;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+
5
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
+
7
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
+
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
+
11
+ 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; }
12
+
13
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
14
+
15
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
+
17
+ /*
18
+ Copyright 2022 Adobe. All rights reserved.
19
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
20
+ you may not use this file except in compliance with the License. You may obtain a copy
21
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
22
+
23
+ Unless required by applicable law or agreed to in writing, software distributed under
24
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
25
+ OF ANY KIND, either express or implied. See the License for the specific language
26
+ governing permissions and limitations under the License.
27
+ */
28
+ var URL_REGEX = /^([^?#]*)(\??[^#]*)(#?.*)$/;
29
+
30
+ var getSeparator = function getSeparator(queryString) {
31
+ if (queryString === "") {
32
+ return "?";
33
+ }
34
+
35
+ if (queryString === "?") {
36
+ return "";
37
+ }
38
+
39
+ return "&";
40
+ };
41
+
42
+ var _default = function _default(_ref) {
43
+ var dateProvider = _ref.dateProvider,
44
+ orgId = _ref.orgId;
45
+ return function (ecid, url) {
46
+ var ts = Math.round(dateProvider().getTime() / 1000);
47
+ var adobemc = encodeURIComponent("TS=" + ts + "|MCMID=" + ecid + "|MCORGID=" + orgId);
48
+
49
+ var _url$match = url.match(URL_REGEX),
50
+ _url$match2 = _slicedToArray(_url$match, 4),
51
+ location = _url$match2[1],
52
+ queryString = _url$match2[2],
53
+ fragment = _url$match2[3];
54
+
55
+ var separator = getSeparator(queryString);
56
+ return "" + location + queryString + separator + "adobe_mc=" + adobemc + fragment;
57
+ };
58
+ };
59
+
60
+ exports.default = _default;
@@ -17,7 +17,8 @@ governing permissions and limitations under the License.
17
17
  */
18
18
  var configValidators = {
19
19
  thirdPartyCookiesEnabled: (0, _validation.boolean)().default(true),
20
- idMigrationEnabled: (0, _validation.boolean)().default(true)
20
+ idMigrationEnabled: (0, _validation.boolean)().default(true),
21
+ idOverwriteEnabled: (0, _validation.boolean)().default(false)
21
22
  };
22
23
  var _default = configValidators;
23
24
  exports.default = _default;
@@ -6,14 +6,19 @@ var _utils = require("../../utils");
6
6
 
7
7
  var _getIdentityOptionsValidator = require("./getIdentity/getIdentityOptionsValidator");
8
8
 
9
+ var _appendIdentityToUrlOptionsValidator = require("./appendIdentityToUrl/appendIdentityToUrlOptionsValidator");
10
+
9
11
  var _default = function _default(_ref) {
10
12
  var addEcidQueryToPayload = _ref.addEcidQueryToPayload,
13
+ addQueryStringIdentityToPayload = _ref.addQueryStringIdentityToPayload,
11
14
  ensureSingleIdentity = _ref.ensureSingleIdentity,
12
15
  setLegacyEcid = _ref.setLegacyEcid,
13
16
  handleResponseForIdSyncs = _ref.handleResponseForIdSyncs,
14
17
  getEcidFromResponse = _ref.getEcidFromResponse,
15
18
  getIdentity = _ref.getIdentity,
16
- consent = _ref.consent;
19
+ consent = _ref.consent,
20
+ appendIdentityToUrl = _ref.appendIdentityToUrl,
21
+ logger = _ref.logger;
17
22
  var ecid;
18
23
  var edge = {};
19
24
  return {
@@ -25,6 +30,7 @@ var _default = function _default(_ref) {
25
30
  // Querying the ECID on every request to be able to set the legacy cookie, and make it
26
31
  // available for the `getIdentity` command.
27
32
  addEcidQueryToPayload(request.getPayload());
33
+ addQueryStringIdentityToPayload(request.getPayload());
28
34
  return ensureSingleIdentity({
29
35
  request: request,
30
36
  onResponse: onResponse,
@@ -64,6 +70,21 @@ var _default = function _default(_ref) {
64
70
  };
65
71
  });
66
72
  }
73
+ },
74
+ appendIdentityToUrl: {
75
+ optionsValidator: _appendIdentityToUrlOptionsValidator.default,
76
+ run: function run(options) {
77
+ return consent.withConsent().then(function () {
78
+ return ecid ? undefined : getIdentity(options.namespaces);
79
+ }).then(function () {
80
+ return {
81
+ url: appendIdentityToUrl(ecid, options.url)
82
+ };
83
+ }).catch(function (error) {
84
+ logger.warn("Unable to append identity to url. " + error.message);
85
+ return options;
86
+ });
87
+ }
67
88
  }
68
89
  }
69
90
  };
@@ -63,7 +63,7 @@ var _default = function _default(_ref) {
63
63
  return Promise.resolve();
64
64
  },
65
65
  setEcid: function setEcid(ecid) {
66
- if (idMigrationEnabled && !_utils.cookieJar.get(amcvCookieName)) {
66
+ if (idMigrationEnabled && getEcidFromLegacyCookies() !== ecid) {
67
67
  _utils.cookieJar.set(amcvCookieName, "MCMID|" + ecid, {
68
68
  domain: apexDomain,
69
69
  // Without `expires` this will be a session cookie.
@@ -25,7 +25,8 @@ var _default = function _default(namespaces) {
25
25
  };
26
26
  return (0, _request.createRequestPayload)({
27
27
  content: content,
28
- addIdentity: (0, _request.createAddIdentity)(content)
28
+ addIdentity: (0, _request.createAddIdentity)(content),
29
+ hasIdentity: (0, _request.createHasIdentity)(content)
29
30
  });
30
31
  };
31
32
 
@@ -26,6 +26,8 @@ var _injectSetDomainForInitialIdentityPayload = require("./injectSetDomainForIni
26
26
 
27
27
  var _injectAddLegacyEcidToPayload = require("./injectAddLegacyEcidToPayload");
28
28
 
29
+ var _injectAddQueryStringIdentityToPayload = require("./injectAddQueryStringIdentityToPayload");
30
+
29
31
  var _addEcidToPayload = require("./addEcidToPayload");
30
32
 
31
33
  var _injectAwaitIdentityCookie = require("./injectAwaitIdentityCookie");
@@ -38,6 +40,8 @@ var _createIdentityRequest = require("./getIdentity/createIdentityRequest");
38
40
 
39
41
  var _createIdentityRequestPayload = require("./getIdentity/createIdentityRequestPayload");
40
42
 
43
+ var _injectAppendIdentityToUrl = require("./appendIdentityToUrl/injectAppendIdentityToUrl");
44
+
41
45
  /*
42
46
  Copyright 2019 Adobe. All rights reserved.
43
47
  This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -56,7 +60,8 @@ var createIdentity = function createIdentity(_ref) {
56
60
  fireReferrerHideableImage = _ref.fireReferrerHideableImage,
57
61
  sendEdgeNetworkRequest = _ref.sendEdgeNetworkRequest;
58
62
  var orgId = config.orgId,
59
- thirdPartyCookiesEnabled = config.thirdPartyCookiesEnabled;
63
+ thirdPartyCookiesEnabled = config.thirdPartyCookiesEnabled,
64
+ idOverwriteEnabled = config.idOverwriteEnabled;
60
65
  var getEcidFromVisitor = (0, _injectGetEcidFromVisitor.default)({
61
66
  logger: logger,
62
67
  orgId: orgId,
@@ -82,6 +87,15 @@ var createIdentity = function createIdentity(_ref) {
82
87
  getLegacyEcid: legacyIdentity.getEcid,
83
88
  addEcidToPayload: _addEcidToPayload.default
84
89
  });
90
+ var addQueryStringIdentityToPayload = (0, _injectAddQueryStringIdentityToPayload.default)({
91
+ locationSearch: window.document.location.search,
92
+ dateProvider: function dateProvider() {
93
+ return new Date();
94
+ },
95
+ orgId: orgId,
96
+ logger: logger,
97
+ idOverwriteEnabled: idOverwriteEnabled
98
+ });
85
99
  var awaitIdentityCookie = (0, _injectAwaitIdentityCookie.default)({
86
100
  doesIdentityCookieExist: doesIdentityCookieExist,
87
101
  orgId: orgId
@@ -100,14 +114,23 @@ var createIdentity = function createIdentity(_ref) {
100
114
  var handleResponseForIdSyncs = (0, _injectHandleResponseForIdSyncs.default)({
101
115
  processIdSyncs: processIdSyncs
102
116
  });
117
+ var appendIdentityToUrl = (0, _injectAppendIdentityToUrl.default)({
118
+ dateProvider: function dateProvider() {
119
+ return new Date();
120
+ },
121
+ orgId: orgId
122
+ });
103
123
  return (0, _createComponent.default)({
104
- ensureSingleIdentity: ensureSingleIdentity,
105
124
  addEcidQueryToPayload: _addEcidQueryToPayload.default,
125
+ addQueryStringIdentityToPayload: addQueryStringIdentityToPayload,
126
+ ensureSingleIdentity: ensureSingleIdentity,
106
127
  setLegacyEcid: legacyIdentity.setEcid,
107
128
  handleResponseForIdSyncs: handleResponseForIdSyncs,
108
129
  getEcidFromResponse: _getEcidFromResponse.default,
109
130
  getIdentity: getIdentity,
110
- consent: consent
131
+ consent: consent,
132
+ appendIdentityToUrl: appendIdentityToUrl,
133
+ logger: logger
111
134
  });
112
135
  };
113
136
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  exports.default = void 0;
4
4
 
5
+ var _ecidNamespace = require("../../constants/ecidNamespace");
6
+
5
7
  /*
6
8
  Copyright 2020 Adobe. All rights reserved.
7
9
  This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -17,6 +19,12 @@ var _default = function _default(_ref) {
17
19
  var getLegacyEcid = _ref.getLegacyEcid,
18
20
  addEcidToPayload = _ref.addEcidToPayload;
19
21
  return function (payload) {
22
+ if (payload.hasIdentity(_ecidNamespace.default)) {
23
+ // don't get the legacy identity if we already have the query string identity or if
24
+ // the user specified it in the identity map
25
+ return Promise.resolve();
26
+ }
27
+
20
28
  return getLegacyEcid().then(function (ecidToMigrate) {
21
29
  if (ecidToMigrate) {
22
30
  addEcidToPayload(payload, ecidToMigrate);
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+
5
+ var _utils = require("../../utils");
6
+
7
+ var _queryStringIdentityParam = require("../../constants/queryStringIdentityParam");
8
+
9
+ var _ecidNamespace = require("../../constants/ecidNamespace");
10
+
11
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
+
13
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
14
+
15
+ 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); }
16
+
17
+ 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; }
18
+
19
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
20
+
21
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22
+
23
+ var LINK_TTL_SECONDS = 300; // 5 minute link time to live
24
+
25
+ var _default = function _default(_ref) {
26
+ var locationSearch = _ref.locationSearch,
27
+ dateProvider = _ref.dateProvider,
28
+ orgId = _ref.orgId,
29
+ logger = _ref.logger,
30
+ idOverwriteEnabled = _ref.idOverwriteEnabled;
31
+ return function (payload) {
32
+ if (payload.hasIdentity(_ecidNamespace.default)) {
33
+ // don't overwrite a user provided ecid identity
34
+ return;
35
+ }
36
+
37
+ var parsedQueryString = _utils.queryString.parse(locationSearch);
38
+
39
+ var queryStringValue = parsedQueryString[_queryStringIdentityParam.default];
40
+
41
+ if (queryStringValue === undefined) {
42
+ return;
43
+ }
44
+
45
+ var properties = queryStringValue.split("|").reduce(function (memo, keyValue) {
46
+ var _keyValue$split = keyValue.split("="),
47
+ _keyValue$split2 = _slicedToArray(_keyValue$split, 2),
48
+ key = _keyValue$split2[0],
49
+ value = _keyValue$split2[1];
50
+
51
+ memo[key] = value;
52
+ return memo;
53
+ }, {}); // We are using MCMID and MCORGID to be compatible with Visitor.
54
+
55
+ var ts = parseInt(properties.TS, 10);
56
+ var mcmid = properties.MCMID;
57
+ var mcorgid = properties.MCORGID;
58
+
59
+ if ( // When TS is not specified or not a number, the following inequality returns false.
60
+ // All inequalities with NaN variables are false.
61
+ dateProvider().getTime() / 1000 <= ts + LINK_TTL_SECONDS && mcorgid === orgId && mcmid) {
62
+ logger.info("Found valid ECID identity " + mcmid + " from the adobe_mc query string parameter.");
63
+ payload.addIdentity(_ecidNamespace.default, {
64
+ id: mcmid
65
+ });
66
+
67
+ if (idOverwriteEnabled) {
68
+ payload.mergeQuery({
69
+ identity: {
70
+ overwriteExisting: true
71
+ }
72
+ });
73
+ }
74
+ } else {
75
+ logger.info("Detected invalid or expired adobe_mc query string parameter.");
76
+ }
77
+ };
78
+ };
79
+
80
+ exports.default = _default;
@@ -21,18 +21,11 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
21
21
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22
22
 
23
23
  // Trying to match ID or CSS class
24
- var CSS_IDENTIFIER_PATTERN = /(#|\.)(-?\w+)/g; // This is required to remove leading " > " from parsed pieces
25
-
26
- var SIBLING_PATTERN = /^\s*>?\s*/;
27
-
28
- var cleanUp = function cleanUp(str) {
29
- return str.replace(SIBLING_PATTERN, "").trim();
30
- }; // Here we use CSS.escape() to make sure we get
24
+ var CSS_IDENTIFIER_PATTERN = /(#|\.)(-?\w+)/g; // Here we use CSS.escape() to make sure we get
31
25
  // correct values for ID and CSS class
32
26
  // Please check: https://www.w3.org/TR/css-syntax-3/#escaping
33
27
  // CSS.escape() polyfill can be found here: https://github.com/mathiasbynens/CSS.escape
34
28
 
35
-
36
29
  var replaceIdentifier = function replaceIdentifier(_, $1, $2) {
37
30
  return "" + $1 + (0, _css.default)($2);
38
31
  };
@@ -51,7 +44,7 @@ var parseSelector = function parseSelector(rawSelector) {
51
44
  var i = 0;
52
45
 
53
46
  while (i < length) {
54
- var sel = cleanUp(parts[i]);
47
+ var sel = parts[i];
55
48
  var eq = parts[i + 1];
56
49
 
57
50
  if (eq) {
@@ -23,6 +23,9 @@ var _default = function _default() {
23
23
  content.identityMap = content.identityMap || {};
24
24
  content.identityMap[namespaceCode] = content.identityMap[namespaceCode] || [];
25
25
  content.identityMap[namespaceCode].push(identity);
26
+ },
27
+ hasIdentity: function hasIdentity(namespaceCode) {
28
+ return (content.identityMap && content.identityMap[namespaceCode]) !== undefined;
26
29
  }
27
30
  });
28
31
 
@@ -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.10.1-beta.0";
18
+ var _default = "2.11.0-alpha.1";
19
19
  exports.default = _default;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+
5
+ /*
6
+ Copyright 2022 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 _default = "adobe_mc";
17
+ exports.default = _default;
@@ -59,6 +59,9 @@ var _default = function _default(_ref) {
59
59
  },
60
60
  awaitConsent: function awaitConsent() {
61
61
  return generalConsentState.awaitConsent();
62
+ },
63
+ withConsent: function withConsent() {
64
+ return generalConsentState.withConsent();
62
65
  }
63
66
  };
64
67
  };
@@ -69,7 +69,11 @@ var _default = function _default(_ref) {
69
69
  return Promise.reject(createDeclinedConsentError("The user declined consent."));
70
70
  };
71
71
 
72
- var awaitPending = function awaitPending() {
72
+ var awaitPending = function awaitPending(returnImmediately) {
73
+ if (returnImmediately) {
74
+ return Promise.reject(new Error("Consent is pending."));
75
+ }
76
+
73
77
  var deferred = (0, _utils.defer)();
74
78
  deferreds.push(deferred);
75
79
  return deferred.promise;
@@ -112,7 +116,10 @@ var _default = function _default(_ref) {
112
116
 
113
117
  this.awaitConsent = awaitPending;
114
118
  },
115
- awaitConsent: awaitInitial
119
+ awaitConsent: awaitInitial,
120
+ withConsent: function withConsent() {
121
+ return this.awaitConsent(true);
122
+ }
116
123
  };
117
124
  };
118
125
 
@@ -15,8 +15,22 @@ 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
+ var SIBLING_PATTERN = /^\s*>/;
19
+
18
20
  var _default = function _default(context, selector) {
19
- return (0, _toArray.default)(context.querySelectorAll(selector));
21
+ if (!SIBLING_PATTERN.test(selector)) {
22
+ return (0, _toArray.default)(context.querySelectorAll(selector));
23
+ }
24
+
25
+ var tag = "alloy-" + Date.now(); // We could use a :scope selector here, but we want to be IE compliant
26
+ // so we add a dummy css class to be able to select the children
27
+
28
+ try {
29
+ context.classList.add(tag);
30
+ return (0, _toArray.default)(context.querySelectorAll("." + tag + " " + selector));
31
+ } finally {
32
+ context.classList.remove(tag);
33
+ }
20
34
  };
21
35
 
22
36
  exports.default = _default;
@@ -6,6 +6,8 @@ var _createRequestPayload = require("./createRequestPayload");
6
6
 
7
7
  var _createAddIdentity = require("./createAddIdentity");
8
8
 
9
+ var _createHasIdentity = require("./createHasIdentity");
10
+
9
11
  /*
10
12
  Copyright 2019 Adobe. All rights reserved.
11
13
  This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -21,7 +23,8 @@ var _default = function _default() {
21
23
  var content = {};
22
24
  var payload = (0, _createRequestPayload.default)({
23
25
  content: content,
24
- addIdentity: (0, _createAddIdentity.default)(content)
26
+ addIdentity: (0, _createAddIdentity.default)(content),
27
+ hasIdentity: (0, _createHasIdentity.default)(content)
25
28
  });
26
29
 
27
30
  payload.addEvent = function (event) {
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ exports.default = void 0;
4
+
5
+ /*
6
+ Copyright 2022 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 _default = function _default(content) {
17
+ return function (namespaceCode) {
18
+ return (content.xdm && content.xdm.identityMap && content.xdm.identityMap[namespaceCode]) !== undefined;
19
+ };
20
+ };
21
+
22
+ exports.default = _default;
@@ -19,11 +19,13 @@ governing permissions and limitations under the License.
19
19
  // request payloads share.
20
20
  var _default = function _default(options) {
21
21
  var content = options.content,
22
- addIdentity = options.addIdentity;
22
+ addIdentity = options.addIdentity,
23
+ hasIdentity = options.hasIdentity;
23
24
  return {
24
25
  mergeState: (0, _.createMerger)(content, "meta.state"),
25
26
  mergeQuery: (0, _.createMerger)(content, "query"),
26
27
  addIdentity: addIdentity,
28
+ hasIdentity: hasIdentity,
27
29
  toJSON: function toJSON() {
28
30
  return content;
29
31
  }
@@ -18,6 +18,12 @@ Object.defineProperty(exports, "createDataCollectionRequestPayload", {
18
18
  return _createDataCollectionRequestPayload.default;
19
19
  }
20
20
  });
21
+ Object.defineProperty(exports, "createHasIdentity", {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return _createHasIdentity.default;
25
+ }
26
+ });
21
27
  Object.defineProperty(exports, "createRequest", {
22
28
  enumerable: true,
23
29
  get: function get() {
@@ -37,6 +43,8 @@ var _createDataCollectionRequest = require("./createDataCollectionRequest");
37
43
 
38
44
  var _createDataCollectionRequestPayload = require("./createDataCollectionRequestPayload");
39
45
 
46
+ var _createHasIdentity = require("./createHasIdentity");
47
+
40
48
  var _createRequest = require("./createRequest");
41
49
 
42
50
  var _createRequestPayload = require("./createRequestPayload");
@@ -0,0 +1,21 @@
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 { objectOf, string } from "../../../utils/validation";
13
+ /**
14
+ * Verifies user provided event options.
15
+ * @param {*} options The user event options to validate
16
+ * @returns {*} Validated options
17
+ */
18
+
19
+ export default objectOf({
20
+ url: string().required().nonEmpty()
21
+ }).required().noUnknownFields();
@@ -0,0 +1,35 @@
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
+ const URL_REGEX = /^([^?#]*)(\??[^#]*)(#?.*)$/;
13
+
14
+ const getSeparator = queryString => {
15
+ if (queryString === "") {
16
+ return "?";
17
+ }
18
+
19
+ if (queryString === "?") {
20
+ return "";
21
+ }
22
+
23
+ return "&";
24
+ };
25
+
26
+ export default (({
27
+ dateProvider,
28
+ orgId
29
+ }) => (ecid, url) => {
30
+ const ts = Math.round(dateProvider().getTime() / 1000);
31
+ const adobemc = encodeURIComponent(`TS=${ts}|MCMID=${ecid}|MCORGID=${orgId}`);
32
+ const [, location, queryString, fragment] = url.match(URL_REGEX);
33
+ const separator = getSeparator(queryString);
34
+ return `${location}${queryString}${separator}adobe_mc=${adobemc}${fragment}`;
35
+ });
@@ -12,6 +12,7 @@ governing permissions and limitations under the License.
12
12
  import { boolean } from "../../utils/validation";
13
13
  const configValidators = {
14
14
  thirdPartyCookiesEnabled: boolean().default(true),
15
- idMigrationEnabled: boolean().default(true)
15
+ idMigrationEnabled: boolean().default(true),
16
+ idOverwriteEnabled: boolean().default(false)
16
17
  };
17
18
  export default configValidators;
@@ -1,13 +1,17 @@
1
1
  import { assign } from "../../utils";
2
2
  import getIdentityOptionsValidator from "./getIdentity/getIdentityOptionsValidator";
3
+ import appendIdentityToUrlOptionsValidator from "./appendIdentityToUrl/appendIdentityToUrlOptionsValidator";
3
4
  export default (({
4
5
  addEcidQueryToPayload,
6
+ addQueryStringIdentityToPayload,
5
7
  ensureSingleIdentity,
6
8
  setLegacyEcid,
7
9
  handleResponseForIdSyncs,
8
10
  getEcidFromResponse,
9
11
  getIdentity,
10
- consent
12
+ consent,
13
+ appendIdentityToUrl,
14
+ logger
11
15
  }) => {
12
16
  let ecid;
13
17
  let edge = {};
@@ -21,6 +25,7 @@ export default (({
21
25
  // Querying the ECID on every request to be able to set the legacy cookie, and make it
22
26
  // available for the `getIdentity` command.
23
27
  addEcidQueryToPayload(request.getPayload());
28
+ addQueryStringIdentityToPayload(request.getPayload());
24
29
  return ensureSingleIdentity({
25
30
  request,
26
31
  onResponse,
@@ -62,6 +67,21 @@ export default (({
62
67
  };
63
68
  });
64
69
  }
70
+ },
71
+ appendIdentityToUrl: {
72
+ optionsValidator: appendIdentityToUrlOptionsValidator,
73
+ run: options => {
74
+ return consent.withConsent().then(() => {
75
+ return ecid ? undefined : getIdentity(options.namespaces);
76
+ }).then(() => {
77
+ return {
78
+ url: appendIdentityToUrl(ecid, options.url)
79
+ };
80
+ }).catch(error => {
81
+ logger.warn(`Unable to append identity to url. ${error.message}`);
82
+ return options;
83
+ });
84
+ }
65
85
  }
66
86
  }
67
87
  };
@@ -61,7 +61,7 @@ export default (({
61
61
  },
62
62
 
63
63
  setEcid(ecid) {
64
- if (idMigrationEnabled && !cookieJar.get(amcvCookieName)) {
64
+ if (idMigrationEnabled && getEcidFromLegacyCookies() !== ecid) {
65
65
  cookieJar.set(amcvCookieName, `MCMID|${ecid}`, {
66
66
  domain: apexDomain,
67
67
  // Without `expires` this will be a session cookie.
@@ -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 { createAddIdentity, createRequestPayload } from "../../../utils/request";
12
+ import { createAddIdentity, createHasIdentity, createRequestPayload } from "../../../utils/request";
13
13
  export default (namespaces => {
14
14
  const content = {
15
15
  query: {
@@ -20,6 +20,7 @@ export default (namespaces => {
20
20
  };
21
21
  return createRequestPayload({
22
22
  content,
23
- addIdentity: createAddIdentity(content)
23
+ addIdentity: createAddIdentity(content),
24
+ hasIdentity: createHasIdentity(content)
24
25
  });
25
26
  });
@@ -21,12 +21,14 @@ import injectEnsureSingleIdentity from "./injectEnsureSingleIdentity";
21
21
  import addEcidQueryToPayload from "./addEcidQueryToPayload";
22
22
  import injectSetDomainForInitialIdentityPayload from "./injectSetDomainForInitialIdentityPayload";
23
23
  import injectAddLegacyEcidToPayload from "./injectAddLegacyEcidToPayload";
24
+ import injectAddQueryStringIdentityToPayload from "./injectAddQueryStringIdentityToPayload";
24
25
  import addEcidToPayload from "./addEcidToPayload";
25
26
  import injectAwaitIdentityCookie from "./injectAwaitIdentityCookie";
26
27
  import getEcidFromResponse from "./getEcidFromResponse";
27
28
  import createGetIdentity from "./getIdentity/createGetIdentity";
28
29
  import createIdentityRequest from "./getIdentity/createIdentityRequest";
29
30
  import createIdentityRequestPayload from "./getIdentity/createIdentityRequestPayload";
31
+ import injectAppendIdentityToUrl from "./appendIdentityToUrl/injectAppendIdentityToUrl";
30
32
 
31
33
  const createIdentity = ({
32
34
  config,
@@ -37,7 +39,8 @@ const createIdentity = ({
37
39
  }) => {
38
40
  const {
39
41
  orgId,
40
- thirdPartyCookiesEnabled
42
+ thirdPartyCookiesEnabled,
43
+ idOverwriteEnabled
41
44
  } = config;
42
45
  const getEcidFromVisitor = injectGetEcidFromVisitor({
43
46
  logger,
@@ -64,6 +67,13 @@ const createIdentity = ({
64
67
  getLegacyEcid: legacyIdentity.getEcid,
65
68
  addEcidToPayload
66
69
  });
70
+ const addQueryStringIdentityToPayload = injectAddQueryStringIdentityToPayload({
71
+ locationSearch: window.document.location.search,
72
+ dateProvider: () => new Date(),
73
+ orgId,
74
+ logger,
75
+ idOverwriteEnabled
76
+ });
67
77
  const awaitIdentityCookie = injectAwaitIdentityCookie({
68
78
  doesIdentityCookieExist,
69
79
  orgId
@@ -82,14 +92,21 @@ const createIdentity = ({
82
92
  const handleResponseForIdSyncs = injectHandleResponseForIdSyncs({
83
93
  processIdSyncs
84
94
  });
95
+ const appendIdentityToUrl = injectAppendIdentityToUrl({
96
+ dateProvider: () => new Date(),
97
+ orgId
98
+ });
85
99
  return createComponent({
86
- ensureSingleIdentity,
87
100
  addEcidQueryToPayload,
101
+ addQueryStringIdentityToPayload,
102
+ ensureSingleIdentity,
88
103
  setLegacyEcid: legacyIdentity.setEcid,
89
104
  handleResponseForIdSyncs,
90
105
  getEcidFromResponse,
91
106
  getIdentity,
92
- consent
107
+ consent,
108
+ appendIdentityToUrl,
109
+ logger
93
110
  });
94
111
  };
95
112
 
@@ -9,11 +9,18 @@ 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 ecidNamespace from "../../constants/ecidNamespace";
12
13
  export default (({
13
14
  getLegacyEcid,
14
15
  addEcidToPayload
15
16
  }) => {
16
17
  return payload => {
18
+ if (payload.hasIdentity(ecidNamespace)) {
19
+ // don't get the legacy identity if we already have the query string identity or if
20
+ // the user specified it in the identity map
21
+ return Promise.resolve();
22
+ }
23
+
17
24
  return getLegacyEcid().then(ecidToMigrate => {
18
25
  if (ecidToMigrate) {
19
26
  addEcidToPayload(payload, ecidToMigrate);
@@ -0,0 +1,55 @@
1
+ // Example: adobe_mc=TS%3D1641432103%7CMCMID%3D77094828402023918047117570965393734545%7CMCORGID%3DFAF554945B90342F0A495E2C%40AdobeOrg
2
+ // Decoded: adobe_mc=TS=1641432103|MCMID=77094828402023918047117570965393734545|MCORGID=FAF554945B90342F0A495E2C@AdobeOrg
3
+ import { queryString } from "../../utils";
4
+ import queryStringIdentityParam from "../../constants/queryStringIdentityParam";
5
+ import ecidNamespace from "../../constants/ecidNamespace";
6
+ const LINK_TTL_SECONDS = 300; // 5 minute link time to live
7
+
8
+ export default (({
9
+ locationSearch,
10
+ dateProvider,
11
+ orgId,
12
+ logger,
13
+ idOverwriteEnabled
14
+ }) => payload => {
15
+ if (payload.hasIdentity(ecidNamespace)) {
16
+ // don't overwrite a user provided ecid identity
17
+ return;
18
+ }
19
+
20
+ const parsedQueryString = queryString.parse(locationSearch);
21
+ const queryStringValue = parsedQueryString[queryStringIdentityParam];
22
+
23
+ if (queryStringValue === undefined) {
24
+ return;
25
+ }
26
+
27
+ const properties = queryStringValue.split("|").reduce((memo, keyValue) => {
28
+ const [key, value] = keyValue.split("=");
29
+ memo[key] = value;
30
+ return memo;
31
+ }, {}); // We are using MCMID and MCORGID to be compatible with Visitor.
32
+
33
+ const ts = parseInt(properties.TS, 10);
34
+ const mcmid = properties.MCMID;
35
+ const mcorgid = properties.MCORGID;
36
+
37
+ if ( // When TS is not specified or not a number, the following inequality returns false.
38
+ // All inequalities with NaN variables are false.
39
+ dateProvider().getTime() / 1000 <= ts + LINK_TTL_SECONDS && mcorgid === orgId && mcmid) {
40
+ logger.info(`Found valid ECID identity ${mcmid} from the adobe_mc query string parameter.`);
41
+ payload.addIdentity(ecidNamespace, {
42
+ id: mcmid
43
+ });
44
+
45
+ if (idOverwriteEnabled) {
46
+ payload.mergeQuery({
47
+ identity: {
48
+ overwriteExisting: true
49
+ }
50
+ });
51
+ }
52
+ } else {
53
+ logger.info("Detected invalid or expired adobe_mc query string parameter.");
54
+ }
55
+ });
@@ -13,16 +13,11 @@ import escape from "css.escape";
13
13
  import { selectNodes } from "../../../../utils/dom";
14
14
  import { isNotEqSelector, splitWithEq } from "./helperForEq"; // Trying to match ID or CSS class
15
15
 
16
- const CSS_IDENTIFIER_PATTERN = /(#|\.)(-?\w+)/g; // This is required to remove leading " > " from parsed pieces
17
-
18
- const SIBLING_PATTERN = /^\s*>?\s*/;
19
-
20
- const cleanUp = str => str.replace(SIBLING_PATTERN, "").trim(); // Here we use CSS.escape() to make sure we get
16
+ const CSS_IDENTIFIER_PATTERN = /(#|\.)(-?\w+)/g; // Here we use CSS.escape() to make sure we get
21
17
  // correct values for ID and CSS class
22
18
  // Please check: https://www.w3.org/TR/css-syntax-3/#escaping
23
19
  // CSS.escape() polyfill can be found here: https://github.com/mathiasbynens/CSS.escape
24
20
 
25
-
26
21
  const replaceIdentifier = (_, $1, $2) => `${$1}${escape($2)}`;
27
22
 
28
23
  export const escapeIdentifiersInSelector = selector => {
@@ -38,7 +33,7 @@ export const parseSelector = rawSelector => {
38
33
  let i = 0;
39
34
 
40
35
  while (i < length) {
41
- const sel = cleanUp(parts[i]);
36
+ const sel = parts[i];
42
37
  const eq = parts[i + 1];
43
38
 
44
39
  if (eq) {
@@ -18,6 +18,9 @@ export default (() => {
18
18
  content.identityMap = content.identityMap || {};
19
19
  content.identityMap[namespaceCode] = content.identityMap[namespaceCode] || [];
20
20
  content.identityMap[namespaceCode].push(identity);
21
+ },
22
+ hasIdentity: namespaceCode => {
23
+ return (content.identityMap && content.identityMap[namespaceCode]) !== undefined;
21
24
  }
22
25
  });
23
26
 
@@ -11,4 +11,4 @@ governing permissions and limitations under the License.
11
11
  */
12
12
  // The __VERSION__ keyword will be replace at alloy build time with the package.json version.
13
13
  // see babel-plugin-version
14
- export default "2.10.1-beta.0";
14
+ export default "2.11.0-alpha.1";
@@ -0,0 +1,12 @@
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
+ export default "adobe_mc";
@@ -55,6 +55,10 @@ export default (({
55
55
 
56
56
  awaitConsent() {
57
57
  return generalConsentState.awaitConsent();
58
+ },
59
+
60
+ withConsent() {
61
+ return generalConsentState.withConsent();
58
62
  }
59
63
 
60
64
  };
@@ -50,7 +50,11 @@ export default (({
50
50
 
51
51
  const awaitOut = () => Promise.reject(createDeclinedConsentError("The user declined consent."));
52
52
 
53
- const awaitPending = () => {
53
+ const awaitPending = returnImmediately => {
54
+ if (returnImmediately) {
55
+ return Promise.reject(new Error("Consent is pending."));
56
+ }
57
+
54
58
  const deferred = defer();
55
59
  deferreds.push(deferred);
56
60
  return deferred.promise;
@@ -96,6 +100,11 @@ export default (({
96
100
  this.awaitConsent = awaitPending;
97
101
  },
98
102
 
99
- awaitConsent: awaitInitial
103
+ awaitConsent: awaitInitial,
104
+
105
+ withConsent() {
106
+ return this.awaitConsent(true);
107
+ }
108
+
100
109
  };
101
110
  });
@@ -10,4 +10,19 @@ 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 toArray from "../toArray";
13
- export default ((context, selector) => toArray(context.querySelectorAll(selector)));
13
+ const SIBLING_PATTERN = /^\s*>/;
14
+ export default ((context, selector) => {
15
+ if (!SIBLING_PATTERN.test(selector)) {
16
+ return toArray(context.querySelectorAll(selector));
17
+ }
18
+
19
+ const tag = `alloy-${Date.now()}`; // We could use a :scope selector here, but we want to be IE compliant
20
+ // so we add a dummy css class to be able to select the children
21
+
22
+ try {
23
+ context.classList.add(tag);
24
+ return toArray(context.querySelectorAll(`.${tag} ${selector}`));
25
+ } finally {
26
+ context.classList.remove(tag);
27
+ }
28
+ });
@@ -11,11 +11,13 @@ governing permissions and limitations under the License.
11
11
  */
12
12
  import createRequestPayload from "./createRequestPayload";
13
13
  import createAddIdentity from "./createAddIdentity";
14
+ import createHasIdentity from "./createHasIdentity";
14
15
  export default (() => {
15
16
  const content = {};
16
17
  const payload = createRequestPayload({
17
18
  content,
18
- addIdentity: createAddIdentity(content)
19
+ addIdentity: createAddIdentity(content),
20
+ hasIdentity: createHasIdentity(content)
19
21
  });
20
22
 
21
23
  payload.addEvent = event => {
@@ -0,0 +1,14 @@
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
+ export default (content => namespaceCode => {
13
+ return (content.xdm && content.xdm.identityMap && content.xdm.identityMap[namespaceCode]) !== undefined;
14
+ });
@@ -15,12 +15,14 @@ import { createMerger } from ".."; // This provides the base functionality that
15
15
  export default (options => {
16
16
  const {
17
17
  content,
18
- addIdentity
18
+ addIdentity,
19
+ hasIdentity
19
20
  } = options;
20
21
  return {
21
22
  mergeState: createMerger(content, "meta.state"),
22
23
  mergeQuery: createMerger(content, "query"),
23
24
  addIdentity,
25
+ hasIdentity,
24
26
 
25
27
  toJSON() {
26
28
  return content;
@@ -12,5 +12,6 @@ governing permissions and limitations under the License.
12
12
  export { default as createAddIdentity } from "./createAddIdentity";
13
13
  export { default as createDataCollectionRequest } from "./createDataCollectionRequest";
14
14
  export { default as createDataCollectionRequestPayload } from "./createDataCollectionRequestPayload";
15
+ export { default as createHasIdentity } from "./createHasIdentity";
15
16
  export { default as createRequest } from "./createRequest";
16
17
  export { default as createRequestPayload } from "./createRequestPayload";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/alloy",
3
- "version": "2.10.1-beta.0",
3
+ "version": "2.11.0-alpha.1",
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.10.1-alpha.0",
67
+ "@adobe/alloy": "^2.11.0-alpha.0",
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",