@adobe/alloy 2.12.0-beta.0 → 2.13.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/libEs5/components/ActivityCollector/attachClickActivityCollector.js +4 -9
  2. package/libEs5/components/ActivityCollector/createLinkClick.js +7 -1
  3. package/libEs5/components/Context/createComponent.js +7 -6
  4. package/libEs5/components/Context/index.js +17 -13
  5. package/libEs5/components/Context/injectHighEntropyUserAgentHints.js +55 -0
  6. package/libEs5/components/DataCollector/index.js +26 -0
  7. package/libEs5/components/DataCollector/validateApplyResponse.js +22 -0
  8. package/libEs5/components/DataCollector/validateUserEventOptions.js +5 -3
  9. package/libEs5/components/Identity/getIdentity/getIdentityOptionsValidator.js +1 -1
  10. package/libEs5/components/Personalization/constants/propositionEventType.js +20 -0
  11. package/libEs5/components/Personalization/createCollect.js +3 -1
  12. package/libEs5/components/Personalization/createComponent.js +19 -13
  13. package/libEs5/components/Personalization/createFetchDataHandler.js +1 -2
  14. package/libEs5/components/Personalization/createOnClickHandler.js +3 -1
  15. package/libEs5/components/Personalization/createSetTargetMigration.js +34 -0
  16. package/libEs5/components/Personalization/createViewChangeHandler.js +3 -1
  17. package/libEs5/components/Personalization/event.js +5 -2
  18. package/libEs5/components/Personalization/index.js +12 -3
  19. package/libEs5/constants/cookieNameKey.js +4 -2
  20. package/libEs5/constants/highEntropyUserAgentClientHints.js +17 -0
  21. package/libEs5/constants/legacyCookies.js +21 -0
  22. package/libEs5/constants/libraryVersion.js +1 -1
  23. package/libEs5/core/createCookieTransfer.js +2 -9
  24. package/libEs5/core/createEventManager.js +32 -1
  25. package/libEs5/core/edgeNetwork/handleRequestFailure.js +20 -0
  26. package/libEs5/core/edgeNetwork/injectApplyResponse.js +62 -0
  27. package/libEs5/core/edgeNetwork/injectGetLocationHint.js +18 -1
  28. package/libEs5/core/edgeNetwork/injectSendEdgeNetworkRequest.js +14 -29
  29. package/libEs5/core/edgeNetwork/mergeLifecycleResponses.js +28 -0
  30. package/libEs5/core/index.js +19 -3
  31. package/libEs5/core/injectShouldTransferCookie.js +33 -0
  32. package/libEs5/utils/isUnique.js +38 -0
  33. package/libEs5/utils/request/createRequestPayload.js +1 -0
  34. package/libEs5/utils/validateIdentityMap.js +1 -1
  35. package/libEs5/utils/validation/createUniqueItemsValidator.js +26 -0
  36. package/libEs5/utils/validation/index.js +8 -1
  37. package/libEs6/components/ActivityCollector/attachClickActivityCollector.js +3 -8
  38. package/libEs6/components/ActivityCollector/createLinkClick.js +7 -1
  39. package/libEs6/components/Context/createComponent.js +4 -5
  40. package/libEs6/components/Context/index.js +10 -2
  41. package/libEs6/components/Context/injectHighEntropyUserAgentHints.js +46 -0
  42. package/libEs6/components/DataCollector/index.js +24 -0
  43. package/libEs6/components/DataCollector/validateApplyResponse.js +16 -0
  44. package/libEs6/components/DataCollector/validateUserEventOptions.js +5 -3
  45. package/libEs6/components/Identity/getIdentity/getIdentityOptionsValidator.js +1 -1
  46. package/libEs6/components/Personalization/constants/propositionEventType.js +15 -0
  47. package/libEs6/components/Personalization/createCollect.js +2 -1
  48. package/libEs6/components/Personalization/createComponent.js +9 -1
  49. package/libEs6/components/Personalization/createFetchDataHandler.js +1 -5
  50. package/libEs6/components/Personalization/createOnClickHandler.js +2 -1
  51. package/libEs6/components/Personalization/createSetTargetMigration.js +27 -0
  52. package/libEs6/components/Personalization/createViewChangeHandler.js +2 -1
  53. package/libEs6/components/Personalization/event.js +6 -2
  54. package/libEs6/components/Personalization/index.js +14 -4
  55. package/libEs6/constants/cookieNameKey.js +2 -1
  56. package/libEs6/constants/highEntropyUserAgentClientHints.js +12 -0
  57. package/libEs6/constants/legacyCookies.js +14 -0
  58. package/libEs6/constants/libraryVersion.js +1 -1
  59. package/libEs6/core/createCookieTransfer.js +3 -10
  60. package/libEs6/core/createEventManager.js +32 -2
  61. package/libEs6/core/edgeNetwork/handleRequestFailure.js +14 -0
  62. package/libEs6/core/edgeNetwork/injectApplyResponse.js +48 -0
  63. package/libEs6/core/edgeNetwork/injectGetLocationHint.js +17 -1
  64. package/libEs6/core/edgeNetwork/injectSendEdgeNetworkRequest.js +5 -21
  65. package/libEs6/core/edgeNetwork/mergeLifecycleResponses.js +9 -0
  66. package/libEs6/core/index.js +17 -3
  67. package/libEs6/core/injectShouldTransferCookie.js +24 -0
  68. package/libEs6/utils/isUnique.js +32 -0
  69. package/libEs6/utils/request/createRequestPayload.js +1 -0
  70. package/libEs6/utils/validateIdentityMap.js +1 -1
  71. package/libEs6/utils/validation/createUniqueItemsValidator.js +18 -0
  72. package/libEs6/utils/validation/index.js +7 -1
  73. package/package.json +4 -3
