@adobe/alloy 2.30.1-beta.9 → 2.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/libEs5/components/Advertising/createComponent.js +7 -3
- package/libEs5/components/Advertising/handlers/onBeforeSendEventHandler.js +8 -2
- package/libEs5/components/Advertising/handlers/sendAdConversion.js +11 -6
- package/libEs5/components/Advertising/handlers/viewThroughHandler.js +8 -2
- package/libEs5/components/Advertising/identities/collectSurferId.js +8 -1
- package/libEs5/components/Advertising/index.js +2 -1
- package/libEs5/components/BrandConcierge/configValidators.js +25 -0
- 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 +148 -0
- package/libEs5/components/BrandConcierge/createSendConversationServiceRequest.js +85 -0
- package/libEs5/components/BrandConcierge/createStreamParser.js +131 -0
- package/libEs5/components/BrandConcierge/createTimeoutWrapper.js +79 -0
- package/libEs5/components/BrandConcierge/index.js +102 -0
- package/libEs5/components/BrandConcierge/utils.js +33 -0
- package/libEs5/components/BrandConcierge/validateMessage.js +44 -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 +52 -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 +10 -4
- 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/dom-actions/remapHeadOffers.js +5 -0
- 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/types.js +12 -0
- package/libEs5/components/RulesEngine/createApplyResponse.js +3 -1
- package/libEs5/components/RulesEngine/types.js +12 -0
- package/libEs5/components/StreamingMedia/createMediaEventManager.js +1 -1
- 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 +7 -0
- package/libEs5/core/edgeNetwork/injectSendEdgeNetworkRequest.js +23 -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/clamp.js +25 -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/filterObject.js +1 -1
- package/libEs5/utils/index.js +8 -1
- package/libEs5/utils/prepareConfigOverridesForEdge.js +4 -2
- package/libEs5/utils/request/createDataCollectionRequestPayload.js +3 -0
- package/libEs5/utils/request/createRequest.js +5 -1
- package/libEs5/utils/request/createRequestParams.js +1 -0
- package/libEs5/utils/request/createRequestPayload.js +11 -1
- package/libEs5/utils/request/types.js +13 -0
- package/libEs5/utils/surfaceUtils.js +82 -0
- package/libEs5/utils/types.js +12 -0
- package/libEs6/components/Advertising/createComponent.js +7 -3
- package/libEs6/components/Advertising/handlers/onBeforeSendEventHandler.js +8 -2
- package/libEs6/components/Advertising/handlers/sendAdConversion.js +11 -6
- package/libEs6/components/Advertising/handlers/viewThroughHandler.js +8 -2
- package/libEs6/components/Advertising/identities/collectSurferId.js +8 -1
- package/libEs6/components/Advertising/index.js +2 -1
- package/libEs6/components/BrandConcierge/configValidators.js +22 -0
- 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 +144 -0
- package/libEs6/components/BrandConcierge/createSendConversationServiceRequest.js +81 -0
- package/libEs6/components/BrandConcierge/createStreamParser.js +127 -0
- package/libEs6/components/BrandConcierge/createTimeoutWrapper.js +76 -0
- package/libEs6/components/BrandConcierge/index.js +98 -0
- package/libEs6/components/BrandConcierge/utils.js +27 -0
- package/libEs6/components/BrandConcierge/validateMessage.js +40 -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 +48 -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 +10 -4
- 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/dom-actions/remapHeadOffers.js +6 -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/types.js +12 -0
- package/libEs6/components/RulesEngine/createApplyResponse.js +3 -1
- package/libEs6/components/RulesEngine/types.js +12 -0
- package/libEs6/components/StreamingMedia/createMediaEventManager.js +1 -1
- 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 +7 -0
- package/libEs6/core/edgeNetwork/injectSendEdgeNetworkRequest.js +23 -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/clamp.js +22 -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/filterObject.js +1 -1
- package/libEs6/utils/index.js +2 -1
- package/libEs6/utils/prepareConfigOverridesForEdge.js +4 -2
- package/libEs6/utils/request/createDataCollectionRequestPayload.js +3 -0
- package/libEs6/utils/request/createRequest.js +5 -1
- package/libEs6/utils/request/createRequestParams.js +1 -0
- package/libEs6/utils/request/createRequestPayload.js +11 -1
- package/libEs6/utils/request/types.js +13 -0
- package/libEs6/utils/surfaceUtils.js +76 -0
- package/libEs6/utils/types.js +12 -0
- package/package.json +32 -36
- package/scripts/helpers/path.js +12 -0
- package/scripts/helpers/versionBabelPlugin.js +12 -0
- package/types/components/Advertising/createComponent.d.ts +3 -2
- package/types/components/Advertising/createComponent.d.ts.map +1 -1
- package/types/components/Advertising/handlers/onBeforeSendEventHandler.d.ts.map +1 -1
- package/types/components/Advertising/handlers/sendAdConversion.d.ts +2 -1
- package/types/components/Advertising/handlers/sendAdConversion.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/Advertising/index.d.ts +1 -1
- package/types/components/Advertising/index.d.ts.map +1 -1
- package/types/components/BrandConcierge/configValidators.d.ts +3 -0
- package/types/components/BrandConcierge/configValidators.d.ts.map +1 -0
- 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 +7 -0
- package/types/components/BrandConcierge/createStreamParser.d.ts.map +1 -0
- package/types/components/BrandConcierge/createTimeoutWrapper.d.ts +6 -0
- package/types/components/BrandConcierge/createTimeoutWrapper.d.ts.map +1 -0
- package/types/components/BrandConcierge/index.d.ts +32 -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/dom-actions/remapHeadOffers.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 +2 -0
- package/types/core/createEvent.d.ts.map +1 -1
- package/types/core/edgeNetwork/injectSendEdgeNetworkRequest.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/clamp.d.ts +3 -0
- package/types/utils/clamp.d.ts.map +1 -0
- 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/prepareConfigOverridesForEdge.d.ts.map +1 -1
- package/types/utils/request/createDataCollectionRequestPayload.d.ts.map +1 -1
- package/types/utils/request/createRequest.d.ts.map +1 -1
- package/types/utils/request/createRequestParams.d.ts.map +1 -1
- package/types/utils/request/createRequestPayload.d.ts.map +1 -1
- package/types/utils/request/types.d.ts +2 -0
- 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/libEs5/components/Personalization/in-app-message-actions/actions/displayIframeContent.js
CHANGED
|
@@ -279,7 +279,8 @@ exports.displayHTMLContentInIframe = displayHTMLContentInIframe;
|
|
|
279
279
|
var _default = (settings, collect) => {
|
|
280
280
|
return new Promise(resolve => {
|
|
281
281
|
const {
|
|
282
|
-
meta
|
|
282
|
+
meta,
|
|
283
|
+
identityMap
|
|
283
284
|
} = settings;
|
|
284
285
|
displayHTMLContentInIframe(settings, (action, propositionAction) => {
|
|
285
286
|
const propositionEventTypes = {};
|
|
@@ -291,7 +292,8 @@ var _default = (settings, collect) => {
|
|
|
291
292
|
decisionsMeta: [meta],
|
|
292
293
|
propositionAction,
|
|
293
294
|
eventType: _eventType.INTERACT,
|
|
294
|
-
propositionEventTypes: Object.keys(propositionEventTypes)
|
|
295
|
+
propositionEventTypes: Object.keys(propositionEventTypes),
|
|
296
|
+
identityMap
|
|
295
297
|
});
|
|
296
298
|
});
|
|
297
299
|
resolve({
|
|
@@ -25,7 +25,7 @@ var _injectCreateProposition = require("./handlers/injectCreateProposition.js");
|
|
|
25
25
|
var _createAsyncArray = require("./utils/createAsyncArray.js");
|
|
26
26
|
var schema = require("../../constants/schema.js");
|
|
27
27
|
var _processDefaultContent = require("./handlers/processDefaultContent.js");
|
|
28
|
-
var _surfaceUtils = require("
|
|
28
|
+
var _surfaceUtils = require("../../utils/surfaceUtils.js");
|
|
29
29
|
var _createProcessDomAction = require("./handlers/createProcessDomAction.js");
|
|
30
30
|
var _createProcessHtmlContent = require("./handlers/createProcessHtmlContent.js");
|
|
31
31
|
var _createProcessRedirect = require("./handlers/createProcessRedirect.js");
|
|
@@ -40,7 +40,7 @@ var _collectInteractions = require("./dom-actions/clicks/collectInteractions.js"
|
|
|
40
40
|
var _propositionInteractionType = require("../../constants/propositionInteractionType.js");
|
|
41
41
|
var _decisionProvider = require("../../constants/decisionProvider.js");
|
|
42
42
|
/*
|
|
43
|
-
Copyright
|
|
43
|
+
Copyright 2025 Adobe. All rights reserved.
|
|
44
44
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
45
45
|
you may not use this file except in compliance with the License. You may obtain a copy
|
|
46
46
|
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -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 { Identity } from '../../utils/request/types.js' */
|
|
5
17
|
|
|
6
18
|
/**
|
|
@@ -28,11 +28,13 @@ var _default = ({
|
|
|
28
28
|
// We extract them and add the events to the event registry.
|
|
29
29
|
const eventPayloads = (0, _extractPayloadsFromEventHistoryOperations.default)(propositions);
|
|
30
30
|
eventRegistry.addEventPayloads(eventPayloads);
|
|
31
|
+
const identityMap = event?.getUserIdentityMap();
|
|
31
32
|
lifecycle.onDecision({
|
|
32
33
|
renderDecisions,
|
|
33
34
|
propositions,
|
|
34
35
|
event,
|
|
35
|
-
personalization
|
|
36
|
+
personalization,
|
|
37
|
+
identityMap
|
|
36
38
|
});
|
|
37
39
|
}
|
|
38
40
|
return {
|
|
@@ -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 {Record<string, EventRecord>} EventRegistry
|
|
6
18
|
*/
|
|
@@ -14,4 +14,4 @@ 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 = exports.default = "2.
|
|
17
|
+
var _default = exports.default = "2.31.0";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.WEBAPP = exports.WEB = exports.SURFACE_TYPE_DELIMITER = exports.FRAGMENT_DELIMITER = 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
|
+
|
|
16
|
+
const WEB = exports.WEB = "web";
|
|
17
|
+
const WEBAPP = exports.WEBAPP = "webapp";
|
|
18
|
+
const SURFACE_TYPE_DELIMITER = exports.SURFACE_TYPE_DELIMITER = "://";
|
|
19
|
+
const FRAGMENT_DELIMITER = exports.FRAGMENT_DELIMITER = "#";
|
|
@@ -18,6 +18,12 @@ Object.defineProperty(exports, "audiences", {
|
|
|
18
18
|
return _index2.default;
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
|
+
Object.defineProperty(exports, "brandConcierge", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _index1.default;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
21
27
|
Object.defineProperty(exports, "consent", {
|
|
22
28
|
enumerable: true,
|
|
23
29
|
get: function () {
|
|
@@ -69,4 +75,5 @@ var _index6 = require("../components/Personalization/index.js");
|
|
|
69
75
|
var _index7 = require("../components/RulesEngine/index.js");
|
|
70
76
|
var _index8 = require("../components/StreamingMedia/index.js");
|
|
71
77
|
var _index9 = require("../components/Advertising/index.js");
|
|
72
|
-
var _index0 = require("../components/PushNotifications/index.js");
|
|
78
|
+
var _index0 = require("../components/PushNotifications/index.js");
|
|
79
|
+
var _index1 = require("../components/BrandConcierge/index.js");
|
|
@@ -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
|
|
@@ -27,6 +27,7 @@ const getXdmPropositions = xdm => {
|
|
|
27
27
|
};
|
|
28
28
|
var _default = () => {
|
|
29
29
|
const content = {};
|
|
30
|
+
const createdAt = Date.now();
|
|
30
31
|
let userXdm;
|
|
31
32
|
let userData;
|
|
32
33
|
let documentMayUnload = false;
|
|
@@ -141,6 +142,9 @@ var _default = () => {
|
|
|
141
142
|
getDocumentMayUnload() {
|
|
142
143
|
return documentMayUnload;
|
|
143
144
|
},
|
|
145
|
+
getCreatedAt() {
|
|
146
|
+
return createdAt;
|
|
147
|
+
},
|
|
144
148
|
isEmpty() {
|
|
145
149
|
return (0, _index.isEmptyObject)(content) && (!userXdm || (0, _index.isEmptyObject)(userXdm)) && (!userData || (0, _index.isEmptyObject)(userData));
|
|
146
150
|
},
|
|
@@ -153,6 +157,9 @@ var _default = () => {
|
|
|
153
157
|
}
|
|
154
158
|
return userXdm.web.webPageDetails.viewName;
|
|
155
159
|
},
|
|
160
|
+
getUserIdentityMap() {
|
|
161
|
+
return userXdm?.identityMap;
|
|
162
|
+
},
|
|
156
163
|
toJSON() {
|
|
157
164
|
if (!isFinalized) {
|
|
158
165
|
throw new Error("toJSON called before finalize");
|
|
@@ -5,6 +5,7 @@ var _domain = require("../../constants/domain.js");
|
|
|
5
5
|
var _apiVersion = require("../../constants/apiVersion.js");
|
|
6
6
|
var _index = require("../../utils/index.js");
|
|
7
7
|
var _networkErrors = require("../../utils/networkErrors.js");
|
|
8
|
+
var _clamp = require("../../utils/clamp.js");
|
|
8
9
|
var _mergeLifecycleResponses = require("./mergeLifecycleResponses.js");
|
|
9
10
|
var _handleRequestFailure = require("./handleRequestFailure.js");
|
|
10
11
|
/*
|
|
@@ -22,6 +23,22 @@ governing permissions and limitations under the License.
|
|
|
22
23
|
/** @import { EdgeRequestExecutor } from './types.js' */
|
|
23
24
|
/** @import { ResponseCreator } from '../types.js' */
|
|
24
25
|
|
|
26
|
+
const MAX_QUEUE_TIME_MILLIS = 300000; // 5 minutes
|
|
27
|
+
|
|
28
|
+
const calculateQueueTimeMillis = payload => {
|
|
29
|
+
if (typeof payload.getEvents !== "function") {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
const events = payload.getEvents();
|
|
33
|
+
if (events.length === 0) {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// In practice, there should only be one event in the payload, in the future if this changes we'll need to
|
|
38
|
+
// evaluate what timestamp to use (earliest, average, latest), or move the queueTime to the event meta
|
|
39
|
+
const earliestCreatedAt = Math.min(...events.map(event => event.getCreatedAt()));
|
|
40
|
+
return (0, _clamp.default)(Date.now() - earliestCreatedAt, 0, MAX_QUEUE_TIME_MILLIS);
|
|
41
|
+
};
|
|
25
42
|
const isDemdexBlockedError = (error, request) => {
|
|
26
43
|
return request.getUseIdThirdPartyDomain() && (0, _networkErrors.isNetworkError)(error);
|
|
27
44
|
};
|
|
@@ -97,6 +114,12 @@ var _default = ({
|
|
|
97
114
|
const endpointDomain = hasDemdexFailed || !request.getUseIdThirdPartyDomain() ? edgeDomain : _domain.ID_THIRD_PARTY;
|
|
98
115
|
const url = buildEndpointUrl(endpointDomain, request);
|
|
99
116
|
const payload = request.getPayload();
|
|
117
|
+
const queueTimeMillis = calculateQueueTimeMillis(payload);
|
|
118
|
+
if (queueTimeMillis !== undefined) {
|
|
119
|
+
payload.mergeMeta({
|
|
120
|
+
queueTimeMillis
|
|
121
|
+
});
|
|
122
|
+
}
|
|
100
123
|
cookieTransfer.cookiesToPayload(payload, endpointDomain);
|
|
101
124
|
return sendNetworkRequest({
|
|
102
125
|
requestId: request.getId(),
|
|
@@ -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]
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.default = 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
|
+
/**
|
|
16
|
+
* Clamps a value between a minimum and maximum value.
|
|
17
|
+
* @param {number} value - The value to clamp.
|
|
18
|
+
* @param {number} min - The minimum value.
|
|
19
|
+
* @param {number} max - The maximum value.
|
|
20
|
+
* @returns {number} The clamped value.
|
|
21
|
+
*/
|
|
22
|
+
var _default = (value, min, max) => {
|
|
23
|
+
return Math.max(min, Math.min(value, max));
|
|
24
|
+
};
|
|
25
|
+
exports.default = _default;
|
|
@@ -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");
|
|
@@ -27,11 +27,13 @@ var _default = configuration => {
|
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
29
29
|
// remove entries that are empty strings or arrays
|
|
30
|
-
const configOverrides = (0, _filterObject.default)(configuration, value => {
|
|
30
|
+
const configOverrides = (0, _filterObject.default)(configuration, (value, key) => {
|
|
31
31
|
if ((0, _isNil.default)(value)) {
|
|
32
32
|
return false;
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
// We want to remove all the { enabled: true } values, but leave any other boolean values.
|
|
35
|
+
// Experience Edge will not accept { enabled: true } values as true is the default for "enabled".
|
|
36
|
+
if ((0, _isBoolean.default)(value) && (key !== "enabled" || value === false)) {
|
|
35
37
|
return true;
|
|
36
38
|
}
|
|
37
39
|
if ((0, _isNumber.default)(value)) {
|
|
@@ -34,6 +34,9 @@ var _default = () => {
|
|
|
34
34
|
content.events = content.events || [];
|
|
35
35
|
content.events.push(event);
|
|
36
36
|
},
|
|
37
|
+
getEvents: () => {
|
|
38
|
+
return content.events || [];
|
|
39
|
+
},
|
|
37
40
|
getDocumentMayUnload: () => {
|
|
38
41
|
return (content.events || []).some(event => event.getDocumentMayUnload());
|
|
39
42
|
}
|
|
@@ -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
|
};
|
|
@@ -44,6 +44,7 @@ var _default = ({
|
|
|
44
44
|
if (localConfigOverridesWithoutDatastreamId && !(0, _index.isEmptyObject)(localConfigOverridesWithoutDatastreamId)) {
|
|
45
45
|
payload.mergeConfigOverride(localConfigOverridesWithoutDatastreamId);
|
|
46
46
|
}
|
|
47
|
+
payload.finalizeConfigOverrides();
|
|
47
48
|
return requestParams;
|
|
48
49
|
};
|
|
49
50
|
exports.default = _default;
|
|
@@ -90,7 +90,17 @@ var _default = options => {
|
|
|
90
90
|
mergeMeta: (0, _index.createMerger)(content, "meta"),
|
|
91
91
|
mergeState: (0, _index.createMerger)(content, "meta.state"),
|
|
92
92
|
mergeQuery: (0, _index.createMerger)(content, "query"),
|
|
93
|
-
mergeConfigOverride: updates => mergeConfigOverrides(
|
|
93
|
+
mergeConfigOverride: updates => mergeConfigOverrides(updates),
|
|
94
|
+
finalizeConfigOverrides: () => {
|
|
95
|
+
if (content.meta?.configOverrides) {
|
|
96
|
+
const prepared = (0, _index.prepareConfigOverridesForEdge)(content.meta.configOverrides);
|
|
97
|
+
if (prepared === null) {
|
|
98
|
+
delete content.meta.configOverrides;
|
|
99
|
+
} else {
|
|
100
|
+
content.meta.configOverrides = prepared;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
94
104
|
addIdentity,
|
|
95
105
|
hasIdentity,
|
|
96
106
|
toJSON() {
|
|
@@ -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
|
*
|
|
@@ -40,6 +52,7 @@ exports.Types = void 0;
|
|
|
40
52
|
* @property {function(string, Identity): void} options.addIdentity
|
|
41
53
|
* @property {function(string): boolean} options.hasIdentity
|
|
42
54
|
* @property {function(object): void} addEvent
|
|
55
|
+
* @property {function(): Array} getEvents
|
|
43
56
|
* @property {function(): boolean} getDocumentMayUnload
|
|
44
57
|
* @property {function(): object} toJSON
|
|
45
58
|
*/
|
|
@@ -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
|