@adobe/alloy 2.30.1-beta.2 → 2.30.1-beta.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/Advertising/handlers/onBeforeSendEventHandler.js +8 -2
- package/libEs5/components/Advertising/handlers/viewThroughHandler.js +8 -2
- package/libEs5/components/Advertising/identities/collectSurferId.js +8 -1
- package/libEs5/components/BrandConcierge/constants.js +16 -0
- package/libEs5/components/BrandConcierge/createBuildEndpointUrl.js +33 -0
- package/libEs5/components/BrandConcierge/createConversationServiceRequest.js +35 -0
- package/libEs5/components/BrandConcierge/createSendConversationEvent.js +146 -0
- package/libEs5/components/BrandConcierge/createSendConversationServiceRequest.js +85 -0
- package/libEs5/components/BrandConcierge/createStreamParser.js +96 -0
- package/libEs5/components/BrandConcierge/createTimeoutWrapper.js +52 -0
- package/libEs5/components/BrandConcierge/index.js +104 -0
- package/libEs5/components/BrandConcierge/utils.js +33 -0
- package/libEs5/components/BrandConcierge/validateMessage.js +41 -0
- package/libEs5/components/Consent/types.js +12 -0
- package/libEs5/components/Context/createComponent.js +1 -2
- package/libEs5/components/Context/implementationDetails.js +7 -9
- package/libEs5/components/Context/index.js +4 -1
- package/libEs5/components/Context/injectDevice.js +2 -2
- package/libEs5/components/Context/injectEnvironment.js +2 -2
- package/libEs5/components/Context/injectHighEntropyUserAgentHints.js +2 -2
- package/libEs5/components/Context/injectOneTimeAnalyticsReferrer.js +49 -0
- package/libEs5/components/Context/injectPlaceContext.js +2 -2
- package/libEs5/components/Context/injectTimestamp.js +2 -3
- package/libEs5/components/Context/injectWeb.js +9 -11
- package/libEs5/components/EventMerge/createEventMergeId.js +1 -1
- package/libEs5/components/Personalization/createComponent.js +3 -1
- package/libEs5/components/Personalization/createFetchDataHandler.js +4 -3
- package/libEs5/components/Personalization/createNotificationHandler.js +5 -3
- package/libEs5/components/Personalization/createOnDecisionHandler.js +4 -3
- package/libEs5/components/Personalization/createPersonalizationDetails.js +1 -1
- package/libEs5/components/Personalization/dom-actions/initDomActionsModules.js +1 -1
- package/libEs5/components/Personalization/handlers/createProcessInAppMessage.js +2 -1
- package/libEs5/components/Personalization/handlers/createProcessRedirect.js +2 -1
- package/libEs5/components/Personalization/handlers/injectCreateProposition.js +4 -1
- package/libEs5/components/Personalization/in-app-message-actions/actions/displayIframeContent.js +4 -2
- package/libEs5/components/Personalization/index.js +2 -2
- package/libEs5/components/PushNotifications/request/makeSendServiceWorkerTrackingData.js +1 -1
- package/libEs5/components/PushNotifications/types.js +12 -0
- package/libEs5/components/RulesEngine/createApplyResponse.js +3 -1
- package/libEs5/components/RulesEngine/types.js +12 -0
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/constants/surface.js +19 -0
- package/libEs5/core/componentCreators.js +8 -1
- package/libEs5/core/consent/types.js +12 -0
- package/libEs5/core/createEvent.js +3 -0
- package/libEs5/core/edgeNetwork/types.js +12 -0
- package/libEs5/core/identity/types.js +12 -0
- package/libEs5/core/index.js +5 -1
- package/libEs5/core/types.js +12 -0
- package/libEs5/utils/createCollect.js +4 -2
- package/libEs5/utils/deepAssign.js +5 -0
- package/libEs5/utils/dom/createGetPageLocation.js +20 -0
- package/libEs5/utils/index.js +8 -1
- package/libEs5/utils/request/createRequest.js +5 -1
- package/libEs5/utils/request/types.js +12 -0
- package/libEs5/utils/surfaceUtils.js +82 -0
- package/libEs5/utils/types.js +12 -0
- package/libEs5/utils/uuid.js +1 -0
- package/libEs6/components/Advertising/handlers/onBeforeSendEventHandler.js +8 -2
- package/libEs6/components/Advertising/handlers/viewThroughHandler.js +8 -2
- package/libEs6/components/Advertising/identities/collectSurferId.js +8 -1
- package/libEs6/components/BrandConcierge/constants.js +13 -0
- package/libEs6/components/BrandConcierge/createBuildEndpointUrl.js +30 -0
- package/libEs6/components/BrandConcierge/createConversationServiceRequest.js +31 -0
- package/libEs6/components/BrandConcierge/createSendConversationEvent.js +142 -0
- package/libEs6/components/BrandConcierge/createSendConversationServiceRequest.js +81 -0
- package/libEs6/components/BrandConcierge/createStreamParser.js +92 -0
- package/libEs6/components/BrandConcierge/createTimeoutWrapper.js +49 -0
- package/libEs6/components/BrandConcierge/index.js +100 -0
- package/libEs6/components/BrandConcierge/utils.js +27 -0
- package/libEs6/components/BrandConcierge/validateMessage.js +37 -0
- package/libEs6/components/Consent/types.js +12 -0
- package/libEs6/components/Context/createComponent.js +1 -2
- package/libEs6/components/Context/implementationDetails.js +7 -9
- package/libEs6/components/Context/index.js +4 -1
- package/libEs6/components/Context/injectDevice.js +3 -3
- package/libEs6/components/Context/injectEnvironment.js +3 -3
- package/libEs6/components/Context/injectHighEntropyUserAgentHints.js +3 -3
- package/libEs6/components/Context/injectOneTimeAnalyticsReferrer.js +46 -0
- package/libEs6/components/Context/injectPlaceContext.js +3 -3
- package/libEs6/components/Context/injectTimestamp.js +2 -3
- package/libEs6/components/Context/injectWeb.js +9 -11
- package/libEs6/components/EventMerge/createEventMergeId.js +1 -1
- package/libEs6/components/Personalization/createComponent.js +3 -1
- package/libEs6/components/Personalization/createFetchDataHandler.js +4 -3
- package/libEs6/components/Personalization/createNotificationHandler.js +5 -3
- package/libEs6/components/Personalization/createOnDecisionHandler.js +4 -3
- package/libEs6/components/Personalization/createPersonalizationDetails.js +1 -1
- package/libEs6/components/Personalization/dom-actions/initDomActionsModules.js +1 -1
- package/libEs6/components/Personalization/handlers/createProcessInAppMessage.js +2 -1
- package/libEs6/components/Personalization/handlers/createProcessRedirect.js +2 -1
- package/libEs6/components/Personalization/handlers/injectCreateProposition.js +4 -1
- package/libEs6/components/Personalization/in-app-message-actions/actions/displayIframeContent.js +4 -2
- package/libEs6/components/Personalization/index.js +2 -2
- package/libEs6/components/PushNotifications/request/makeSendServiceWorkerTrackingData.js +1 -1
- package/libEs6/components/PushNotifications/types.js +12 -0
- package/libEs6/components/RulesEngine/createApplyResponse.js +3 -1
- package/libEs6/components/RulesEngine/types.js +12 -0
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/constants/surface.js +16 -0
- package/libEs6/core/componentCreators.js +2 -1
- package/libEs6/core/consent/types.js +12 -0
- package/libEs6/core/createEvent.js +3 -0
- package/libEs6/core/edgeNetwork/types.js +12 -0
- package/libEs6/core/identity/types.js +12 -0
- package/libEs6/core/index.js +5 -1
- package/libEs6/core/types.js +12 -0
- package/libEs6/utils/createCollect.js +4 -2
- package/libEs6/utils/deepAssign.js +6 -0
- package/libEs6/utils/dom/createGetPageLocation.js +17 -0
- package/libEs6/utils/index.js +2 -1
- package/libEs6/utils/request/createRequest.js +5 -1
- package/libEs6/utils/request/types.js +12 -0
- package/libEs6/utils/surfaceUtils.js +76 -0
- package/libEs6/utils/types.js +12 -0
- package/libEs6/utils/uuid.js +1 -0
- package/package.json +44 -48
- package/scripts/helpers/path.js +12 -0
- package/scripts/helpers/versionBabelPlugin.js +12 -0
- package/types/components/Advertising/handlers/onBeforeSendEventHandler.d.ts.map +1 -1
- package/types/components/Advertising/handlers/viewThroughHandler.d.ts.map +1 -1
- package/types/components/Advertising/identities/collectSurferId.d.ts.map +1 -1
- package/types/components/BrandConcierge/constants.d.ts +3 -0
- package/types/components/BrandConcierge/constants.d.ts.map +1 -0
- package/types/components/BrandConcierge/createBuildEndpointUrl.d.ts +9 -0
- package/types/components/BrandConcierge/createBuildEndpointUrl.d.ts.map +1 -0
- package/types/components/BrandConcierge/createConversationServiceRequest.d.ts +7 -0
- package/types/components/BrandConcierge/createConversationServiceRequest.d.ts.map +1 -0
- package/types/components/BrandConcierge/createSendConversationEvent.d.ts +15 -0
- package/types/components/BrandConcierge/createSendConversationEvent.d.ts.map +1 -0
- package/types/components/BrandConcierge/createSendConversationServiceRequest.d.ts +11 -0
- package/types/components/BrandConcierge/createSendConversationServiceRequest.d.ts.map +1 -0
- package/types/components/BrandConcierge/createStreamParser.d.ts +3 -0
- package/types/components/BrandConcierge/createStreamParser.d.ts.map +1 -0
- package/types/components/BrandConcierge/createTimeoutWrapper.d.ts +3 -0
- package/types/components/BrandConcierge/createTimeoutWrapper.d.ts.map +1 -0
- package/types/components/BrandConcierge/index.d.ts +31 -0
- package/types/components/BrandConcierge/index.d.ts.map +1 -0
- package/types/components/BrandConcierge/utils.d.ts +6 -0
- package/types/components/BrandConcierge/utils.d.ts.map +1 -0
- package/types/components/BrandConcierge/validateMessage.d.ts +5 -0
- package/types/components/BrandConcierge/validateMessage.d.ts.map +1 -0
- package/types/components/Consent/types.d.ts.map +1 -1
- package/types/components/Context/createComponent.d.ts +1 -1
- package/types/components/Context/createComponent.d.ts.map +1 -1
- package/types/components/Context/implementationDetails.d.ts +1 -1
- package/types/components/Context/implementationDetails.d.ts.map +1 -1
- package/types/components/Context/index.d.ts +1 -1
- package/types/components/Context/index.d.ts.map +1 -1
- package/types/components/Context/injectDevice.d.ts +1 -1
- package/types/components/Context/injectDevice.d.ts.map +1 -1
- package/types/components/Context/injectEnvironment.d.ts +1 -1
- package/types/components/Context/injectEnvironment.d.ts.map +1 -1
- package/types/components/Context/injectHighEntropyUserAgentHints.d.ts +1 -1
- package/types/components/Context/injectHighEntropyUserAgentHints.d.ts.map +1 -1
- package/types/components/Context/injectOneTimeAnalyticsReferrer.d.ts +3 -0
- package/types/components/Context/injectOneTimeAnalyticsReferrer.d.ts.map +1 -0
- package/types/components/Context/injectPlaceContext.d.ts +1 -1
- package/types/components/Context/injectPlaceContext.d.ts.map +1 -1
- package/types/components/Context/injectTimestamp.d.ts +1 -1
- package/types/components/Context/injectTimestamp.d.ts.map +1 -1
- package/types/components/Context/injectWeb.d.ts +1 -1
- package/types/components/Context/injectWeb.d.ts.map +1 -1
- package/types/components/Personalization/createComponent.d.ts.map +1 -1
- package/types/components/Personalization/createFetchDataHandler.d.ts +2 -1
- package/types/components/Personalization/createFetchDataHandler.d.ts.map +1 -1
- package/types/components/Personalization/createNotificationHandler.d.ts +1 -1
- package/types/components/Personalization/createNotificationHandler.d.ts.map +1 -1
- package/types/components/Personalization/createOnDecisionHandler.d.ts +2 -1
- package/types/components/Personalization/createOnDecisionHandler.d.ts.map +1 -1
- package/types/components/Personalization/createPersonalizationDetails.d.ts.map +1 -1
- package/types/components/Personalization/handlers/createProcessInAppMessage.d.ts.map +1 -1
- package/types/components/Personalization/handlers/createProcessRedirect.d.ts.map +1 -1
- package/types/components/Personalization/handlers/injectCreateProposition.d.ts +2 -1
- package/types/components/Personalization/handlers/injectCreateProposition.d.ts.map +1 -1
- package/types/components/Personalization/in-app-message-actions/actions/displayIframeContent.d.ts.map +1 -1
- package/types/components/Personalization/index.d.ts.map +1 -1
- package/types/components/PushNotifications/types.d.ts.map +1 -1
- package/types/components/RulesEngine/createApplyResponse.d.ts.map +1 -1
- package/types/components/RulesEngine/index.d.ts.map +1 -1
- package/types/components/RulesEngine/types.d.ts.map +1 -1
- package/types/constants/surface.d.ts +5 -0
- package/types/constants/surface.d.ts.map +1 -0
- package/types/core/componentCreators.d.ts +1 -0
- package/types/core/consent/types.d.ts.map +1 -1
- package/types/core/createEvent.d.ts +1 -0
- package/types/core/createEvent.d.ts.map +1 -1
- package/types/core/edgeNetwork/types.d.ts.map +1 -1
- package/types/core/identity/types.d.ts.map +1 -1
- package/types/core/index.d.ts.map +1 -1
- package/types/core/types.d.ts.map +1 -1
- package/types/utils/createCollect.d.ts +2 -1
- package/types/utils/createCollect.d.ts.map +1 -1
- package/types/utils/deepAssign.d.ts.map +1 -1
- package/types/utils/dom/createGetPageLocation.d.ts +5 -0
- package/types/utils/dom/createGetPageLocation.d.ts.map +1 -0
- package/types/utils/index.d.ts +1 -0
- package/types/utils/request/createRequest.d.ts.map +1 -1
- package/types/utils/request/types.d.ts.map +1 -1
- package/types/utils/surfaceUtils.d.ts +4 -0
- package/types/utils/surfaceUtils.d.ts.map +1 -0
- package/types/utils/types.d.ts.map +1 -1
- package/types/utils/uuid.d.ts.map +1 -1
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.Types = void 0;
|
|
4
|
+
/*
|
|
5
|
+
Copyright 2025 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
|
+
|
|
4
16
|
/**
|
|
5
17
|
* @typedef {Object} ConsentStateMachine
|
|
6
18
|
* @property {function(string): void} in
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.Types = void 0;
|
|
4
|
+
/*
|
|
5
|
+
Copyright 2025 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
|
+
|
|
4
16
|
/** @import { Request } from '../../utils/request/types.js' */
|
|
5
17
|
|
|
6
18
|
/**
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.Types = void 0;
|
|
4
|
+
/*
|
|
5
|
+
Copyright 2025 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
|
+
|
|
4
16
|
/** @import { Logger } from '../../core/types.js' */
|
|
5
17
|
/** @import { CookieJar } from '../../utils/types.js' */
|
|
6
18
|
|
package/libEs5/core/index.js
CHANGED
|
@@ -184,6 +184,8 @@ const createExecuteCommand = ({
|
|
|
184
184
|
getImmediatelyAvailableTools(componentName) {
|
|
185
185
|
const componentLogger = createComponentLogger(componentName);
|
|
186
186
|
return {
|
|
187
|
+
loggingCookieJar,
|
|
188
|
+
instanceName,
|
|
187
189
|
config,
|
|
188
190
|
componentRegistry,
|
|
189
191
|
consent,
|
|
@@ -199,7 +201,9 @@ const createExecuteCommand = ({
|
|
|
199
201
|
}),
|
|
200
202
|
createNamespacedStorage,
|
|
201
203
|
apexDomain,
|
|
202
|
-
getBrowser
|
|
204
|
+
getBrowser,
|
|
205
|
+
cookieTransfer,
|
|
206
|
+
createResponse
|
|
203
207
|
};
|
|
204
208
|
}
|
|
205
209
|
});
|
package/libEs5/core/types.js
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.Types = void 0;
|
|
4
|
+
/*
|
|
5
|
+
Copyright 2025 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
|
+
|
|
4
16
|
/**
|
|
5
17
|
* @typedef {object} AlloyMonitor
|
|
6
18
|
* @property {function(any): void} [onBeforeLog]
|
|
@@ -26,11 +26,13 @@ var _default = ({
|
|
|
26
26
|
documentMayUnload = false,
|
|
27
27
|
eventType = _eventType.DISPLAY,
|
|
28
28
|
propositionEventTypes = [(0, _propositionEventType.getPropositionEventType)(eventType)],
|
|
29
|
-
viewName
|
|
29
|
+
viewName,
|
|
30
|
+
identityMap
|
|
30
31
|
}) => {
|
|
31
32
|
const event = eventManager.createEvent();
|
|
32
33
|
const data = {
|
|
33
|
-
eventType
|
|
34
|
+
eventType,
|
|
35
|
+
identityMap
|
|
34
36
|
};
|
|
35
37
|
if (viewName) {
|
|
36
38
|
data.web = {
|
|
@@ -15,8 +15,13 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
15
15
|
governing permissions and limitations under the License.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
// Keys that should never be copied to prevent prototype pollution.
|
|
19
|
+
const DANGEROUS_KEYS = ["__proto__", "constructor", "prototype"];
|
|
18
20
|
const deepAssignObject = (target, source) => {
|
|
19
21
|
Object.keys(source).forEach(key => {
|
|
22
|
+
if (DANGEROUS_KEYS.includes(key)) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
20
25
|
if ((0, _isObject.default)(target[key]) && (0, _isObject.default)(source[key])) {
|
|
21
26
|
deepAssignObject(target[key], source[key]);
|
|
22
27
|
return;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
/*
|
|
5
|
+
Copyright 2022 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 = ({
|
|
16
|
+
window
|
|
17
|
+
}) => () => {
|
|
18
|
+
return window.location;
|
|
19
|
+
};
|
|
20
|
+
exports.default = _default;
|
package/libEs5/utils/index.js
CHANGED
|
@@ -36,6 +36,12 @@ Object.defineProperty(exports, "createCallbackAggregator", {
|
|
|
36
36
|
return _createCallbackAggregator.default;
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
|
+
Object.defineProperty(exports, "createGetPageLocation", {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () {
|
|
42
|
+
return _createGetPageLocation.default;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
39
45
|
Object.defineProperty(exports, "createLoggingCookieJar", {
|
|
40
46
|
enumerable: true,
|
|
41
47
|
get: function () {
|
|
@@ -362,4 +368,5 @@ var _toISOStringLocal = require("./toISOStringLocal.js");
|
|
|
362
368
|
var _uuid = require("./uuid.js");
|
|
363
369
|
var _updateErrorMessage = require("./updateErrorMessage.js");
|
|
364
370
|
var _validateIdentityMap = require("./validateIdentityMap.js");
|
|
365
|
-
var _validateConfigOverride = require("./validateConfigOverride.js");
|
|
371
|
+
var _validateConfigOverride = require("./validateConfigOverride.js");
|
|
372
|
+
var _createGetPageLocation = require("./dom/createGetPageLocation.js");
|
|
@@ -47,7 +47,8 @@ var _default = options => {
|
|
|
47
47
|
getAction,
|
|
48
48
|
getUseSendBeacon,
|
|
49
49
|
datastreamIdOverride,
|
|
50
|
-
edgeSubPath
|
|
50
|
+
edgeSubPath,
|
|
51
|
+
requestParams = {}
|
|
51
52
|
} = options;
|
|
52
53
|
const id = (0, _index.uuid)();
|
|
53
54
|
let shouldUseThirdPartyDomain = false;
|
|
@@ -86,6 +87,9 @@ var _default = options => {
|
|
|
86
87
|
},
|
|
87
88
|
setIsIdentityEstablished() {
|
|
88
89
|
isIdentityEstablished = true;
|
|
90
|
+
},
|
|
91
|
+
getRequestParams() {
|
|
92
|
+
return requestParams;
|
|
89
93
|
}
|
|
90
94
|
};
|
|
91
95
|
};
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.Types = void 0;
|
|
4
|
+
/*
|
|
5
|
+
Copyright 2025 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
|
+
|
|
4
16
|
/**
|
|
5
17
|
* Request object with methods to access and modify request properties.
|
|
6
18
|
*
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.normalizeSurfaces = exports.isPageWideSurface = exports.buildPageSurface = void 0;
|
|
4
|
+
var _surface = require("../constants/surface.js");
|
|
5
|
+
var _index = require("./index.js");
|
|
6
|
+
/*
|
|
7
|
+
Copyright 2022 Adobe. All rights reserved.
|
|
8
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
10
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
13
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
14
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
15
|
+
governing permissions and limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const SURFACE_REGEX = /^(\w+):\/\/([^/#]+)(\/[^#]*)?(#.*)?$/;
|
|
19
|
+
const AUTHORITY_REGEX = /^(?:.*@)?(?:[a-z\d\u00a1-\uffff.-]+|\[[a-f\d:]+])(?::\d+)?$/;
|
|
20
|
+
const PATH_REGEX = /^\/(?:[/\w\u00a1-\uffff-.~]|%[a-fA-F\d]{2})*$/;
|
|
21
|
+
const FRAGMENT_REGEX = /^#(?:[/\w\u00a1-\uffff-.~]|%[a-fA-F\d]{2})+$/;
|
|
22
|
+
const normalizePath = (path = "/") => {
|
|
23
|
+
let end = path.length;
|
|
24
|
+
while (end > 0 && "/".indexOf(path.charAt(end - 1)) !== -1) {
|
|
25
|
+
end -= 1;
|
|
26
|
+
}
|
|
27
|
+
return path.substring(0, end) || "/";
|
|
28
|
+
};
|
|
29
|
+
const getSurfaceType = surfaceTypeMatch => (0, _index.isNonEmptyString)(surfaceTypeMatch) ? surfaceTypeMatch.toLowerCase() : "";
|
|
30
|
+
const getAuthority = authorityMatch => (0, _index.isNonEmptyString)(authorityMatch) ? authorityMatch.toLowerCase() : "";
|
|
31
|
+
const getPath = pathMatch => (0, _index.isNonEmptyString)(pathMatch) ? normalizePath(pathMatch) : "/";
|
|
32
|
+
const parseSurface = surfaceString => {
|
|
33
|
+
const matched = surfaceString.match(SURFACE_REGEX);
|
|
34
|
+
return matched ? {
|
|
35
|
+
surfaceType: getSurfaceType(matched[1]),
|
|
36
|
+
authority: getAuthority(matched[2]),
|
|
37
|
+
path: getPath(matched[3]),
|
|
38
|
+
fragment: matched[4]
|
|
39
|
+
} : null;
|
|
40
|
+
};
|
|
41
|
+
const stringifySurface = surface => "" + surface.surfaceType + _surface.SURFACE_TYPE_DELIMITER + surface.authority + (surface.path || "") + (surface.fragment || "");
|
|
42
|
+
const buildPageSurface = getPageLocation => {
|
|
43
|
+
const location = getPageLocation();
|
|
44
|
+
const host = location.host.toLowerCase();
|
|
45
|
+
const path = location.pathname;
|
|
46
|
+
return _surface.WEB + _surface.SURFACE_TYPE_DELIMITER + host + normalizePath(path);
|
|
47
|
+
};
|
|
48
|
+
exports.buildPageSurface = buildPageSurface;
|
|
49
|
+
const expandFragmentSurface = (surface, getPageLocation) => surface.startsWith(_surface.FRAGMENT_DELIMITER) ? buildPageSurface(getPageLocation) + surface : surface;
|
|
50
|
+
const validateSurface = (surface, getPageLocation, logger) => {
|
|
51
|
+
const invalidateSurface = validationError => {
|
|
52
|
+
logger.warn(validationError);
|
|
53
|
+
return null;
|
|
54
|
+
};
|
|
55
|
+
if (!(0, _index.isNonEmptyString)(surface)) {
|
|
56
|
+
return invalidateSurface("Invalid surface: " + surface);
|
|
57
|
+
}
|
|
58
|
+
const expanded = expandFragmentSurface(surface, getPageLocation);
|
|
59
|
+
const parsed = parseSurface(expanded);
|
|
60
|
+
if (parsed === null) {
|
|
61
|
+
return invalidateSurface("Invalid surface: " + surface);
|
|
62
|
+
}
|
|
63
|
+
if (![_surface.WEB, _surface.WEBAPP].includes(parsed.surfaceType)) {
|
|
64
|
+
return invalidateSurface("Unsupported surface type " + parsed.surfaceType + " in surface: " + surface);
|
|
65
|
+
}
|
|
66
|
+
if (!parsed.authority || !AUTHORITY_REGEX.test(parsed.authority)) {
|
|
67
|
+
return invalidateSurface("Invalid authority " + parsed.authority + " in surface: " + surface);
|
|
68
|
+
}
|
|
69
|
+
if (parsed.path && !PATH_REGEX.test(parsed.path)) {
|
|
70
|
+
return invalidateSurface("Invalid path " + parsed.path + " in surface: " + surface);
|
|
71
|
+
}
|
|
72
|
+
if (parsed.fragment && !FRAGMENT_REGEX.test(parsed.fragment)) {
|
|
73
|
+
return invalidateSurface("Invalid fragment " + parsed.fragment + " in surface: " + surface);
|
|
74
|
+
}
|
|
75
|
+
return parsed;
|
|
76
|
+
};
|
|
77
|
+
const isPageWideSurface = scope => !!scope && scope.indexOf(_surface.WEB + _surface.SURFACE_TYPE_DELIMITER) === 0 && scope.indexOf(_surface.FRAGMENT_DELIMITER) === -1;
|
|
78
|
+
|
|
79
|
+
// eslint-disable-next-line default-param-last
|
|
80
|
+
exports.isPageWideSurface = isPageWideSurface;
|
|
81
|
+
const normalizeSurfaces = (surfaces = [], getPageLocation, logger) => surfaces.map(surface => validateSurface(surface, getPageLocation, logger)).filter(surface => !(0, _index.isNil)(surface)).map(stringifySurface);
|
|
82
|
+
exports.normalizeSurfaces = normalizeSurfaces;
|
package/libEs5/utils/types.js
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.Types = void 0;
|
|
4
|
+
/*
|
|
5
|
+
Copyright 2025 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
|
+
|
|
4
16
|
/**
|
|
5
17
|
* @typedef {Object} Storage
|
|
6
18
|
* @property {function(string): string|null} getItem
|
package/libEs5/utils/uuid.js
CHANGED
|
@@ -13,4 +13,5 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
13
13
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
14
14
|
governing permissions and limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
// eslint-disable-next-line import/no-unresolved
|
|
16
17
|
var _default = exports.default = _uuid.v4;
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
/*
|
|
2
2
|
Copyright 2023 Adobe. All rights reserved.
|
|
3
|
-
|
|
4
|
-
|
|
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.
|
|
5
11
|
*/
|
|
6
12
|
|
|
7
13
|
import collectSurferId from "../identities/collectSurferId.js";
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
/*
|
|
2
2
|
Copyright 2025 Adobe. All rights reserved.
|
|
3
|
-
|
|
4
|
-
|
|
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.
|
|
5
11
|
*/
|
|
6
12
|
|
|
7
13
|
import collectAllIdentities from "../identities/collectAllIdentities.js";
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
/*
|
|
2
2
|
Copyright 2025 Adobe. All rights reserved.
|
|
3
|
-
This file is licensed under the Apache License, Version 2.0
|
|
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.
|
|
4
11
|
*/
|
|
5
12
|
|
|
6
13
|
import { DISPLAY_CLICK_COOKIE_KEY, SURFER_ID, SURFER_PIXEL_HOST, SURFER_USER_ID, SURFER_TIMEOUT_MS, SURFER_TRUSTED_ORIGIN, SURFER_PARAM_KEY, DISPLAY_CLICK_COOKIE_KEY_EXPIRES } from "../constants/index.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
export const BC_SESSION_COOKIE_NAME = "bc_session_id";
|
|
13
|
+
export const STREAM_START_TIMEOUT_MS = 10000;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2025 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
|
+
export default ({
|
|
14
|
+
queryString
|
|
15
|
+
}) => {
|
|
16
|
+
return ({
|
|
17
|
+
edgeDomain,
|
|
18
|
+
request,
|
|
19
|
+
datastreamId
|
|
20
|
+
}) => {
|
|
21
|
+
const params = request.getRequestParams();
|
|
22
|
+
const configId = request.getDatastreamIdOverride() || datastreamId;
|
|
23
|
+
params.requestId = request.getId();
|
|
24
|
+
params.configId = configId;
|
|
25
|
+
const stringifiedRequestParams = queryString.stringify({
|
|
26
|
+
...params
|
|
27
|
+
});
|
|
28
|
+
return `https://${edgeDomain}${request.getEdgeSubPath()}/${request.getAction()}?${stringifiedRequestParams}`;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2023 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 { createRequest } from "../../utils/request/index.js";
|
|
13
|
+
export default ({
|
|
14
|
+
payload,
|
|
15
|
+
action = "conversations",
|
|
16
|
+
sessionId
|
|
17
|
+
}) => {
|
|
18
|
+
return createRequest({
|
|
19
|
+
payload: payload,
|
|
20
|
+
edgeSubPath: "/brand-concierge",
|
|
21
|
+
requestParams: {
|
|
22
|
+
sessionId
|
|
23
|
+
},
|
|
24
|
+
getAction() {
|
|
25
|
+
return action;
|
|
26
|
+
},
|
|
27
|
+
getUseSendBeacon() {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2025 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 { createDataCollectionRequestPayload } from "../../utils/request/index.js";
|
|
13
|
+
import createConversationServiceRequest from "./createConversationServiceRequest.js";
|
|
14
|
+
import { getConciergeSessionCookie, getPageSurface } from "./utils.js";
|
|
15
|
+
import uuid from "../../utils/uuid.js";
|
|
16
|
+
import createStreamParser from "./createStreamParser.js";
|
|
17
|
+
import createTimeoutWrapper from "./createTimeoutWrapper.js";
|
|
18
|
+
export default ({
|
|
19
|
+
eventManager,
|
|
20
|
+
loggingCookieJar,
|
|
21
|
+
config,
|
|
22
|
+
logger,
|
|
23
|
+
sendConversationServiceRequest,
|
|
24
|
+
buildEndpointUrl,
|
|
25
|
+
cookieTransfer,
|
|
26
|
+
createResponse,
|
|
27
|
+
decodeKndctrCookie,
|
|
28
|
+
lifecycle,
|
|
29
|
+
consent
|
|
30
|
+
}) => {
|
|
31
|
+
const {
|
|
32
|
+
edgeDomain,
|
|
33
|
+
edgeBasePath,
|
|
34
|
+
datastreamId,
|
|
35
|
+
onBeforeEventSend
|
|
36
|
+
} = config;
|
|
37
|
+
return options => {
|
|
38
|
+
let streamingEnabled = false;
|
|
39
|
+
const {
|
|
40
|
+
message,
|
|
41
|
+
onStreamResponse,
|
|
42
|
+
xdm,
|
|
43
|
+
data
|
|
44
|
+
} = options;
|
|
45
|
+
const sessionId = getConciergeSessionCookie({
|
|
46
|
+
loggingCookieJar,
|
|
47
|
+
config
|
|
48
|
+
}) || uuid();
|
|
49
|
+
const payload = createDataCollectionRequestPayload();
|
|
50
|
+
const request = createConversationServiceRequest({
|
|
51
|
+
payload,
|
|
52
|
+
sessionId: sessionId
|
|
53
|
+
});
|
|
54
|
+
const event = eventManager.createEvent();
|
|
55
|
+
if (message || data) {
|
|
56
|
+
const pageSurface = getPageSurface();
|
|
57
|
+
event.mergeQuery({
|
|
58
|
+
conversation: {
|
|
59
|
+
surfaces: [pageSurface],
|
|
60
|
+
message,
|
|
61
|
+
data
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
const {
|
|
66
|
+
state
|
|
67
|
+
} = consent.current();
|
|
68
|
+
event.mergeMeta({
|
|
69
|
+
consent: {
|
|
70
|
+
state: state
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
const ecid = decodeKndctrCookie();
|
|
74
|
+
event.mergeXdm({
|
|
75
|
+
identityMap: {
|
|
76
|
+
ECID: [{
|
|
77
|
+
id: ecid
|
|
78
|
+
}]
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
event.mergeXdm({
|
|
82
|
+
...xdm
|
|
83
|
+
});
|
|
84
|
+
if (message || data) {
|
|
85
|
+
streamingEnabled = true;
|
|
86
|
+
}
|
|
87
|
+
const url = buildEndpointUrl({
|
|
88
|
+
edgeDomain,
|
|
89
|
+
edgeBasePath,
|
|
90
|
+
datastreamId,
|
|
91
|
+
request
|
|
92
|
+
});
|
|
93
|
+
return lifecycle.onBeforeEvent({
|
|
94
|
+
event
|
|
95
|
+
}).then(() => {
|
|
96
|
+
try {
|
|
97
|
+
// NOTE: this calls onBeforeEventSend callback (if configured)
|
|
98
|
+
event.finalize(onBeforeEventSend);
|
|
99
|
+
} catch (error) {
|
|
100
|
+
onStreamResponse({
|
|
101
|
+
error
|
|
102
|
+
});
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
105
|
+
payload.addEvent(event);
|
|
106
|
+
cookieTransfer.cookiesToPayload(payload, edgeDomain);
|
|
107
|
+
return sendConversationServiceRequest({
|
|
108
|
+
requestId: uuid(),
|
|
109
|
+
url,
|
|
110
|
+
request,
|
|
111
|
+
onStreamResponse,
|
|
112
|
+
streamingEnabled
|
|
113
|
+
}).then(response => {
|
|
114
|
+
if (response.status === 204) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const onStreamResponseCallback = event => {
|
|
118
|
+
if (event.error) {
|
|
119
|
+
logger.error("Stream error occurred", event.error);
|
|
120
|
+
onStreamResponse({
|
|
121
|
+
error: event.error
|
|
122
|
+
});
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const substr = event.data.replace("data: ", "");
|
|
126
|
+
const responseJson = JSON.parse(substr);
|
|
127
|
+
const response = createResponse({
|
|
128
|
+
content: responseJson
|
|
129
|
+
});
|
|
130
|
+
cookieTransfer.responseToCookies(response);
|
|
131
|
+
logger.info("onStreamResponse callback called with", response.getPayloadsByType("brand-concierge:conversation"));
|
|
132
|
+
onStreamResponse(response.getPayloadsByType("brand-concierge:conversation"));
|
|
133
|
+
};
|
|
134
|
+
const wrappedCallback = createTimeoutWrapper({
|
|
135
|
+
onStreamResponseCallback
|
|
136
|
+
});
|
|
137
|
+
const streamParser = createStreamParser();
|
|
138
|
+
streamParser(response.body, wrappedCallback);
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
};
|