@adobe/alloy 2.32.1-beta.0 → 2.32.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components.json +4 -0
- package/dist/alloy.js +12561 -11149
- package/dist/alloy.min.js +1 -1
- package/dist/alloyServiceWorker.js +7 -19
- package/dist/alloyServiceWorker.min.js +1 -1
- package/dist/types/browser/src/allOptionalComponents.d.ts +2 -0
- package/dist/types/browser/src/components/componentCreators.d.ts +1 -0
- package/dist/types/browser/src/index.d.ts +4 -2
- package/dist/types/browser/src/initializeStandalone.d.ts +4 -0
- package/dist/types/core/src/components/MediaAnalyticsBridge/createGetInstance.d.ts +1 -1
- package/dist/types/core/src/components/MediaAnalyticsBridge/createMediaHelper.d.ts +7 -56
- package/dist/types/core/src/core/componentCreators.d.ts +0 -1
- package/dist/utils/createEventMergeId.js +38 -30
- package/dist/utils/deepAssign.js +10 -4
- package/package.json +9 -13
- package/rollup.config.js +9 -15
- package/scripts/alloyBuilder.js +34 -42
- package/scripts/helpers/componentMetadata.js +25 -0
- package/scripts/helpers/generateEntryPoint.js +29 -0
- package/src/allOptionalComponents.js +14 -0
- package/src/components/ActivityCollector/attachClickActivityCollector.js +55 -0
- package/src/components/ActivityCollector/configValidators.js +52 -0
- package/src/components/ActivityCollector/createClickActivityStorage.js +33 -0
- package/src/components/ActivityCollector/createClickedElementProperties.js +224 -0
- package/src/components/ActivityCollector/createGetClickedElementProperties.js +68 -0
- package/src/components/ActivityCollector/createInjectClickedElementProperties.js +80 -0
- package/src/components/ActivityCollector/createRecallAndInjectClickedElementProperties.js +45 -0
- package/src/components/ActivityCollector/createStorePageViewProperties.js +20 -0
- package/src/components/ActivityCollector/getLinkName.js +145 -0
- package/src/components/ActivityCollector/getLinkRegion.js +65 -0
- package/src/components/ActivityCollector/index.js +132 -0
- package/src/components/ActivityCollector/utils/activityMapExtensionEnabled.js +16 -0
- package/src/components/ActivityCollector/utils/createTransientStorage.js +26 -0
- package/src/components/ActivityCollector/utils/determineLinkType.js +27 -0
- package/src/components/ActivityCollector/utils/dom/elementHasClickHandler.js +15 -0
- package/src/components/ActivityCollector/utils/dom/extractDomain.js +20 -0
- package/src/components/ActivityCollector/utils/dom/findClickableElement.js +36 -0
- package/src/components/ActivityCollector/utils/dom/getAbsoluteUrlFromAnchorElement.js +25 -0
- package/src/components/ActivityCollector/utils/dom/isButtonSubmitElement.js +15 -0
- package/src/components/ActivityCollector/utils/dom/isDownloadLink.js +27 -0
- package/src/components/ActivityCollector/utils/dom/isExitLink.js +24 -0
- package/src/components/ActivityCollector/utils/dom/isInputSubmitElement.js +26 -0
- package/src/components/ActivityCollector/utils/dom/isSupportedAnchorElement.js +24 -0
- package/src/components/ActivityCollector/utils/dom/isSupportedTextNode.js +27 -0
- package/src/components/ActivityCollector/utils/hasPageName.js +23 -0
- package/src/components/ActivityCollector/utils/isDifferentDomains.js +19 -0
- package/src/components/ActivityCollector/utils/trimQueryFromUrl.js +31 -0
- package/src/components/ActivityCollector/utils/truncateWhiteSpace.js +22 -0
- package/src/components/ActivityCollector/validateClickCollectionConfig.js +47 -0
- package/src/components/componentCreators.js +13 -0
- package/src/index.js +10 -2
- package/src/initializeStandalone.js +34 -0
- package/src/standalone.js +3 -26
- package/.browserslistrc +0 -2
- package/babel.config.js +0 -76
- package/dist/types/core/src/constants/sessionDataKeys.d.ts +0 -1
- package/scripts/helpers/entryPointGeneratorBabelPlugin.js +0 -101
- /package/dist/types/{core → browser}/src/components/ActivityCollector/attachClickActivityCollector.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/configValidators.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/createClickActivityStorage.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/createClickedElementProperties.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/createGetClickedElementProperties.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/createInjectClickedElementProperties.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/createRecallAndInjectClickedElementProperties.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/createStorePageViewProperties.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/getLinkName.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/getLinkRegion.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/index.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/activityMapExtensionEnabled.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/createTransientStorage.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/determineLinkType.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/elementHasClickHandler.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/extractDomain.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/findClickableElement.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/getAbsoluteUrlFromAnchorElement.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/isButtonSubmitElement.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/isDownloadLink.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/isExitLink.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/isInputSubmitElement.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/isSupportedAnchorElement.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/isSupportedTextNode.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/hasPageName.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/isDifferentDomains.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/trimQueryFromUrl.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/truncateWhiteSpace.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/validateClickCollectionConfig.d.ts +0 -0
|
@@ -294,8 +294,6 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
294
294
|
governing permissions and limitations under the License.
|
|
295
295
|
*/
|
|
296
296
|
|
|
297
|
-
/* eslint-disable no-underscore-dangle */
|
|
298
|
-
|
|
299
297
|
/** @import { ServiceWorkerLogger } from '../types.js' */
|
|
300
298
|
/** @import { TrackingDataPayload } from '../types.js' */
|
|
301
299
|
|
|
@@ -466,21 +464,17 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
466
464
|
byteToHex[arr[offset + 15]]).toLowerCase();
|
|
467
465
|
}
|
|
468
466
|
|
|
469
|
-
let getRandomValues;
|
|
470
467
|
const rnds8 = new Uint8Array(16);
|
|
471
468
|
function rng() {
|
|
472
|
-
|
|
473
|
-
if (typeof crypto === 'undefined' || !crypto.getRandomValues) {
|
|
474
|
-
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
475
|
-
}
|
|
476
|
-
getRandomValues = crypto.getRandomValues.bind(crypto);
|
|
477
|
-
}
|
|
478
|
-
return getRandomValues(rnds8);
|
|
469
|
+
return crypto.getRandomValues(rnds8);
|
|
479
470
|
}
|
|
480
471
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
472
|
+
function v4(options, buf, offset) {
|
|
473
|
+
if (!buf && !options && crypto.randomUUID) {
|
|
474
|
+
return crypto.randomUUID();
|
|
475
|
+
}
|
|
476
|
+
return _v4(options, buf, offset);
|
|
477
|
+
}
|
|
484
478
|
function _v4(options, buf, offset) {
|
|
485
479
|
options = options || {};
|
|
486
480
|
const rnds = options.random ?? options.rng?.() ?? rng();
|
|
@@ -501,12 +495,6 @@ function _v4(options, buf, offset) {
|
|
|
501
495
|
}
|
|
502
496
|
return unsafeStringify(rnds);
|
|
503
497
|
}
|
|
504
|
-
function v4(options, buf, offset) {
|
|
505
|
-
if (native.randomUUID && !buf && !options) {
|
|
506
|
-
return native.randomUUID();
|
|
507
|
-
}
|
|
508
|
-
return _v4(options, buf, offset);
|
|
509
|
-
}
|
|
510
498
|
|
|
511
499
|
/*
|
|
512
500
|
Copyright 2025 Adobe. All rights reserved.
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
const e=e=>["DEEPLINK","WEBURL"].includes(e);const t="config";var n=async e=>{try{const e=await(n="alloyPushNotifications",o=1,r=e=>{e.objectStoreNames.contains(t)||e.createObjectStore(t,{keyPath:"id"})},new Promise((e,t)=>{const a=indexedDB.open(n,o);a.onerror=()=>t(a.error),a.onsuccess=()=>e(a.result),a.onupgradeneeded=e=>{const t=e.target.result;r&&r(t)}})),a=await((e,t,n)=>new Promise((o,r)=>{const a=e.transaction([t],"readonly").objectStore(t).get(n);a.onerror=()=>r(a.error),a.onsuccess=()=>o(a.result)}))(e,t,"alloyConfig");return e.close(),a}catch(t){e.error("Failed to read data from IndexedDB",{error:t})}var n,o,r};const o=[];for(let e=0;e<256;++e)o.push((e+256).toString(16).slice(1));
|
|
13
|
+
const e=e=>["DEEPLINK","WEBURL"].includes(e);const t="config";var n=async e=>{try{const e=await(n="alloyPushNotifications",o=1,r=e=>{e.objectStoreNames.contains(t)||e.createObjectStore(t,{keyPath:"id"})},new Promise((e,t)=>{const a=indexedDB.open(n,o);a.onerror=()=>t(a.error),a.onsuccess=()=>e(a.result),a.onupgradeneeded=e=>{const t=e.target.result;r&&r(t)}})),a=await((e,t,n)=>new Promise((o,r)=>{const a=e.transaction([t],"readonly").objectStore(t).get(n);a.onerror=()=>r(a.error),a.onsuccess=()=>o(a.result)}))(e,t,"alloyConfig");return e.close(),a}catch(t){e.error("Failed to read data from IndexedDB",{error:t})}var n,o,r};const o=[];for(let e=0;e<256;++e)o.push((e+256).toString(16).slice(1));const r=new Uint8Array(16);function a(e,t,n){return t||e||!crypto.randomUUID?function(e,t,n){e=e||{};const a=e.random??e.rng?.()??crypto.getRandomValues(r);if(a.length<16)throw new Error("Random bytes length must be >= 16");if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){if((n=n||0)<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=a[e];return t}return function(e,t=0){return(o[e[t+0]]+o[e[t+1]]+o[e[t+2]]+o[e[t+3]]+"-"+o[e[t+4]]+o[e[t+5]]+"-"+o[e[t+6]]+o[e[t+7]]+"-"+o[e[t+8]]+o[e[t+9]]+"-"+o[e[t+10]]+o[e[t+11]]+o[e[t+12]]+o[e[t+13]]+o[e[t+14]]+o[e[t+15]]).toLowerCase()}(a)}(e,t,n):crypto.randomUUID()}const i=self,s={namespace:"[alloy][pushNotificationWorker]",info:(...e)=>console.log(s.namespace,...e),error:(...e)=>console.error(s.namespace,...e)},c=(({platform:t,sw:o})=>{const r=(({readFromIndexedDb:e,uuidv4:t,logger:n,fetch:o})=>async({xdm:r,actionLabel:a,applicationLaunches:i=0})=>{const s=await e(n),{browser:c,ecid:l,edgeDomain:d,edgeBasePath:u,datastreamId:g,datasetId:m}=s||{};let f={};a&&(f={customAction:{actionID:a}});const p=[{name:"browser",errorField:"Browser"},{name:"ecid",errorField:"ECID"},{name:"edgeDomain",errorField:"Edge domain"},{name:"edgeBasePath",errorField:"Edge base path"},{name:"datastreamId",errorField:"Datastream ID"},{name:"datasetId",errorField:"Dataset ID"}];try{for(const e of p)if(!s[e.name])throw new Error(`Cannot send tracking call. ${e.errorField} is missing.`);const e=`https://${d}/${u}/v1/interact?configId=${g}&requestId=${t()}`,h={events:[{xdm:{identityMap:{ECID:[{id:l}]},timestamp:(new Date).toISOString(),pushNotificationTracking:{...f,pushProviderMessageID:t(),pushProvider:c.toLowerCase()},application:{launches:{value:i}},eventType:a?"pushTracking.customAction":"pushTracking.applicationOpened",_experience:{...r._experience,customerJourneyManagement:{...r._experience.customerJourneyManagement,pushChannelContext:{platform:"web"},messageProfile:{channel:{_id:"https://ns.adobe.com/xdm/channels/push"}}}}},meta:{collect:{datasetId:m}}}]},w=await o(e,{method:"POST",headers:{"content-type":"text/plain; charset=UTF-8"},body:JSON.stringify(h)});return!!w.ok||(n.error("Tracking call failed: ",w.status,w.statusText),!1)}catch(e){return n.error("Error sending tracking call:",e),!1}})({readFromIndexedDb:n,uuidv4:a,logger:t.logger,fetch:t.fetch}),i=(({makeSendServiceWorkerTrackingData:t,sw:n,logger:o})=>({event:r})=>{r.notification.close();const a=r.notification.data;let i=null,s=null;if(r.action){const t=parseInt(r.action.replace("action_",""),10);if(a?.actions?.buttons[t]){const n=a.actions.buttons[t];s=n.label,e(n.type)&&n.uri&&(i=n.uri)}}else e(a?.interaction?.type)&&a?.interaction?.uri&&(i=a.interaction.uri);t({xdm:a._xdm.mixins,actionLabel:s,applicationLaunches:1}).catch(e=>{o.error("Failed to send tracking call:",e)}),i&&r.waitUntil(n.clients.matchAll({type:"window"}).then(e=>{for(const t of e)if(t.url===i&&"focus"in t)return t.focus();if(n.clients.openWindow)return n.clients.openWindow(i)}))})({makeSendServiceWorkerTrackingData:r,sw:o,logger:t.logger});return{pushNotifications:{onPush:e=>(async({sw:e,event:t,logger:n})=>{if(!t.data)return;let o;try{o=t.data.json()}catch(e){return void n.error("Error decoding notification JSON data:",e)}const r=o.web;if(!r?.title)return;const a={body:r.body,icon:r.media,image:r.media,data:r,actions:[]};return Object.keys(a).forEach(e=>{null==a[e]&&delete a[e]}),r.actions&&r.actions.buttons&&(a.actions=r.actions.buttons.map((e,t)=>({action:`action_${t}`,title:e.label}))),e.registration.showNotification(r.title,a)})({event:e,sw:o,logger:t.logger}),onNotificationClick(e){i({event:e})},async onNotificationClose(e){const n=e.notification.data;try{await r({xdm:n._xdm.mixins,actionLabel:"Dismiss"})}catch(e){t.logger.error("Failed to send tracking call:",e)}}}}})({sw:i,platform:{logger:s,fetch:fetch}});i.addEventListener("install",()=>{i.skipWaiting()}),i.addEventListener("activate",e=>{e.waitUntil(i.clients.claim())}),i.addEventListener("push",e=>c.pushNotifications.onPush(e)),i.addEventListener("notificationclick",e=>c.pushNotifications.onNotificationClick(e)),i.addEventListener("notificationclose",e=>{c.pushNotifications.onNotificationClose(e)});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as activityCollector } from "./ActivityCollector/index.js";
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
1
|
+
export function createInstance(options?: {}): (commandName: string, options?: any) => Promise<any>;
|
|
2
|
+
import { createCustomInstance } from "@adobe/alloy-core";
|
|
3
|
+
import * as allOptionalComponents from "./allOptionalComponents.js";
|
|
4
|
+
export { createCustomInstance, allOptionalComponents as components };
|
|
@@ -10,7 +10,7 @@ declare function _default({ logger, trackMediaSession, trackMediaEvent, uuid }:
|
|
|
10
10
|
trackSessionEnd: () => any;
|
|
11
11
|
trackComplete: () => any;
|
|
12
12
|
trackError: (errorId: any) => any;
|
|
13
|
-
trackEvent: (eventType: any, info: any,
|
|
13
|
+
trackEvent: (eventType: any, info: any, contextData: any) => any;
|
|
14
14
|
updatePlayhead: (time: any) => void;
|
|
15
15
|
updateQoEObject: (qoeObject: any) => void;
|
|
16
16
|
destroy: () => void;
|
|
@@ -1,61 +1,12 @@
|
|
|
1
1
|
declare function _default({ logger }: {
|
|
2
2
|
logger: any;
|
|
3
3
|
}): {
|
|
4
|
-
createMediaObject: (
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
} | {
|
|
13
|
-
sessionDetails?: undefined;
|
|
14
|
-
};
|
|
15
|
-
createAdBreakObject: (name: any, position: any, startTime: any) => {
|
|
16
|
-
advertisingPodDetails: {
|
|
17
|
-
friendlyName: any;
|
|
18
|
-
offset: any;
|
|
19
|
-
index: any;
|
|
20
|
-
};
|
|
21
|
-
} | {
|
|
22
|
-
advertisingPodDetails?: undefined;
|
|
23
|
-
};
|
|
24
|
-
createAdObject: (name: any, id: any, position: any, length: any) => {
|
|
25
|
-
advertisingDetails: {
|
|
26
|
-
friendlyName: any;
|
|
27
|
-
name: any;
|
|
28
|
-
podPosition: any;
|
|
29
|
-
length: any;
|
|
30
|
-
};
|
|
31
|
-
} | {
|
|
32
|
-
advertisingDetails?: undefined;
|
|
33
|
-
};
|
|
34
|
-
createChapterObject: (name: any, position: any, length: any, startTime: any) => {
|
|
35
|
-
chapterDetails: {
|
|
36
|
-
friendlyName: any;
|
|
37
|
-
offset: any;
|
|
38
|
-
index: any;
|
|
39
|
-
length: any;
|
|
40
|
-
};
|
|
41
|
-
} | {
|
|
42
|
-
chapterDetails?: undefined;
|
|
43
|
-
};
|
|
44
|
-
createStateObject: (stateName: any) => {
|
|
45
|
-
name: any;
|
|
46
|
-
} | {
|
|
47
|
-
name?: undefined;
|
|
48
|
-
};
|
|
49
|
-
createQoEObject: (bitrate: any, droppedFrames: any, fps: any, startupTime: any) => {
|
|
50
|
-
bitrate: any;
|
|
51
|
-
droppedFrames: any;
|
|
52
|
-
framesPerSecond: any;
|
|
53
|
-
timeToStart: any;
|
|
54
|
-
} | {
|
|
55
|
-
bitrate?: undefined;
|
|
56
|
-
droppedFrames?: undefined;
|
|
57
|
-
framesPerSecond?: undefined;
|
|
58
|
-
timeToStart?: undefined;
|
|
59
|
-
};
|
|
4
|
+
createMediaObject: (...args: any[]) => any;
|
|
5
|
+
createAdBreakObject: (...args: any[]) => any;
|
|
6
|
+
createAdObject: (...args: any[]) => any;
|
|
7
|
+
createChapterObject: (...args: any[]) => any;
|
|
8
|
+
createStateObject: (...args: any[]) => any;
|
|
9
|
+
createQoEObject: (...args: any[]) => any;
|
|
10
|
+
version: string;
|
|
60
11
|
};
|
|
61
12
|
export default _default;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export { default as activityCollector } from "../components/ActivityCollector/index.js";
|
|
2
1
|
export { default as audiences } from "../components/Audiences/index.js";
|
|
3
2
|
export { default as consent } from "../components/Consent/index.js";
|
|
4
3
|
export { default as eventMerge } from "../components/EventMerge/index.js";
|
|
@@ -12,44 +12,51 @@
|
|
|
12
12
|
|
|
13
13
|
const byteToHex = [];
|
|
14
14
|
for (let i = 0; i < 256; ++i) {
|
|
15
|
-
|
|
15
|
+
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
16
16
|
}
|
|
17
17
|
function unsafeStringify(arr, offset = 0) {
|
|
18
|
-
|
|
18
|
+
return (byteToHex[arr[offset + 0]] +
|
|
19
|
+
byteToHex[arr[offset + 1]] +
|
|
20
|
+
byteToHex[arr[offset + 2]] +
|
|
21
|
+
byteToHex[arr[offset + 3]] +
|
|
22
|
+
'-' +
|
|
23
|
+
byteToHex[arr[offset + 4]] +
|
|
24
|
+
byteToHex[arr[offset + 5]] +
|
|
25
|
+
'-' +
|
|
26
|
+
byteToHex[arr[offset + 6]] +
|
|
27
|
+
byteToHex[arr[offset + 7]] +
|
|
28
|
+
'-' +
|
|
29
|
+
byteToHex[arr[offset + 8]] +
|
|
30
|
+
byteToHex[arr[offset + 9]] +
|
|
31
|
+
'-' +
|
|
32
|
+
byteToHex[arr[offset + 10]] +
|
|
33
|
+
byteToHex[arr[offset + 11]] +
|
|
34
|
+
byteToHex[arr[offset + 12]] +
|
|
35
|
+
byteToHex[arr[offset + 13]] +
|
|
36
|
+
byteToHex[arr[offset + 14]] +
|
|
37
|
+
byteToHex[arr[offset + 15]]).toLowerCase();
|
|
19
38
|
}
|
|
20
39
|
|
|
21
|
-
let getRandomValues;
|
|
22
40
|
const rnds8 = new Uint8Array(16);
|
|
23
41
|
function rng() {
|
|
24
|
-
|
|
25
|
-
if (typeof crypto === 'undefined' || !crypto.getRandomValues) {
|
|
26
|
-
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
27
|
-
}
|
|
28
|
-
getRandomValues = crypto.getRandomValues.bind(crypto);
|
|
29
|
-
}
|
|
30
|
-
return getRandomValues(rnds8);
|
|
42
|
+
return crypto.getRandomValues(rnds8);
|
|
31
43
|
}
|
|
32
44
|
|
|
33
|
-
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
34
|
-
var native = {
|
|
35
|
-
randomUUID
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
function _v4(options, buf, offset) {
|
|
39
|
-
options = options || {};
|
|
40
|
-
const rnds = options.random ?? options.rng?.() ?? rng();
|
|
41
|
-
if (rnds.length < 16) {
|
|
42
|
-
throw new Error('Random bytes length must be >= 16');
|
|
43
|
-
}
|
|
44
|
-
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
45
|
-
rnds[8] = rnds[8] & 0x3f | 0x80;
|
|
46
|
-
return unsafeStringify(rnds);
|
|
47
|
-
}
|
|
48
45
|
function v4(options, buf, offset) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
if (crypto.randomUUID) {
|
|
47
|
+
return crypto.randomUUID();
|
|
48
|
+
}
|
|
49
|
+
return _v4(options);
|
|
50
|
+
}
|
|
51
|
+
function _v4(options, buf, offset) {
|
|
52
|
+
options = options || {};
|
|
53
|
+
const rnds = options.random ?? options.rng?.() ?? rng();
|
|
54
|
+
if (rnds.length < 16) {
|
|
55
|
+
throw new Error('Random bytes length must be >= 16');
|
|
56
|
+
}
|
|
57
|
+
rnds[6] = (rnds[6] & 0x0f) | 0x40;
|
|
58
|
+
rnds[8] = (rnds[8] & 0x3f) | 0x80;
|
|
59
|
+
return unsafeStringify(rnds);
|
|
53
60
|
}
|
|
54
61
|
|
|
55
62
|
/*
|
|
@@ -64,9 +71,10 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
64
71
|
governing permissions and limitations under the License.
|
|
65
72
|
*/
|
|
66
73
|
|
|
74
|
+
|
|
67
75
|
var createEventMergeId = () => {
|
|
68
76
|
return {
|
|
69
|
-
eventMergeId: v4()
|
|
77
|
+
eventMergeId: v4(),
|
|
70
78
|
};
|
|
71
79
|
};
|
|
72
80
|
|
package/dist/utils/deepAssign.js
CHANGED
|
@@ -27,7 +27,7 @@ governing permissions and limitations under the License.
|
|
|
27
27
|
* @param {*} value
|
|
28
28
|
* @returns {boolean}
|
|
29
29
|
*/
|
|
30
|
-
var isNil = value => value == null;
|
|
30
|
+
var isNil = (value) => value == null;
|
|
31
31
|
|
|
32
32
|
/*
|
|
33
33
|
Copyright 2019 Adobe. All rights reserved.
|
|
@@ -47,7 +47,8 @@ governing permissions and limitations under the License.
|
|
|
47
47
|
* @param {*} value
|
|
48
48
|
* @returns {boolean}
|
|
49
49
|
*/
|
|
50
|
-
var isObject =
|
|
50
|
+
var isObject = (value) =>
|
|
51
|
+
!isNil(value) && !Array.isArray(value) && typeof value === "object";
|
|
51
52
|
|
|
52
53
|
/*
|
|
53
54
|
Copyright 2019 Adobe. All rights reserved.
|
|
@@ -64,11 +65,13 @@ governing permissions and limitations under the License.
|
|
|
64
65
|
|
|
65
66
|
// Keys that should never be copied to prevent prototype pollution.
|
|
66
67
|
const DANGEROUS_KEYS = ["__proto__", "constructor", "prototype"];
|
|
68
|
+
|
|
67
69
|
const deepAssignObject = (target, source) => {
|
|
68
|
-
Object.keys(source).forEach(key => {
|
|
70
|
+
Object.keys(source).forEach((key) => {
|
|
69
71
|
if (DANGEROUS_KEYS.includes(key)) {
|
|
70
72
|
return;
|
|
71
73
|
}
|
|
74
|
+
|
|
72
75
|
if (isObject(target[key]) && isObject(source[key])) {
|
|
73
76
|
deepAssignObject(target[key], source[key]);
|
|
74
77
|
return;
|
|
@@ -89,8 +92,11 @@ var deepAssign = (target, ...sources) => {
|
|
|
89
92
|
if (isNil(target)) {
|
|
90
93
|
throw new TypeError('deepAssign "target" cannot be null or undefined');
|
|
91
94
|
}
|
|
95
|
+
|
|
92
96
|
const result = Object(target);
|
|
93
|
-
|
|
97
|
+
|
|
98
|
+
sources.forEach((source) => deepAssignObject(result, Object(source)));
|
|
99
|
+
|
|
94
100
|
return result;
|
|
95
101
|
};
|
|
96
102
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/alloy",
|
|
3
|
-
"version": "2.32.1-beta.
|
|
3
|
+
"version": "2.32.1-beta.1",
|
|
4
4
|
"description": "Adobe Experience Platform Web SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"src",
|
|
18
18
|
"dist",
|
|
19
|
+
"components.json",
|
|
19
20
|
"scripts/alloyBuilder.js",
|
|
20
|
-
"scripts/helpers/
|
|
21
|
+
"scripts/helpers/componentMetadata.js",
|
|
22
|
+
"scripts/helpers/generateEntryPoint.js",
|
|
21
23
|
"scripts/helpers/path.js",
|
|
22
24
|
"rollup.config.js",
|
|
23
|
-
"babel.config.js",
|
|
24
|
-
".browserslistrc",
|
|
25
25
|
"LICENSE_BANNER"
|
|
26
26
|
],
|
|
27
27
|
"exports": {
|
|
@@ -56,32 +56,28 @@
|
|
|
56
56
|
"./libEs6/components/EventMerge/createEventMergeId": {
|
|
57
57
|
"types": "./dist/types/browser/src/utils/createEventMergeId.d.ts",
|
|
58
58
|
"default": "./dist/utils/createEventMergeId.js"
|
|
59
|
-
}
|
|
59
|
+
},
|
|
60
|
+
"./components.json": "./components.json"
|
|
60
61
|
},
|
|
61
62
|
"dependencies": {
|
|
62
|
-
"@babel/core": "^7.28.5",
|
|
63
|
-
"@babel/plugin-transform-modules-commonjs": "^7.27.1",
|
|
64
|
-
"@babel/plugin-transform-template-literals": "^7.27.1",
|
|
65
|
-
"@babel/preset-env": "^7.28.5",
|
|
66
63
|
"@inquirer/prompts": "^7.9.0",
|
|
67
|
-
"@rollup/plugin-babel": "^6.1.0",
|
|
68
64
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
69
65
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
66
|
+
"@rollup/plugin-replace": "^6.0.0",
|
|
70
67
|
"@rollup/plugin-terser": "^0.4.4",
|
|
71
68
|
"commander": "^14.0.2",
|
|
72
69
|
"rollup": "^4.52.5",
|
|
73
70
|
"rollup-plugin-license": "^3.6.0",
|
|
74
|
-
"@adobe/alloy-core": "^1.1.2-beta.
|
|
71
|
+
"@adobe/alloy-core": "^1.1.2-beta.1"
|
|
75
72
|
},
|
|
76
73
|
"devDependencies": {
|
|
77
|
-
"@babel/cli": "^7.28.3",
|
|
78
74
|
"glob": "^11.0.3",
|
|
79
75
|
"msw": "^2.11.6",
|
|
80
76
|
"read-cache": "^1.0.0",
|
|
81
77
|
"rimraf": "^6.1.0",
|
|
82
78
|
"testcafe": "^3.7.2",
|
|
83
79
|
"testcafe-browser-provider-playwright": "^1.1.0",
|
|
84
|
-
"uuid": "^
|
|
80
|
+
"uuid": "^14.0.0",
|
|
85
81
|
"vitest": "^4.0.6"
|
|
86
82
|
},
|
|
87
83
|
"scripts": {
|
package/rollup.config.js
CHANGED
|
@@ -13,13 +13,15 @@ governing permissions and limitations under the License.
|
|
|
13
13
|
import path from "path";
|
|
14
14
|
import resolve from "@rollup/plugin-node-resolve";
|
|
15
15
|
import commonjs from "@rollup/plugin-commonjs";
|
|
16
|
-
import
|
|
16
|
+
import replace from "@rollup/plugin-replace";
|
|
17
17
|
import terser from "@rollup/plugin-terser";
|
|
18
18
|
import license from "rollup-plugin-license";
|
|
19
19
|
import { fileURLToPath } from "url";
|
|
20
20
|
import { gzip, brotliCompress as br, constants as zlibConstants } from "zlib";
|
|
21
21
|
import { promisify } from "util";
|
|
22
22
|
import { readFile, writeFile } from "fs/promises";
|
|
23
|
+
import packageJson from "./package.json" with { type: "json" };
|
|
24
|
+
const { version } = packageJson;
|
|
23
25
|
|
|
24
26
|
const INCLUDE_BUNDLESIZE = process.env.BUNDLESIZE === "true";
|
|
25
27
|
/**
|
|
@@ -148,8 +150,12 @@ export const utilityExportBuilds = [
|
|
|
148
150
|
},
|
|
149
151
|
];
|
|
150
152
|
|
|
151
|
-
const buildPlugins = ({ variant, minify
|
|
153
|
+
const buildPlugins = ({ variant, minify }) => {
|
|
152
154
|
const plugins = [
|
|
155
|
+
replace({
|
|
156
|
+
__VERSION__: version,
|
|
157
|
+
preventAssignment: true,
|
|
158
|
+
}),
|
|
153
159
|
resolve({
|
|
154
160
|
preferBuiltins: false,
|
|
155
161
|
// Support the browser field in dependencies' package.json.
|
|
@@ -159,17 +165,6 @@ const buildPlugins = ({ variant, minify, babelPlugins }) => {
|
|
|
159
165
|
commonjs(),
|
|
160
166
|
];
|
|
161
167
|
|
|
162
|
-
if (variant !== SERVICE_WORKER) {
|
|
163
|
-
plugins.push(
|
|
164
|
-
babel({
|
|
165
|
-
envName: "rollup",
|
|
166
|
-
babelHelpers: "bundled",
|
|
167
|
-
configFile: path.resolve(dirname, "babel.config.js"),
|
|
168
|
-
plugins: babelPlugins,
|
|
169
|
-
}),
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
168
|
if (INCLUDE_BUNDLESIZE) {
|
|
174
169
|
plugins.push(
|
|
175
170
|
bundleSizePlugin({
|
|
@@ -220,11 +215,10 @@ const buildPlugins = ({ variant, minify, babelPlugins }) => {
|
|
|
220
215
|
export const buildConfig = ({
|
|
221
216
|
variant = STANDALONE,
|
|
222
217
|
minify = false,
|
|
223
|
-
babelPlugins = [],
|
|
224
218
|
input = `${dirname}/src/standalone.js`,
|
|
225
219
|
file,
|
|
226
220
|
}) => {
|
|
227
|
-
const plugins = buildPlugins({ variant, minify
|
|
221
|
+
const plugins = buildPlugins({ variant, minify });
|
|
228
222
|
const minifiedExtension = minify ? ".min" : "";
|
|
229
223
|
|
|
230
224
|
if (variant === SERVICE_WORKER) {
|
package/scripts/alloyBuilder.js
CHANGED
|
@@ -11,7 +11,6 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
11
11
|
governing permissions and limitations under the License.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import babel from "@babel/core";
|
|
15
14
|
import terser from "@rollup/plugin-terser";
|
|
16
15
|
import resolve from "@rollup/plugin-node-resolve";
|
|
17
16
|
import commonjs from "@rollup/plugin-commonjs";
|
|
@@ -23,11 +22,11 @@ import fs from "fs";
|
|
|
23
22
|
import path from "path";
|
|
24
23
|
import { rollup } from "rollup";
|
|
25
24
|
import { buildConfig } from "../rollup.config.js";
|
|
26
|
-
import
|
|
25
|
+
import { generateEntryPointSource } from "./helpers/generateEntryPoint.js";
|
|
27
26
|
import {
|
|
28
27
|
optionalComponentNames,
|
|
29
28
|
requiredComponentNames,
|
|
30
|
-
} from "
|
|
29
|
+
} from "./helpers/componentMetadata.js";
|
|
31
30
|
import { getBrowserPackageRoot, safePathJoin } from "./helpers/path.js";
|
|
32
31
|
|
|
33
32
|
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -40,22 +39,7 @@ const packageJsonContent = fs.readFileSync(
|
|
|
40
39
|
);
|
|
41
40
|
const { version } = JSON.parse(packageJsonContent);
|
|
42
41
|
|
|
43
|
-
const
|
|
44
|
-
const candidates = ["src", "libEs6"];
|
|
45
|
-
|
|
46
|
-
for (const candidate of candidates) {
|
|
47
|
-
const candidatePath = safePathJoin(browserPackageRoot, candidate);
|
|
48
|
-
if (fs.existsSync(candidatePath)) {
|
|
49
|
-
return candidatePath;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
throw new Error(
|
|
54
|
-
"Unable to locate source directory. Expected to find 'src' or 'libEs6' within the browser package.",
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const sourceRootPath = resolveSourceRootPath();
|
|
42
|
+
const sourceRootPath = safePathJoin(browserPackageRoot, "src");
|
|
59
43
|
|
|
60
44
|
const arrayDifference = (arr1, arr2) => arr1.filter((x) => !arr2.includes(x));
|
|
61
45
|
|
|
@@ -91,14 +75,12 @@ const generateInputEntryFile = ({
|
|
|
91
75
|
outputFile = "input.js",
|
|
92
76
|
includedModules,
|
|
93
77
|
}) => {
|
|
94
|
-
const
|
|
95
|
-
plugins: [entryPointGeneratorBabelPlugin(babel.types, includedModules)],
|
|
96
|
-
}).code;
|
|
78
|
+
const source = generateEntryPointSource(includedModules);
|
|
97
79
|
|
|
98
80
|
const destinationDirectory = path.dirname(inputPath);
|
|
99
81
|
const outputPath = safePathJoin(destinationDirectory, outputFile);
|
|
100
82
|
|
|
101
|
-
fs.writeFileSync(outputPath,
|
|
83
|
+
fs.writeFileSync(outputPath, source);
|
|
102
84
|
|
|
103
85
|
return outputPath;
|
|
104
86
|
};
|
|
@@ -116,16 +98,22 @@ const build = async (argv) => {
|
|
|
116
98
|
minify: argv.minify,
|
|
117
99
|
});
|
|
118
100
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
101
|
+
let bundle;
|
|
102
|
+
try {
|
|
103
|
+
bundle = await rollup(rollupConfig);
|
|
104
|
+
await bundle.write(rollupConfig.output[0]);
|
|
105
|
+
|
|
106
|
+
console.log(
|
|
107
|
+
`🎉 Wrote ${
|
|
108
|
+
path.isAbsolute(argv.outputDir)
|
|
109
|
+
? rollupConfig.output[0].file
|
|
110
|
+
: path.relative(process.cwd(), rollupConfig.output[0].file)
|
|
111
|
+
} (${getFileSizeInKB(rollupConfig.output[0].file)}).`,
|
|
112
|
+
);
|
|
113
|
+
} finally {
|
|
114
|
+
await bundle?.close();
|
|
115
|
+
fs.rmSync(inputFile, { force: true });
|
|
116
|
+
}
|
|
129
117
|
};
|
|
130
118
|
|
|
131
119
|
const buildPushNotificationsServiceWorker = async (argv) => {
|
|
@@ -168,15 +156,19 @@ const buildPushNotificationsServiceWorker = async (argv) => {
|
|
|
168
156
|
};
|
|
169
157
|
|
|
170
158
|
const bundle = await rollup(rollupConfig);
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
159
|
+
try {
|
|
160
|
+
await bundle.write(rollupConfig.output[0]);
|
|
161
|
+
|
|
162
|
+
console.log(
|
|
163
|
+
`🎉 Wrote ${
|
|
164
|
+
path.isAbsolute(argv.outputDir)
|
|
165
|
+
? rollupConfig.output[0].file
|
|
166
|
+
: path.relative(process.cwd(), rollupConfig.output[0].file)
|
|
167
|
+
} (${getFileSizeInKB(rollupConfig.output[0].file)}).`,
|
|
168
|
+
);
|
|
169
|
+
} finally {
|
|
170
|
+
await bundle.close();
|
|
171
|
+
}
|
|
180
172
|
};
|
|
181
173
|
|
|
182
174
|
const getMakeBuildCommand = () => {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import {
|
|
14
|
+
optionalComponentNames as coreOptional,
|
|
15
|
+
requiredComponentNames,
|
|
16
|
+
} from "@adobe/alloy-core/componentMetadata.js";
|
|
17
|
+
import browserManifest from "../../components.json" with { type: "json" };
|
|
18
|
+
|
|
19
|
+
const browserOptional = browserManifest.optional.map((c) => c.name);
|
|
20
|
+
|
|
21
|
+
export const optionalComponentNames = Object.freeze([
|
|
22
|
+
...new Set([...coreOptional, ...browserOptional]),
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
export { requiredComponentNames };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export const generateEntryPointSource = (includedModules) => {
|
|
14
|
+
const hasComponents = includedModules.length > 0;
|
|
15
|
+
const componentList = includedModules.join(", ");
|
|
16
|
+
|
|
17
|
+
const importLine = hasComponents
|
|
18
|
+
? `import { ${componentList} } from "./allOptionalComponents.js";`
|
|
19
|
+
: "";
|
|
20
|
+
|
|
21
|
+
const componentsArray = hasComponents ? `[${componentList}]` : "[]";
|
|
22
|
+
|
|
23
|
+
return `\
|
|
24
|
+
import initializeStandalone from "./initializeStandalone.js";
|
|
25
|
+
${importLine}
|
|
26
|
+
|
|
27
|
+
initializeStandalone({ components: ${componentsArray} });
|
|
28
|
+
`;
|
|
29
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2026 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export * from "@adobe/alloy-core/core/componentCreators.js";
|
|
14
|
+
export * from "./components/componentCreators.js";
|