@adobe/alloy 2.19.2 → 2.20.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.
- package/libEs5/components/Identity/index.js +1 -2
- package/libEs5/components/Identity/injectAddQueryStringIdentityToPayload.js +0 -4
- package/libEs5/components/Identity/injectAwaitIdentityCookie.js +11 -7
- package/libEs5/components/Identity/injectEnsureSingleIdentity.js +3 -6
- package/libEs5/components/LegacyMediaAnalytics/createMediaAnalyticsTracker.js +272 -0
- package/libEs5/components/LegacyMediaAnalytics/createMediaHelper.js +188 -0
- package/libEs5/components/LegacyMediaAnalytics/index.js +48 -0
- package/libEs5/components/LegacyMediaAnalytics/media/constants.js +154 -0
- package/libEs5/components/LegacyMediaAnalytics/media/mediaKeysToXdmConverter.js +51 -0
- package/libEs5/components/MediaCollection/constants/eventTypes.js +25 -0
- package/libEs5/components/MediaCollection/createHeartbeatEngine.js +63 -0
- package/libEs5/components/MediaCollection/createMediaEventManager.js +109 -0
- package/libEs5/components/MediaCollection/createMediaRequest.js +30 -0
- package/libEs5/components/MediaCollection/createMediaSessionCacheManager.js +62 -0
- package/libEs5/components/MediaCollection/createUpdateMediaSessionState.js +31 -0
- package/libEs5/components/MediaCollection/index.js +165 -0
- package/libEs5/components/MediaCollection/validateMediaEventOptions.js +35 -0
- package/libEs5/components/MediaCollection/validateMediaSessionOptions.js +36 -0
- package/libEs5/components/Personalization/createFetchDataHandler.js +1 -4
- package/libEs5/components/Personalization/createNotificationHandler.js +2 -8
- package/libEs5/components/Personalization/createOnDecisionHandler.js +1 -1
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/core/componentCreators.js +3 -1
- package/libEs5/core/edgeNetwork/injectSendEdgeNetworkRequest.js +1 -1
- package/libEs5/utils/debounce.js +30 -0
- package/libEs5/utils/request/createRequest.js +8 -1
- package/libEs5/utils/validation/createMaximumValidator.js +22 -0
- package/libEs5/utils/validation/index.js +11 -1
- package/libEs5/utils/validation/matchesRegexpValidator.js +22 -0
- package/libEs6/components/Identity/index.js +1 -2
- package/libEs6/components/Identity/injectAddQueryStringIdentityToPayload.js +1 -5
- package/libEs6/components/Identity/injectAwaitIdentityCookie.js +11 -7
- package/libEs6/components/Identity/injectEnsureSingleIdentity.js +3 -4
- package/libEs6/components/LegacyMediaAnalytics/createMediaAnalyticsTracker.js +276 -0
- package/libEs6/components/LegacyMediaAnalytics/createMediaHelper.js +186 -0
- package/libEs6/components/LegacyMediaAnalytics/index.js +45 -0
- package/libEs6/components/LegacyMediaAnalytics/media/constants.js +140 -0
- package/libEs6/components/LegacyMediaAnalytics/media/mediaKeysToXdmConverter.js +46 -0
- package/libEs6/components/MediaCollection/constants/eventTypes.js +21 -0
- package/libEs6/components/MediaCollection/createHeartbeatEngine.js +64 -0
- package/libEs6/components/MediaCollection/createMediaEventManager.js +115 -0
- package/libEs6/components/MediaCollection/createMediaRequest.js +28 -0
- package/libEs6/components/MediaCollection/createMediaSessionCacheManager.js +63 -0
- package/libEs6/components/MediaCollection/createUpdateMediaSessionState.js +30 -0
- package/libEs6/components/MediaCollection/index.js +164 -0
- package/libEs6/components/MediaCollection/validateMediaEventOptions.js +32 -0
- package/libEs6/components/MediaCollection/validateMediaSessionOptions.js +34 -0
- package/libEs6/components/Personalization/createFetchDataHandler.js +1 -4
- package/libEs6/components/Personalization/createNotificationHandler.js +2 -6
- package/libEs6/components/Personalization/createOnDecisionHandler.js +1 -1
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/core/componentCreators.js +3 -1
- package/libEs6/core/edgeNetwork/injectSendEdgeNetworkRequest.js +1 -1
- package/libEs6/utils/debounce.js +22 -0
- package/libEs6/utils/request/createRequest.js +8 -1
- package/libEs6/utils/validation/createMaximumValidator.js +16 -0
- package/libEs6/utils/validation/index.js +11 -1
- package/libEs6/utils/validation/matchesRegexpValidator.js +17 -0
- package/package.json +3 -8
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
var _validation = require("../../utils/validation");
|
|
5
|
+
var _createMediaSessionCacheManager = require("./createMediaSessionCacheManager");
|
|
6
|
+
var _validateMediaEventOptions = require("./validateMediaEventOptions");
|
|
7
|
+
var _validateMediaSessionOptions = require("./validateMediaSessionOptions");
|
|
8
|
+
var _createMediaEventManager = require("./createMediaEventManager");
|
|
9
|
+
var _utils = require("../../utils");
|
|
10
|
+
var _createHeartbeatEngine = require("./createHeartbeatEngine");
|
|
11
|
+
var _createUpdateMediaSessionState = require("./createUpdateMediaSessionState");
|
|
12
|
+
/*
|
|
13
|
+
Copyright 2023 Adobe. All rights reserved.
|
|
14
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
15
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
16
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
|
|
18
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
19
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
20
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
21
|
+
governing permissions and limitations under the License.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
var createMediaCollection = function createMediaCollection(_ref) {
|
|
25
|
+
var config = _ref.config,
|
|
26
|
+
logger = _ref.logger,
|
|
27
|
+
eventManager = _ref.eventManager,
|
|
28
|
+
sendEdgeNetworkRequest = _ref.sendEdgeNetworkRequest,
|
|
29
|
+
consent = _ref.consent;
|
|
30
|
+
var mediaSessionCacheManager = (0, _createMediaSessionCacheManager.default)({
|
|
31
|
+
config: config
|
|
32
|
+
});
|
|
33
|
+
var mediaEventManager = (0, _createMediaEventManager.default)({
|
|
34
|
+
config: config,
|
|
35
|
+
eventManager: eventManager,
|
|
36
|
+
logger: logger,
|
|
37
|
+
consent: consent,
|
|
38
|
+
sendEdgeNetworkRequest: sendEdgeNetworkRequest
|
|
39
|
+
});
|
|
40
|
+
var heartbeatTicker = (0, _createHeartbeatEngine.default)({
|
|
41
|
+
config: config,
|
|
42
|
+
mediaEventManager: mediaEventManager,
|
|
43
|
+
mediaSessionCacheManager: mediaSessionCacheManager
|
|
44
|
+
});
|
|
45
|
+
var updateMediaSessionState = (0, _createUpdateMediaSessionState.default)({
|
|
46
|
+
mediaSessionCacheManager: mediaSessionCacheManager
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
lifecycle: {
|
|
50
|
+
onBeforeEvent: function onBeforeEvent(_ref2) {
|
|
51
|
+
var playerId = _ref2.playerId,
|
|
52
|
+
onBeforeMediaEvent = _ref2.onBeforeMediaEvent,
|
|
53
|
+
_ref2$onResponse = _ref2.onResponse,
|
|
54
|
+
onResponse = _ref2$onResponse === void 0 ? _utils.noop : _ref2$onResponse;
|
|
55
|
+
onResponse(function (_ref3) {
|
|
56
|
+
var response = _ref3.response;
|
|
57
|
+
var sessionId = response.getPayloadsByType("media-analytics:new-session");
|
|
58
|
+
logger.info("Media session ID returned: ", sessionId);
|
|
59
|
+
if (sessionId.length > 0) {
|
|
60
|
+
if (playerId && onBeforeMediaEvent) {
|
|
61
|
+
var heartbeatId = setInterval(function () {
|
|
62
|
+
heartbeatTicker({
|
|
63
|
+
sessionId: sessionId[0].sessionId,
|
|
64
|
+
playerId: playerId,
|
|
65
|
+
onBeforeMediaEvent: onBeforeMediaEvent
|
|
66
|
+
});
|
|
67
|
+
}, 1000);
|
|
68
|
+
mediaSessionCacheManager.saveHeartbeat({
|
|
69
|
+
playerId: playerId,
|
|
70
|
+
heartbeatId: heartbeatId
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
sessionId: sessionId[0].sessionId
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
return {};
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
commands: {
|
|
82
|
+
createMediaSession: {
|
|
83
|
+
optionsValidator: function optionsValidator(options) {
|
|
84
|
+
return (0, _validateMediaSessionOptions.default)({
|
|
85
|
+
options: options
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
run: function run(options) {
|
|
89
|
+
var playerId = options.playerId,
|
|
90
|
+
onBeforeMediaEvent = options.onBeforeMediaEvent;
|
|
91
|
+
var event = mediaEventManager.createMediaSession(options);
|
|
92
|
+
mediaEventManager.augmentMediaEvent({
|
|
93
|
+
event: event,
|
|
94
|
+
playerId: playerId,
|
|
95
|
+
onBeforeMediaEvent: onBeforeMediaEvent
|
|
96
|
+
});
|
|
97
|
+
var sessionPromise = mediaEventManager.trackMediaSession({
|
|
98
|
+
event: event,
|
|
99
|
+
playerId: playerId,
|
|
100
|
+
onBeforeMediaEvent: onBeforeMediaEvent
|
|
101
|
+
});
|
|
102
|
+
mediaSessionCacheManager.storeSession({
|
|
103
|
+
playerId: playerId,
|
|
104
|
+
sessionDetails: {
|
|
105
|
+
sessionPromise: sessionPromise,
|
|
106
|
+
onBeforeMediaEvent: onBeforeMediaEvent,
|
|
107
|
+
latestTriggeredEvent: Date.now()
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
return sessionPromise;
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
sendMediaEvent: {
|
|
114
|
+
optionsValidator: function optionsValidator(options) {
|
|
115
|
+
return (0, _validateMediaEventOptions.default)({
|
|
116
|
+
options: options
|
|
117
|
+
});
|
|
118
|
+
},
|
|
119
|
+
run: function run(options) {
|
|
120
|
+
var event = mediaEventManager.createMediaEvent({
|
|
121
|
+
options: options
|
|
122
|
+
});
|
|
123
|
+
var playerId = options.playerId,
|
|
124
|
+
xdm = options.xdm;
|
|
125
|
+
var eventType = xdm.eventType;
|
|
126
|
+
var action = eventType.split(".")[1];
|
|
127
|
+
var _mediaSessionCacheMan = mediaSessionCacheManager.getSession(playerId),
|
|
128
|
+
onBeforeMediaEvent = _mediaSessionCacheMan.onBeforeMediaEvent,
|
|
129
|
+
sessionPromise = _mediaSessionCacheMan.sessionPromise;
|
|
130
|
+
sessionPromise.then(function (result) {
|
|
131
|
+
mediaEventManager.augmentMediaEvent({
|
|
132
|
+
event: event,
|
|
133
|
+
playerId: playerId,
|
|
134
|
+
onBeforeMediaEvent: onBeforeMediaEvent,
|
|
135
|
+
sessionID: result.sessionId
|
|
136
|
+
});
|
|
137
|
+
return mediaEventManager.trackMediaEvent({
|
|
138
|
+
event: event,
|
|
139
|
+
action: action
|
|
140
|
+
}).then(function () {
|
|
141
|
+
updateMediaSessionState({
|
|
142
|
+
playerId: playerId,
|
|
143
|
+
eventType: eventType
|
|
144
|
+
});
|
|
145
|
+
}).catch(function (error) {
|
|
146
|
+
logger.warn("The Media Event of type " + action + " failed.", error);
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
createMediaCollection.namespace = "Media Collection";
|
|
155
|
+
createMediaCollection.configValidators = (0, _validation.objectOf)({
|
|
156
|
+
mediaCollection: (0, _validation.objectOf)({
|
|
157
|
+
channel: (0, _validation.string)().nonEmpty().required(),
|
|
158
|
+
playerName: (0, _validation.string)().nonEmpty().required(),
|
|
159
|
+
version: (0, _validation.string)(),
|
|
160
|
+
mainPingInterval: (0, _validation.number)().minimum(10).maximum(50).default(10),
|
|
161
|
+
adPingInterval: (0, _validation.number)().minimum(10).maximum(50).default(10)
|
|
162
|
+
}).noUnknownFields()
|
|
163
|
+
});
|
|
164
|
+
var _default = createMediaCollection;
|
|
165
|
+
exports.default = _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
var _validation = require("../../utils/validation");
|
|
5
|
+
/*
|
|
6
|
+
Copyright 2023 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(_ref) {
|
|
17
|
+
var options = _ref.options;
|
|
18
|
+
var validator = (0, _validation.anyOf)([(0, _validation.objectOf)({
|
|
19
|
+
playerId: (0, _validation.string)().required(),
|
|
20
|
+
xdm: (0, _validation.objectOf)({
|
|
21
|
+
eventType: (0, _validation.string)().required(),
|
|
22
|
+
mediaCollection: (0, _validation.objectOf)((0, _validation.anything)())
|
|
23
|
+
}).required()
|
|
24
|
+
}).required(), (0, _validation.objectOf)({
|
|
25
|
+
xdm: (0, _validation.objectOf)({
|
|
26
|
+
eventType: (0, _validation.string)().required(),
|
|
27
|
+
mediaCollection: (0, _validation.objectOf)({
|
|
28
|
+
playhead: (0, _validation.number)().integer().required(),
|
|
29
|
+
sessionID: (0, _validation.string)().required()
|
|
30
|
+
}).required()
|
|
31
|
+
}).required()
|
|
32
|
+
}).required()], "Error validating the sendMediaEvent command options.");
|
|
33
|
+
return validator(options);
|
|
34
|
+
};
|
|
35
|
+
exports.default = _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
var _validation = require("../../utils/validation");
|
|
5
|
+
/*
|
|
6
|
+
Copyright 2023 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(_ref) {
|
|
17
|
+
var options = _ref.options;
|
|
18
|
+
var sessionValidator = (0, _validation.anyOf)([(0, _validation.objectOf)({
|
|
19
|
+
playerId: (0, _validation.string)().required(),
|
|
20
|
+
onBeforeMediaEvent: (0, _validation.callback)().required(),
|
|
21
|
+
xdm: (0, _validation.objectOf)({
|
|
22
|
+
mediaCollection: (0, _validation.objectOf)({
|
|
23
|
+
sessionDetails: (0, _validation.objectOf)((0, _validation.anything)()).required()
|
|
24
|
+
})
|
|
25
|
+
})
|
|
26
|
+
}).required(), (0, _validation.objectOf)({
|
|
27
|
+
xdm: (0, _validation.objectOf)({
|
|
28
|
+
mediaCollection: (0, _validation.objectOf)({
|
|
29
|
+
playhead: (0, _validation.number)().required(),
|
|
30
|
+
sessionDetails: (0, _validation.objectOf)((0, _validation.anything)()).required()
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
}).required()], "Error validating the createMediaSession command options.");
|
|
34
|
+
return sessionValidator(options);
|
|
35
|
+
};
|
|
36
|
+
exports.default = _default;
|
|
@@ -38,10 +38,7 @@ var _default = function _default(_ref) {
|
|
|
38
38
|
showContainers();
|
|
39
39
|
}
|
|
40
40
|
mergeQuery(event, personalizationDetails.createQueryDetails());
|
|
41
|
-
|
|
42
|
-
// This needs to be called before the response so that future sendEvent calls
|
|
43
|
-
// can know to wait until this request is complete for pending display notifications.
|
|
44
|
-
var handleNotifications = notificationHandler(personalizationDetails.isRenderDecisions(), personalizationDetails.isSendDisplayEvent(), personalizationDetails.getViewName());
|
|
41
|
+
var handleNotifications = notificationHandler(personalizationDetails.isSendDisplayEvent(), personalizationDetails.getViewName());
|
|
45
42
|
onResponse(function (_ref3) {
|
|
46
43
|
var response = _ref3.response;
|
|
47
44
|
var handles = response.getPayloadsByType(DECISIONS_HANDLE);
|
|
@@ -14,14 +14,8 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
14
14
|
governing permissions and limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
var _default = function _default(collect, renderedPropositions) {
|
|
17
|
-
return function (
|
|
18
|
-
if (!
|
|
19
|
-
// If we aren't rendering anything, then we don't need to sendDisplayEvents.
|
|
20
|
-
return function () {
|
|
21
|
-
return undefined;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
if (!isSendDisplayEvent) {
|
|
17
|
+
return function (sendDisplayEvent, viewName) {
|
|
18
|
+
if (!sendDisplayEvent) {
|
|
25
19
|
var renderedPropositionsDeferred = (0, _utils.defer)();
|
|
26
20
|
renderedPropositions.concat(renderedPropositionsDeferred.promise);
|
|
27
21
|
return renderedPropositionsDeferred.resolve;
|
|
@@ -34,7 +34,7 @@ var _default = function _default(_ref) {
|
|
|
34
34
|
var _processPropositions = processPropositions(propositionsToExecute),
|
|
35
35
|
render = _processPropositions.render,
|
|
36
36
|
returnedPropositions = _processPropositions.returnedPropositions;
|
|
37
|
-
var handleNotifications = notificationHandler(
|
|
37
|
+
var handleNotifications = notificationHandler(sendDisplayEvent, viewName);
|
|
38
38
|
render().then(handleNotifications);
|
|
39
39
|
return Promise.resolve({
|
|
40
40
|
propositions: returnedPropositions
|
|
@@ -14,5 +14,5 @@ governing permissions and limitations under the License.
|
|
|
14
14
|
*/
|
|
15
15
|
// The __VERSION__ keyword will be replace at alloy build time with the package.json version.
|
|
16
16
|
// see babel-plugin-version
|
|
17
|
-
var _default = "2.
|
|
17
|
+
var _default = "2.20.0-alpha.1";
|
|
18
18
|
exports.default = _default;
|
|
@@ -12,6 +12,8 @@ var _EventMerge = require("../components/EventMerge");
|
|
|
12
12
|
var _LibraryInfo = require("../components/LibraryInfo");
|
|
13
13
|
var _DecisioningEngine = require("../components/DecisioningEngine");
|
|
14
14
|
var _MachineLearning = require("../components/MachineLearning");
|
|
15
|
+
var _MediaCollection = require("../components/MediaCollection");
|
|
16
|
+
var _LegacyMediaAnalytics = require("../components/LegacyMediaAnalytics");
|
|
15
17
|
/*
|
|
16
18
|
Copyright 2019 Adobe. All rights reserved.
|
|
17
19
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -28,5 +30,5 @@ governing permissions and limitations under the License.
|
|
|
28
30
|
/* eslint-disable import/no-restricted-paths */
|
|
29
31
|
// TODO: Register the Components here statically for now. They might be registered differently.
|
|
30
32
|
// TODO: Figure out how sub-components will be made available/registered
|
|
31
|
-
var _default = [_DataCollector.default, _ActivityCollector.default, _Identity.default, _Audiences.default, _Personalization.default, _Context.default, _Privacy.default, _EventMerge.default, _LibraryInfo.default, _MachineLearning.default, _DecisioningEngine.default];
|
|
33
|
+
var _default = [_DataCollector.default, _ActivityCollector.default, _Identity.default, _Audiences.default, _Personalization.default, _Context.default, _Privacy.default, _EventMerge.default, _LibraryInfo.default, _MachineLearning.default, _DecisioningEngine.default, _LegacyMediaAnalytics.default, _MediaCollection.default];
|
|
32
34
|
exports.default = _default;
|
|
@@ -53,7 +53,7 @@ var _default = function _default(_ref) {
|
|
|
53
53
|
}).then(function () {
|
|
54
54
|
var endpointDomain = request.getUseIdThirdPartyDomain() ? _domain.ID_THIRD_PARTY : edgeDomain;
|
|
55
55
|
var locationHint = getLocationHint();
|
|
56
|
-
var edgeBasePathWithLocationHint = locationHint ? edgeBasePath + "/" + locationHint : edgeBasePath;
|
|
56
|
+
var edgeBasePathWithLocationHint = locationHint ? edgeBasePath + "/" + locationHint + request.getEdgeSubPath() : "" + edgeBasePath + request.getEdgeSubPath();
|
|
57
57
|
var configId = request.getDatastreamIdOverride() || datastreamId;
|
|
58
58
|
var payload = request.getPayload();
|
|
59
59
|
if (configId !== datastreamId) {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
/*
|
|
5
|
+
Copyright 2023 Adobe. All rights reserved.
|
|
6
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
8
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
11
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
12
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
|
+
governing permissions and limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
var _default = function _default(fn) {
|
|
16
|
+
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 150;
|
|
17
|
+
var timer;
|
|
18
|
+
return function () {
|
|
19
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
20
|
+
args[_key] = arguments[_key];
|
|
21
|
+
}
|
|
22
|
+
if (timer) {
|
|
23
|
+
clearTimeout(timer);
|
|
24
|
+
}
|
|
25
|
+
timer = setTimeout(function () {
|
|
26
|
+
fn.apply(void 0, args);
|
|
27
|
+
}, delay);
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
exports.default = _default;
|
|
@@ -18,7 +18,8 @@ var _default = function _default(options) {
|
|
|
18
18
|
var payload = options.payload,
|
|
19
19
|
_getAction = options.getAction,
|
|
20
20
|
_getUseSendBeacon = options.getUseSendBeacon,
|
|
21
|
-
datastreamIdOverride = options.datastreamIdOverride
|
|
21
|
+
datastreamIdOverride = options.datastreamIdOverride,
|
|
22
|
+
edgeSubPath = options.edgeSubPath;
|
|
22
23
|
var id = (0, _.uuid)();
|
|
23
24
|
var shouldUseThirdPartyDomain = false;
|
|
24
25
|
var isIdentityEstablished = false;
|
|
@@ -42,6 +43,12 @@ var _default = function _default(options) {
|
|
|
42
43
|
isIdentityEstablished: isIdentityEstablished
|
|
43
44
|
});
|
|
44
45
|
},
|
|
46
|
+
getEdgeSubPath: function getEdgeSubPath() {
|
|
47
|
+
if (edgeSubPath) {
|
|
48
|
+
return edgeSubPath;
|
|
49
|
+
}
|
|
50
|
+
return "";
|
|
51
|
+
},
|
|
45
52
|
getUseIdThirdPartyDomain: function getUseIdThirdPartyDomain() {
|
|
46
53
|
return shouldUseThirdPartyDomain;
|
|
47
54
|
},
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
var _utils = require("./utils");
|
|
5
|
+
/*
|
|
6
|
+
Copyright 2023 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(typeName, maximum) {
|
|
17
|
+
return function (value, path) {
|
|
18
|
+
(0, _utils.assertValid)(value <= maximum, value, path, typeName + " less than or equal to " + maximum);
|
|
19
|
+
return value;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
exports.default = _default;
|
|
@@ -10,6 +10,7 @@ var _createDeprecatedValidator = require("./createDeprecatedValidator");
|
|
|
10
10
|
var _createLiteralValidator = require("./createLiteralValidator");
|
|
11
11
|
var _createMapOfValuesValidator = require("./createMapOfValuesValidator");
|
|
12
12
|
var _createMinimumValidator = require("./createMinimumValidator");
|
|
13
|
+
var _createMaximumValidator = require("./createMaximumValidator");
|
|
13
14
|
var _createNoUnknownFieldsValidator = require("./createNoUnknownFieldsValidator");
|
|
14
15
|
var _createNonEmptyValidator = require("./createNonEmptyValidator");
|
|
15
16
|
var _createObjectOfValidator = require("./createObjectOfValidator");
|
|
@@ -22,6 +23,7 @@ var _numberValidator = require("./numberValidator");
|
|
|
22
23
|
var _regexpValidator = require("./regexpValidator");
|
|
23
24
|
var _requiredValidator = require("./requiredValidator");
|
|
24
25
|
var _stringValidator = require("./stringValidator");
|
|
26
|
+
var _matchesRegexpValidator = require("./matchesRegexpValidator");
|
|
25
27
|
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; }
|
|
26
28
|
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; }
|
|
27
29
|
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; } /*
|
|
@@ -116,6 +118,9 @@ var minimumInteger = function minimumInteger(minValue) {
|
|
|
116
118
|
var minimumNumber = function minimumNumber(minValue) {
|
|
117
119
|
return (0, _utils.nullSafeChain)(this, (0, _createMinimumValidator.default)("a number", minValue));
|
|
118
120
|
};
|
|
121
|
+
var maximumNumber = function maximumNumber(maxValue) {
|
|
122
|
+
return (0, _utils.nullSafeChain)(this, (0, _createMaximumValidator.default)("a number", maxValue));
|
|
123
|
+
};
|
|
119
124
|
var integer = function integer() {
|
|
120
125
|
return (0, _utils.nullSafeChain)(this, _integerValidator.default, {
|
|
121
126
|
minimum: minimumInteger
|
|
@@ -133,6 +138,9 @@ var nonEmptyObject = function nonEmptyObject() {
|
|
|
133
138
|
var regexp = function regexp() {
|
|
134
139
|
return (0, _utils.nullSafeChain)(this, _regexpValidator.default);
|
|
135
140
|
};
|
|
141
|
+
var matches = function matches(regexpPattern) {
|
|
142
|
+
return (0, _utils.nullSafeChain)(this, (0, _matchesRegexpValidator.default)(regexpPattern));
|
|
143
|
+
};
|
|
136
144
|
var unique = function createUnique() {
|
|
137
145
|
return (0, _utils.nullSafeChain)(this, (0, _createUniqueValidator.default)());
|
|
138
146
|
};
|
|
@@ -167,6 +175,7 @@ var literal = function literal(literalValue) {
|
|
|
167
175
|
var number = function number() {
|
|
168
176
|
return (0, _utils.nullSafeChain)(this, _numberValidator.default, {
|
|
169
177
|
minimum: minimumNumber,
|
|
178
|
+
maximum: maximumNumber,
|
|
170
179
|
integer: integer,
|
|
171
180
|
unique: unique
|
|
172
181
|
});
|
|
@@ -203,7 +212,8 @@ var string = function string() {
|
|
|
203
212
|
regexp: regexp,
|
|
204
213
|
domain: domain,
|
|
205
214
|
nonEmpty: nonEmptyString,
|
|
206
|
-
unique: unique
|
|
215
|
+
unique: unique,
|
|
216
|
+
matches: matches
|
|
207
217
|
});
|
|
208
218
|
};
|
|
209
219
|
var boundAnyOf = anyOf.bind(base);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
var _utils = require("./utils");
|
|
5
|
+
/*
|
|
6
|
+
Copyright 2023 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(regexp) {
|
|
17
|
+
return function (value, path) {
|
|
18
|
+
(0, _utils.assertValid)(regexp.test(value), value, path, "does not match the " + regexp.toString());
|
|
19
|
+
return value;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
exports.default = _default;
|
|
@@ -28,14 +28,10 @@ export default (({
|
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
const parsedQueryString = queryString.parse(locationSearch);
|
|
31
|
-
|
|
31
|
+
const queryStringValue = parsedQueryString[queryStringIdentityParam];
|
|
32
32
|
if (queryStringValue === undefined) {
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
|
-
if (Array.isArray(queryStringValue)) {
|
|
36
|
-
logger.warn("Found multiple adobe_mc query string paramters, only using the last one.");
|
|
37
|
-
queryStringValue = queryStringValue[queryStringValue.length - 1];
|
|
38
|
-
}
|
|
39
35
|
const properties = queryStringValue.split("|").reduce((memo, keyValue) => {
|
|
40
36
|
const [key, value] = keyValue.split("=");
|
|
41
37
|
memo[key] = value;
|
|
@@ -12,8 +12,7 @@ governing permissions and limitations under the License.
|
|
|
12
12
|
|
|
13
13
|
export default (({
|
|
14
14
|
doesIdentityCookieExist,
|
|
15
|
-
orgId
|
|
16
|
-
logger
|
|
15
|
+
orgId
|
|
17
16
|
}) => {
|
|
18
17
|
/**
|
|
19
18
|
* Returns a promise that will be resolved once an identity cookie exists.
|
|
@@ -31,11 +30,16 @@ export default (({
|
|
|
31
30
|
} else {
|
|
32
31
|
// This logic assumes that the code setting the cookie is working as expected and that
|
|
33
32
|
// the cookie was missing from the response.
|
|
34
|
-
|
|
33
|
+
const noIdentityCookieError = new Error(`An identity was not set properly. Please verify that the org ID ${orgId} configured in Alloy matches the org ID specified in the edge configuration.`);
|
|
35
34
|
|
|
36
|
-
// Rejecting the promise will
|
|
37
|
-
//
|
|
38
|
-
|
|
35
|
+
// Rejecting the promise will reject commands that were queued
|
|
36
|
+
// by the Identity component while waiting on the response to
|
|
37
|
+
// the initial request.
|
|
38
|
+
reject(noIdentityCookieError);
|
|
39
|
+
|
|
40
|
+
// Throwing an error will reject the event command that initiated
|
|
41
|
+
// the request.
|
|
42
|
+
throw noIdentityCookieError;
|
|
39
43
|
}
|
|
40
44
|
});
|
|
41
45
|
onRequestFailure(() => {
|
|
@@ -44,7 +48,7 @@ export default (({
|
|
|
44
48
|
} else {
|
|
45
49
|
// The error from the request failure will be logged separately. Rejecting this here
|
|
46
50
|
// will tell ensureSingleIdentity to send the next request without identity
|
|
47
|
-
reject(new Error("
|
|
51
|
+
reject(new Error("No identity was set on response."));
|
|
48
52
|
}
|
|
49
53
|
});
|
|
50
54
|
});
|
|
@@ -55,8 +55,9 @@ export default (({
|
|
|
55
55
|
if (obtainedIdentityPromise) {
|
|
56
56
|
// We don't have an identity cookie, but at least one request has
|
|
57
57
|
// been sent to get it. Konductor may set the identity cookie in the
|
|
58
|
-
// response. We will hold up this request until the
|
|
59
|
-
// returns and awaitIdentityCookie confirms the
|
|
58
|
+
// response. We will hold up this request until the last request
|
|
59
|
+
// requiring identity returns and awaitIdentityCookie confirms the
|
|
60
|
+
// identity was set.
|
|
60
61
|
logger.info("Delaying request while retrieving ECID from server.");
|
|
61
62
|
const previousObtainedIdentityPromise = obtainedIdentityPromise;
|
|
62
63
|
|
|
@@ -91,8 +92,6 @@ export default (({
|
|
|
91
92
|
onResponse,
|
|
92
93
|
onRequestFailure
|
|
93
94
|
});
|
|
94
|
-
// This prevents an un-caught promise in the console when the identity isn't set.
|
|
95
|
-
obtainedIdentityPromise.catch(() => undefined);
|
|
96
95
|
return allowRequestToGoWithoutIdentity(request);
|
|
97
96
|
};
|
|
98
97
|
});
|