@@ -0,0 +1,24 @@
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 { isNamespacedCookieName } from "../utils";
13
+ import { AT_QA_MODE, MBOX } from "../constants/legacyCookies";
14
+ export default (({
15
+ orgId,
16
+ targetMigrationEnabled
17
+ }) => name => {
18
+ // We have a contract with the server that we will pass
19
+ // all cookies whose names are namespaced according to the
20
+ // logic in isNamespacedCookieName as well as any legacy
21
+ // cookie names (so that the server can handle migrating
22
+ // identities on websites previously using Visitor.js)
23
+ return isNamespacedCookieName(orgId, name) || name === AT_QA_MODE || targetMigrationEnabled && name === MBOX;
24
+ });
@@ -0,0 +1,32 @@
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
+
13
+ /**
14
+ * Returns whether an array contains unique values.
15
+ * @param {*} value
16
+ * @returns {boolean}
17
+ */
18
+ export default (values => {
19
+ const storedVals = Object.create(null);
20
+
21
+ for (let i = 0; i < values.length; i += 1) {
22
+ const item = values[i];
23
+
24
+ if (item in storedVals) {
25
+ return false;
26
+ }
27
+
28
+ storedVals[item] = true;
29
+ }
30
+
31
+ return true;
32
+ });
@@ -19,6 +19,7 @@ export default (options => {
19
19
  hasIdentity
20
20
  } = options;
21
21
  return {
22
+ mergeMeta: createMerger(content, "meta"),
22
23
  mergeState: createMerger(content, "meta.state"),
23
24
  mergeQuery: createMerger(content, "query"),
24
25
  addIdentity,
@@ -19,4 +19,4 @@ export default mapOfValues(arrayOf(objectOf({
19
19
  }).noUnknownFields(),
20
20
  primary: boolean(),
21
21
  xid: string()
22
- })).required());
22
+ }).noUnknownFields()).required());
@@ -0,0 +1,18 @@
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 assertValid from "./assertValid";
13
+ import isUnique from "../isUnique";
14
+ export default (() => {
15
+ return (value, path) => {
16
+ assertValid(isUnique(value), value, path, "array values to be unique");
17
+ };
18
+ });
@@ -24,6 +24,7 @@ import createNonEmptyValidator from "./createNonEmptyValidator";
24
24
  import createObjectOfValidator from "./createObjectOfValidator";
25
25
  import createAnyOfValidator from "./createAnyOfValidator";
26
26
  import createUniqueValidator from "./createUniqueValidator";
27
+ import createUniqueItemsValidator from "./createUniqueItemsValidator";
27
28
  import domainValidator from "./domainValidator";
28
29
  import integerValidator from "./integerValidator";
29
30
  import numberValidator from "./numberValidator";
@@ -80,6 +81,10 @@ const regexp = function regexp() {
80
81
 
81
82
  const unique = function createUnique() {
82
83
  return nullSafeChain(this, createUniqueValidator());
84
+ };
85
+
86
+ const uniqueItems = function createUniqueItems() {
87
+ return nullSafeChain(this, createUniqueItemsValidator());
83
88
  }; // top-level validators. These are the first functions that are called to create a validator.
84
89
 
85
90
 
@@ -95,7 +100,8 @@ const anything = function anything() {
95
100
 
96
101
  const arrayOf = function arrayOf(elementValidator) {
97
102
  return nullSafeChain(this, createArrayOfValidator(elementValidator), {
98
- nonEmpty: nonEmptyArray
103
+ nonEmpty: nonEmptyArray,
104
+ uniqueItems
99
105
  });
100
106
  };
101
107
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/alloy",
3
- "version": "2.12.0-beta.0",
3
+ "version": "2.13.0-beta.0",
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",
67
+ "@adobe/alloy": "^2.12.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",
@@ -100,6 +100,7 @@
100
100
  "karma-sauce-launcher": "^4.3.6",
101
101
  "karma-spec-reporter": "0.0.32",
102
102
  "lint-staged": "^10.5.4",
103
+ "node-fetch": "^2.6.7",
103
104
  "prettier": "^1.16.4",
104
105
  "promise-polyfill": "^8.1.0",
105
106
  "read-cache": "^1.0.0",
@@ -116,7 +117,7 @@
116
117
  "rollup-plugin-terser": "^7.0.2",
117
118
  "semver": "^7.3.7",
118
119
  "start-server-and-test": "^1.10.6",
119
- "testcafe": "^1.17.1",
120
+ "testcafe": "^1.19.0",
120
121
  "testcafe-browser-provider-saucelabs": "^1.8.3",
121
122
  "testcafe-reporter-testrail": "^0.6.3",
122
123
  "url-exists-nodejs": "^0.1.0",