@adobe/alloy 2.29.0-beta.5 → 2.30.0-beta.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.
Files changed (177) hide show
  1. package/libEs5/components/ActivityCollector/utils/dom/findClickableElement.js +4 -0
  2. package/libEs5/components/Advertising/handlers/clickThroughHandler.js +2 -1
  3. package/libEs5/components/Advertising/handlers/onBeforeSendEventHandler.js +8 -3
  4. package/libEs5/components/Advertising/handlers/viewThroughHandler.js +2 -1
  5. package/libEs5/components/Advertising/identities/collectID5Id.js +1 -1
  6. package/libEs5/components/Advertising/identities/collectRampId.js +1 -1
  7. package/libEs5/components/Consent/createConsentRequestPayload.js +14 -3
  8. package/libEs5/components/Consent/types.js +18 -0
  9. package/libEs5/components/Personalization/dom-actions/action.js +7 -4
  10. package/libEs5/components/Personalization/dom-actions/initDomActionsModules.js +10 -10
  11. package/libEs5/components/PushNotifications/helpers/constants.js +19 -0
  12. package/libEs5/components/PushNotifications/helpers/getPushSubscriptionDetails.js +116 -0
  13. package/libEs5/components/PushNotifications/helpers/readFromIndexedDb.js +41 -0
  14. package/libEs5/components/PushNotifications/helpers/saveToIndexedDb.js +50 -0
  15. package/libEs5/components/PushNotifications/helpers/serviceWorkerNotificationClickListener.js +85 -0
  16. package/libEs5/components/PushNotifications/helpers/serviceWorkerPushListener.js +70 -0
  17. package/libEs5/components/PushNotifications/index.js +129 -0
  18. package/libEs5/components/PushNotifications/request/createSendPushSubscriptionPayload.js +62 -0
  19. package/libEs5/components/PushNotifications/request/createSendPushSubscriptionRequest.js +35 -0
  20. package/libEs5/components/PushNotifications/request/makeSendPushSubscriptionRequest.js +93 -0
  21. package/libEs5/components/PushNotifications/request/makeSendServiceWorkerTrackingData.js +146 -0
  22. package/libEs5/components/PushNotifications/serviceWorker.js +91 -0
  23. package/libEs5/components/PushNotifications/types.js +95 -0
  24. package/libEs5/constants/libraryVersion.js +1 -1
  25. package/libEs5/core/componentCreators.js +8 -1
  26. package/libEs5/core/consent/createConsent.js +10 -0
  27. package/libEs5/core/consent/createConsentStateMachine.js +36 -0
  28. package/libEs5/core/consent/types.js +24 -0
  29. package/libEs5/core/edgeNetwork/injectSendEdgeNetworkRequest.js +20 -0
  30. package/libEs5/core/edgeNetwork/types.js +10 -0
  31. package/libEs5/core/identity/createIdentity.js +36 -0
  32. package/libEs5/core/identity/types.js +15 -0
  33. package/libEs5/core/injectCreateResponse.js +9 -7
  34. package/libEs5/core/types.js +101 -11
  35. package/libEs5/utils/bytes.js +12 -1
  36. package/libEs5/utils/createLoggingCookieJar.js +14 -1
  37. package/libEs5/utils/createMerger.js +5 -4
  38. package/libEs5/utils/index.js +19 -0
  39. package/libEs5/utils/indexedDb.js +73 -0
  40. package/libEs5/utils/injectStorage.js +19 -0
  41. package/libEs5/utils/request/createDataCollectionRequestPayload.js +16 -8
  42. package/libEs5/utils/request/createRequest.js +28 -1
  43. package/libEs5/utils/request/createRequestPayload.js +15 -2
  44. package/libEs5/utils/request/types.js +52 -0
  45. package/libEs5/utils/types.js +39 -0
  46. package/libEs6/components/ActivityCollector/utils/dom/findClickableElement.js +4 -0
  47. package/libEs6/components/Advertising/handlers/clickThroughHandler.js +2 -1
  48. package/libEs6/components/Advertising/handlers/onBeforeSendEventHandler.js +8 -3
  49. package/libEs6/components/Advertising/handlers/viewThroughHandler.js +2 -1
  50. package/libEs6/components/Advertising/identities/collectID5Id.js +1 -1
  51. package/libEs6/components/Advertising/identities/collectRampId.js +1 -1
  52. package/libEs6/components/Consent/createConsentRequestPayload.js +16 -3
  53. package/libEs6/components/Consent/types.js +15 -0
  54. package/libEs6/components/Personalization/dom-actions/action.js +7 -4
  55. package/libEs6/components/Personalization/dom-actions/initDomActionsModules.js +10 -10
  56. package/libEs6/components/PushNotifications/helpers/constants.js +16 -0
  57. package/libEs6/components/PushNotifications/helpers/getPushSubscriptionDetails.js +114 -0
  58. package/libEs6/components/PushNotifications/helpers/readFromIndexedDb.js +40 -0
  59. package/libEs6/components/PushNotifications/helpers/saveToIndexedDb.js +48 -0
  60. package/libEs6/components/PushNotifications/helpers/serviceWorkerNotificationClickListener.js +82 -0
  61. package/libEs6/components/PushNotifications/helpers/serviceWorkerPushListener.js +69 -0
  62. package/libEs6/components/PushNotifications/index.js +126 -0
  63. package/libEs6/components/PushNotifications/request/createSendPushSubscriptionPayload.js +61 -0
  64. package/libEs6/components/PushNotifications/request/createSendPushSubscriptionRequest.js +34 -0
  65. package/libEs6/components/PushNotifications/request/makeSendPushSubscriptionRequest.js +89 -0
  66. package/libEs6/components/PushNotifications/request/makeSendServiceWorkerTrackingData.js +146 -0
  67. package/libEs6/components/PushNotifications/serviceWorker.js +90 -0
  68. package/libEs6/components/PushNotifications/types.js +92 -0
  69. package/libEs6/constants/libraryVersion.js +1 -1
  70. package/libEs6/core/componentCreators.js +2 -1
  71. package/libEs6/core/consent/createConsent.js +12 -0
  72. package/libEs6/core/consent/createConsentStateMachine.js +36 -0
  73. package/libEs6/core/consent/types.js +21 -0
  74. package/libEs6/core/edgeNetwork/injectSendEdgeNetworkRequest.js +20 -0
  75. package/libEs6/core/edgeNetwork/types.js +7 -0
  76. package/libEs6/core/identity/createIdentity.js +38 -0
  77. package/libEs6/core/identity/types.js +12 -0
  78. package/libEs6/core/injectCreateResponse.js +11 -7
  79. package/libEs6/core/types.js +101 -11
  80. package/libEs6/utils/bytes.js +12 -1
  81. package/libEs6/utils/createLoggingCookieJar.js +15 -1
  82. package/libEs6/utils/createMerger.js +5 -4
  83. package/libEs6/utils/index.js +1 -0
  84. package/libEs6/utils/indexedDb.js +67 -0
  85. package/libEs6/utils/injectStorage.js +20 -0
  86. package/libEs6/utils/request/createDataCollectionRequestPayload.js +19 -8
  87. package/libEs6/utils/request/createRequest.js +29 -1
  88. package/libEs6/utils/request/createRequestPayload.js +15 -2
  89. package/libEs6/utils/request/types.js +49 -0
  90. package/libEs6/utils/types.js +36 -0
  91. package/package.json +45 -52
  92. package/scripts/alloyBuilder.js +130 -4
  93. package/types/components/ActivityCollector/utils/dom/findClickableElement.d.ts.map +1 -1
  94. package/types/components/Advertising/handlers/onBeforeSendEventHandler.d.ts.map +1 -1
  95. package/types/components/Advertising/handlers/viewThroughHandler.d.ts.map +1 -1
  96. package/types/components/Consent/createConsentRequest.d.ts +1 -11
  97. package/types/components/Consent/createConsentRequest.d.ts.map +1 -1
  98. package/types/components/Consent/createConsentRequestPayload.d.ts +2 -9
  99. package/types/components/Consent/createConsentRequestPayload.d.ts.map +1 -1
  100. package/types/components/Consent/types.d.ts +28 -0
  101. package/types/components/Consent/types.d.ts.map +1 -0
  102. package/types/components/Identity/getIdentity/createIdentityRequest.d.ts +1 -11
  103. package/types/components/Identity/getIdentity/createIdentityRequest.d.ts.map +1 -1
  104. package/types/components/Identity/getIdentity/createIdentityRequestPayload.d.ts +1 -9
  105. package/types/components/Identity/getIdentity/createIdentityRequestPayload.d.ts.map +1 -1
  106. package/types/components/Personalization/dom-actions/action.d.ts +1 -1
  107. package/types/components/Personalization/dom-actions/action.d.ts.map +1 -1
  108. package/types/components/PushNotifications/helpers/constants.d.ts +5 -0
  109. package/types/components/PushNotifications/helpers/constants.d.ts.map +1 -0
  110. package/types/components/PushNotifications/helpers/getPushSubscriptionDetails.d.ts +30 -0
  111. package/types/components/PushNotifications/helpers/getPushSubscriptionDetails.d.ts.map +1 -0
  112. package/types/components/PushNotifications/helpers/readFromIndexedDb.d.ts +4 -0
  113. package/types/components/PushNotifications/helpers/readFromIndexedDb.d.ts.map +1 -0
  114. package/types/components/PushNotifications/helpers/saveToIndexedDb.d.ts +9 -0
  115. package/types/components/PushNotifications/helpers/saveToIndexedDb.d.ts.map +1 -0
  116. package/types/components/PushNotifications/helpers/serviceWorkerNotificationClickListener.d.ts +9 -0
  117. package/types/components/PushNotifications/helpers/serviceWorkerNotificationClickListener.d.ts.map +1 -0
  118. package/types/components/PushNotifications/helpers/serviceWorkerPushListener.d.ts +8 -0
  119. package/types/components/PushNotifications/helpers/serviceWorkerPushListener.d.ts.map +1 -0
  120. package/types/components/PushNotifications/index.d.ts +51 -0
  121. package/types/components/PushNotifications/index.d.ts.map +1 -0
  122. package/types/components/PushNotifications/request/createSendPushSubscriptionPayload.d.ts +10 -0
  123. package/types/components/PushNotifications/request/createSendPushSubscriptionPayload.d.ts.map +1 -0
  124. package/types/components/PushNotifications/request/createSendPushSubscriptionRequest.d.ts +7 -0
  125. package/types/components/PushNotifications/request/createSendPushSubscriptionRequest.d.ts.map +1 -0
  126. package/types/components/PushNotifications/request/makeSendPushSubscriptionRequest.d.ts +21 -0
  127. package/types/components/PushNotifications/request/makeSendPushSubscriptionRequest.d.ts.map +1 -0
  128. package/types/components/PushNotifications/request/makeSendServiceWorkerTrackingData.d.ts +11 -0
  129. package/types/components/PushNotifications/request/makeSendServiceWorkerTrackingData.d.ts.map +1 -0
  130. package/types/components/PushNotifications/serviceWorker.d.ts +2 -0
  131. package/types/components/PushNotifications/serviceWorker.d.ts.map +1 -0
  132. package/types/components/PushNotifications/types.d.ts +190 -0
  133. package/types/components/PushNotifications/types.d.ts.map +1 -0
  134. package/types/components/StreamingMedia/createMediaRequest.d.ts +1 -11
  135. package/types/components/StreamingMedia/createMediaRequest.d.ts.map +1 -1
  136. package/types/core/componentCreators.d.ts +1 -0
  137. package/types/core/consent/createConsent.d.ts +4 -10
  138. package/types/core/consent/createConsent.d.ts.map +1 -1
  139. package/types/core/consent/createConsentStateMachine.d.ts +4 -12
  140. package/types/core/consent/createConsentStateMachine.d.ts.map +1 -1
  141. package/types/core/consent/types.d.ts +42 -0
  142. package/types/core/consent/types.d.ts.map +1 -0
  143. package/types/core/edgeNetwork/injectSendEdgeNetworkRequest.d.ts +15 -13
  144. package/types/core/edgeNetwork/injectSendEdgeNetworkRequest.d.ts.map +1 -1
  145. package/types/core/edgeNetwork/types.d.ts +12 -0
  146. package/types/core/edgeNetwork/types.d.ts.map +1 -0
  147. package/types/core/identity/createIdentity.d.ts +9 -9
  148. package/types/core/identity/createIdentity.d.ts.map +1 -1
  149. package/types/core/identity/types.d.ts +23 -0
  150. package/types/core/identity/types.d.ts.map +1 -0
  151. package/types/core/injectCreateResponse.d.ts +3 -27
  152. package/types/core/injectCreateResponse.d.ts.map +1 -1
  153. package/types/core/types.d.ts +209 -22
  154. package/types/core/types.d.ts.map +1 -1
  155. package/types/utils/bytes.d.ts +3 -1
  156. package/types/utils/bytes.d.ts.map +1 -1
  157. package/types/utils/createLoggingCookieJar.d.ts +5 -3
  158. package/types/utils/createLoggingCookieJar.d.ts.map +1 -1
  159. package/types/utils/createMerger.d.ts +1 -1
  160. package/types/utils/createMerger.d.ts.map +1 -1
  161. package/types/utils/index.d.ts +1 -0
  162. package/types/utils/indexedDb.d.ts +4 -0
  163. package/types/utils/indexedDb.d.ts.map +1 -0
  164. package/types/utils/injectStorage.d.ts +2 -40
  165. package/types/utils/injectStorage.d.ts.map +1 -1
  166. package/types/utils/request/createDataCollectionRequest.d.ts +1 -11
  167. package/types/utils/request/createDataCollectionRequest.d.ts.map +1 -1
  168. package/types/utils/request/createDataCollectionRequestPayload.d.ts +2 -9
  169. package/types/utils/request/createDataCollectionRequestPayload.d.ts.map +1 -1
  170. package/types/utils/request/createRequest.d.ts +13 -11
  171. package/types/utils/request/createRequest.d.ts.map +1 -1
  172. package/types/utils/request/createRequestPayload.d.ts +7 -9
  173. package/types/utils/request/createRequestPayload.d.ts.map +1 -1
  174. package/types/utils/request/types.d.ts +91 -0
  175. package/types/utils/request/types.d.ts.map +1 -0
  176. package/types/utils/types.d.ts +91 -0
  177. package/types/utils/types.d.ts.map +1 -0
