@adobe/alloy 2.33.0 → 2.33.1-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.
package/dist/alloy.js CHANGED
@@ -6890,7 +6890,7 @@
6890
6890
  governing permissions and limitations under the License.
6891
6891
  */
6892
6892
 
6893
- var createComponent$4 = ({
6893
+ var createComponent$5 = ({
6894
6894
  addEcidQueryToPayload,
6895
6895
  addQueryStringIdentityToPayload,
6896
6896
  ensureSingleIdentity,
@@ -7891,7 +7891,7 @@
7891
7891
  thirdPartyCookiesEnabled,
7892
7892
  areThirdPartyCookiesSupportedByDefault,
7893
7893
  });
7894
- return createComponent$4({
7894
+ return createComponent$5({
7895
7895
  addEcidQueryToPayload,
7896
7896
  addQueryStringIdentityToPayload,
7897
7897
  ensureSingleIdentity,
@@ -7922,10 +7922,10 @@
7922
7922
  governing permissions and limitations under the License.
7923
7923
  */
7924
7924
 
7925
- // The 2.33.0 keyword will be replace at alloy build time with the package.json version.
7925
+ // The 2.33.1-beta.0 keyword will be replace at alloy build time with the package.json version.
7926
7926
  // see babel-plugin-version
7927
7927
 
7928
- var libraryVersion = "2.33.0";
7928
+ var libraryVersion = "2.33.1-beta.0";
7929
7929
 
7930
7930
  /*
7931
7931
  Copyright 2019 Adobe. All rights reserved.
@@ -8013,7 +8013,7 @@
8013
8013
 
8014
8014
  const createNamespacedStorage$1 = injectStorage(window);
8015
8015
 
8016
- const { fetch, navigator } = window;
8016
+ const { fetch, navigator: navigator$1 } = window;
8017
8017
 
8018
8018
  const coreConfigValidators = createCoreConfigs();
8019
8019
  const apexDomain = getApexDomain(window, cookieJar);
@@ -8061,11 +8061,11 @@
8061
8061
  apexDomain,
8062
8062
  dateProvider: () => new Date(),
8063
8063
  });
8064
- const sendBeaconRequest = isFunction(navigator.sendBeacon)
8064
+ const sendBeaconRequest = isFunction(navigator$1.sendBeacon)
8065
8065
  ? injectSendBeaconRequest({
8066
8066
  // Without the bind(), the browser will complain about an
8067
8067
  // illegal invocation.
8068
- sendBeacon: navigator.sendBeacon.bind(navigator),
8068
+ sendBeacon: navigator$1.sendBeacon.bind(navigator$1),
8069
8069
  sendFetchRequest,
8070
8070
  logger,
8071
8071
  })
@@ -8307,7 +8307,7 @@
8307
8307
  */
8308
8308
 
8309
8309
 
8310
- var createComponent$3 = ({
8310
+ var createComponent$4 = ({
8311
8311
  storedConsent,
8312
8312
  taskQueue,
8313
8313
  defaultConsent,
@@ -8706,7 +8706,7 @@
8706
8706
 
8707
8707
  const doesIdentityCookieExist = injectDoesIdentityCookieExist({ orgId });
8708
8708
 
8709
- return createComponent$3({
8709
+ return createComponent$4({
8710
8710
  storedConsent,
8711
8711
  taskQueue,
8712
8712
  defaultConsent,
@@ -8752,7 +8752,7 @@
8752
8752
  governing permissions and limitations under the License.
8753
8753
  */
8754
8754
 
8755
- var createComponent$2 = ({ createEventMergeId }) => {
8755
+ var createComponent$3 = ({ createEventMergeId }) => {
8756
8756
  return {
8757
8757
  commands: {
8758
8758
  createEventMergeId: {
@@ -8776,7 +8776,7 @@
8776
8776
 
8777
8777
 
8778
8778
  const createEventMerge = () => {
8779
- return createComponent$2({ createEventMergeId });
8779
+ return createComponent$3({ createEventMergeId });
8780
8780
  };
8781
8781
 
8782
8782
  createEventMerge.namespace = "EventMerge";
@@ -10732,7 +10732,7 @@
10732
10732
  return Math.round(allocationValue * MAX_PERCENTAGE) / MAX_PERCENTAGE;
10733
10733
  }
10734
10734
  const createAllocationMemoized = memoize(createAllocation);
10735
- function createContext(id, buckets, context) {
10735
+ function createContext$1(id, buckets, context) {
10736
10736
  const allocation = createAllocationMemoized(id, buckets);
10737
10737
  return {
10738
10738
  allocation,
@@ -10775,7 +10775,7 @@
10775
10775
  const key = rulesKeys[i];
10776
10776
  const rulesForKey = rulesWithKeys[key];
10777
10777
  const id = createId(identity, key, metadata);
10778
- const contextForKey = createContext(id, buckets, context);
10778
+ const contextForKey = createContext$1(id, buckets, context);
10779
10779
  const consequences = evaluateRules(contextForKey, rulesForKey);
10780
10780
  consequencesWithKeys.push(...consequences);
10781
10781
  }
@@ -13372,7 +13372,7 @@
13372
13372
  *
13373
13373
  * @see {@link https://experienceleague.adobe.com/en/docs/experience-platform/web-sdk/install/create-custom-build} for more details.
13374
13374
  */
13375
- const createCustomInstance = (options = {}) => {
13375
+ const createCustomInstance$1 = (options = {}) => {
13376
13376
  const eventOptionsValidator = boundObjectOf({
13377
13377
  name: boundString().default("alloy"),
13378
13378
  monitors: boundArrayOf(boundObjectOf({})).default([]),
@@ -14761,7 +14761,7 @@
14761
14761
  governing permissions and limitations under the License.
14762
14762
  */
14763
14763
 
14764
- var createComponent$1 = ({ handleOnBeforeSendEvent, sendAdConversionHandler }) => {
14764
+ var createComponent$2 = ({ handleOnBeforeSendEvent, sendAdConversionHandler }) => {
14765
14765
  return {
14766
14766
  lifecycle: {
14767
14767
  onComponentsRegistered() {
@@ -16512,7 +16512,7 @@
16512
16512
  collectHashedIPAddr: () =>
16513
16513
  hashedIpHandler.collect(initiateAdvertisingIdentityCall),
16514
16514
  });
16515
- return createComponent$1({
16515
+ return createComponent$2({
16516
16516
  handleOnBeforeSendEvent,
16517
16517
  sendAdConversionHandler,
16518
16518
  });
@@ -16721,7 +16721,7 @@
16721
16721
  */
16722
16722
 
16723
16723
 
16724
- var createComponent = ({
16724
+ var createComponent$1 = ({
16725
16725
  getPageLocation,
16726
16726
  logger,
16727
16727
  fetchDataHandler,
@@ -20721,7 +20721,7 @@
20721
20721
  consent,
20722
20722
  });
20723
20723
 
20724
- return createComponent({
20724
+ return createComponent$1({
20725
20725
  getPageLocation,
20726
20726
  logger,
20727
20727
  fetchDataHandler,
@@ -21531,6 +21531,214 @@
21531
21531
  };
21532
21532
  };
21533
21533
 
21534
+ /*
21535
+ Copyright 2020 Adobe. All rights reserved.
21536
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
21537
+ you may not use this file except in compliance with the License. You may obtain a copy
21538
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
21539
+
21540
+ Unless required by applicable law or agreed to in writing, software distributed under
21541
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
21542
+ OF ANY KIND, either express or implied. See the License for the specific language
21543
+ governing permissions and limitations under the License.
21544
+ */
21545
+
21546
+ var libraryName = "https://ns.adobe.com/experience/alloy";
21547
+
21548
+ /*
21549
+ Copyright 2019 Adobe. All rights reserved.
21550
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
21551
+ you may not use this file except in compliance with the License. You may obtain a copy
21552
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
21553
+
21554
+ Unless required by applicable law or agreed to in writing, software distributed under
21555
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
21556
+ OF ANY KIND, either express or implied. See the License for the specific language
21557
+ governing permissions and limitations under the License.
21558
+ */
21559
+
21560
+ var implementationDetails = (event) => {
21561
+ event.mergeXdm({
21562
+ implementationDetails: {
21563
+ name: libraryName,
21564
+ version: libraryVersion,
21565
+ environment: "browser",
21566
+ },
21567
+ });
21568
+ };
21569
+
21570
+ /*
21571
+ Copyright 2019 Adobe. All rights reserved.
21572
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
21573
+ you may not use this file except in compliance with the License. You may obtain a copy
21574
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
21575
+
21576
+ Unless required by applicable law or agreed to in writing, software distributed under
21577
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
21578
+ OF ANY KIND, either express or implied. See the License for the specific language
21579
+ governing permissions and limitations under the License.
21580
+ */
21581
+ var createComponent = (config, logger, optionalContexts, requiredContexts) => {
21582
+ const configuredContexts = config.context;
21583
+
21584
+ const contexts = configuredContexts
21585
+ .flatMap((context, i) => {
21586
+ if (optionalContexts[context]) {
21587
+ return [optionalContexts[context]];
21588
+ }
21589
+ logger.warn(`Invalid context[${i}]: '${context}' is not available.`);
21590
+ return [];
21591
+ })
21592
+ .concat(requiredContexts);
21593
+
21594
+ return {
21595
+ namespace: "Context",
21596
+ lifecycle: {
21597
+ onBeforeEvent({ event }) {
21598
+ return Promise.all(
21599
+ contexts.map((context) => Promise.resolve(context(event, logger))),
21600
+ );
21601
+ },
21602
+ },
21603
+ };
21604
+ };
21605
+
21606
+ /*
21607
+ Copyright 2022 Adobe. All rights reserved.
21608
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
21609
+ you may not use this file except in compliance with the License. You may obtain a copy
21610
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
21611
+
21612
+ Unless required by applicable law or agreed to in writing, software distributed under
21613
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
21614
+ OF ANY KIND, either express or implied. See the License for the specific language
21615
+ governing permissions and limitations under the License.
21616
+ */
21617
+
21618
+ var highEntropyUserAgentHints$1 = [
21619
+ ["architecture", "string"],
21620
+ ["bitness", "string"],
21621
+ ["model", "string"],
21622
+ ["platformVersion", "string"],
21623
+ ["wow64", "boolean"],
21624
+ ];
21625
+
21626
+ /*
21627
+ Copyright 2022 Adobe. All rights reserved.
21628
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
21629
+ you may not use this file except in compliance with the License. You may obtain a copy
21630
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
21631
+
21632
+ Unless required by applicable law or agreed to in writing, software distributed under
21633
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
21634
+ OF ANY KIND, either express or implied. See the License for the specific language
21635
+ governing permissions and limitations under the License.
21636
+ */
21637
+
21638
+
21639
+ const browserSupportsUserAgentClientHints = (navigator) => {
21640
+ return "userAgentData" in navigator;
21641
+ };
21642
+
21643
+ var injectHighEntropyUserAgentHints = (navigator) => {
21644
+ if (!browserSupportsUserAgentClientHints(navigator)) {
21645
+ return noop;
21646
+ }
21647
+ return (event, logger) => {
21648
+ try {
21649
+ // eslint-disable-next-line compat/compat -- Feature detection performed above
21650
+ return navigator.userAgentData
21651
+ .getHighEntropyValues(highEntropyUserAgentHints$1.map((hint) => hint[0]))
21652
+ .then((hints) => {
21653
+ const userAgentClientHints = {};
21654
+ highEntropyUserAgentHints$1.forEach(([hintName, hintType]) => {
21655
+ if (
21656
+ Object.prototype.hasOwnProperty.call(hints, hintName) &&
21657
+ /* eslint-disable-next-line valid-typeof */
21658
+ typeof hints[hintName] === hintType
21659
+ ) {
21660
+ userAgentClientHints[hintName] = hints[hintName];
21661
+ }
21662
+ });
21663
+ event.mergeXdm({
21664
+ environment: {
21665
+ browserDetails: {
21666
+ userAgentClientHints,
21667
+ },
21668
+ },
21669
+ });
21670
+ });
21671
+ } catch (error) {
21672
+ logger.warn(
21673
+ `Unable to collect user-agent client hints. ${error.message}`,
21674
+ );
21675
+ return noop;
21676
+ }
21677
+ };
21678
+ };
21679
+
21680
+ /*
21681
+ Copyright 2025 Adobe. All rights reserved.
21682
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
21683
+ you may not use this file except in compliance with the License. You may obtain a copy
21684
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
21685
+
21686
+ Unless required by applicable law or agreed to in writing, software distributed under
21687
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
21688
+ OF ANY KIND, either express or implied. See the License for the specific language
21689
+ governing permissions and limitations under the License.
21690
+ */
21691
+
21692
+ // Because these events are originated by the SDK rather than user actions, don't change the referrer
21693
+ const IGNORED_EVENT_TYPES = new Set([
21694
+ "decisioning.propositionFetch",
21695
+ "decisioning.propositionDisplay",
21696
+ "decisioning.propositionInteract",
21697
+ ]);
21698
+
21699
+ var injectOneTimeAnalyticsReferrer = (window) => {
21700
+ let lastReferrerSent = null;
21701
+
21702
+ return (event) => {
21703
+ const content = event.getContent();
21704
+ const eventType = content.xdm?.eventType;
21705
+
21706
+ if (IGNORED_EVENT_TYPES.has(eventType)) {
21707
+ return;
21708
+ }
21709
+
21710
+ // Allow customers to explicitly set the referrer (for SPA view changes)
21711
+ // Otherwise, use document.referrer
21712
+ // eslint-disable-next-line no-underscore-dangle
21713
+ const explicitReferrer = content.data?.__adobe?.analytics?.referrer;
21714
+ const currentReferrer =
21715
+ explicitReferrer !== undefined
21716
+ ? explicitReferrer
21717
+ : window.document.referrer;
21718
+
21719
+ if (currentReferrer === lastReferrerSent) {
21720
+ event.mergeData({
21721
+ __adobe: {
21722
+ analytics: {
21723
+ referrer: "",
21724
+ },
21725
+ },
21726
+ });
21727
+ return;
21728
+ }
21729
+
21730
+ event.mergeData({
21731
+ __adobe: {
21732
+ analytics: {
21733
+ referrer: currentReferrer,
21734
+ },
21735
+ },
21736
+ });
21737
+
21738
+ lastReferrerSent = currentReferrer;
21739
+ };
21740
+ };
21741
+
21534
21742
  /*
21535
21743
  Copyright 2019 Adobe. All rights reserved.
21536
21744
  This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -21548,6 +21756,9 @@
21548
21756
  const device = injectDevice(window);
21549
21757
  const environment = injectEnvironment(window);
21550
21758
  const placeContext = injectPlaceContext(() => new Date());
21759
+ const timestamp = injectTimestamp(() => new Date());
21760
+ const highEntropyUserAgentHints = injectHighEntropyUserAgentHints(navigator);
21761
+ const oneTimeAnalyticsReferrer = injectOneTimeAnalyticsReferrer(window);
21551
21762
 
21552
21763
  const defaultEnabledContexts = {
21553
21764
  web,
@@ -21555,10 +21766,59 @@
21555
21766
  environment,
21556
21767
  placeContext,
21557
21768
  };
21558
- boundObjectOf({
21769
+ const defaultDisabledContexts = {
21770
+ highEntropyUserAgentHints,
21771
+ oneTimeAnalyticsReferrer,
21772
+ };
21773
+ const optionalContexts = {
21774
+ ...defaultEnabledContexts,
21775
+ ...defaultDisabledContexts,
21776
+ };
21777
+ const requiredContexts = [timestamp, implementationDetails];
21778
+
21779
+ const createContext = ({ config, logger }) => {
21780
+ return createComponent(config, logger, optionalContexts, requiredContexts);
21781
+ };
21782
+ createContext.namespace = "Context";
21783
+ createContext.configValidators = boundObjectOf({
21559
21784
  context: boundArrayOf(boundString()).default(Object.keys(defaultEnabledContexts)),
21560
21785
  });
21561
21786
 
21787
+ /*
21788
+ Copyright 2026 Adobe. All rights reserved.
21789
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
21790
+ you may not use this file except in compliance with the License. You may obtain a copy
21791
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
21792
+
21793
+ Unless required by applicable law or agreed to in writing, software distributed under
21794
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
21795
+ OF ANY KIND, either express or implied. See the License for the specific language
21796
+ governing permissions and limitations under the License.
21797
+ */
21798
+
21799
+ var allRequiredComponents = /*#__PURE__*/Object.freeze({
21800
+ __proto__: null,
21801
+ context: createContext
21802
+ });
21803
+
21804
+ /*
21805
+ Copyright 2025 Adobe. All rights reserved.
21806
+ This file is licensed to you under the Apache License, Version 2.0 (the "License");
21807
+ you may not use this file except in compliance with the License. You may obtain a copy
21808
+ of the License at http://www.apache.org/licenses/LICENSE-2.0
21809
+
21810
+ Unless required by applicable law or agreed to in writing, software distributed under
21811
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
21812
+ OF ANY KIND, either express or implied. See the License for the specific language
21813
+ governing permissions and limitations under the License.
21814
+ */
21815
+
21816
+ const createCustomInstance = ({ components = [], ...options } = {}) =>
21817
+ createCustomInstance$1({
21818
+ ...options,
21819
+ components: [...Object.values(allRequiredComponents), ...components],
21820
+ });
21821
+
21562
21822
  /*
21563
21823
  Copyright 2025 Adobe. All rights reserved.
21564
21824
  This file is licensed to you under the Apache License, Version 2.0 (the "License");