@adobe/alloy 2.14.0-alpha.20 → 2.14.0-alpha.21
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/DataCollector/index.js +10 -26
- package/libEs5/components/DataCollector/validateUserEventOptions.js +1 -2
- package/libEs5/components/Identity/appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js +1 -4
- package/libEs5/components/Identity/createComponent.js +2 -2
- package/libEs5/components/Identity/getIdentity/createGetIdentity.js +3 -11
- package/libEs5/components/Identity/getIdentity/getIdentityOptionsValidator.js +11 -8
- package/libEs5/components/Identity/index.js +4 -8
- package/libEs5/components/Privacy/createComponent.js +2 -4
- package/libEs5/components/Privacy/index.js +1 -2
- package/libEs5/components/Privacy/injectSendSetConsentRequest.js +2 -6
- package/libEs5/components/Privacy/validateSetConsentOptions.js +1 -2
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/core/config/createCoreConfigs.js +1 -2
- package/libEs5/core/createEventManager.js +1 -5
- package/libEs5/utils/index.js +0 -24
- package/libEs5/utils/request/createRequestPayload.js +0 -6
- package/libEs6/components/DataCollector/index.js +10 -25
- package/libEs6/components/DataCollector/validateUserEventOptions.js +2 -3
- package/libEs6/components/Identity/appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js +1 -3
- package/libEs6/components/Identity/createComponent.js +2 -2
- package/libEs6/components/Identity/getIdentity/createGetIdentity.js +3 -10
- package/libEs6/components/Identity/getIdentity/getIdentityOptionsValidator.js +10 -6
- package/libEs6/components/Identity/index.js +4 -8
- package/libEs6/components/Privacy/createComponent.js +2 -4
- package/libEs6/components/Privacy/index.js +1 -2
- package/libEs6/components/Privacy/injectSendSetConsentRequest.js +2 -6
- package/libEs6/components/Privacy/validateSetConsentOptions.js +2 -3
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/core/config/createCoreConfigs.js +2 -3
- package/libEs6/core/createEventManager.js +1 -5
- package/libEs6/utils/index.js +0 -3
- package/libEs6/utils/request/createRequestPayload.js +1 -3
- package/package.json +2 -2
- package/libEs5/utils/filterObject.js +0 -57
- package/libEs5/utils/prepareConfigOverridesForEdge.js +0 -61
- package/libEs5/utils/validateConfigOverride.js +0 -20
- package/libEs6/utils/filterObject.js +0 -59
- package/libEs6/utils/prepareConfigOverridesForEdge.js +0 -57
- package/libEs6/utils/validateConfigOverride.js +0 -13
|
@@ -6,8 +6,6 @@ var _validateUserEventOptions = require("./validateUserEventOptions");
|
|
|
6
6
|
|
|
7
7
|
var _validateApplyResponse = require("./validateApplyResponse");
|
|
8
8
|
|
|
9
|
-
var _utils = require("../../utils");
|
|
10
|
-
|
|
11
9
|
/*
|
|
12
10
|
Copyright 2019 Adobe. All rights reserved.
|
|
13
11
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -20,8 +18,7 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
20
18
|
governing permissions and limitations under the License.
|
|
21
19
|
*/
|
|
22
20
|
var createDataCollector = function createDataCollector(_ref) {
|
|
23
|
-
var eventManager = _ref.eventManager
|
|
24
|
-
logger = _ref.logger;
|
|
21
|
+
var eventManager = _ref.eventManager;
|
|
25
22
|
return {
|
|
26
23
|
commands: {
|
|
27
24
|
sendEvent: {
|
|
@@ -44,8 +41,7 @@ var createDataCollector = function createDataCollector(_ref) {
|
|
|
44
41
|
decisionScopes = _options$decisionScop === void 0 ? [] : _options$decisionScop,
|
|
45
42
|
_options$personalizat = options.personalization,
|
|
46
43
|
personalization = _options$personalizat === void 0 ? {} : _options$personalizat,
|
|
47
|
-
datasetId = options.datasetId
|
|
48
|
-
edgeConfigOverrides = options.edgeConfigOverrides;
|
|
44
|
+
datasetId = options.datasetId;
|
|
49
45
|
var event = eventManager.createEvent();
|
|
50
46
|
|
|
51
47
|
if (documentUnloading) {
|
|
@@ -67,31 +63,19 @@ var createDataCollector = function createDataCollector(_ref) {
|
|
|
67
63
|
});
|
|
68
64
|
}
|
|
69
65
|
|
|
70
|
-
var sendEventOptions = {
|
|
71
|
-
renderDecisions: renderDecisions,
|
|
72
|
-
decisionScopes: decisionScopes,
|
|
73
|
-
personalization: personalization
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
if (edgeConfigOverrides) {
|
|
77
|
-
sendEventOptions.edgeConfigOverrides = edgeConfigOverrides;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
66
|
if (datasetId) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
com_adobe_experience_platform: {
|
|
85
|
-
datasets: {
|
|
86
|
-
event: {
|
|
87
|
-
datasetId: datasetId
|
|
88
|
-
}
|
|
89
|
-
}
|
|
67
|
+
event.mergeMeta({
|
|
68
|
+
collect: {
|
|
69
|
+
datasetId: datasetId
|
|
90
70
|
}
|
|
91
71
|
});
|
|
92
72
|
}
|
|
93
73
|
|
|
94
|
-
return eventManager.sendEvent(event,
|
|
74
|
+
return eventManager.sendEvent(event, {
|
|
75
|
+
renderDecisions: renderDecisions,
|
|
76
|
+
decisionScopes: decisionScopes,
|
|
77
|
+
personalization: personalization
|
|
78
|
+
});
|
|
95
79
|
}
|
|
96
80
|
},
|
|
97
81
|
applyResponse: {
|
|
@@ -40,8 +40,7 @@ var _default = function _default(_ref) {
|
|
|
40
40
|
surfaces: (0, _validation.arrayOf)((0, _validation.string)()).uniqueItems()
|
|
41
41
|
}),
|
|
42
42
|
datasetId: (0, _validation.string)(),
|
|
43
|
-
mergeId: (0, _validation.string)()
|
|
44
|
-
edgeConfigOverrides: _utils.validateConfigOverride
|
|
43
|
+
mergeId: (0, _validation.string)()
|
|
45
44
|
}).required().noUnknownFields();
|
|
46
45
|
return eventOptionsValidator(options);
|
|
47
46
|
};
|
package/libEs5/components/Identity/appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js
CHANGED
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
exports.default = void 0;
|
|
4
4
|
|
|
5
|
-
var _utils = require("../../../utils");
|
|
6
|
-
|
|
7
5
|
var _validation = require("../../../utils/validation");
|
|
8
6
|
|
|
9
7
|
/*
|
|
@@ -24,8 +22,7 @@ governing permissions and limitations under the License.
|
|
|
24
22
|
* @returns {*} Validated options
|
|
25
23
|
*/
|
|
26
24
|
var _default = (0, _validation.objectOf)({
|
|
27
|
-
url: (0, _validation.string)().required().nonEmpty()
|
|
28
|
-
edgeConfigOverrides: _utils.validateConfigOverride
|
|
25
|
+
url: (0, _validation.string)().required().nonEmpty()
|
|
29
26
|
}).required().noUnknownFields();
|
|
30
27
|
|
|
31
28
|
exports.default = _default;
|
|
@@ -60,7 +60,7 @@ var _default = function _default(_ref) {
|
|
|
60
60
|
optionsValidator: _getIdentityOptionsValidator.default,
|
|
61
61
|
run: function run(options) {
|
|
62
62
|
return consent.awaitConsent().then(function () {
|
|
63
|
-
return ecid ? undefined : getIdentity(options);
|
|
63
|
+
return ecid ? undefined : getIdentity(options.namespaces);
|
|
64
64
|
}).then(function () {
|
|
65
65
|
return {
|
|
66
66
|
identity: {
|
|
@@ -75,7 +75,7 @@ var _default = function _default(_ref) {
|
|
|
75
75
|
optionsValidator: _appendIdentityToUrlOptionsValidator.default,
|
|
76
76
|
run: function run(options) {
|
|
77
77
|
return consent.withConsent().then(function () {
|
|
78
|
-
return ecid ? undefined : getIdentity(options);
|
|
78
|
+
return ecid ? undefined : getIdentity(options.namespaces);
|
|
79
79
|
}).then(function () {
|
|
80
80
|
return {
|
|
81
81
|
url: appendIdentityToUrl(ecid, options.url)
|
|
@@ -16,18 +16,10 @@ governing permissions and limitations under the License.
|
|
|
16
16
|
var _default = function _default(_ref) {
|
|
17
17
|
var sendEdgeNetworkRequest = _ref.sendEdgeNetworkRequest,
|
|
18
18
|
createIdentityRequestPayload = _ref.createIdentityRequestPayload,
|
|
19
|
-
createIdentityRequest = _ref.createIdentityRequest
|
|
20
|
-
|
|
21
|
-
return function () {
|
|
22
|
-
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
23
|
-
namespaces = _ref2.namespaces,
|
|
24
|
-
localConfigOverrides = _ref2.edgeConfigOverrides;
|
|
25
|
-
|
|
19
|
+
createIdentityRequest = _ref.createIdentityRequest;
|
|
20
|
+
return function (namespaces) {
|
|
26
21
|
var payload = createIdentityRequestPayload(namespaces);
|
|
27
|
-
var request = createIdentityRequest(payload);
|
|
28
|
-
|
|
29
|
-
payload.mergeConfigOverride(globalConfigOverrides);
|
|
30
|
-
payload.mergeConfigOverride(localConfigOverrides);
|
|
22
|
+
var request = createIdentityRequest(payload);
|
|
31
23
|
return sendEdgeNetworkRequest({
|
|
32
24
|
request: request
|
|
33
25
|
});
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
exports.default = void 0;
|
|
4
4
|
|
|
5
|
-
var _utils = require("../../../utils");
|
|
6
|
-
|
|
7
5
|
var _validation = require("../../../utils/validation");
|
|
8
6
|
|
|
9
7
|
/*
|
|
@@ -23,11 +21,16 @@ governing permissions and limitations under the License.
|
|
|
23
21
|
* @param {*} options The user event options to validate
|
|
24
22
|
* @returns {*} Validated options
|
|
25
23
|
*/
|
|
26
|
-
var _default = (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}).noUnknownFields()
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
var _default = function _default(options) {
|
|
25
|
+
var getIdentityOptionsValidator = (0, _validation.objectOf)({
|
|
26
|
+
namespaces: (0, _validation.arrayOf)((0, _validation.literal)("ECID")).nonEmpty().uniqueItems()
|
|
27
|
+
}).noUnknownFields();
|
|
28
|
+
getIdentityOptionsValidator(options); // Return default options for now
|
|
29
|
+
// To-Do: Accept namespace from given options
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
namespaces: ["ECID"]
|
|
33
|
+
};
|
|
34
|
+
};
|
|
32
35
|
|
|
33
36
|
exports.default = _default;
|
|
@@ -61,8 +61,7 @@ var createIdentity = function createIdentity(_ref) {
|
|
|
61
61
|
sendEdgeNetworkRequest = _ref.sendEdgeNetworkRequest,
|
|
62
62
|
apexDomain = _ref.apexDomain;
|
|
63
63
|
var orgId = config.orgId,
|
|
64
|
-
thirdPartyCookiesEnabled = config.thirdPartyCookiesEnabled
|
|
65
|
-
globalConfigOverrides = config.edgeConfigOverrides;
|
|
64
|
+
thirdPartyCookiesEnabled = config.thirdPartyCookiesEnabled;
|
|
66
65
|
var getEcidFromVisitor = (0, _injectGetEcidFromVisitor.default)({
|
|
67
66
|
logger: logger,
|
|
68
67
|
orgId: orgId,
|
|
@@ -85,8 +84,7 @@ var createIdentity = function createIdentity(_ref) {
|
|
|
85
84
|
var getIdentity = (0, _createGetIdentity.default)({
|
|
86
85
|
sendEdgeNetworkRequest: sendEdgeNetworkRequest,
|
|
87
86
|
createIdentityRequestPayload: _createIdentityRequestPayload.default,
|
|
88
|
-
createIdentityRequest: _createIdentityRequest.default
|
|
89
|
-
globalConfigOverrides: globalConfigOverrides
|
|
87
|
+
createIdentityRequest: _createIdentityRequest.default
|
|
90
88
|
});
|
|
91
89
|
var setDomainForInitialIdentityPayload = (0, _injectSetDomainForInitialIdentityPayload.default)({
|
|
92
90
|
thirdPartyCookiesEnabled: thirdPartyCookiesEnabled,
|
|
@@ -126,8 +124,7 @@ var createIdentity = function createIdentity(_ref) {
|
|
|
126
124
|
dateProvider: function dateProvider() {
|
|
127
125
|
return new Date();
|
|
128
126
|
},
|
|
129
|
-
orgId: orgId
|
|
130
|
-
globalConfigOverrides: globalConfigOverrides
|
|
127
|
+
orgId: orgId
|
|
131
128
|
});
|
|
132
129
|
return (0, _createComponent.default)({
|
|
133
130
|
addEcidQueryToPayload: _addEcidQueryToPayload.default,
|
|
@@ -139,8 +136,7 @@ var createIdentity = function createIdentity(_ref) {
|
|
|
139
136
|
getIdentity: getIdentity,
|
|
140
137
|
consent: consent,
|
|
141
138
|
appendIdentityToUrl: appendIdentityToUrl,
|
|
142
|
-
logger: logger
|
|
143
|
-
config: config
|
|
139
|
+
logger: logger
|
|
144
140
|
});
|
|
145
141
|
};
|
|
146
142
|
|
|
@@ -52,16 +52,14 @@ var _default = function _default(_ref) {
|
|
|
52
52
|
optionsValidator: validateSetConsentOptions,
|
|
53
53
|
run: function run(_ref2) {
|
|
54
54
|
var consentOptions = _ref2.consent,
|
|
55
|
-
identityMap = _ref2.identityMap
|
|
56
|
-
edgeConfigOverrides = _ref2.edgeConfigOverrides;
|
|
55
|
+
identityMap = _ref2.identityMap;
|
|
57
56
|
consent.suspend();
|
|
58
57
|
var consentHashes = consentHashStore.lookup(consentOptions);
|
|
59
58
|
return taskQueue.addTask(function () {
|
|
60
59
|
if (consentHashes.isNew()) {
|
|
61
60
|
return sendSetConsentRequest({
|
|
62
61
|
consentOptions: consentOptions,
|
|
63
|
-
identityMap: identityMap
|
|
64
|
-
edgeConfigOverrides: edgeConfigOverrides
|
|
62
|
+
identityMap: identityMap
|
|
65
63
|
});
|
|
66
64
|
}
|
|
67
65
|
|
|
@@ -47,8 +47,7 @@ var createPrivacy = function createPrivacy(_ref) {
|
|
|
47
47
|
var sendSetConsentRequest = (0, _injectSendSetConsentRequest.default)({
|
|
48
48
|
createConsentRequestPayload: _createConsentRequestPayload.default,
|
|
49
49
|
createConsentRequest: _createConsentRequest.default,
|
|
50
|
-
sendEdgeNetworkRequest: sendEdgeNetworkRequest
|
|
51
|
-
edgeConfigOverrides: config.edgeConfigOverrides
|
|
50
|
+
sendEdgeNetworkRequest: sendEdgeNetworkRequest
|
|
52
51
|
});
|
|
53
52
|
var storage = createNamespacedStorage((0, _utils.sanitizeOrgIdForCookieName)(orgId) + ".consentHashes.");
|
|
54
53
|
var consentHashStore = (0, _createConsentHashStore.default)({
|
|
@@ -18,16 +18,12 @@ governing permissions and limitations under the License.
|
|
|
18
18
|
var _default = function _default(_ref) {
|
|
19
19
|
var createConsentRequestPayload = _ref.createConsentRequestPayload,
|
|
20
20
|
createConsentRequest = _ref.createConsentRequest,
|
|
21
|
-
sendEdgeNetworkRequest = _ref.sendEdgeNetworkRequest
|
|
22
|
-
globalConfigOverrides = _ref.edgeConfigOverrides;
|
|
21
|
+
sendEdgeNetworkRequest = _ref.sendEdgeNetworkRequest;
|
|
23
22
|
return function (_ref2) {
|
|
24
23
|
var consentOptions = _ref2.consentOptions,
|
|
25
|
-
identityMap = _ref2.identityMap
|
|
26
|
-
localConfigOverrides = _ref2.edgeConfigOverrides;
|
|
24
|
+
identityMap = _ref2.identityMap;
|
|
27
25
|
var payload = createConsentRequestPayload();
|
|
28
26
|
payload.setConsent(consentOptions);
|
|
29
|
-
payload.mergeConfigOverride(globalConfigOverrides);
|
|
30
|
-
payload.mergeConfigOverride(localConfigOverrides);
|
|
31
27
|
|
|
32
28
|
if ((0, _utils.isObject)(identityMap)) {
|
|
33
29
|
Object.keys(identityMap).forEach(function (key) {
|
|
@@ -8,8 +8,7 @@ var _utils = require("../../utils");
|
|
|
8
8
|
|
|
9
9
|
var _default = (0, _validation.objectOf)({
|
|
10
10
|
consent: (0, _validation.arrayOf)((0, _validation.anything)()).required().nonEmpty(),
|
|
11
|
-
identityMap: _utils.validateIdentityMap
|
|
12
|
-
edgeConfigOverrides: _utils.validateConfigOverride
|
|
11
|
+
identityMap: _utils.validateIdentityMap
|
|
13
12
|
}).noUnknownFields().required();
|
|
14
13
|
|
|
15
14
|
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.14.0-alpha.
|
|
18
|
+
var _default = "2.14.0-alpha.21";
|
|
19
19
|
exports.default = _default;
|
|
@@ -31,8 +31,7 @@ var _default = function _default() {
|
|
|
31
31
|
edgeDomain: (0, _validation.string)().domain().default(_domain.EDGE),
|
|
32
32
|
edgeBasePath: (0, _validation.string)().nonEmpty().default(_edgeBasePath.default),
|
|
33
33
|
orgId: (0, _validation.string)().unique().required(),
|
|
34
|
-
onBeforeEventSend: (0, _validation.callback)().default(_utils.noop)
|
|
35
|
-
edgeConfigOverrides: _utils.validateConfigOverride
|
|
34
|
+
onBeforeEventSend: (0, _validation.callback)().default(_utils.noop)
|
|
36
35
|
};
|
|
37
36
|
};
|
|
38
37
|
|
|
@@ -29,8 +29,7 @@ var _default = function _default(_ref) {
|
|
|
29
29
|
createDataCollectionRequest = _ref.createDataCollectionRequest,
|
|
30
30
|
sendEdgeNetworkRequest = _ref.sendEdgeNetworkRequest,
|
|
31
31
|
_applyResponse = _ref.applyResponse;
|
|
32
|
-
var onBeforeEventSend = config.onBeforeEventSend
|
|
33
|
-
globalConfigOverrides = config.edgeConfigOverrides;
|
|
32
|
+
var onBeforeEventSend = config.onBeforeEventSend;
|
|
34
33
|
return {
|
|
35
34
|
createEvent: createEvent,
|
|
36
35
|
|
|
@@ -55,14 +54,11 @@ var _default = function _default(_ref) {
|
|
|
55
54
|
var _options$renderDecisi = options.renderDecisions,
|
|
56
55
|
renderDecisions = _options$renderDecisi === void 0 ? false : _options$renderDecisi,
|
|
57
56
|
decisionScopes = options.decisionScopes,
|
|
58
|
-
localConfigOverrides = options.edgeConfigOverrides,
|
|
59
57
|
personalization = options.personalization;
|
|
60
58
|
var payload = createDataCollectionRequestPayload();
|
|
61
59
|
var request = createDataCollectionRequest(payload);
|
|
62
60
|
var onResponseCallbackAggregator = (0, _utils.createCallbackAggregator)();
|
|
63
61
|
var onRequestFailureCallbackAggregator = (0, _utils.createCallbackAggregator)();
|
|
64
|
-
payload.mergeConfigOverride(globalConfigOverrides);
|
|
65
|
-
payload.mergeConfigOverride(localConfigOverrides);
|
|
66
62
|
return lifecycle.onBeforeEvent({
|
|
67
63
|
event: event,
|
|
68
64
|
renderDecisions: renderDecisions,
|
package/libEs5/utils/index.js
CHANGED
|
@@ -78,12 +78,6 @@ Object.defineProperty(exports, "endsWith", {
|
|
|
78
78
|
return _endsWith.default;
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
|
-
Object.defineProperty(exports, "filterObject", {
|
|
82
|
-
enumerable: true,
|
|
83
|
-
get: function get() {
|
|
84
|
-
return _filterObject.default;
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
81
|
Object.defineProperty(exports, "find", {
|
|
88
82
|
enumerable: true,
|
|
89
83
|
get: function get() {
|
|
@@ -240,12 +234,6 @@ Object.defineProperty(exports, "padStart", {
|
|
|
240
234
|
return _padStart.default;
|
|
241
235
|
}
|
|
242
236
|
});
|
|
243
|
-
Object.defineProperty(exports, "prepareConfigOverridesForEdge", {
|
|
244
|
-
enumerable: true,
|
|
245
|
-
get: function get() {
|
|
246
|
-
return _prepareConfigOverridesForEdge.default;
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
237
|
Object.defineProperty(exports, "queryString", {
|
|
250
238
|
enumerable: true,
|
|
251
239
|
get: function get() {
|
|
@@ -312,12 +300,6 @@ Object.defineProperty(exports, "uuid", {
|
|
|
312
300
|
return _uuid.default;
|
|
313
301
|
}
|
|
314
302
|
});
|
|
315
|
-
Object.defineProperty(exports, "validateConfigOverride", {
|
|
316
|
-
enumerable: true,
|
|
317
|
-
get: function get() {
|
|
318
|
-
return _validateConfigOverride.default;
|
|
319
|
-
}
|
|
320
|
-
});
|
|
321
303
|
Object.defineProperty(exports, "validateIdentityMap", {
|
|
322
304
|
enumerable: true,
|
|
323
305
|
get: function get() {
|
|
@@ -363,8 +345,6 @@ var _fireImage = require("./fireImage");
|
|
|
363
345
|
|
|
364
346
|
var _injectFireReferrerHideableImage = require("./injectFireReferrerHideableImage");
|
|
365
347
|
|
|
366
|
-
var _filterObject = require("./filterObject");
|
|
367
|
-
|
|
368
348
|
var _flatMap = require("./flatMap");
|
|
369
349
|
|
|
370
350
|
var _getApexDomain = require("./getApexDomain");
|
|
@@ -411,8 +391,6 @@ var _noop = require("./noop");
|
|
|
411
391
|
|
|
412
392
|
var _padStart = require("./padStart");
|
|
413
393
|
|
|
414
|
-
var _prepareConfigOverridesForEdge = require("./prepareConfigOverridesForEdge");
|
|
415
|
-
|
|
416
394
|
var _querystring = require("./querystring");
|
|
417
395
|
|
|
418
396
|
var _sanitizeOrgIdForCookieName = require("./sanitizeOrgIdForCookieName");
|
|
@@ -437,6 +415,4 @@ var _updateErrorMessage = require("./updateErrorMessage");
|
|
|
437
415
|
|
|
438
416
|
var _validateIdentityMap = require("./validateIdentityMap");
|
|
439
417
|
|
|
440
|
-
var _validateConfigOverride = require("./validateConfigOverride");
|
|
441
|
-
|
|
442
418
|
var _values = require("./values");
|
|
@@ -21,16 +21,10 @@ var _default = function _default(options) {
|
|
|
21
21
|
var content = options.content,
|
|
22
22
|
addIdentity = options.addIdentity,
|
|
23
23
|
hasIdentity = options.hasIdentity;
|
|
24
|
-
|
|
25
|
-
var _mergeConfigOverride = (0, _.createMerger)(content, "meta.configOverrides");
|
|
26
|
-
|
|
27
24
|
return {
|
|
28
25
|
mergeMeta: (0, _.createMerger)(content, "meta"),
|
|
29
26
|
mergeState: (0, _.createMerger)(content, "meta.state"),
|
|
30
27
|
mergeQuery: (0, _.createMerger)(content, "query"),
|
|
31
|
-
mergeConfigOverride: function mergeConfigOverride(updates) {
|
|
32
|
-
return _mergeConfigOverride((0, _.prepareConfigOverridesForEdge)(updates));
|
|
33
|
-
},
|
|
34
28
|
addIdentity: addIdentity,
|
|
35
29
|
hasIdentity: hasIdentity,
|
|
36
30
|
toJSON: function toJSON() {
|
|
@@ -11,11 +11,9 @@ governing permissions and limitations under the License.
|
|
|
11
11
|
*/
|
|
12
12
|
import validateUserEventOptions from "./validateUserEventOptions";
|
|
13
13
|
import validateApplyResponse from "./validateApplyResponse";
|
|
14
|
-
import { deepAssign } from "../../utils";
|
|
15
14
|
|
|
16
15
|
const createDataCollector = ({
|
|
17
|
-
eventManager
|
|
18
|
-
logger
|
|
16
|
+
eventManager
|
|
19
17
|
}) => {
|
|
20
18
|
return {
|
|
21
19
|
commands: {
|
|
@@ -37,8 +35,7 @@ const createDataCollector = ({
|
|
|
37
35
|
decisionScopes = [],
|
|
38
36
|
// Note: this option will soon be deprecated, please use personalization.decisionScopes instead
|
|
39
37
|
personalization = {},
|
|
40
|
-
datasetId
|
|
41
|
-
edgeConfigOverrides
|
|
38
|
+
datasetId
|
|
42
39
|
} = options;
|
|
43
40
|
const event = eventManager.createEvent();
|
|
44
41
|
|
|
@@ -61,31 +58,19 @@ const createDataCollector = ({
|
|
|
61
58
|
});
|
|
62
59
|
}
|
|
63
60
|
|
|
64
|
-
const sendEventOptions = {
|
|
65
|
-
renderDecisions,
|
|
66
|
-
decisionScopes,
|
|
67
|
-
personalization
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
if (edgeConfigOverrides) {
|
|
71
|
-
sendEventOptions.edgeConfigOverrides = edgeConfigOverrides;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
61
|
if (datasetId) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
com_adobe_experience_platform: {
|
|
79
|
-
datasets: {
|
|
80
|
-
event: {
|
|
81
|
-
datasetId
|
|
82
|
-
}
|
|
83
|
-
}
|
|
62
|
+
event.mergeMeta({
|
|
63
|
+
collect: {
|
|
64
|
+
datasetId
|
|
84
65
|
}
|
|
85
66
|
});
|
|
86
67
|
}
|
|
87
68
|
|
|
88
|
-
return eventManager.sendEvent(event,
|
|
69
|
+
return eventManager.sendEvent(event, {
|
|
70
|
+
renderDecisions,
|
|
71
|
+
decisionScopes,
|
|
72
|
+
personalization
|
|
73
|
+
});
|
|
89
74
|
}
|
|
90
75
|
},
|
|
91
76
|
applyResponse: {
|
|
@@ -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 { string, objectOf, boolean, arrayOf } from "../../utils/validation";
|
|
13
|
-
import {
|
|
13
|
+
import { validateIdentityMap } from "../../utils";
|
|
14
14
|
/**
|
|
15
15
|
* Verifies user provided event options.
|
|
16
16
|
* @param {*} options The user event options to validate
|
|
@@ -35,8 +35,7 @@ export default (({
|
|
|
35
35
|
surfaces: arrayOf(string()).uniqueItems()
|
|
36
36
|
}),
|
|
37
37
|
datasetId: string(),
|
|
38
|
-
mergeId: string()
|
|
39
|
-
edgeConfigOverrides: validateConfigOverride
|
|
38
|
+
mergeId: string()
|
|
40
39
|
}).required().noUnknownFields();
|
|
41
40
|
return eventOptionsValidator(options);
|
|
42
41
|
});
|
package/libEs6/components/Identity/appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js
CHANGED
|
@@ -9,7 +9,6 @@ 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 { validateConfigOverride } from "../../../utils";
|
|
13
12
|
import { objectOf, string } from "../../../utils/validation";
|
|
14
13
|
/**
|
|
15
14
|
* Verifies user provided event options.
|
|
@@ -18,6 +17,5 @@ import { objectOf, string } from "../../../utils/validation";
|
|
|
18
17
|
*/
|
|
19
18
|
|
|
20
19
|
export default objectOf({
|
|
21
|
-
url: string().required().nonEmpty()
|
|
22
|
-
edgeConfigOverrides: validateConfigOverride
|
|
20
|
+
url: string().required().nonEmpty()
|
|
23
21
|
}).required().noUnknownFields();
|
|
@@ -57,7 +57,7 @@ export default (({
|
|
|
57
57
|
optionsValidator: getIdentityOptionsValidator,
|
|
58
58
|
run: options => {
|
|
59
59
|
return consent.awaitConsent().then(() => {
|
|
60
|
-
return ecid ? undefined : getIdentity(options);
|
|
60
|
+
return ecid ? undefined : getIdentity(options.namespaces);
|
|
61
61
|
}).then(() => {
|
|
62
62
|
return {
|
|
63
63
|
identity: {
|
|
@@ -72,7 +72,7 @@ export default (({
|
|
|
72
72
|
optionsValidator: appendIdentityToUrlOptionsValidator,
|
|
73
73
|
run: options => {
|
|
74
74
|
return consent.withConsent().then(() => {
|
|
75
|
-
return ecid ? undefined : getIdentity(options);
|
|
75
|
+
return ecid ? undefined : getIdentity(options.namespaces);
|
|
76
76
|
}).then(() => {
|
|
77
77
|
return {
|
|
78
78
|
url: appendIdentityToUrl(ecid, options.url)
|
|
@@ -12,18 +12,11 @@ governing permissions and limitations under the License.
|
|
|
12
12
|
export default (({
|
|
13
13
|
sendEdgeNetworkRequest,
|
|
14
14
|
createIdentityRequestPayload,
|
|
15
|
-
createIdentityRequest
|
|
16
|
-
globalConfigOverrides
|
|
15
|
+
createIdentityRequest
|
|
17
16
|
}) => {
|
|
18
|
-
return
|
|
19
|
-
namespaces,
|
|
20
|
-
edgeConfigOverrides: localConfigOverrides
|
|
21
|
-
} = {}) => {
|
|
17
|
+
return namespaces => {
|
|
22
18
|
const payload = createIdentityRequestPayload(namespaces);
|
|
23
|
-
const request = createIdentityRequest(payload);
|
|
24
|
-
|
|
25
|
-
payload.mergeConfigOverride(globalConfigOverrides);
|
|
26
|
-
payload.mergeConfigOverride(localConfigOverrides);
|
|
19
|
+
const request = createIdentityRequest(payload);
|
|
27
20
|
return sendEdgeNetworkRequest({
|
|
28
21
|
request
|
|
29
22
|
});
|
|
@@ -9,7 +9,6 @@ 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 { validateConfigOverride } from "../../../utils";
|
|
13
12
|
import { objectOf, literal, arrayOf } from "../../../utils/validation";
|
|
14
13
|
/**
|
|
15
14
|
* Verifies user provided event options.
|
|
@@ -17,9 +16,14 @@ import { objectOf, literal, arrayOf } from "../../../utils/validation";
|
|
|
17
16
|
* @returns {*} Validated options
|
|
18
17
|
*/
|
|
19
18
|
|
|
20
|
-
export default
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}).noUnknownFields()
|
|
24
|
-
|
|
19
|
+
export default (options => {
|
|
20
|
+
const getIdentityOptionsValidator = objectOf({
|
|
21
|
+
namespaces: arrayOf(literal("ECID")).nonEmpty().uniqueItems()
|
|
22
|
+
}).noUnknownFields();
|
|
23
|
+
getIdentityOptionsValidator(options); // Return default options for now
|
|
24
|
+
// To-Do: Accept namespace from given options
|
|
25
|
+
|
|
26
|
+
return {
|
|
27
|
+
namespaces: ["ECID"]
|
|
28
|
+
};
|
|
25
29
|
});
|
|
@@ -40,8 +40,7 @@ const createIdentity = ({
|
|
|
40
40
|
}) => {
|
|
41
41
|
const {
|
|
42
42
|
orgId,
|
|
43
|
-
thirdPartyCookiesEnabled
|
|
44
|
-
edgeConfigOverrides: globalConfigOverrides
|
|
43
|
+
thirdPartyCookiesEnabled
|
|
45
44
|
} = config;
|
|
46
45
|
const getEcidFromVisitor = injectGetEcidFromVisitor({
|
|
47
46
|
logger,
|
|
@@ -65,8 +64,7 @@ const createIdentity = ({
|
|
|
65
64
|
const getIdentity = createGetIdentity({
|
|
66
65
|
sendEdgeNetworkRequest,
|
|
67
66
|
createIdentityRequestPayload,
|
|
68
|
-
createIdentityRequest
|
|
69
|
-
globalConfigOverrides
|
|
67
|
+
createIdentityRequest
|
|
70
68
|
});
|
|
71
69
|
const setDomainForInitialIdentityPayload = injectSetDomainForInitialIdentityPayload({
|
|
72
70
|
thirdPartyCookiesEnabled,
|
|
@@ -102,8 +100,7 @@ const createIdentity = ({
|
|
|
102
100
|
});
|
|
103
101
|
const appendIdentityToUrl = injectAppendIdentityToUrl({
|
|
104
102
|
dateProvider: () => new Date(),
|
|
105
|
-
orgId
|
|
106
|
-
globalConfigOverrides
|
|
103
|
+
orgId
|
|
107
104
|
});
|
|
108
105
|
return createComponent({
|
|
109
106
|
addEcidQueryToPayload,
|
|
@@ -115,8 +112,7 @@ const createIdentity = ({
|
|
|
115
112
|
getIdentity,
|
|
116
113
|
consent,
|
|
117
114
|
appendIdentityToUrl,
|
|
118
|
-
logger
|
|
119
|
-
config
|
|
115
|
+
logger
|
|
120
116
|
});
|
|
121
117
|
};
|
|
122
118
|
|
|
@@ -57,8 +57,7 @@ export default (({
|
|
|
57
57
|
optionsValidator: validateSetConsentOptions,
|
|
58
58
|
run: ({
|
|
59
59
|
consent: consentOptions,
|
|
60
|
-
identityMap
|
|
61
|
-
edgeConfigOverrides
|
|
60
|
+
identityMap
|
|
62
61
|
}) => {
|
|
63
62
|
consent.suspend();
|
|
64
63
|
const consentHashes = consentHashStore.lookup(consentOptions);
|
|
@@ -66,8 +65,7 @@ export default (({
|
|
|
66
65
|
if (consentHashes.isNew()) {
|
|
67
66
|
return sendSetConsentRequest({
|
|
68
67
|
consentOptions,
|
|
69
|
-
identityMap
|
|
70
|
-
edgeConfigOverrides
|
|
68
|
+
identityMap
|
|
71
69
|
});
|
|
72
70
|
}
|
|
73
71
|
|
|
@@ -38,8 +38,7 @@ const createPrivacy = ({
|
|
|
38
38
|
const sendSetConsentRequest = injectSendSetConsentRequest({
|
|
39
39
|
createConsentRequestPayload,
|
|
40
40
|
createConsentRequest,
|
|
41
|
-
sendEdgeNetworkRequest
|
|
42
|
-
edgeConfigOverrides: config.edgeConfigOverrides
|
|
41
|
+
sendEdgeNetworkRequest
|
|
43
42
|
});
|
|
44
43
|
const storage = createNamespacedStorage(`${sanitizeOrgIdForCookieName(orgId)}.consentHashes.`);
|
|
45
44
|
const consentHashStore = createConsentHashStore({
|
|
@@ -13,17 +13,13 @@ import { isObject } from "../../utils";
|
|
|
13
13
|
export default (({
|
|
14
14
|
createConsentRequestPayload,
|
|
15
15
|
createConsentRequest,
|
|
16
|
-
sendEdgeNetworkRequest
|
|
17
|
-
edgeConfigOverrides: globalConfigOverrides
|
|
16
|
+
sendEdgeNetworkRequest
|
|
18
17
|
}) => ({
|
|
19
18
|
consentOptions,
|
|
20
|
-
identityMap
|
|
21
|
-
edgeConfigOverrides: localConfigOverrides
|
|
19
|
+
identityMap
|
|
22
20
|
}) => {
|
|
23
21
|
const payload = createConsentRequestPayload();
|
|
24
22
|
payload.setConsent(consentOptions);
|
|
25
|
-
payload.mergeConfigOverride(globalConfigOverrides);
|
|
26
|
-
payload.mergeConfigOverride(localConfigOverrides);
|
|
27
23
|
|
|
28
24
|
if (isObject(identityMap)) {
|
|
29
25
|
Object.keys(identityMap).forEach(key => {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { objectOf, anything, arrayOf } from "../../utils/validation";
|
|
2
|
-
import { validateIdentityMap
|
|
2
|
+
import { validateIdentityMap } from "../../utils";
|
|
3
3
|
export default objectOf({
|
|
4
4
|
consent: arrayOf(anything()).required().nonEmpty(),
|
|
5
|
-
identityMap: validateIdentityMap
|
|
6
|
-
edgeConfigOverrides: validateConfigOverride
|
|
5
|
+
identityMap: validateIdentityMap
|
|
7
6
|
}).noUnknownFields().required();
|
|
@@ -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 { boolean, string, callback, enumOf } from "../../utils/validation";
|
|
13
|
-
import { noop
|
|
13
|
+
import { noop } from "../../utils";
|
|
14
14
|
import { EDGE as EDGE_DOMAIN } from "../../constants/domain";
|
|
15
15
|
import EDGE_BASE_PATH from "../../constants/edgeBasePath";
|
|
16
16
|
import { IN, OUT, PENDING } from "../../constants/consentStatus";
|
|
@@ -21,6 +21,5 @@ export default (() => ({
|
|
|
21
21
|
edgeDomain: string().domain().default(EDGE_DOMAIN),
|
|
22
22
|
edgeBasePath: string().nonEmpty().default(EDGE_BASE_PATH),
|
|
23
23
|
orgId: string().unique().required(),
|
|
24
|
-
onBeforeEventSend: callback().default(noop)
|
|
25
|
-
edgeConfigOverrides: validateConfigOverride
|
|
24
|
+
onBeforeEventSend: callback().default(noop)
|
|
26
25
|
}));
|
|
@@ -24,8 +24,7 @@ export default (({
|
|
|
24
24
|
applyResponse
|
|
25
25
|
}) => {
|
|
26
26
|
const {
|
|
27
|
-
onBeforeEventSend
|
|
28
|
-
edgeConfigOverrides: globalConfigOverrides
|
|
27
|
+
onBeforeEventSend
|
|
29
28
|
} = config;
|
|
30
29
|
return {
|
|
31
30
|
createEvent,
|
|
@@ -50,15 +49,12 @@ export default (({
|
|
|
50
49
|
const {
|
|
51
50
|
renderDecisions = false,
|
|
52
51
|
decisionScopes,
|
|
53
|
-
edgeConfigOverrides: localConfigOverrides,
|
|
54
52
|
personalization
|
|
55
53
|
} = options;
|
|
56
54
|
const payload = createDataCollectionRequestPayload();
|
|
57
55
|
const request = createDataCollectionRequest(payload);
|
|
58
56
|
const onResponseCallbackAggregator = createCallbackAggregator();
|
|
59
57
|
const onRequestFailureCallbackAggregator = createCallbackAggregator();
|
|
60
|
-
payload.mergeConfigOverride(globalConfigOverrides);
|
|
61
|
-
payload.mergeConfigOverride(localConfigOverrides);
|
|
62
58
|
return lifecycle.onBeforeEvent({
|
|
63
59
|
event,
|
|
64
60
|
renderDecisions,
|
package/libEs6/utils/index.js
CHANGED
|
@@ -26,7 +26,6 @@ export { default as endsWith } from "./endsWith";
|
|
|
26
26
|
export { default as find } from "./find";
|
|
27
27
|
export { default as fireImage } from "./fireImage";
|
|
28
28
|
export { default as injectFireReferrerHideableImage } from "./injectFireReferrerHideableImage";
|
|
29
|
-
export { default as filterObject } from "./filterObject";
|
|
30
29
|
export { default as flatMap } from "./flatMap";
|
|
31
30
|
export { default as getApexDomain } from "./getApexDomain";
|
|
32
31
|
export { default as getLastArrayItems } from "./getLastArrayItems";
|
|
@@ -50,7 +49,6 @@ export { default as isString } from "./isString";
|
|
|
50
49
|
export { default as memoize } from "./memoize";
|
|
51
50
|
export { default as noop } from "./noop";
|
|
52
51
|
export { default as padStart } from "./padStart";
|
|
53
|
-
export { default as prepareConfigOverridesForEdge } from "./prepareConfigOverridesForEdge";
|
|
54
52
|
export { default as queryString } from "./querystring";
|
|
55
53
|
export { default as sanitizeOrgIdForCookieName } from "./sanitizeOrgIdForCookieName";
|
|
56
54
|
export { default as stackError } from "./stackError";
|
|
@@ -63,5 +61,4 @@ export { default as toISOStringLocal } from "./toISOStringLocal";
|
|
|
63
61
|
export { default as uuid } from "./uuid";
|
|
64
62
|
export { default as updateErrorMessage } from "./updateErrorMessage";
|
|
65
63
|
export { default as validateIdentityMap } from "./validateIdentityMap";
|
|
66
|
-
export { default as validateConfigOverride } from "./validateConfigOverride";
|
|
67
64
|
export { default as values } from "./values";
|
|
@@ -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 { createMerger
|
|
12
|
+
import { createMerger } from ".."; // This provides the base functionality that all types of
|
|
13
13
|
// request payloads share.
|
|
14
14
|
|
|
15
15
|
export default (options => {
|
|
@@ -18,12 +18,10 @@ export default (options => {
|
|
|
18
18
|
addIdentity,
|
|
19
19
|
hasIdentity
|
|
20
20
|
} = options;
|
|
21
|
-
const mergeConfigOverride = createMerger(content, "meta.configOverrides");
|
|
22
21
|
return {
|
|
23
22
|
mergeMeta: createMerger(content, "meta"),
|
|
24
23
|
mergeState: createMerger(content, "meta.state"),
|
|
25
24
|
mergeQuery: createMerger(content, "query"),
|
|
26
|
-
mergeConfigOverride: updates => mergeConfigOverride(prepareConfigOverridesForEdge(updates)),
|
|
27
25
|
addIdentity,
|
|
28
26
|
hasIdentity,
|
|
29
27
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/alloy",
|
|
3
|
-
"version": "2.14.0-alpha.
|
|
3
|
+
"version": "2.14.0-alpha.21",
|
|
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.14.0-alpha.
|
|
67
|
+
"@adobe/alloy": "^2.14.0-alpha.20",
|
|
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,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.default = void 0;
|
|
4
|
-
|
|
5
|
-
var _isEmptyObject = require("./isEmptyObject");
|
|
6
|
-
|
|
7
|
-
var _isNil = require("./isNil");
|
|
8
|
-
|
|
9
|
-
var _isObject = require("./isObject");
|
|
10
|
-
|
|
11
|
-
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; }
|
|
12
|
-
|
|
13
|
-
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; }
|
|
14
|
-
|
|
15
|
-
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; }
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Given an object and a function that takes a value and returns a predicate, filter out
|
|
19
|
-
* all non-object deeply nested values that do not pass the predicate.
|
|
20
|
-
*
|
|
21
|
-
* Example: filterObject({ a: 2, b: { c: 6 } }, (val) => val > 5) returns { b { c: 6 } }
|
|
22
|
-
*
|
|
23
|
-
* @param {*} obj
|
|
24
|
-
* @param {* => boolean} predicate a function that takes a value and return a boolean,
|
|
25
|
-
* representing if it should be included in the result object or not.
|
|
26
|
-
* @returns A copy of the original object with the values that fail the predicate, filtered out.
|
|
27
|
-
*/
|
|
28
|
-
var filterObject = function filterObject(obj, predicate) {
|
|
29
|
-
if ((0, _isNil.default)(obj) || !(0, _isObject.default)(obj)) {
|
|
30
|
-
return obj;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return Object.keys(obj).reduce(function (result, key) {
|
|
34
|
-
var value = obj[key];
|
|
35
|
-
|
|
36
|
-
if ((0, _isObject.default)(value)) {
|
|
37
|
-
// value is object, go deeper
|
|
38
|
-
var filteredValue = filterObject(value, predicate);
|
|
39
|
-
|
|
40
|
-
if ((0, _isEmptyObject.default)(filteredValue)) {
|
|
41
|
-
return result;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, key, filteredValue));
|
|
45
|
-
} // value is not an object, test predicate
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (predicate(value)) {
|
|
49
|
-
return _objectSpread(_objectSpread({}, result), {}, _defineProperty({}, key, value));
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return result;
|
|
53
|
-
}, {});
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
var _default = filterObject;
|
|
57
|
-
exports.default = _default;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.default = void 0;
|
|
4
|
-
|
|
5
|
-
var _isNil = require("./isNil");
|
|
6
|
-
|
|
7
|
-
var _filterObject = require("./filterObject");
|
|
8
|
-
|
|
9
|
-
var _isEmptyObject = require("./isEmptyObject");
|
|
10
|
-
|
|
11
|
-
var _isNonEmptyArray = require("./isNonEmptyArray");
|
|
12
|
-
|
|
13
|
-
var _isNonEmptyString = require("./isNonEmptyString");
|
|
14
|
-
|
|
15
|
-
var _isNumber = require("./isNumber");
|
|
16
|
-
|
|
17
|
-
var _isBoolean = require("./isBoolean");
|
|
18
|
-
|
|
19
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
20
|
-
|
|
21
|
-
// We want to avoid mapping between specific keys because we want Konductor
|
|
22
|
-
// to be able to add overrides in the future without us needing to make
|
|
23
|
-
// any changes to the Web SDK
|
|
24
|
-
var _default = function _default(configuration) {
|
|
25
|
-
if ((0, _isNil.default)(configuration) || _typeof(configuration) !== "object") {
|
|
26
|
-
return null;
|
|
27
|
-
} // remove entries that are empty strings or arrays
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
var configOverrides = (0, _filterObject.default)(configuration, function (value) {
|
|
31
|
-
if ((0, _isNil.default)(value)) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if ((0, _isBoolean.default)(value)) {
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if ((0, _isNumber.default)(value)) {
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if ((0, _isNonEmptyString.default)(value)) {
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if ((0, _isNonEmptyArray.default)(value)) {
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return false;
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
if ((0, _isEmptyObject.default)(configOverrides)) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return configOverrides;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
exports.default = _default;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.default = void 0;
|
|
4
|
-
|
|
5
|
-
var _validation = require("./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
|
-
var _default = (0, _validation.objectOf)({});
|
|
19
|
-
|
|
20
|
-
exports.default = _default;
|
|
@@ -1,59 +0,0 @@
|
|
|
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 isEmptyObject from "./isEmptyObject";
|
|
13
|
-
import isNil from "./isNil";
|
|
14
|
-
import isObject from "./isObject";
|
|
15
|
-
/**
|
|
16
|
-
* Given an object and a function that takes a value and returns a predicate, filter out
|
|
17
|
-
* all non-object deeply nested values that do not pass the predicate.
|
|
18
|
-
*
|
|
19
|
-
* Example: filterObject({ a: 2, b: { c: 6 } }, (val) => val > 5) returns { b { c: 6 } }
|
|
20
|
-
*
|
|
21
|
-
* @param {*} obj
|
|
22
|
-
* @param {* => boolean} predicate a function that takes a value and return a boolean,
|
|
23
|
-
* representing if it should be included in the result object or not.
|
|
24
|
-
* @returns A copy of the original object with the values that fail the predicate, filtered out.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
const filterObject = (obj, predicate) => {
|
|
28
|
-
if (isNil(obj) || !isObject(obj)) {
|
|
29
|
-
return obj;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return Object.keys(obj).reduce((result, key) => {
|
|
33
|
-
const value = obj[key];
|
|
34
|
-
|
|
35
|
-
if (isObject(value)) {
|
|
36
|
-
// value is object, go deeper
|
|
37
|
-
const filteredValue = filterObject(value, predicate);
|
|
38
|
-
|
|
39
|
-
if (isEmptyObject(filteredValue)) {
|
|
40
|
-
return result;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return { ...result,
|
|
44
|
-
[key]: filteredValue
|
|
45
|
-
};
|
|
46
|
-
} // value is not an object, test predicate
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (predicate(value)) {
|
|
50
|
-
return { ...result,
|
|
51
|
-
[key]: value
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return result;
|
|
56
|
-
}, {});
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export default filterObject;
|
|
@@ -1,57 +0,0 @@
|
|
|
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 isNil from "./isNil";
|
|
13
|
-
import filterObject from "./filterObject";
|
|
14
|
-
import isEmptyObject from "./isEmptyObject";
|
|
15
|
-
import isNonEmptyArray from "./isNonEmptyArray";
|
|
16
|
-
import isNonEmptyString from "./isNonEmptyString";
|
|
17
|
-
import isNumber from "./isNumber";
|
|
18
|
-
import isBoolean from "./isBoolean"; // We want to avoid mapping between specific keys because we want Konductor
|
|
19
|
-
// to be able to add overrides in the future without us needing to make
|
|
20
|
-
// any changes to the Web SDK
|
|
21
|
-
|
|
22
|
-
export default (configuration => {
|
|
23
|
-
if (isNil(configuration) || typeof configuration !== "object") {
|
|
24
|
-
return null;
|
|
25
|
-
} // remove entries that are empty strings or arrays
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const configOverrides = filterObject(configuration, value => {
|
|
29
|
-
if (isNil(value)) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (isBoolean(value)) {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (isNumber(value)) {
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (isNonEmptyString(value)) {
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (isNonEmptyArray(value)) {
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return false;
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
if (isEmptyObject(configOverrides)) {
|
|
53
|
-
return null;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return configOverrides;
|
|
57
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
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 } from "./validation";
|
|
13
|
-
export default objectOf({});
|