@adobe/alloy 2.29.0-beta.0 → 2.29.0-beta.13
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/ActivityCollector/utils/dom/findClickableElement.js +4 -0
- package/libEs5/components/Advertising/createComponent.js +1 -5
- package/libEs5/components/Advertising/handlers/clickThroughHandler.js +2 -1
- package/libEs5/components/Advertising/handlers/sendAdConversion.js +6 -8
- package/libEs5/components/Advertising/handlers/viewThroughHandler.js +4 -3
- package/libEs5/components/Consent/createConsentRequestPayload.js +14 -3
- package/libEs5/components/Consent/types.js +18 -0
- package/libEs5/components/Identity/createComponent.js +5 -4
- package/libEs5/components/Identity/index.js +4 -9
- package/libEs5/components/Personalization/dom-actions/action.js +7 -4
- package/libEs5/components/Personalization/dom-actions/initDomActionsModules.js +10 -10
- package/libEs5/components/PushNotifications/helpers/getPushSubscriptionDetails.js +112 -0
- package/libEs5/components/PushNotifications/index.js +96 -0
- package/libEs5/components/PushNotifications/request/createSendPushSubscriptionPayload.js +62 -0
- package/libEs5/components/PushNotifications/request/createSendPushSubscriptionRequest.js +35 -0
- package/libEs5/components/PushNotifications/request/makeSendPushSubscriptionRequest.js +88 -0
- package/libEs5/components/PushNotifications/types.js +14 -0
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/core/componentCreators.js +8 -1
- package/libEs5/core/consent/createConsent.js +10 -0
- package/libEs5/core/consent/createConsentStateMachine.js +36 -0
- package/libEs5/core/consent/types.js +24 -0
- package/libEs5/core/edgeNetwork/injectSendEdgeNetworkRequest.js +20 -0
- package/libEs5/core/edgeNetwork/types.js +10 -0
- package/libEs5/core/identity/createIdentity.js +82 -0
- package/libEs5/core/identity/types.js +15 -0
- package/libEs5/core/index.js +8 -0
- package/libEs5/core/injectCreateResponse.js +9 -7
- package/libEs5/core/types.js +101 -11
- package/libEs5/utils/bytes.js +38 -0
- package/libEs5/{components/Identity → utils}/createDecodeKndctrCookie.js +12 -20
- package/libEs5/utils/createLoggingCookieJar.js +14 -1
- package/libEs5/utils/createMerger.js +5 -4
- package/libEs5/utils/index.js +13 -0
- package/libEs5/utils/injectStorage.js +19 -0
- package/libEs5/utils/request/createDataCollectionRequestPayload.js +16 -8
- package/libEs5/utils/request/createRequest.js +28 -1
- package/libEs5/utils/request/createRequestPayload.js +68 -4
- package/libEs5/utils/request/types.js +52 -0
- package/libEs5/utils/types.js +39 -0
- package/libEs6/components/ActivityCollector/utils/dom/findClickableElement.js +4 -0
- package/libEs6/components/Advertising/createComponent.js +1 -5
- package/libEs6/components/Advertising/handlers/clickThroughHandler.js +2 -1
- package/libEs6/components/Advertising/handlers/sendAdConversion.js +6 -8
- package/libEs6/components/Advertising/handlers/viewThroughHandler.js +4 -3
- package/libEs6/components/Consent/createConsentRequestPayload.js +16 -3
- package/libEs6/components/Consent/types.js +15 -0
- package/libEs6/components/Identity/createComponent.js +5 -4
- package/libEs6/components/Identity/index.js +4 -9
- package/libEs6/components/Personalization/dom-actions/action.js +7 -4
- package/libEs6/components/Personalization/dom-actions/initDomActionsModules.js +10 -10
- package/libEs6/components/PushNotifications/helpers/getPushSubscriptionDetails.js +110 -0
- package/libEs6/components/PushNotifications/index.js +93 -0
- package/libEs6/components/PushNotifications/request/createSendPushSubscriptionPayload.js +61 -0
- package/libEs6/components/PushNotifications/request/createSendPushSubscriptionRequest.js +34 -0
- package/libEs6/components/PushNotifications/request/makeSendPushSubscriptionRequest.js +84 -0
- package/libEs6/components/PushNotifications/types.js +11 -0
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/core/componentCreators.js +2 -1
- package/libEs6/core/consent/createConsent.js +12 -0
- package/libEs6/core/consent/createConsentStateMachine.js +36 -0
- package/libEs6/core/consent/types.js +21 -0
- package/libEs6/core/edgeNetwork/injectSendEdgeNetworkRequest.js +20 -0
- package/libEs6/core/edgeNetwork/types.js +7 -0
- package/libEs6/core/identity/createIdentity.js +81 -0
- package/libEs6/core/identity/types.js +12 -0
- package/libEs6/core/index.js +8 -0
- package/libEs6/core/injectCreateResponse.js +11 -7
- package/libEs6/core/types.js +101 -11
- package/libEs6/utils/bytes.js +33 -0
- package/libEs6/{components/Identity → utils}/createDecodeKndctrCookie.js +11 -19
- package/libEs6/utils/createLoggingCookieJar.js +15 -1
- package/libEs6/utils/createMerger.js +5 -4
- package/libEs6/utils/index.js +1 -0
- package/libEs6/utils/injectStorage.js +20 -0
- package/libEs6/utils/request/createDataCollectionRequestPayload.js +19 -8
- package/libEs6/utils/request/createRequest.js +29 -1
- package/libEs6/utils/request/createRequestPayload.js +67 -4
- package/libEs6/utils/request/types.js +49 -0
- package/libEs6/utils/types.js +36 -0
- package/package.json +30 -30
- package/types/components/ActivityCollector/utils/dom/findClickableElement.d.ts.map +1 -1
- package/types/components/Advertising/createComponent.d.ts +1 -1
- package/types/components/Advertising/createComponent.d.ts.map +1 -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/index.d.ts +1 -1
- package/types/components/Consent/createConsentRequest.d.ts +1 -11
- package/types/components/Consent/createConsentRequest.d.ts.map +1 -1
- package/types/components/Consent/createConsentRequestPayload.d.ts +2 -9
- package/types/components/Consent/createConsentRequestPayload.d.ts.map +1 -1
- package/types/components/Consent/types.d.ts +28 -0
- package/types/components/Consent/types.d.ts.map +1 -0
- package/types/components/Identity/createComponent.d.ts +2 -2
- package/types/components/Identity/createComponent.d.ts.map +1 -1
- package/types/components/Identity/getIdentity/createIdentityRequest.d.ts +1 -11
- package/types/components/Identity/getIdentity/createIdentityRequest.d.ts.map +1 -1
- package/types/components/Identity/getIdentity/createIdentityRequestPayload.d.ts +1 -9
- package/types/components/Identity/getIdentity/createIdentityRequestPayload.d.ts.map +1 -1
- package/types/components/Identity/index.d.ts +2 -1
- package/types/components/Identity/index.d.ts.map +1 -1
- package/types/components/Personalization/dom-actions/action.d.ts +1 -1
- package/types/components/Personalization/dom-actions/action.d.ts.map +1 -1
- package/types/components/PushNotifications/helpers/getPushSubscriptionDetails.d.ts +30 -0
- package/types/components/PushNotifications/helpers/getPushSubscriptionDetails.d.ts.map +1 -0
- package/types/components/PushNotifications/index.d.ts +43 -0
- package/types/components/PushNotifications/index.d.ts.map +1 -0
- package/types/components/PushNotifications/request/createSendPushSubscriptionPayload.d.ts +10 -0
- package/types/components/PushNotifications/request/createSendPushSubscriptionPayload.d.ts.map +1 -0
- package/types/components/PushNotifications/request/createSendPushSubscriptionRequest.d.ts +7 -0
- package/types/components/PushNotifications/request/createSendPushSubscriptionRequest.d.ts.map +1 -0
- package/types/components/PushNotifications/request/makeSendPushSubscriptionRequest.d.ts +20 -0
- package/types/components/PushNotifications/request/makeSendPushSubscriptionRequest.d.ts.map +1 -0
- package/types/components/PushNotifications/types.d.ts +23 -0
- package/types/components/PushNotifications/types.d.ts.map +1 -0
- package/types/components/StreamingMedia/createMediaRequest.d.ts +1 -11
- package/types/components/StreamingMedia/createMediaRequest.d.ts.map +1 -1
- package/types/core/componentCreators.d.ts +1 -0
- package/types/core/consent/createConsent.d.ts +4 -10
- package/types/core/consent/createConsent.d.ts.map +1 -1
- package/types/core/consent/createConsentStateMachine.d.ts +4 -12
- package/types/core/consent/createConsentStateMachine.d.ts.map +1 -1
- package/types/core/consent/types.d.ts +42 -0
- package/types/core/consent/types.d.ts.map +1 -0
- package/types/core/edgeNetwork/injectSendEdgeNetworkRequest.d.ts +15 -13
- package/types/core/edgeNetwork/injectSendEdgeNetworkRequest.d.ts.map +1 -1
- package/types/core/edgeNetwork/types.d.ts +12 -0
- package/types/core/edgeNetwork/types.d.ts.map +1 -0
- package/types/core/identity/createIdentity.d.ts +12 -0
- package/types/core/identity/createIdentity.d.ts.map +1 -0
- package/types/core/identity/types.d.ts +23 -0
- package/types/core/identity/types.d.ts.map +1 -0
- package/types/core/index.d.ts.map +1 -1
- package/types/core/injectCreateResponse.d.ts +3 -27
- package/types/core/injectCreateResponse.d.ts.map +1 -1
- package/types/core/types.d.ts +209 -22
- package/types/core/types.d.ts.map +1 -1
- package/types/utils/bytes.d.ts +3 -0
- package/types/utils/bytes.d.ts.map +1 -0
- package/types/utils/createDecodeKndctrCookie.d.ts.map +1 -0
- package/types/utils/createLoggingCookieJar.d.ts +5 -3
- package/types/utils/createLoggingCookieJar.d.ts.map +1 -1
- package/types/utils/createMerger.d.ts +1 -1
- package/types/utils/createMerger.d.ts.map +1 -1
- package/types/utils/index.d.ts +1 -0
- package/types/utils/injectStorage.d.ts +2 -40
- package/types/utils/injectStorage.d.ts.map +1 -1
- package/types/utils/request/createDataCollectionRequest.d.ts +1 -11
- package/types/utils/request/createDataCollectionRequest.d.ts.map +1 -1
- package/types/utils/request/createDataCollectionRequestPayload.d.ts +2 -9
- package/types/utils/request/createDataCollectionRequestPayload.d.ts.map +1 -1
- package/types/utils/request/createRequest.d.ts +13 -11
- package/types/utils/request/createRequest.d.ts.map +1 -1
- package/types/utils/request/createRequestPayload.d.ts +7 -9
- package/types/utils/request/createRequestPayload.d.ts.map +1 -1
- package/types/utils/request/types.d.ts +91 -0
- package/types/utils/request/types.d.ts.map +1 -0
- package/types/utils/types.d.ts +91 -0
- package/types/utils/types.d.ts.map +1 -0
- package/types/components/Identity/createDecodeKndctrCookie.d.ts.map +0 -1
- /package/types/{components/Identity → utils}/createDecodeKndctrCookie.d.ts +0 -0
|
@@ -12,6 +12,19 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
12
12
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
13
13
|
governing permissions and limitations under the License.
|
|
14
14
|
*/
|
|
15
|
+
/** @import { Logger } from '../core/types.js' */
|
|
16
|
+
/** @import { CookieJar } from './types.js' */
|
|
17
|
+
/**
|
|
18
|
+
* Creates a logging wrapper around a cookie jar that logs cookie operations.
|
|
19
|
+
*
|
|
20
|
+
* @function
|
|
21
|
+
*
|
|
22
|
+
* @param {object} options
|
|
23
|
+
* @param {Logger} options.logger
|
|
24
|
+
* @param {CookieJar} options.cookieJar
|
|
25
|
+
*
|
|
26
|
+
* @returns {CookieJar}
|
|
27
|
+
*/
|
|
15
28
|
var _default = ({
|
|
16
29
|
logger,
|
|
17
30
|
cookieJar
|
|
@@ -24,7 +37,7 @@ var _default = ({
|
|
|
24
37
|
value,
|
|
25
38
|
...options
|
|
26
39
|
});
|
|
27
|
-
cookieJar.set(key, value, options);
|
|
40
|
+
return cookieJar.set(key, value, options);
|
|
28
41
|
}
|
|
29
42
|
};
|
|
30
43
|
};
|
|
@@ -16,10 +16,11 @@ governing permissions and limitations under the License.
|
|
|
16
16
|
/**
|
|
17
17
|
* Creates a function that, when passed an object of updates, will merge
|
|
18
18
|
* the updates onto the current value of a payload property.
|
|
19
|
-
*
|
|
20
|
-
* @param {
|
|
21
|
-
* can be a dot-notation property path.
|
|
22
|
-
*
|
|
19
|
+
*
|
|
20
|
+
* @param {object} content The base object to modify
|
|
21
|
+
* @param {string} key The property to merge updates into. This can be a dot-notation property path.
|
|
22
|
+
*
|
|
23
|
+
* @returns {function(object): void}
|
|
23
24
|
*/
|
|
24
25
|
var _default = (content, key) => updates => {
|
|
25
26
|
const propertyPath = key.split(".");
|
package/libEs5/utils/index.js
CHANGED
|
@@ -6,6 +6,18 @@ Object.defineProperty(exports, "assignConcatArrayValues", {
|
|
|
6
6
|
return _assignConcatArrayValues.default;
|
|
7
7
|
}
|
|
8
8
|
});
|
|
9
|
+
Object.defineProperty(exports, "base64ToBytes", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () {
|
|
12
|
+
return _bytes.base64ToBytes;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "bytesToBase64", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () {
|
|
18
|
+
return _bytes.bytesToBase64;
|
|
19
|
+
}
|
|
20
|
+
});
|
|
9
21
|
Object.defineProperty(exports, "clone", {
|
|
10
22
|
enumerable: true,
|
|
11
23
|
get: function () {
|
|
@@ -301,6 +313,7 @@ Object.defineProperty(exports, "validateIdentityMap", {
|
|
|
301
313
|
}
|
|
302
314
|
});
|
|
303
315
|
var _assignConcatArrayValues = require("./assignConcatArrayValues.js");
|
|
316
|
+
var _bytes = require("./bytes.js");
|
|
304
317
|
var _clone = require("./clone.js");
|
|
305
318
|
var _cookieJar = require("./cookieJar.js");
|
|
306
319
|
var _createMerger = require("./createMerger.js");
|
|
@@ -14,6 +14,16 @@ 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
|
|
|
17
|
+
/** @import { Storage, StorageCreator } from './types.js' */
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Creates a storage interface for a specific storage type with namespaced keys.
|
|
21
|
+
*
|
|
22
|
+
* @param {Object} context - The context object (typically window) that provides storage APIs.
|
|
23
|
+
* @param {string} storageType - The type of storage to use ('localStorage' or 'sessionStorage').
|
|
24
|
+
* @param {string} namespace - The namespace prefix to prepend to all storage keys.
|
|
25
|
+
* @returns {Storage}
|
|
26
|
+
*/
|
|
17
27
|
const getStorageByType = (context, storageType, namespace) => {
|
|
18
28
|
// When storage is disabled on Safari, the mere act of referencing
|
|
19
29
|
// window.localStorage or window.sessionStorage throws an error.
|
|
@@ -62,6 +72,15 @@ const getStorageByType = (context, storageType, namespace) => {
|
|
|
62
72
|
}
|
|
63
73
|
};
|
|
64
74
|
};
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Creates a storage factory function that provides access to both session and persistent storage
|
|
78
|
+
* with namespaced keys. This is a higher-order function that returns a function which can be
|
|
79
|
+
* used to create storage instances with additional namespace suffixes.
|
|
80
|
+
*
|
|
81
|
+
* @param {Object} context - The context object (typically window) that provides storage APIs.
|
|
82
|
+
* @returns {StorageCreator}
|
|
83
|
+
*/
|
|
65
84
|
var _default = context => additionalNamespace => {
|
|
66
85
|
const finalNamespace = _namespace.default + additionalNamespace;
|
|
67
86
|
return {
|
|
@@ -15,20 +15,28 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
15
15
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
16
16
|
governing permissions and limitations under the License.
|
|
17
17
|
*/
|
|
18
|
+
/** @import { DataCollectionRequestPayload } from './types.js' */
|
|
19
|
+
/**
|
|
20
|
+
* @function
|
|
21
|
+
*
|
|
22
|
+
* @returns {DataCollectionRequestPayload}
|
|
23
|
+
*/
|
|
18
24
|
var _default = () => {
|
|
19
25
|
const content = {};
|
|
20
|
-
const
|
|
26
|
+
const requestPayload = (0, _createRequestPayload.default)({
|
|
21
27
|
content,
|
|
22
28
|
addIdentity: (0, _createAddIdentity.default)(content),
|
|
23
29
|
hasIdentity: (0, _createHasIdentity.default)(content)
|
|
24
30
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
return {
|
|
32
|
+
...requestPayload,
|
|
33
|
+
addEvent: event => {
|
|
34
|
+
content.events = content.events || [];
|
|
35
|
+
content.events.push(event);
|
|
36
|
+
},
|
|
37
|
+
getDocumentMayUnload: () => {
|
|
38
|
+
return (content.events || []).some(event => event.getDocumentMayUnload());
|
|
39
|
+
}
|
|
28
40
|
};
|
|
29
|
-
payload.getDocumentMayUnload = () => {
|
|
30
|
-
return (content.events || []).some(event => event.getDocumentMayUnload());
|
|
31
|
-
};
|
|
32
|
-
return payload;
|
|
33
41
|
};
|
|
34
42
|
exports.default = _default;
|
|
@@ -13,7 +13,34 @@ 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
|
-
|
|
16
|
+
/** @import { Request, RequestPayload } from './types.js' */
|
|
17
|
+
/**
|
|
18
|
+
* Creates a request object with methods to access and modify request properties.
|
|
19
|
+
*
|
|
20
|
+
* @function
|
|
21
|
+
*
|
|
22
|
+
* @param {Object} options
|
|
23
|
+
* @param {RequestPayload} options.payload
|
|
24
|
+
* @param {function({isIdentityEstablished: boolean}): string} options.getAction
|
|
25
|
+
* @param {function({isIdentityEstablished: boolean}): boolean} options.getUseSendBeacon
|
|
26
|
+
* @param {string} [options.datastreamIdOverride]
|
|
27
|
+
* @param {string} [options.edgeSubPath]
|
|
28
|
+
*
|
|
29
|
+
* @returns {Request}
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* const request = createRequest({
|
|
33
|
+
* payload: { event: 'pageView' },
|
|
34
|
+
* getAction: ({ isIdentityEstablished }) => isIdentityEstablished ? 'send' : 'queue',
|
|
35
|
+
* getUseSendBeacon: ({ isIdentityEstablished }) => isIdentityEstablished,
|
|
36
|
+
* datastreamIdOverride: 'custom-datastream-id',
|
|
37
|
+
* edgeSubPath: 'custom/path'
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* console.log(request.getId()); // Returns unique UUID
|
|
41
|
+
* request.setIsIdentityEstablished();
|
|
42
|
+
* console.log(request.getAction()); // Returns action based on identity status
|
|
43
|
+
*/
|
|
17
44
|
var _default = options => {
|
|
18
45
|
const {
|
|
19
46
|
payload,
|
|
@@ -13,20 +13,84 @@ 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
|
-
|
|
17
|
-
|
|
16
|
+
|
|
17
|
+
/** @import { RequestPayload, Identity } from './types.js' */
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* createMerger creates a function that does a deep merge. Example:
|
|
21
|
+
* ```js
|
|
22
|
+
* payload.mergeConfigOverride({
|
|
23
|
+
* com_adobe_analytics: {
|
|
24
|
+
* reportSuites: ["reportSuite1"],
|
|
25
|
+
* },
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* payload.mergeConfigOverride({
|
|
29
|
+
* com_adobe_analytics: {
|
|
30
|
+
* enabled: false,
|
|
31
|
+
* },
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
*
|
|
35
|
+
* // payload.meta.configOverrides is now:
|
|
36
|
+
* // {
|
|
37
|
+
* // com_adobe_analytics: {
|
|
38
|
+
* // enabled: false,
|
|
39
|
+
* // reportSuites: ["reportSuite1"],
|
|
40
|
+
* // },
|
|
41
|
+
* // }
|
|
42
|
+
* ```
|
|
43
|
+
* however, we need the result to be:
|
|
44
|
+
* ```js
|
|
45
|
+
* // {
|
|
46
|
+
* // com_adobe_analytics: {
|
|
47
|
+
* // enabled: false,
|
|
48
|
+
* // },
|
|
49
|
+
* // }
|
|
50
|
+
* ```
|
|
51
|
+
* aka a shallow merge, where the second object overwrites the first.
|
|
52
|
+
* This is because order matters and we don't want to send reportSuites when something is
|
|
53
|
+
* disabled.
|
|
54
|
+
* This function does that.
|
|
55
|
+
*
|
|
56
|
+
* @param {Object} content
|
|
57
|
+
* @param {string} key
|
|
58
|
+
* @returns {(updates: Object) => void}
|
|
59
|
+
*/
|
|
60
|
+
const createMergeConfigOverride = (content, key) => updates => {
|
|
61
|
+
const propertyPath = key.split(".");
|
|
62
|
+
const hostObjectForUpdates = propertyPath.reduce((obj, propertyName) => {
|
|
63
|
+
obj[propertyName] = obj[propertyName] || {};
|
|
64
|
+
return obj[propertyName];
|
|
65
|
+
}, content);
|
|
66
|
+
Object.assign(hostObjectForUpdates, updates);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Creates a request payload object with methods for merging different types of data.
|
|
71
|
+
* This provides the base functionality that all types of request payloads share.
|
|
72
|
+
*
|
|
73
|
+
* @function
|
|
74
|
+
*
|
|
75
|
+
* @param {Object} options
|
|
76
|
+
* @param {Object} options.content
|
|
77
|
+
* @param {function(string, Identity): void} options.addIdentity
|
|
78
|
+
* @param {function(string): boolean} options.hasIdentity
|
|
79
|
+
*
|
|
80
|
+
* @returns {RequestPayload}
|
|
81
|
+
*/
|
|
18
82
|
var _default = options => {
|
|
19
83
|
const {
|
|
20
84
|
content,
|
|
21
85
|
addIdentity,
|
|
22
86
|
hasIdentity
|
|
23
87
|
} = options;
|
|
24
|
-
const
|
|
88
|
+
const mergeConfigOverrides = createMergeConfigOverride(content, "meta.configOverrides");
|
|
25
89
|
return {
|
|
26
90
|
mergeMeta: (0, _index.createMerger)(content, "meta"),
|
|
27
91
|
mergeState: (0, _index.createMerger)(content, "meta.state"),
|
|
28
92
|
mergeQuery: (0, _index.createMerger)(content, "query"),
|
|
29
|
-
mergeConfigOverride: updates =>
|
|
93
|
+
mergeConfigOverride: updates => mergeConfigOverrides((0, _index.prepareConfigOverridesForEdge)(updates)),
|
|
30
94
|
addIdentity,
|
|
31
95
|
hasIdentity,
|
|
32
96
|
toJSON() {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.Types = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Request object with methods to access and modify request properties.
|
|
6
|
+
*
|
|
7
|
+
* @typedef {Object} Request
|
|
8
|
+
* @property {function(): string} getId
|
|
9
|
+
* @property {function(): RequestPayload} getPayload
|
|
10
|
+
* @property {function({isIdentityEstablished: boolean}): string} getAction
|
|
11
|
+
* @property {function(): string|undefined} getDatastreamIdOverride
|
|
12
|
+
* @property {Function} getUseSendBeacon
|
|
13
|
+
* @property {function(): string|undefined} getEdgeSubPath
|
|
14
|
+
* @property {Function} getUseIdThirdPartyDomain
|
|
15
|
+
* @property {Function} setUseIdThirdPartyDomain
|
|
16
|
+
* @property {Function} setIsIdentityEstablished
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Request payload object with methods for merging different types of data.
|
|
21
|
+
*
|
|
22
|
+
* @typedef {Object} RequestPayload
|
|
23
|
+
* @property {function(object): void} mergeMeta
|
|
24
|
+
* @property {function(object): void} mergeState
|
|
25
|
+
* @property {function(object): void} mergeQuery
|
|
26
|
+
* @property {function(object): void} mergeConfigOverride
|
|
27
|
+
* @property {function(string, Identity): void} options.addIdentity
|
|
28
|
+
* @property {function(string): boolean} options.hasIdentity
|
|
29
|
+
* @property {function(): object} toJSON
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Request payload object with methods for merging different types of data.
|
|
34
|
+
*
|
|
35
|
+
* @typedef {Object} DataCollectionRequestPayload
|
|
36
|
+
* @property {function(object): void} mergeMeta
|
|
37
|
+
* @property {function(object): void} mergeState
|
|
38
|
+
* @property {function(object): void} mergeQuery
|
|
39
|
+
* @property {function(object): void} mergeConfigOverride
|
|
40
|
+
* @property {function(string, Identity): void} options.addIdentity
|
|
41
|
+
* @property {function(string): boolean} options.hasIdentity
|
|
42
|
+
* @property {function(object): void} addEvent
|
|
43
|
+
* @property {function(): boolean} getDocumentMayUnload
|
|
44
|
+
* @property {function(): object} toJSON
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @typedef {Object} Identity
|
|
49
|
+
* @property {string} id
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
const Types = exports.Types = {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.Types = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {Object} Storage
|
|
6
|
+
* @property {function(string): string|null} getItem
|
|
7
|
+
* @property {function(string, string): void} setItem
|
|
8
|
+
* @property {function(): void} clear
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {Object} CookieAttributes
|
|
13
|
+
* @property {number|Date} [expires] - Cookie expiration (number of days or Date object)
|
|
14
|
+
* @property {string} [path] - Cookie path (default: "/")
|
|
15
|
+
* @property {string} [domain] - Cookie domain
|
|
16
|
+
* @property {boolean} [secure] - Requires HTTPS transmission
|
|
17
|
+
* @property {"strict"|"lax"|"none"} [sameSite] - SameSite attribute
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {Object} CookieConverter
|
|
22
|
+
* @property {function(string, string): string} [read] - Custom decoder function
|
|
23
|
+
* @property {function(string, string): string} [write] - Custom encoder function
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @typedef {Object} CookieJar
|
|
28
|
+
* @property {function(string): string|undefined} get - Get cookie value by name, or get all cookies as object if no name provided
|
|
29
|
+
* @property {function(): Object<string, string>} get - Get all cookies as key-value object when called with no arguments
|
|
30
|
+
* @property {function(string, string, CookieAttributes=): string|undefined} set - Set cookie with optional attributes
|
|
31
|
+
* @property {function(string, CookieAttributes=): void} remove - Remove cookie with optional attributes (must match set attributes)
|
|
32
|
+
* @property {function(CookieConverter): CookieJar} withConverter - Create new instance with custom encoding/decoding
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @typedef {function(string): { session: Storage, persistent: Storage }} StorageCreator
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
const Types = exports.Types = {};
|
|
@@ -17,6 +17,10 @@ import isButtonSubmitElement from "./isButtonSubmitElement.js";
|
|
|
17
17
|
export default element => {
|
|
18
18
|
let node = element;
|
|
19
19
|
while (node) {
|
|
20
|
+
// Stop looking when BODY is reached
|
|
21
|
+
if (node.nodeName && node.nodeName === "BODY") {
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
20
24
|
if (isSupportedAnchorElement(node) || elementHasClickHandler(node) || isInputSubmitElement(node) || isButtonSubmitElement(node)) {
|
|
21
25
|
return node;
|
|
22
26
|
}
|
|
@@ -21,9 +21,6 @@ export default ({
|
|
|
21
21
|
getBrowser
|
|
22
22
|
}) => {
|
|
23
23
|
const componentConfig = config.advertising;
|
|
24
|
-
const sharedState = {
|
|
25
|
-
processedAdvertisingIds: false
|
|
26
|
-
};
|
|
27
24
|
const sendAdConversionHandler = createSendAdConversion({
|
|
28
25
|
eventManager,
|
|
29
26
|
cookieManager,
|
|
@@ -35,7 +32,7 @@ export default ({
|
|
|
35
32
|
return {
|
|
36
33
|
lifecycle: {
|
|
37
34
|
onComponentsRegistered() {
|
|
38
|
-
sendAdConversionHandler(
|
|
35
|
+
return sendAdConversionHandler();
|
|
39
36
|
},
|
|
40
37
|
onBeforeEvent: ({
|
|
41
38
|
event,
|
|
@@ -44,7 +41,6 @@ export default ({
|
|
|
44
41
|
return handleOnBeforeSendEvent({
|
|
45
42
|
cookieManager,
|
|
46
43
|
logger,
|
|
47
|
-
state: sharedState,
|
|
48
44
|
event,
|
|
49
45
|
componentConfig,
|
|
50
46
|
advertising,
|
|
@@ -62,7 +62,8 @@ export default async function handleClickThrough({
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
|
-
eventType: AD_CONVERSION_CLICK_EVENT_TYPE
|
|
65
|
+
eventType: AD_CONVERSION_CLICK_EVENT_TYPE,
|
|
66
|
+
timestamp: new Date().toISOString()
|
|
66
67
|
};
|
|
67
68
|
event.setUserXdm(xdm);
|
|
68
69
|
cookieManager.setValue(LAST_CONVERSION_TIME_KEY);
|
|
@@ -33,11 +33,11 @@ export default ({
|
|
|
33
33
|
skwcid,
|
|
34
34
|
efid
|
|
35
35
|
} = getUrlParams();
|
|
36
|
-
const isClickThru = !!(skwcid
|
|
36
|
+
const isClickThru = !!(skwcid || efid);
|
|
37
37
|
try {
|
|
38
|
-
let result = null;
|
|
39
38
|
if (isClickThru) {
|
|
40
|
-
|
|
39
|
+
// wait for click through to complete
|
|
40
|
+
return handleClickThrough({
|
|
41
41
|
eventManager,
|
|
42
42
|
cookieManager,
|
|
43
43
|
adConversionHandler,
|
|
@@ -45,19 +45,17 @@ export default ({
|
|
|
45
45
|
skwcid,
|
|
46
46
|
efid
|
|
47
47
|
});
|
|
48
|
-
return result;
|
|
49
48
|
} else if (activeAdvertiserIds) {
|
|
50
|
-
|
|
49
|
+
// fire and forget view through
|
|
50
|
+
handleViewThrough({
|
|
51
51
|
eventManager,
|
|
52
52
|
cookieManager,
|
|
53
53
|
logger,
|
|
54
54
|
componentConfig,
|
|
55
55
|
adConversionHandler,
|
|
56
56
|
getBrowser
|
|
57
|
-
});
|
|
58
|
-
return result;
|
|
57
|
+
}).catch(error => logger.error("Error in view through:", error));
|
|
59
58
|
}
|
|
60
|
-
return null;
|
|
61
59
|
} catch (error) {
|
|
62
60
|
logger.error("Error in sendAdConversion:", error);
|
|
63
61
|
}
|
|
@@ -23,7 +23,8 @@ export default async function handleViewThrough({
|
|
|
23
23
|
try {
|
|
24
24
|
const event = appendAdvertisingIdQueryToEvent(resolvedIds, eventManager.createEvent(), cookieManager, componentConfig, true);
|
|
25
25
|
const xdm = {
|
|
26
|
-
eventType: AD_CONVERSION_VIEW_EVENT_TYPE
|
|
26
|
+
eventType: AD_CONVERSION_VIEW_EVENT_TYPE,
|
|
27
|
+
timestamp: new Date().toISOString()
|
|
27
28
|
};
|
|
28
29
|
event.setUserXdm(xdm);
|
|
29
30
|
const result = await adConversionHandler.trackAdConversion({
|
|
@@ -43,11 +44,11 @@ export default async function handleViewThrough({
|
|
|
43
44
|
const identityPromises = Object.entries(identityPromisesMap).map(([idType, idPromise]) => idPromise.then(idValue => {
|
|
44
45
|
if (idValue) {
|
|
45
46
|
resolvedIds[idType] = idValue;
|
|
46
|
-
return triggerConversion();
|
|
47
|
+
return triggerConversion();
|
|
47
48
|
}
|
|
48
49
|
}).catch(error => {
|
|
49
50
|
logger.error(LOG_ERROR_RESOLVING_ID.replace("{0}", idType), error);
|
|
50
51
|
return null;
|
|
51
52
|
}));
|
|
52
|
-
return Promise.allSettled(identityPromises);
|
|
53
|
+
return Promise.allSettled(identityPromises);
|
|
53
54
|
}
|
|
@@ -10,10 +10,18 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
/** @import { ConsentRequestPayload } from './types.js' */
|
|
14
|
+
|
|
13
15
|
import { createRequestPayload } from "../../utils/request/index.js";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @function
|
|
19
|
+
*
|
|
20
|
+
* @returns {ConsentRequestPayload}
|
|
21
|
+
*/
|
|
14
22
|
export default () => {
|
|
15
23
|
const content = {};
|
|
16
|
-
const
|
|
24
|
+
const requestPayload = createRequestPayload({
|
|
17
25
|
content,
|
|
18
26
|
addIdentity: (namespaceCode, identity) => {
|
|
19
27
|
content.identityMap = content.identityMap || {};
|
|
@@ -24,8 +32,13 @@ export default () => {
|
|
|
24
32
|
return (content.identityMap && content.identityMap[namespaceCode]) !== undefined;
|
|
25
33
|
}
|
|
26
34
|
});
|
|
27
|
-
|
|
28
|
-
|
|
35
|
+
|
|
36
|
+
/** @type {ConsentRequestPayload} */
|
|
37
|
+
const payload = {
|
|
38
|
+
...requestPayload,
|
|
39
|
+
setConsent: consent => {
|
|
40
|
+
content.consent = consent;
|
|
41
|
+
}
|
|
29
42
|
};
|
|
30
43
|
return payload;
|
|
31
44
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request payload object with methods for merging different types of data.
|
|
3
|
+
*
|
|
4
|
+
* @typedef {Object} ConsentRequestPayload
|
|
5
|
+
* @property {Function} mergeMeta
|
|
6
|
+
* @property {Function} mergeState
|
|
7
|
+
* @property {Function} mergeQuery
|
|
8
|
+
* @property {Function} mergeConfigOverride
|
|
9
|
+
* @property {Function} addIdentity
|
|
10
|
+
* @property {Function} hasIdentity
|
|
11
|
+
* @property {Function} toJSON
|
|
12
|
+
* @property {Function} setConsent
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
export const Types = {};
|
|
@@ -22,8 +22,8 @@ export default ({
|
|
|
22
22
|
consent,
|
|
23
23
|
appendIdentityToUrl,
|
|
24
24
|
logger,
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
identity,
|
|
26
|
+
getIdentityOptionsValidator
|
|
27
27
|
}) => {
|
|
28
28
|
let namespaces;
|
|
29
29
|
let edge = {};
|
|
@@ -65,6 +65,7 @@ export default ({
|
|
|
65
65
|
...edge,
|
|
66
66
|
...response.getEdge()
|
|
67
67
|
};
|
|
68
|
+
identity.setIdentityAcquired();
|
|
68
69
|
return handleResponseForIdSyncs(response);
|
|
69
70
|
}
|
|
70
71
|
},
|
|
@@ -79,7 +80,7 @@ export default ({
|
|
|
79
80
|
if (namespaces) {
|
|
80
81
|
return undefined;
|
|
81
82
|
}
|
|
82
|
-
const ecidFromCookie =
|
|
83
|
+
const ecidFromCookie = identity.getEcidFromCookie();
|
|
83
84
|
if (ecidFromCookie && requestedNamespaces.includes(ecidNamespace)) {
|
|
84
85
|
if (!namespaces) {
|
|
85
86
|
namespaces = {};
|
|
@@ -110,7 +111,7 @@ export default ({
|
|
|
110
111
|
if (namespaces) {
|
|
111
112
|
return undefined;
|
|
112
113
|
}
|
|
113
|
-
const ecidFromCookie =
|
|
114
|
+
const ecidFromCookie = identity.getEcidFromCookie();
|
|
114
115
|
if (ecidFromCookie) {
|
|
115
116
|
if (!namespaces) {
|
|
116
117
|
namespaces = {};
|
|
@@ -31,7 +31,6 @@ import createIdentityRequest from "./getIdentity/createIdentityRequest.js";
|
|
|
31
31
|
import createIdentityRequestPayload from "./getIdentity/createIdentityRequestPayload.js";
|
|
32
32
|
import injectAppendIdentityToUrl from "./appendIdentityToUrl/injectAppendIdentityToUrl.js";
|
|
33
33
|
import createGetIdentityOptionsValidator from "./getIdentity/createGetIdentityOptionsValidator.js";
|
|
34
|
-
import createGetEcidFromCookie from "./createDecodeKndctrCookie.js";
|
|
35
34
|
const createIdentity = ({
|
|
36
35
|
config,
|
|
37
36
|
logger,
|
|
@@ -39,7 +38,8 @@ const createIdentity = ({
|
|
|
39
38
|
fireReferrerHideableImage,
|
|
40
39
|
sendEdgeNetworkRequest,
|
|
41
40
|
apexDomain,
|
|
42
|
-
getBrowser
|
|
41
|
+
getBrowser,
|
|
42
|
+
identity
|
|
43
43
|
}) => {
|
|
44
44
|
const {
|
|
45
45
|
orgId,
|
|
@@ -119,11 +119,6 @@ const createIdentity = ({
|
|
|
119
119
|
thirdPartyCookiesEnabled,
|
|
120
120
|
areThirdPartyCookiesSupportedByDefault
|
|
121
121
|
});
|
|
122
|
-
const decodeKndctrCookie = createGetEcidFromCookie({
|
|
123
|
-
orgId,
|
|
124
|
-
cookieJar: loggingCookieJar,
|
|
125
|
-
logger
|
|
126
|
-
});
|
|
127
122
|
return createComponent({
|
|
128
123
|
addEcidQueryToPayload,
|
|
129
124
|
addQueryStringIdentityToPayload,
|
|
@@ -133,11 +128,11 @@ const createIdentity = ({
|
|
|
133
128
|
getNamespacesFromResponse,
|
|
134
129
|
getIdentity,
|
|
135
130
|
consent,
|
|
131
|
+
identity,
|
|
136
132
|
appendIdentityToUrl,
|
|
137
133
|
logger,
|
|
138
134
|
config,
|
|
139
|
-
getIdentityOptionsValidator
|
|
140
|
-
decodeKndctrCookie
|
|
135
|
+
getIdentityOptionsValidator
|
|
141
136
|
});
|
|
142
137
|
};
|
|
143
138
|
createIdentity.namespace = "Identity";
|
|
@@ -40,9 +40,10 @@ const renderContent = ({
|
|
|
40
40
|
content,
|
|
41
41
|
decorateProposition,
|
|
42
42
|
renderFunc,
|
|
43
|
-
renderStatusHandler
|
|
43
|
+
renderStatusHandler,
|
|
44
|
+
alwaysRender
|
|
44
45
|
}) => {
|
|
45
|
-
const executions = containers.filter(renderStatusHandler.shouldRender).map(async container => {
|
|
46
|
+
const executions = containers.filter(element => alwaysRender || renderStatusHandler.shouldRender(element)).map(async container => {
|
|
46
47
|
await renderFunc(container, content, decorateProposition);
|
|
47
48
|
renderStatusHandler.markAsRendered(container);
|
|
48
49
|
});
|
|
@@ -53,8 +54,9 @@ const renderContent = ({
|
|
|
53
54
|
* Creates an action function that renders content into a container element.
|
|
54
55
|
*
|
|
55
56
|
* @param {Function} renderFunc - The function that performs the rendering.
|
|
57
|
+
* @param {boolean} alwaysRender - Whether to always render the content, even if it has already been rendered.
|
|
56
58
|
*/
|
|
57
|
-
export const createAction = renderFunc => {
|
|
59
|
+
export const createAction = (renderFunc, alwaysRender = false) => {
|
|
58
60
|
/**
|
|
59
61
|
* Renders content into a container element.
|
|
60
62
|
*
|
|
@@ -76,7 +78,8 @@ export const createAction = renderFunc => {
|
|
|
76
78
|
content,
|
|
77
79
|
decorateProposition,
|
|
78
80
|
renderFunc,
|
|
79
|
-
renderStatusHandler
|
|
81
|
+
renderStatusHandler,
|
|
82
|
+
alwaysRender
|
|
80
83
|
});
|
|
81
84
|
} finally {
|
|
82
85
|
showElements(prehidingSelector);
|
|
@@ -45,21 +45,21 @@ export const DOM_ACTION_CLICK = "click";
|
|
|
45
45
|
export const DOM_ACTION_COLLECT_INTERACTIONS = "collectInteractions";
|
|
46
46
|
export default () => {
|
|
47
47
|
return {
|
|
48
|
-
[DOM_ACTION_SET_HTML]: createAction(setHtml),
|
|
48
|
+
[DOM_ACTION_SET_HTML]: createAction(setHtml, true),
|
|
49
49
|
[DOM_ACTION_CUSTOM_CODE]: createAction(prependHtml),
|
|
50
|
-
[DOM_ACTION_SET_TEXT]: createAction(setText),
|
|
51
|
-
[DOM_ACTION_SET_ATTRIBUTE]: createAction(setAttributes),
|
|
52
|
-
[DOM_ACTION_SET_IMAGE_SOURCE]: createAction(swapImage),
|
|
53
|
-
[DOM_ACTION_SET_STYLE]: createAction(setStyles),
|
|
54
|
-
[DOM_ACTION_MOVE]: createAction(move),
|
|
55
|
-
[DOM_ACTION_RESIZE]: createAction(resize),
|
|
50
|
+
[DOM_ACTION_SET_TEXT]: createAction(setText, true),
|
|
51
|
+
[DOM_ACTION_SET_ATTRIBUTE]: createAction(setAttributes, true),
|
|
52
|
+
[DOM_ACTION_SET_IMAGE_SOURCE]: createAction(swapImage, true),
|
|
53
|
+
[DOM_ACTION_SET_STYLE]: createAction(setStyles, true),
|
|
54
|
+
[DOM_ACTION_MOVE]: createAction(move, true),
|
|
55
|
+
[DOM_ACTION_RESIZE]: createAction(resize, true),
|
|
56
56
|
[DOM_ACTION_REARRANGE]: createAction(rearrangeChildren),
|
|
57
|
-
[DOM_ACTION_REMOVE]: createAction(removeNode),
|
|
57
|
+
[DOM_ACTION_REMOVE]: createAction(removeNode, true),
|
|
58
58
|
[DOM_ACTION_INSERT_AFTER]: createAction(insertHtmlAfter),
|
|
59
59
|
[DOM_ACTION_INSERT_BEFORE]: createAction(insertHtmlBefore),
|
|
60
|
-
[DOM_ACTION_REPLACE_HTML]: createAction(replaceHtml),
|
|
60
|
+
[DOM_ACTION_REPLACE_HTML]: createAction(replaceHtml, true),
|
|
61
61
|
[DOM_ACTION_PREPEND_HTML]: createAction(prependHtml),
|
|
62
62
|
[DOM_ACTION_APPEND_HTML]: createAction(appendHtml),
|
|
63
|
-
[DOM_ACTION_COLLECT_INTERACTIONS]: createAction(collectInteractions)
|
|
63
|
+
[DOM_ACTION_COLLECT_INTERACTIONS]: createAction(collectInteractions, true)
|
|
64
64
|
};
|
|
65
65
|
};
|