@@ -9,22 +9,33 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
9
9
  OF ANY KIND, either express or implied. See the License for the specific language
10
10
  governing permissions and limitations under the License.
11
11
  */
12
+
13
+ /** @import { DataCollectionRequestPayload } from './types.js' */
14
+
12
15
  import createRequestPayload from "./createRequestPayload.js";
13
16
  import createAddIdentity from "./createAddIdentity.js";
14
17
  import createHasIdentity from "./createHasIdentity.js";
18
+
19
+ /**
20
+ * @function
21
+ *
22
+ * @returns {DataCollectionRequestPayload}
23
+ */
15
24
  export default () => {
16
25
  const content = {};
17
- const payload = createRequestPayload({
26
+ const requestPayload = createRequestPayload({
18
27
  content,
19
28
  addIdentity: createAddIdentity(content),
20
29
  hasIdentity: createHasIdentity(content)
21
30
  });
22
- payload.addEvent = event => {
23
- content.events = content.events || [];
24
- content.events.push(event);
25
- };
26
- payload.getDocumentMayUnload = () => {
27
- return (content.events || []).some(event => event.getDocumentMayUnload());
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
- return payload;
30
41
  };
@@ -10,9 +10,37 @@ 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 { Request, RequestPayload } from './types.js' */
14
+
13
15
  import { uuid } from "../index.js";
14
16
 
15
- // This provides the base functionality that all types of requests share.
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
+ */
16
44
  export default options => {
17
45
  const {
18
46
  payload,
@@ -10,6 +10,8 @@ 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 { RequestPayload, Identity } from './types.js' */
14
+
13
15
  import { createMerger, prepareConfigOverridesForEdge } from "../index.js";
14
16
 
15
17
  /**
@@ -62,8 +64,19 @@ const createMergeConfigOverride = (content, key) => updates => {
62
64
  Object.assign(hostObjectForUpdates, updates);
63
65
  };
64
66
 
65
- // This provides the base functionality that all types of
66
- // request payloads share.
67
+ /**
68
+ * Creates a request payload object with methods for merging different types of data.
69
+ * This provides the base functionality that all types of request payloads share.
70
+ *
71
+ * @function
72
+ *
73
+ * @param {Object} options
74
+ * @param {Object} options.content
75
+ * @param {function(string, Identity): void} options.addIdentity
76
+ * @param {function(string): boolean} options.hasIdentity
77
+ *
78
+ * @returns {RequestPayload}
79
+ */
67
80
  export default options => {
68
81
  const {
69
82
  content,
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Request object with methods to access and modify request properties.
3
+ *
4
+ * @typedef {Object} Request
5
+ * @property {function(): string} getId
6
+ * @property {function(): RequestPayload} getPayload
7
+ * @property {function({isIdentityEstablished: boolean}): string} getAction
8
+ * @property {function(): string|undefined} getDatastreamIdOverride
9
+ * @property {Function} getUseSendBeacon
10
+ * @property {function(): string|undefined} getEdgeSubPath
11
+ * @property {Function} getUseIdThirdPartyDomain
12
+ * @property {Function} setUseIdThirdPartyDomain
13
+ * @property {Function} setIsIdentityEstablished
14
+ */
15
+
16
+ /**
17
+ * Request payload object with methods for merging different types of data.
18
+ *
19
+ * @typedef {Object} RequestPayload
20
+ * @property {function(object): void} mergeMeta
21
+ * @property {function(object): void} mergeState
22
+ * @property {function(object): void} mergeQuery
23
+ * @property {function(object): void} mergeConfigOverride
24
+ * @property {function(string, Identity): void} options.addIdentity
25
+ * @property {function(string): boolean} options.hasIdentity
26
+ * @property {function(): object} toJSON
27
+ */
28
+
29
+ /**
30
+ * Request payload object with methods for merging different types of data.
31
+ *
32
+ * @typedef {Object} DataCollectionRequestPayload
33
+ * @property {function(object): void} mergeMeta
34
+ * @property {function(object): void} mergeState
35
+ * @property {function(object): void} mergeQuery
36
+ * @property {function(object): void} mergeConfigOverride
37
+ * @property {function(string, Identity): void} options.addIdentity
38
+ * @property {function(string): boolean} options.hasIdentity
39
+ * @property {function(object): void} addEvent
40
+ * @property {function(): boolean} getDocumentMayUnload
41
+ * @property {function(): object} toJSON
42
+ */
43
+
44
+ /**
45
+ * @typedef {Object} Identity
46
+ * @property {string} id
47
+ */
48
+
49
+ export const Types = {};
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @typedef {Object} Storage
3
+ * @property {function(string): string|null} getItem
4
+ * @property {function(string, string): void} setItem
5
+ * @property {function(): void} clear
6
+ */
7
+
8
+ /**
9
+ * @typedef {Object} CookieAttributes
10
+ * @property {number|Date} [expires] - Cookie expiration (number of days or Date object)
11
+ * @property {string} [path] - Cookie path (default: "/")
12
+ * @property {string} [domain] - Cookie domain
13
+ * @property {boolean} [secure] - Requires HTTPS transmission
14
+ * @property {"strict"|"lax"|"none"} [sameSite] - SameSite attribute
15
+ */
16
+
17
+ /**
18
+ * @typedef {Object} CookieConverter
19
+ * @property {function(string, string): string} [read] - Custom decoder function
20
+ * @property {function(string, string): string} [write] - Custom encoder function
21
+ */
22
+
23
+ /**
24
+ * @typedef {Object} CookieJar
25
+ * @property {function(string): string|undefined} get - Get cookie value by name, or get all cookies as object if no name provided
26
+ * @property {function(): Object<string, string>} get - Get all cookies as key-value object when called with no arguments
27
+ * @property {function(string, string, CookieAttributes=): string|undefined} set - Set cookie with optional attributes
28
+ * @property {function(string, CookieAttributes=): void} remove - Remove cookie with optional attributes (must match set attributes)
29
+ * @property {function(CookieConverter): CookieJar} withConverter - Create new instance with custom encoding/decoding
30
+ */
31
+
32
+ /**
33
+ * @typedef {function(string): { session: Storage, persistent: Storage }} StorageCreator
34
+ */
35
+
36
+ export const Types = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/alloy",
3
- "version": "2.29.0-beta.5",
3
+ "version": "2.30.0-beta.0",
4
4
  "description": "Adobe Experience Platform Web SDK",
5
5
  "type": "module",
6
6
  "main": "libEs5/index.js",
@@ -26,16 +26,16 @@
26
26
  "lint": "eslint --cache --fix \"*.{js,cjs,mjs,jsx}\" \"{src,test,scripts,sandbox}/**/*.{js,cjs,mjs,jsx}\"",
27
27
  "format": "prettier --write \"*.{html,js,cjs,mjs,jsx}\" \"{sandbox,src,test,scripts}/**/*.{html,js,cjs,mjs,jsx}\"",
28
28
  "types": "tsc",
29
- "test": "npx playwright install chromium && vitest run && npm run test:scripts",
30
- "test:coverage": "rimraf coverage && npx playwright install chromium && vitest run --coverage",
31
- "test:unit": "npx playwright install chromium && vitest run --project=unit",
32
- "test:unit:debug": "npx playwright install chromium && vitest --no-file-parallelism --project=unit --browser=chromium --browser.provider=playwright --browser.headless=false",
33
- "test:unit:watch": "npx playwright install chromium && vitest --project=unit",
34
- "test:unit:coverage": "npx playwright install chromium && vitest run --coverage --project=unit",
35
- "test:integration": "npx playwright install chromium && vitest run --project=integration",
36
- "test:integration:debug": "npx playwright install chromium && vitest --no-file-parallelism --project=integration --browser=chromium --browser.provider=playwright --browser.headless=false",
37
- "test:integration:watch": "npx playwright install chromium && vitest --project=integration",
38
- "test:integration:coverage": "npx playwright install chromium && vitest run --coverage --project=integration",
29
+ "test": "pnpm exec playwright install chromium && vitest run && pnpm run test:scripts",
30
+ "test:coverage": "rimraf coverage && pnpm exec playwright install chromium && vitest run --coverage",
31
+ "test:unit": "pnpm exec playwright install chromium && vitest run --project=unit",
32
+ "test:unit:debug": "pnpm exec playwright install chromium && vitest --no-file-parallelism --project=unit --browser=chromium --browser.provider=playwright --browser.headless=false",
33
+ "test:unit:watch": "pnpm exec playwright install chromium && vitest --project=unit",
34
+ "test:unit:coverage": "pnpm exec playwright install chromium && vitest run --coverage --project=unit",
35
+ "test:integration": "pnpm exec playwright install chromium && vitest run --project=integration",
36
+ "test:integration:debug": "pnpm exec playwright install chromium && vitest --no-file-parallelism --project=integration --browser=chromium --browser.provider=playwright --browser.headless=false",
37
+ "test:integration:watch": "pnpm exec playwright install chromium && vitest --project=integration",
38
+ "test:integration:coverage": "pnpm exec playwright install chromium && vitest run --coverage --project=integration",
39
39
  "test:functional": "EDGE_BASE_PATH=\"ee-pre-prd\" ALLOY_ENV=\"int\" testcafe chrome",
40
40
  "test:functional:custom": "node scripts/helpers/runFunctionalTests.js",
41
41
  "test:functional:watch": "EDGE_BASE_PATH=\"ee-pre-prd\" ALLOY_ENV=\"int\" ./scripts/watchFunctionalTests.js --browsers chrome",
@@ -43,12 +43,12 @@
43
43
  "test:functional:build:int": "rollup -c --environment BASE_CODE_MIN,STANDALONE,NPM_PACKAGE_LOCAL",
44
44
  "test:functional:build:prod": "rollup -c --environment BASE_CODE_MIN,NPM_PACKAGE_PROD",
45
45
  "test:scripts": "vitest run --config=./scripts/specs/vitest.config.js",
46
- "dev": "concurrently --names build,sandbox \"rollup -c -w --environment SANDBOX\" \"cd sandbox && export REACT_APP_NONCE=321 && npm start\"",
47
- "build": "npm run clean && rollup -c --environment BASE_CODE_MIN,STANDALONE,STANDALONE_MIN,BUNDLESIZE && echo \"Base Code:\" && cat distTest/baseCode.min.js",
48
- "build:watch": "npm run clean && rollup -c --watch --environment BASE_CODE_MIN,STANDALONE",
46
+ "dev": "concurrently --names build,sandbox \"rollup -c -w --environment SANDBOX\" \"cd sandbox && export REACT_APP_NONCE=321 && pnpm start\"",
47
+ "build": "pnpm run clean && rollup -c --environment BASE_CODE_MIN,STANDALONE,STANDALONE_MIN,BUNDLESIZE && echo \"Base Code:\" && cat distTest/baseCode.min.js",
48
+ "build:watch": "pnpm run clean && rollup -c --watch --environment BASE_CODE_MIN,STANDALONE",
49
49
  "build:custom": "node scripts/alloyBuilder.js",
50
- "prepare": "husky && cd sandbox && npm install",
51
- "prepack": "npm run clean && babel src -d libEs5 --env-name npmEs5 && babel src -d libEs6 --env-name npmEs6 && npm run types",
50
+ "prepare": "husky",
51
+ "prepack": "pnpm run clean && babel src -d libEs5 --env-name npmEs5 && babel src -d libEs6 --env-name npmEs6 && pnpm run types",
52
52
  "checkthattestfilesexist": "./scripts/checkThatTestFilesExist.js",
53
53
  "add-license": "./scripts/add-license.js"
54
54
  },
@@ -74,69 +74,62 @@
74
74
  "license": "Apache-2.0",
75
75
  "dependencies": {
76
76
  "@adobe/aep-rules-engine": "^3.1.1",
77
- "@adobe/reactor-cookie": "^1.1.0",
78
- "@adobe/reactor-load-script": "^1.1.1",
79
- "@adobe/reactor-object-assign": "^2.0.0",
80
77
  "@adobe/reactor-query-string": "^2.0.0",
81
- "@babel/core": "^7.27.4",
78
+ "@babel/core": "^7.28.4",
82
79
  "@babel/plugin-transform-template-literals": "^7.27.1",
83
- "@babel/preset-env": "^7.27.2",
84
- "@inquirer/prompts": "^7.5.3",
80
+ "@babel/preset-env": "^7.28.3",
81
+ "@inquirer/prompts": "^7.8.4",
85
82
  "@rollup/plugin-babel": "^6.0.4",
86
- "@rollup/plugin-commonjs": "^28.0.3",
83
+ "@rollup/plugin-commonjs": "^28.0.6",
87
84
  "@rollup/plugin-node-resolve": "^16.0.1",
88
85
  "@rollup/plugin-terser": "^0.4.4",
89
86
  "commander": "^14.0.0",
90
87
  "css.escape": "^1.5.1",
91
88
  "js-cookie": "3.0.5",
92
- "rollup": "^4.41.1",
89
+ "rollup": "^4.50.1",
93
90
  "rollup-plugin-license": "^3.6.0",
94
91
  "uuid": "^11.1.0"
95
92
  },
96
93
  "devDependencies": {
97
- "@adobe/alloy": "^2.29.0-beta.4",
98
- "@babel/cli": "^7.27.2",
94
+ "@adobe/alloy": "^2.29.0",
95
+ "@babel/cli": "^7.28.3",
99
96
  "@babel/plugin-transform-modules-commonjs": "^7.27.1",
100
- "@babel/plugin-transform-runtime": "^7.27.4",
101
- "@eslint/js": "^9.28.0",
97
+ "@eslint/js": "^9.35.0",
102
98
  "@octokit/rest": "^22.0.0",
103
- "@vitest/browser": "^3.1.4",
104
- "@vitest/coverage-v8": "^3.1.4",
105
- "@vitest/eslint-plugin": "^1.2.1",
106
- "chalk": "^5.4.1",
107
- "concurrently": "^9.2.0",
99
+ "@types/node": "^24.3.1",
100
+ "@vitest/browser": "^3.2.4",
101
+ "@vitest/coverage-v8": "^3.2.4",
102
+ "@vitest/eslint-plugin": "^1.3.9",
103
+ "chalk": "^5.6.2",
104
+ "concurrently": "^9.2.1",
108
105
  "date-fns": "^4.1.0",
109
- "dotenv": "^16.5.0",
110
- "eslint": "^9.28.0",
111
- "eslint-config-prettier": "^10.1.5",
106
+ "eslint": "^9.35.0",
107
+ "eslint-config-prettier": "^10.1.8",
112
108
  "eslint-plugin-compat": "^6.0.2",
113
- "eslint-plugin-import": "^2.31.0",
114
- "eslint-plugin-prettier": "^5.4.1",
109
+ "eslint-plugin-import": "^2.32.0",
110
+ "eslint-plugin-prettier": "^5.5.4",
115
111
  "eslint-plugin-react": "^7.37.5",
116
- "glob": "^11.0.2",
117
- "globals": "^16.2.0",
112
+ "glob": "^11.0.3",
113
+ "globals": "^16.4.0",
118
114
  "handlebars": "^4.7.8",
119
- "happy-dom": "^17.5.9",
115
+ "happy-dom": "^18.0.1",
120
116
  "husky": "^9.1.7",
121
- "lint-staged": "^16.1.0",
122
- "msw": "^2.8.7",
123
- "playwright": "^1.52.0",
124
- "prettier": "^3.5.3",
117
+ "lint-staged": "^16.1.6",
118
+ "minimatch": "^10.0.3",
119
+ "msw": "^2.11.2",
120
+ "playwright": "^1.55.0",
121
+ "prettier": "^3.6.2",
125
122
  "read-cache": "^1.0.0",
126
123
  "recursive-readdir": "^2.2.3",
127
124
  "rimraf": "^6.0.1",
128
125
  "semver": "^7.7.2",
129
126
  "staged-git-files": "^1.3.0",
130
127
  "testcafe": "^3.7.2",
131
- "testcafe-browser-provider-saucelabs": "^3.0.0",
132
- "testcafe-reporter-junit": "^3.0.2",
133
- "testcafe-reporter-saucelabs": "^3.6.0",
134
- "typescript": "^5.8.3",
128
+ "typescript": "^5.9.2",
135
129
  "url-exists-nodejs": "^0.2.4",
136
- "url-parse": "^1.5.10",
137
- "vitest": "^3.2.0"
130
+ "vitest": "^3.2.4"
138
131
  },
139
132
  "optionalDependencies": {
140
- "@rollup/rollup-linux-x64-gnu": "^4.41.1"
133
+ "@rollup/rollup-linux-x64-gnu": "^4.50.1"
141
134
  }
142
135
  }
@@ -12,6 +12,11 @@ governing permissions and limitations under the License.
12
12
  */
13
13
 
14
14
  import babel from "@babel/core";
15
+ import terser from "@rollup/plugin-terser";
16
+ import resolve from "@rollup/plugin-node-resolve";
17
+ import commonjs from "@rollup/plugin-commonjs";
18
+ import license from "rollup-plugin-license";
19
+ import { fileURLToPath } from "url";
15
20
  import { checkbox, input, select } from "@inquirer/prompts";
16
21
  import { Command, InvalidOptionArgumentError, Option } from "commander";
17
22
  import fs from "fs";
@@ -21,6 +26,8 @@ import { buildConfig } from "../rollup.config.js";
21
26
  import entryPointGeneratorBabelPlugin from "./helpers/entryPointGeneratorBabelPlugin.js";
22
27
  import { getProjectRoot, safePathJoin } from "./helpers/path.js";
23
28
 
29
+ const dirname = path.dirname(fileURLToPath(import.meta.url));
30
+
24
31
  const packageJsonContent = fs.readFileSync(
25
32
  safePathJoin(getProjectRoot(), "package.json"),
26
33
  "utf8",
@@ -128,6 +135,57 @@ const build = async (argv) => {
128
135
  );
129
136
  };
130
137
 
138
+ const buildPushNotificationsServiceWorker = async (argv) => {
139
+ const outputPath = path.join(
140
+ argv.outputDir,
141
+ `alloyPushNotificationsServiceWorker${argv.minify ? ".min" : ""}.js`,
142
+ );
143
+
144
+ const plugins = [
145
+ resolve({
146
+ preferBuiltins: false,
147
+ // Support the browser field in dependencies' package.json.
148
+ // Useful for the uuid package.
149
+ mainFields: ["module", "main", "browser"],
150
+ }),
151
+ commonjs(),
152
+ ];
153
+ if (argv.minify) {
154
+ plugins.push(terser());
155
+ plugins.push(
156
+ license({
157
+ cwd: path.join(dirname, ".."),
158
+ banner: {
159
+ content: {
160
+ file: path.join(dirname, "..", "license_banner"),
161
+ },
162
+ },
163
+ }),
164
+ );
165
+ }
166
+ const rollupConfig = {
167
+ input: `${sourceRootPath}/components/PushNotifications/serviceWorker.js`,
168
+ output: [
169
+ {
170
+ file: outputPath,
171
+ format: "es",
172
+ },
173
+ ],
174
+ plugins,
175
+ };
176
+
177
+ const bundle = await rollup(rollupConfig);
178
+ await bundle.write(rollupConfig.output[0]);
179
+
180
+ console.log(
181
+ `🎉 Wrote ${
182
+ path.isAbsolute(argv.outputDir)
183
+ ? rollupConfig.output[0].file
184
+ : path.relative(process.cwd(), rollupConfig.output[0].file)
185
+ } (${getFileSizeInKB(rollupConfig.output[0].file)}).`,
186
+ );
187
+ };
188
+
131
189
  const getMakeBuildCommand = () => {
132
190
  const optionalComponentsParameters = getComponents().optional;
133
191
  return new Command("build")
@@ -168,13 +226,11 @@ const getMakeBuildCommand = () => {
168
226
  const stats = fs.statSync(value);
169
227
  if (!stats.isDirectory()) {
170
228
  throw new InvalidOptionArgumentError(
171
- `Output directory "${value}" is not a valid directory path.`,
229
+ `"${value}" is not a valid directory path.`,
172
230
  );
173
231
  }
174
232
  } catch (error) {
175
- throw new InvalidOptionArgumentError(
176
- `Output directory "${value}" is not a valid directory path. ${error.message}`,
177
- );
233
+ throw new InvalidOptionArgumentError(error.message);
178
234
  }
179
235
 
180
236
  return value.replace(new RegExp(`${path.sep}+$`, "g"), "");
@@ -190,6 +246,74 @@ const getMakeBuildCommand = () => {
190
246
  });
191
247
  };
192
248
 
249
+ const getPushNotificationsServiceWorkerBuildCommand = () =>
250
+ new Command("build-pushnotifications-sw")
251
+ .description("Build the push notification service worker.")
252
+ .addOption(
253
+ new Option("-m, --minify", "enable code minification").default(false),
254
+ )
255
+ .addOption(
256
+ new Option(
257
+ "-o, --outputDir <dir>",
258
+ "the output directory for the generated build",
259
+ )
260
+ .default(getProjectRoot())
261
+ .argParser((value) => {
262
+ if (!path.isAbsolute(value)) {
263
+ value = path.join(process.cwd(), value);
264
+ }
265
+
266
+ try {
267
+ const stats = fs.statSync(value);
268
+ if (!stats.isDirectory()) {
269
+ throw new InvalidOptionArgumentError(
270
+ `"${value}" is not a valid directory path.`,
271
+ );
272
+ }
273
+ } catch (error) {
274
+ throw new InvalidOptionArgumentError(error.message);
275
+ }
276
+
277
+ return value.replace(new RegExp(`${path.sep}+$`, "g"), "");
278
+ }),
279
+ )
280
+ .action((opts) => {
281
+ return buildPushNotificationsServiceWorker(opts);
282
+ });
283
+
284
+ const getInteractivePushNotificationsServiceWorkerBuildCommand = () =>
285
+ new Command("interactive-build-pushnotifications-sw")
286
+ .description(
287
+ "Interactive process that will ask a series of questions and then it will generate a push notification service worker build.",
288
+ )
289
+ .action(async () => {
290
+ try {
291
+ const opts = {
292
+ minify: await select({
293
+ message: "How would you like your service worker JavaScript to be?",
294
+ choices: [
295
+ { name: "Minified", value: true },
296
+ { name: "Unminified", value: false },
297
+ ],
298
+ }),
299
+ outputDir: await input({
300
+ message: "Where would you like to save the service worker build?",
301
+ default: process.cwd(),
302
+ }),
303
+ };
304
+
305
+ buildPushNotificationsServiceWorker(opts);
306
+ } catch (error) {
307
+ if (error.isTtyError) {
308
+ console.error(
309
+ "Prompt couldn't be rendered in the current environment",
310
+ );
311
+ } else if (error.name !== "ExitPromptError") {
312
+ console.error("An error occurred: ", error);
313
+ }
314
+ }
315
+ });
316
+
193
317
  const getInteractiveBuildCommand = () =>
194
318
  new Command("interactive-build")
195
319
  .description(
@@ -241,5 +365,7 @@ program
241
365
  .version(version);
242
366
 
243
367
  program.addCommand(getMakeBuildCommand());
368
+ program.addCommand(getPushNotificationsServiceWorkerBuildCommand());
244
369
  program.addCommand(getInteractiveBuildCommand(), { isDefault: true });
370
+ program.addCommand(getInteractivePushNotificationsServiceWorkerBuildCommand());
245
371
  program.parse();
@@ -1 +1 @@
1
- {"version":3,"file":"findClickableElement.d.ts","sourceRoot":"","sources":["../../../../../src/components/ActivityCollector/utils/dom/findClickableElement.js"],"names":[],"mappings":"AAiBe,6CAcd"}
1
+ {"version":3,"file":"findClickableElement.d.ts","sourceRoot":"","sources":["../../../../../src/components/ActivityCollector/utils/dom/findClickableElement.js"],"names":[],"mappings":"AAiBe,6CAkBd"}
@@ -1 +1 @@
1
- {"version":3,"file":"onBeforeSendEventHandler.d.ts","sourceRoot":"","sources":["../../../../src/components/Advertising/handlers/onBeforeSendEventHandler.js"],"names":[],"mappings":"AAyBA;;;;;;;;;;GAUG;AACH,6HARG;IAAuB,aAAa;IACb,MAAM;IACN,KAAK;IACL,KAAK;IACL,eAAe;IACf,WAAW;IACT,UAAU;CACrC,iBAiFA"}
1
+ {"version":3,"file":"onBeforeSendEventHandler.d.ts","sourceRoot":"","sources":["../../../../src/components/Advertising/handlers/onBeforeSendEventHandler.js"],"names":[],"mappings":"AA4BA;;;;;;;;;;GAUG;AACH,6HARG;IAAuB,aAAa;IACb,MAAM;IACN,KAAK;IACL,KAAK;IACL,eAAe;IACf,WAAW;IACT,UAAU;CACrC,iBAsFA"}
@@ -1 +1 @@
1
- {"version":3,"file":"viewThroughHandler.d.ts","sourceRoot":"","sources":["../../../../src/components/Advertising/handlers/viewThroughHandler.js"],"names":[],"mappings":"AAkBA;;;;;;;yCAgEC"}
1
+ {"version":3,"file":"viewThroughHandler.d.ts","sourceRoot":"","sources":["../../../../src/components/Advertising/handlers/viewThroughHandler.js"],"names":[],"mappings":"AAkBA;;;;;;;yCAiEC"}
@@ -1,16 +1,6 @@
1
1
  declare function _default({ payload, datastreamIdOverride }: {
2
2
  payload: any;
3
3
  datastreamIdOverride: any;
4
- }): {
5
- getId(): string;
6
- getPayload(): any;
7
- getAction(): any;
8
- getDatastreamIdOverride(): any;
9
- getUseSendBeacon(): any;
10
- getEdgeSubPath(): any;
11
- getUseIdThirdPartyDomain(): boolean;
12
- setUseIdThirdPartyDomain(): void;
13
- setIsIdentityEstablished(): void;
14
- };
4
+ }): import("../../utils/request/types.js").Request;
15
5
  export default _default;
16
6
  //# sourceMappingURL=createConsentRequest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createConsentRequest.d.ts","sourceRoot":"","sources":["../../../src/components/Consent/createConsentRequest.js"],"names":[],"mappings":"AAce;;;;;;;;;;;;;EAWd"}
1
+ {"version":3,"file":"createConsentRequest.d.ts","sourceRoot":"","sources":["../../../src/components/Consent/createConsentRequest.js"],"names":[],"mappings":"AAce;;;mDAWd"}
@@ -1,11 +1,4 @@
1
- declare function _default(): {
2
- mergeMeta: Function;
3
- mergeState: Function;
4
- mergeQuery: Function;
5
- mergeConfigOverride: (updates: any) => void;
6
- addIdentity: any;
7
- hasIdentity: any;
8
- toJSON(): any;
9
- };
1
+ declare function _default(): ConsentRequestPayload;
10
2
  export default _default;
3
+ import type { ConsentRequestPayload } from './types.js';
11
4
  //# sourceMappingURL=createConsentRequestPayload.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createConsentRequestPayload.d.ts","sourceRoot":"","sources":["../../../src/components/Consent/createConsentRequestPayload.js"],"names":[],"mappings":"AAce;;;;;;;;EAuBd"}
1
+ {"version":3,"file":"createConsentRequestPayload.d.ts","sourceRoot":"","sources":["../../../src/components/Consent/createConsentRequestPayload.js"],"names":[],"mappings":"AAqBe,6BAFF,qBAAqB,CA8BjC;;2CArC0C,YAAY"}
@@ -0,0 +1,28 @@
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
+ export const Types: {};
15
+ /**
16
+ * Request payload object with methods for merging different types of data.
17
+ */
18
+ export type ConsentRequestPayload = {
19
+ mergeMeta: Function;
20
+ mergeState: Function;
21
+ mergeQuery: Function;
22
+ mergeConfigOverride: Function;
23
+ addIdentity: Function;
24
+ hasIdentity: Function;
25
+ toJSON: Function;
26
+ setConsent: Function;
27
+ };
28
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Consent/types.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,uBAAwB"}
@@ -1,16 +1,6 @@
1
1
  declare function _default({ payload, datastreamIdOverride }: {
2
2
  payload: any;
3
3
  datastreamIdOverride: any;
4
- }): {
5
- getId(): string;
6
- getPayload(): any;
7
- getAction(): any;
8
- getDatastreamIdOverride(): any;
9
- getUseSendBeacon(): any;
10
- getEdgeSubPath(): any;
11
- getUseIdThirdPartyDomain(): boolean;
12
- setUseIdThirdPartyDomain(): void;
13
- setIsIdentityEstablished(): void;
14
- };
4
+ }): import("../../../utils/request/types.js").Request;
15
5
  export default _default;
16
6
  //# sourceMappingURL=createIdentityRequest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createIdentityRequest.d.ts","sourceRoot":"","sources":["../../../../src/components/Identity/getIdentity/createIdentityRequest.js"],"names":[],"mappings":"AAce;;;;;;;;;;;;;EAWd"}
1
+ {"version":3,"file":"createIdentityRequest.d.ts","sourceRoot":"","sources":["../../../../src/components/Identity/getIdentity/createIdentityRequest.js"],"names":[],"mappings":"AAce;;;sDAWd"}