@adobe/alloy 2.34.1 → 2.34.2-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.
Files changed (47) hide show
  1. package/dist/alloy.js +329 -436
  2. package/dist/alloy.min.js +2 -2
  3. package/dist/types/browser/src/components/Advertising/index.d.ts +2 -1
  4. package/dist/types/browser/src/components/Advertising/utils/advertisingCookieManager.d.ts +2 -1
  5. package/dist/types/browser/src/components/PushNotifications/index.d.ts +4 -4
  6. package/dist/types/browser/src/index.d.ts +2 -1
  7. package/dist/types/browser/src/services/createBrowserGlobalsService.d.ts +0 -1
  8. package/dist/types/browser/src/services/createBrowserNetworkService.d.ts +1 -1
  9. package/dist/types/browser/src/services/createBrowserPlatformServices.d.ts +1 -4
  10. package/dist/types/core/src/components/Audiences/index.d.ts +2 -1
  11. package/dist/types/core/src/components/BrandConcierge/createSendConversationEvent.d.ts +2 -1
  12. package/dist/types/core/src/components/BrandConcierge/index.d.ts +2 -1
  13. package/dist/types/core/src/components/BrandConcierge/utils.d.ts +1 -1
  14. package/dist/types/core/src/components/Consent/createConsentHashStore.d.ts +2 -2
  15. package/dist/types/core/src/components/Consent/index.d.ts +2 -2
  16. package/dist/types/core/src/components/Identity/index.d.ts +2 -1
  17. package/dist/types/core/src/components/RulesEngine/createContextProvider.d.ts +2 -2
  18. package/dist/types/core/src/components/RulesEngine/index.d.ts +2 -2
  19. package/dist/types/core/src/components/RulesEngine/utils/storage.d.ts +1 -1
  20. package/dist/types/core/src/core/createLogController.d.ts +4 -4
  21. package/dist/types/core/src/core/index.d.ts +1 -3
  22. package/dist/types/core/src/index.d.ts +1 -4
  23. package/dist/types/core/src/services/types.d.ts +23 -3
  24. package/dist/types/core/src/utils/index.d.ts +2 -3
  25. package/dist/types/core/src/utils/injectDoesIdentityCookieExist.d.ts +2 -1
  26. package/dist/types/core/src/utils/request/createGetAssuranceValidationTokenParams.d.ts +2 -2
  27. package/package.json +3 -2
  28. package/src/components/Advertising/index.js +2 -0
  29. package/src/components/Advertising/utils/advertisingCookieManager.js +2 -2
  30. package/src/components/PushNotifications/index.js +4 -4
  31. package/src/components/PushNotifications/request/makeSendPushSubscriptionRequest.js +2 -1
  32. package/src/index.js +6 -1
  33. package/src/services/createBrowserCookieService.js +3 -2
  34. package/src/services/createBrowserGlobalsService.js +14 -0
  35. package/src/services/createBrowserNetworkService.js +3 -4
  36. package/src/services/createBrowserPlatformServices.js +2 -3
  37. package/src/services/injectSendBeaconRequest.js +32 -0
  38. package/src/services/injectSendFetchRequest.js +37 -0
  39. package/dist/types/core/src/components/Identity/visitorService/awaitVisitorOptIn.d.ts +0 -4
  40. package/dist/types/core/src/components/Identity/visitorService/getVisitor.d.ts +0 -2
  41. package/dist/types/core/src/components/Identity/visitorService/injectGetEcidFromVisitor.d.ts +0 -6
  42. package/dist/types/core/src/core/getMonitors.d.ts +0 -3
  43. package/dist/types/core/src/utils/cookieJar.d.ts +0 -7
  44. /package/dist/types/{core/src/core/network/requestMethods → browser/src/services}/injectSendBeaconRequest.d.ts +0 -0
  45. /package/dist/types/{core/src/core/network/requestMethods → browser/src/services}/injectSendFetchRequest.d.ts +0 -0
  46. /package/dist/types/core/src/utils/{fireImage.d.ts → dom/fireImage.d.ts} +0 -0
  47. /package/dist/types/core/src/utils/{injectFireReferrerHideableImage.d.ts → dom/injectFireReferrerHideableImage.d.ts} +0 -0
package/dist/alloy.js CHANGED
@@ -135,155 +135,6 @@
135
135
  return base64;
136
136
  };
137
137
 
138
- /*! js-cookie v3.0.7 | MIT */
139
- function assign (target) {
140
- for (var i = 1; i < arguments.length; i++) {
141
- var source = arguments[i];
142
- for (var key in source) {
143
- if (key === '__proto__') continue
144
- target[key] = source[key];
145
- }
146
- }
147
- return target
148
- }
149
-
150
- var defaultConverter = {
151
- read: function (value) {
152
- if (value[0] === '"') {
153
- value = value.slice(1, -1);
154
- }
155
- return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
156
- },
157
- write: function (value) {
158
- return encodeURIComponent(value).replace(
159
- /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
160
- decodeURIComponent
161
- )
162
- }
163
- };
164
-
165
- function init(converter, defaultAttributes) {
166
- function set(name, value, attributes) {
167
- if (typeof document === 'undefined') {
168
- return
169
- }
170
-
171
- attributes = assign({}, defaultAttributes, attributes);
172
-
173
- if (typeof attributes.expires === 'number') {
174
- attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
175
- }
176
- if (attributes.expires) {
177
- attributes.expires = attributes.expires.toUTCString();
178
- }
179
-
180
- name = encodeURIComponent(name)
181
- .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
182
- .replace(/[()]/g, escape);
183
-
184
- var stringifiedAttributes = '';
185
- for (var attributeName in attributes) {
186
- if (!attributes[attributeName]) {
187
- continue
188
- }
189
-
190
- stringifiedAttributes += '; ' + attributeName;
191
-
192
- if (attributes[attributeName] === true) {
193
- continue
194
- }
195
-
196
- // Considers RFC 6265 section 5.2:
197
- // ...
198
- // 3. If the remaining unparsed-attributes contains a %x3B (";")
199
- // character:
200
- // Consume the characters of the unparsed-attributes up to,
201
- // not including, the first %x3B (";") character.
202
- // ...
203
- stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
204
- }
205
-
206
- return (document.cookie =
207
- name + '=' + converter.write(value, name) + stringifiedAttributes)
208
- }
209
-
210
- function get(name) {
211
- if (typeof document === 'undefined' || (arguments.length && !name)) {
212
- return
213
- }
214
-
215
- // To prevent the for loop in the first place assign an empty array
216
- // in case there are no cookies at all.
217
- var cookies = document.cookie ? document.cookie.split('; ') : [];
218
- var jar = {};
219
- for (var i = 0; i < cookies.length; i++) {
220
- var parts = cookies[i].split('=');
221
- var value = parts.slice(1).join('=');
222
-
223
- try {
224
- var found = decodeURIComponent(parts[0]);
225
- if (!(found in jar)) jar[found] = converter.read(value, found);
226
- if (name === found) {
227
- break
228
- }
229
- } catch {
230
- // Do nothing...
231
- }
232
- }
233
-
234
- return name ? jar[name] : jar
235
- }
236
-
237
- return Object.create(
238
- {
239
- set,
240
- get,
241
- remove: function (name, attributes) {
242
- set(
243
- name,
244
- '',
245
- assign({}, attributes, {
246
- expires: -1
247
- })
248
- );
249
- },
250
- withAttributes: function (attributes) {
251
- return init(this.converter, assign({}, this.attributes, attributes))
252
- },
253
- withConverter: function (converter) {
254
- return init(assign({}, this.converter, converter), this.attributes)
255
- }
256
- },
257
- {
258
- attributes: { value: Object.freeze(defaultAttributes) },
259
- converter: { value: Object.freeze(converter) }
260
- }
261
- )
262
- }
263
-
264
- var api = init(defaultConverter, { path: '/' });
265
-
266
- /*
267
- Copyright 2019 Adobe. All rights reserved.
268
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
269
- you may not use this file except in compliance with the License. You may obtain a copy
270
- of the License at http://www.apache.org/licenses/LICENSE-2.0
271
-
272
- Unless required by applicable law or agreed to in writing, software distributed under
273
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
274
- OF ANY KIND, either express or implied. See the License for the specific language
275
- governing permissions and limitations under the License.
276
- */
277
-
278
-
279
-
280
- var cookieJar = {
281
- get: api.get.bind(api),
282
- set: api.set.bind(api),
283
- remove: api.remove.bind(api),
284
- withConverter: api.withConverter.bind(api)
285
- };
286
-
287
138
  /*
288
139
  Copyright 2019 Adobe. All rights reserved.
289
140
  This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -1558,7 +1409,7 @@
1558
1409
  */
1559
1410
 
1560
1411
 
1561
- var injectDoesIdentityCookieExist = ({ orgId }) => {
1412
+ var injectDoesIdentityCookieExist = ({ orgId, cookieJar }) => {
1562
1413
  const identityCookieName = getNamespacedCookieName(orgId, IDENTITY);
1563
1414
  /**
1564
1415
  * Returns whether the identity cookie exists.
@@ -3403,23 +3254,6 @@
3403
3254
 
3404
3255
  var validateConfigOverride = boundObjectOf({});
3405
3256
 
3406
- /*
3407
- Copyright 2022 Adobe. All rights reserved.
3408
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
3409
- you may not use this file except in compliance with the License. You may obtain a copy
3410
- of the License at http://www.apache.org/licenses/LICENSE-2.0
3411
-
3412
- Unless required by applicable law or agreed to in writing, software distributed under
3413
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
3414
- OF ANY KIND, either express or implied. See the License for the specific language
3415
- governing permissions and limitations under the License.
3416
- */
3417
-
3418
- var createGetPageLocation$1 = ({ window }) =>
3419
- () => {
3420
- return window.location;
3421
- };
3422
-
3423
3257
  /*
3424
3258
  Copyright 2019 Adobe. All rights reserved.
3425
3259
  This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -3436,25 +3270,34 @@
3436
3270
  console,
3437
3271
  createLogger,
3438
3272
  instanceName,
3439
- createNamespacedStorage,
3440
3273
  getMonitors,
3274
+ storage,
3441
3275
  }) => {
3442
- const storage = createNamespacedStorage(`instance.${instanceName}.`);
3443
-
3444
- const debugSessionValue = storage.session.getItem("debug");
3445
- let debugEnabled = debugSessionValue === "true";
3446
- let debugEnabledWritableFromConfig = debugSessionValue === null;
3276
+ let debugEnabled = false;
3277
+ let debugSetByUser = false;
3278
+
3279
+ // Restore debug state from the previous page load in this tab.
3280
+ storage
3281
+ .getItem("debug")
3282
+ .then((stored) => {
3283
+ if (stored !== null && !debugSetByUser) {
3284
+ debugEnabled = stored === "true";
3285
+ debugSetByUser = true;
3286
+ }
3287
+ })
3288
+ .catch(() => {});
3447
3289
 
3448
3290
  const getDebugEnabled = () => debugEnabled;
3449
- const setDebugEnabled = (value, { fromConfig }) => {
3450
- if (!fromConfig || debugEnabledWritableFromConfig) {
3291
+ const setDebugEnabled = (value, { fromConfig = false } = {}) => {
3292
+ if (!fromConfig || !debugSetByUser) {
3451
3293
  debugEnabled = value;
3452
3294
  }
3453
-
3454
3295
  if (!fromConfig) {
3455
- // Web storage only allows strings, so we explicitly convert to string.
3456
- storage.session.setItem("debug", value.toString());
3457
- debugEnabledWritableFromConfig = false;
3296
+ debugSetByUser = true;
3297
+ const result = storage.setItem("debug", String(value));
3298
+ if (result && typeof result.then === "function") {
3299
+ result.catch(() => {});
3300
+ }
3458
3301
  }
3459
3302
  };
3460
3303
 
@@ -5607,20 +5450,28 @@
5607
5450
 
5608
5451
 
5609
5452
  const ASSURANCE_VALIDATION_SESSION_URL_PARAM = "adb_validation_sessionid";
5610
- const ASSURANCE_VALIDATION_NAMESPACE = "validation.";
5611
- const CLIENT_ID = "clientId";
5612
-
5613
- const getOrCreateAssuranceClientId = (storage) => {
5614
- let clientId = storage.persistent.getItem(CLIENT_ID);
5615
- if (!clientId) {
5616
- clientId = v4();
5617
- storage.persistent.setItem(CLIENT_ID, clientId);
5618
- }
5619
- return clientId;
5620
- };
5453
+ const CLIENT_ID_KEY = "clientId";
5454
+
5455
+ var createGetAssuranceValidationTokenParams = ({ getLocationSearch, storage }) => {
5456
+ // Start with a fresh UUID as an immediate fallback, then overwrite with the
5457
+ // persisted value once the async read resolves. Requests fired before the
5458
+ // read settles carry the fallback UUID; all subsequent requests (and all
5459
+ // requests on future page loads) use the stable persisted ID.
5460
+ let clientId = v4();
5461
+ storage
5462
+ .getItem(CLIENT_ID_KEY)
5463
+ .then((stored) => {
5464
+ if (stored) {
5465
+ clientId = stored;
5466
+ } else {
5467
+ const result = storage.setItem(CLIENT_ID_KEY, clientId);
5468
+ if (result && typeof result.then === "function") {
5469
+ result.catch(() => {});
5470
+ }
5471
+ }
5472
+ })
5473
+ .catch(() => {});
5621
5474
 
5622
- var createGetAssuranceValidationTokenParams = ({ getLocationSearch, createNamespacedStorage }) => {
5623
- const storage = createNamespacedStorage(ASSURANCE_VALIDATION_NAMESPACE);
5624
5475
  return () => {
5625
5476
  const parsedQuery = queryString.parse(getLocationSearch());
5626
5477
  const validationSessionId =
@@ -5628,7 +5479,6 @@
5628
5479
  if (!validationSessionId) {
5629
5480
  return "";
5630
5481
  }
5631
- const clientId = getOrCreateAssuranceClientId(storage);
5632
5482
  const validationToken = `${validationSessionId}|${clientId}`;
5633
5483
  return `&${queryString.stringify({
5634
5484
  adobeAepValidationToken: validationToken,
@@ -5814,7 +5664,7 @@
5814
5664
  // to the payload since they'll be automatically passed through cookie
5815
5665
  // headers.
5816
5666
  if (!isEndpointFirstParty) {
5817
- const cookies = cookieJar.get();
5667
+ const cookies = cookieJar.getAll();
5818
5668
 
5819
5669
  const entries = Object.keys(cookies)
5820
5670
  .filter(shouldTransferCookie)
@@ -6483,40 +6333,6 @@
6483
6333
  };
6484
6334
  };
6485
6335
 
6486
- /*
6487
- Copyright 2025 Adobe. All rights reserved.
6488
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
6489
- you may not use this file except in compliance with the License. You may obtain a copy
6490
- of the License at http://www.apache.org/licenses/LICENSE-2.0
6491
-
6492
- Unless required by applicable law or agreed to in writing, software distributed under
6493
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
6494
- OF ANY KIND, either express or implied. See the License for the specific language
6495
- governing permissions and limitations under the License.
6496
- */
6497
-
6498
- /* eslint-disable dot-notation */
6499
-
6500
- /** @import { AlloyMonitor } from './types.js' */
6501
-
6502
- /**
6503
- * This factory function creates a getter that combines both provided monitors
6504
- * and any monitors found in the global window.__alloyMonitors array.
6505
- *
6506
- * @param {Array<AlloyMonitor>} [monitors] - Optional array of monitor objects to append to the current one
6507
- * @returns {Function} A function that when called, returns all available monitors
6508
- */
6509
- var getMonitors = (monitors) => {
6510
- /** @type {Array<AlloyMonitor>} */
6511
- let alloyMonitors = window["__alloyMonitors"] || [];
6512
-
6513
- if (monitors) {
6514
- alloyMonitors = alloyMonitors.concat(monitors);
6515
- }
6516
-
6517
- return alloyMonitors;
6518
- };
6519
-
6520
6336
  /*
6521
6337
  Copyright 2020 Adobe. All rights reserved.
6522
6338
  This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -7017,114 +6833,6 @@
7017
6833
  governing permissions and limitations under the License.
7018
6834
  */
7019
6835
 
7020
-
7021
- var awaitVisitorOptIn$1 = ({ logger }) => {
7022
- return new Promise((resolve, reject) => {
7023
- if (isObject(window.adobe) && isObject(window.adobe.optIn)) {
7024
- const optInOld = window.adobe.optIn;
7025
- logger.info(
7026
- "Delaying request while waiting for legacy opt-in to let Visitor retrieve ECID from server.",
7027
- );
7028
- optInOld.fetchPermissions(() => {
7029
- if (optInOld.isApproved([optInOld.Categories.ECID])) {
7030
- logger.info(
7031
- "Received legacy opt-in approval to let Visitor retrieve ECID from server.",
7032
- );
7033
- resolve();
7034
- } else {
7035
- reject(new Error("Legacy opt-in was declined."));
7036
- }
7037
- }, true);
7038
- } else {
7039
- resolve();
7040
- }
7041
- });
7042
- };
7043
-
7044
- /*
7045
- Copyright 2020 Adobe. All rights reserved.
7046
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
7047
- you may not use this file except in compliance with the License. You may obtain a copy
7048
- of the License at http://www.apache.org/licenses/LICENSE-2.0
7049
-
7050
- Unless required by applicable law or agreed to in writing, software distributed under
7051
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
7052
- OF ANY KIND, either express or implied. See the License for the specific language
7053
- governing permissions and limitations under the License.
7054
- */
7055
-
7056
-
7057
- var getVisitor$1 = (window) => {
7058
- const Visitor = window.Visitor;
7059
- return isFunction(Visitor) && isFunction(Visitor.getInstance) && Visitor;
7060
- };
7061
-
7062
- /*
7063
- Copyright 2020 Adobe. All rights reserved.
7064
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
7065
- you may not use this file except in compliance with the License. You may obtain a copy
7066
- of the License at http://www.apache.org/licenses/LICENSE-2.0
7067
-
7068
- Unless required by applicable law or agreed to in writing, software distributed under
7069
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
7070
- OF ANY KIND, either express or implied. See the License for the specific language
7071
- governing permissions and limitations under the License.
7072
- */
7073
-
7074
-
7075
- var injectGetEcidFromVisitor = ({ logger, orgId, awaitVisitorOptIn }) => {
7076
- return () => {
7077
- const Visitor = getVisitor$1(window);
7078
- if (Visitor) {
7079
- // Need to explicitly wait for optIn because visitor will call callback
7080
- // with invalid values prior to optIn being approved
7081
- return awaitVisitorOptIn({ logger })
7082
- .then(() => {
7083
- logger.info(
7084
- "Delaying request while using Visitor to retrieve ECID from server.",
7085
- );
7086
-
7087
- return new Promise((resolve) => {
7088
- const visitor = Visitor.getInstance(orgId, {});
7089
- visitor.getMarketingCloudVisitorID((ecid) => {
7090
- logger.info(
7091
- "Resuming previously delayed request that was waiting for ECID from Visitor.",
7092
- );
7093
- resolve(ecid);
7094
- }, true);
7095
- });
7096
- })
7097
- .catch((error) => {
7098
- // If consent was denied, get the ECID from experience edge. OptIn and AEP Web SDK
7099
- // consent should operate independently, but during id migration AEP Web SDK needs
7100
- // to wait for optIn object consent resolution so that only one ECID is generated.
7101
- if (error) {
7102
- logger.info(
7103
- `${error.message}, retrieving ECID from experience edge`,
7104
- );
7105
- } else {
7106
- logger.info(
7107
- "An error occurred while obtaining the ECID from Visitor.",
7108
- );
7109
- }
7110
- });
7111
- }
7112
- return Promise.resolve();
7113
- };
7114
- };
7115
-
7116
- /*
7117
- Copyright 2020 Adobe. All rights reserved.
7118
- This file is licensed to you under the Apache License, Version 2.0 (the "License");
7119
- you may not use this file except in compliance with the License. You may obtain a copy
7120
- of the License at http://www.apache.org/licenses/LICENSE-2.0
7121
-
7122
- Unless required by applicable law or agreed to in writing, software distributed under
7123
- the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
7124
- OF ANY KIND, either express or implied. See the License for the specific language
7125
- governing permissions and limitations under the License.
7126
- */
7127
-
7128
6836
  var injectHandleResponseForIdSyncs = ({ processIdSyncs }) => {
7129
6837
  return (response) => {
7130
6838
  // no need to wait for response
@@ -7732,6 +7440,7 @@
7732
7440
  apexDomain,
7733
7441
  getBrowser,
7734
7442
  identity,
7443
+ platformServices,
7735
7444
  }) => {
7736
7445
  const {
7737
7446
  orgId,
@@ -7739,20 +7448,24 @@
7739
7448
  edgeConfigOverrides: globalConfigOverrides,
7740
7449
  } = config;
7741
7450
 
7742
- const getEcidFromVisitor = injectGetEcidFromVisitor({
7451
+ const getEcidFromVisitor = () =>
7452
+ platformServices.legacy.getEcidFromVisitor({ orgId, logger });
7453
+
7454
+ const loggingCookieJar = createLoggingCookieJar({
7743
7455
  logger,
7744
- orgId,
7745
- awaitVisitorOptIn: awaitVisitorOptIn$1,
7456
+ cookieJar: platformServices.cookie,
7746
7457
  });
7747
- const loggingCookieJar = createLoggingCookieJar({ logger, cookieJar });
7748
7458
  const legacyIdentity = createLegacyIdentity({
7749
7459
  config,
7750
7460
  getEcidFromVisitor,
7751
7461
  apexDomain,
7752
7462
  cookieJar: loggingCookieJar,
7753
- isPageSsl: window.location.protocol === "https:",
7463
+ isPageSsl: platformServices.globals.isPageSsl(),
7464
+ });
7465
+ const doesIdentityCookieExist = injectDoesIdentityCookieExist({
7466
+ orgId,
7467
+ cookieJar: platformServices.cookie,
7754
7468
  });
7755
- const doesIdentityCookieExist = injectDoesIdentityCookieExist({ orgId });
7756
7469
  const getIdentity = createGetIdentity({
7757
7470
  sendEdgeNetworkRequest,
7758
7471
  createIdentityRequestPayload,
@@ -7772,8 +7485,8 @@
7772
7485
  });
7773
7486
  const addQueryStringIdentityToPayload = injectAddQueryStringIdentityToPayload(
7774
7487
  {
7775
- locationSearch: window.document.location.search,
7776
- locationHash: window.document.location.hash,
7488
+ locationSearch: platformServices.globals.getLocationSearch(),
7489
+ locationHash: platformServices.globals.getLocationHash(),
7777
7490
  dateProvider: () => new Date(),
7778
7491
  orgId,
7779
7492
  logger,
@@ -7839,10 +7552,10 @@
7839
7552
  governing permissions and limitations under the License.
7840
7553
  */
7841
7554
 
7842
- // The 2.34.1 keyword will be replace at alloy build time with the package.json version.
7555
+ // The 2.34.2-beta.1 keyword will be replace at alloy build time with the package.json version.
7843
7556
  // see babel-plugin-version
7844
7557
 
7845
- var libraryVersion = "2.34.1";
7558
+ var libraryVersion = "2.34.2-beta.1";
7846
7559
 
7847
7560
  /*
7848
7561
  Copyright 2019 Adobe. All rights reserved.
@@ -7935,7 +7648,7 @@
7935
7648
  * @param {string} params.instanceName
7936
7649
  * @param {Array<import('./types.js').AlloyMonitor>} [params.monitors]
7937
7650
  * @param {Array<Function>} params.components
7938
- * @param {(deps: { logger: import('./types.js').Logger }) => import('../services/index.js').PlatformServices} params.createPlatformServices
7651
+ * @param {() => import('../services/index.js').PlatformServices} params.createPlatformServices
7939
7652
  */
7940
7653
  const createExecuteCommand = ({
7941
7654
  instanceName,
@@ -7943,22 +7656,21 @@
7943
7656
  components,
7944
7657
  createPlatformServices,
7945
7658
  }) => {
7946
- // `createLogController` and `createGetAssuranceValidationTokenParams` still
7947
- // consume sync storage, so we can't use the async storage capability here
7948
- // yet. Remove once those consumers are migrated.
7949
- const createNamespacedStorage = injectStorage(window);
7659
+ const platformServices = createPlatformServices();
7660
+ const allMonitors = [...platformServices.globals.getMonitors(), ...monitors];
7950
7661
 
7951
7662
  const logController = createLogController({
7952
7663
  console: globalThis.console,
7953
7664
  createLogger,
7954
7665
  instanceName,
7955
- createNamespacedStorage,
7956
- getMonitors: getMonitors.bind(null, monitors),
7666
+ getMonitors: () => allMonitors,
7667
+ storage: platformServices.storage.createNamespacedStorage(
7668
+ `instance.${instanceName}.`,
7669
+ ).session,
7957
7670
  });
7958
7671
 
7959
7672
  const { setDebugEnabled, logger, createComponentLogger } = logController;
7960
-
7961
- const platformServices = createPlatformServices({ logger });
7673
+ const network = platformServices.createNetworkService(logger);
7962
7674
 
7963
7675
  const parsedQueryString = queryString.parse(
7964
7676
  platformServices.globals.getLocationSearch(),
@@ -7971,13 +7683,15 @@
7971
7683
 
7972
7684
  const apexDomain = getApexDomain(
7973
7685
  platformServices.globals.getHostname(),
7974
- cookieJar,
7686
+ platformServices.cookie,
7975
7687
  );
7976
- const fireReferrerHideableImage = injectFireReferrerHideableImage();
7688
+ const { fireReferrerHideableImage } = platformServices.globals;
7977
7689
  const getAssuranceValidationTokenParams =
7978
7690
  createGetAssuranceValidationTokenParams({
7979
7691
  getLocationSearch: () => platformServices.globals.getLocationSearch(),
7980
- createNamespacedStorage,
7692
+ storage: platformServices.storage.createNamespacedStorage(
7693
+ `instance.${instanceName}.validation.`,
7694
+ ).persistent,
7981
7695
  });
7982
7696
  const getBrowser = injectGetBrowser({
7983
7697
  userAgent: platformServices.globals.getUserAgent(),
@@ -7994,7 +7708,10 @@
7994
7708
  setDebugEnabled(options.enabled, { fromConfig: false });
7995
7709
  };
7996
7710
 
7997
- const loggingCookieJar = createLoggingCookieJar({ logger, cookieJar });
7711
+ const loggingCookieJar = createLoggingCookieJar({
7712
+ logger,
7713
+ cookieJar: platformServices.cookie,
7714
+ });
7998
7715
  const configureCommand = (options) => {
7999
7716
  const config = buildAndValidateConfig({
8000
7717
  options,
@@ -8015,10 +7732,11 @@
8015
7732
  apexDomain,
8016
7733
  dateProvider: () => new Date(),
8017
7734
  });
7735
+
8018
7736
  const sendNetworkRequest = injectSendNetworkRequest({
8019
7737
  logger,
8020
- sendFetchRequest: platformServices.network.sendFetchRequest,
8021
- sendBeaconRequest: platformServices.network.sendBeaconRequest,
7738
+ sendFetchRequest: network.sendFetchRequest,
7739
+ sendBeaconRequest: network.sendBeaconRequest,
8022
7740
  isRequestRetryable,
8023
7741
  getRequestRetryDelay,
8024
7742
  });
@@ -8027,7 +7745,10 @@
8027
7745
  });
8028
7746
  const extractEdgeInfo = injectExtractEdgeInfo({ logger });
8029
7747
  const createResponse = injectCreateResponse({ extractEdgeInfo });
8030
- const getLocationHint = injectGetLocationHint({ orgId, cookieJar });
7748
+ const getLocationHint = injectGetLocationHint({
7749
+ orgId,
7750
+ cookieJar: platformServices.cookie,
7751
+ });
8031
7752
  const sendEdgeNetworkRequest = injectSendEdgeNetworkRequest({
8032
7753
  config,
8033
7754
  lifecycle,
@@ -8088,7 +7809,6 @@
8088
7809
  errorPrefix: `[${instanceName}] [${componentName}]`,
8089
7810
  logger: componentLogger,
8090
7811
  }),
8091
- createNamespacedStorage,
8092
7812
  apexDomain,
8093
7813
  getBrowser,
8094
7814
  cookieTransfer,
@@ -8213,9 +7933,13 @@
8213
7933
  */
8214
7934
 
8215
7935
 
8216
- const createAudiences = ({ logger, fireReferrerHideableImage }) => {
8217
- // we override the js-cookie converter to encode the cookie value similar on how it is in DIL (PDCL-10238)
8218
- const cookieJarWithEncoding = cookieJar.withConverter({
7936
+ const createAudiences = ({
7937
+ logger,
7938
+ fireReferrerHideableImage,
7939
+ platformServices,
7940
+ }) => {
7941
+ // Override the js-cookie converter to encode the cookie value similar to DIL (PDCL-10238)
7942
+ const cookieJarWithEncoding = platformServices.cookie.withConverter({
8219
7943
  write: (value) => {
8220
7944
  return encodeURIComponent(value);
8221
7945
  },
@@ -8229,7 +7953,7 @@
8229
7953
  fireReferrerHideableImage,
8230
7954
  logger,
8231
7955
  cookieJar: loggingCookieJar,
8232
- isPageSsl: window.location.protocol === "https:",
7956
+ isPageSsl: platformServices.globals.isPageSsl(),
8233
7957
  });
8234
7958
 
8235
7959
  const processResponse = injectProcessResponse({ processDestinations });
@@ -8307,17 +8031,26 @@
8307
8031
  consent.suspend();
8308
8032
  const consentHashes = consentHashStore.lookup(consentOptions);
8309
8033
  return taskQueue
8310
- .addTask(() => {
8311
- if (consentHashes.isNew()) {
8034
+ .addTask(async () => {
8035
+ if (await consentHashes.isNew()) {
8312
8036
  return sendSetConsentRequest({
8313
8037
  consentOptions,
8314
8038
  identityMap,
8315
8039
  edgeConfigOverrides,
8316
8040
  });
8317
8041
  }
8318
- return Promise.resolve();
8042
+ return undefined;
8319
8043
  })
8320
8044
  .then(() => consentHashes.save())
8045
+ .catch((error) => {
8046
+ if (
8047
+ taskQueue.length === 0 &&
8048
+ storedConsent.read()[GENERAL] === undefined
8049
+ ) {
8050
+ consent.setConsent(defaultConsentByPurpose);
8051
+ }
8052
+ throw error;
8053
+ })
8321
8054
  .finally(readCookieIfQueueEmpty);
8322
8055
  },
8323
8056
  },
@@ -8384,21 +8117,26 @@
8384
8117
  };
8385
8118
 
8386
8119
  return {
8387
- isNew() {
8388
- return consentObjects.some((consentObject) => {
8389
- const key = getKey(consentObject);
8390
- const previousHash = storage.getItem(key);
8391
- return (
8392
- previousHash === null ||
8393
- previousHash !== getCurrentHash(consentObject)
8394
- );
8395
- });
8120
+ async isNew() {
8121
+ const checks = await Promise.all(
8122
+ consentObjects.map(async (consentObject) => {
8123
+ const key = getKey(consentObject);
8124
+ const previousHash = await storage.getItem(key);
8125
+ return (
8126
+ previousHash === null ||
8127
+ previousHash !== getCurrentHash(consentObject)
8128
+ );
8129
+ }),
8130
+ );
8131
+ return checks.some(Boolean);
8396
8132
  },
8397
- save() {
8398
- consentObjects.forEach((consentObject) => {
8399
- const key = getKey(consentObject);
8400
- storage.setItem(key, getCurrentHash(consentObject));
8401
- });
8133
+ async save() {
8134
+ await Promise.all(
8135
+ consentObjects.map((consentObject) => {
8136
+ const key = getKey(consentObject);
8137
+ return storage.setItem(key, getCurrentHash(consentObject));
8138
+ }),
8139
+ );
8402
8140
  },
8403
8141
  };
8404
8142
  },
@@ -8632,13 +8370,13 @@
8632
8370
  config,
8633
8371
  consent,
8634
8372
  sendEdgeNetworkRequest,
8635
- createNamespacedStorage,
8373
+ platformServices,
8636
8374
  }) => {
8637
8375
  const { orgId, defaultConsent } = config;
8638
8376
  const storedConsent = createStoredConsent({
8639
8377
  parseConsentCookie,
8640
8378
  orgId,
8641
- cookieJar,
8379
+ cookieJar: platformServices.cookie,
8642
8380
  });
8643
8381
  const taskQueue = createTaskQueue();
8644
8382
  const sendSetConsentRequest = injectSendSetConsentRequest({
@@ -8647,14 +8385,17 @@
8647
8385
  sendEdgeNetworkRequest,
8648
8386
  edgeConfigOverrides: config.edgeConfigOverrides,
8649
8387
  });
8650
- const storage = createNamespacedStorage(
8388
+ const storage = platformServices.storage.createNamespacedStorage(
8651
8389
  `${sanitizeOrgIdForCookieName(orgId)}.consentHashes.`,
8652
8390
  );
8653
8391
  const consentHashStore = createConsentHashStore({
8654
8392
  storage: storage.persistent,
8655
8393
  });
8656
8394
 
8657
- const doesIdentityCookieExist = injectDoesIdentityCookieExist({ orgId });
8395
+ const doesIdentityCookieExist = injectDoesIdentityCookieExist({
8396
+ orgId,
8397
+ cookieJar: platformServices.cookie,
8398
+ });
8658
8399
 
8659
8400
  return createComponent$4({
8660
8401
  storedConsent,
@@ -11048,9 +10789,10 @@
11048
10789
  */
11049
10790
 
11050
10791
  const createRestoreStorage = (storage, storageKey) => {
11051
- return (defaultValue) => {
10792
+ return async (defaultValue) => {
11052
10793
  try {
11053
- const stored = storage.getItem(storageKey);
10794
+ const stored = await storage.getItem(storageKey);
10795
+ if (stored == null) return [defaultValue, 0];
11054
10796
  const s = JSON.parse(stored);
11055
10797
  return [s, stored.length];
11056
10798
  // eslint-disable-next-line no-empty
@@ -11061,7 +10803,10 @@
11061
10803
  };
11062
10804
 
11063
10805
  const createSaveStorage = (storage, storageKey) => (value) => {
11064
- storage.setItem(storageKey, JSON.stringify(value));
10806
+ const result = storage.setItem(storageKey, JSON.stringify(value));
10807
+ if (result && typeof result.then === "function") {
10808
+ result.catch(() => {});
10809
+ }
11065
10810
  };
11066
10811
 
11067
10812
  const createInMemoryStorage = () => {
@@ -11448,19 +11193,22 @@
11448
11193
  */
11449
11194
  var createEventRegistry = ({ storage, logger }) => {
11450
11195
  let currentStorage = storage;
11451
- let save;
11452
11196
 
11197
+ // Initialized to safe defaults so the registry is usable immediately;
11198
+ // setStorage updates them asynchronously when switching to persistent storage.
11453
11199
  /** @type {EventRegistry} */
11454
- let eventRegistry;
11200
+ let eventRegistry = {};
11455
11201
 
11456
11202
  /** @type {number} */
11457
- let eventRegistrySize;
11203
+ let eventRegistrySize = 0;
11204
+
11205
+ let save = createSaveStorage(storage, EVENT_HISTORY_STORAGE_KEY);
11458
11206
 
11459
11207
  /**
11460
11208
  * Sets a new storage object for the event registry
11461
11209
  * @param {Object} newStorage
11462
11210
  */
11463
- const setStorage = (newStorage) => {
11211
+ const setStorage = async (newStorage) => {
11464
11212
  currentStorage = newStorage;
11465
11213
 
11466
11214
  const restore = createRestoreStorage(
@@ -11468,9 +11216,9 @@
11468
11216
  EVENT_HISTORY_STORAGE_KEY,
11469
11217
  );
11470
11218
 
11471
- save = createSaveStorage(currentStorage, EVENT_HISTORY_STORAGE_KEY);
11219
+ [eventRegistry, eventRegistrySize] = await restore({});
11472
11220
 
11473
- [eventRegistry, eventRegistrySize] = restore({});
11221
+ save = createSaveStorage(currentStorage, EVENT_HISTORY_STORAGE_KEY);
11474
11222
 
11475
11223
  if (eventRegistrySize > EVENT_HISTORY_MAX_LENGTH) {
11476
11224
  const eventPruner = createEventPruner();
@@ -11621,7 +11369,7 @@
11621
11369
  governing permissions and limitations under the License.
11622
11370
  */
11623
11371
 
11624
- var createContextProvider = ({ eventRegistry, window, getBrowser }) => {
11372
+ var createContextProvider = ({ eventRegistry, getWindowContext, getBrowser }) => {
11625
11373
  const pageLoadTimestamp = new Date().getTime();
11626
11374
  const getBrowserContext = () => {
11627
11375
  return {
@@ -11629,17 +11377,19 @@
11629
11377
  };
11630
11378
  };
11631
11379
  const getPageContext = () => {
11380
+ const { title, url } = getWindowContext();
11632
11381
  return {
11633
- title: window.title,
11634
- url: window.url,
11635
- ...parseUrl(window.url),
11382
+ title,
11383
+ url,
11384
+ ...parseUrl(url),
11636
11385
  };
11637
11386
  };
11638
11387
 
11639
11388
  const getReferrerContext = () => {
11389
+ const { referrer } = getWindowContext();
11640
11390
  return {
11641
- url: window.referrer,
11642
- ...parseUrl(window.referrer),
11391
+ url: referrer,
11392
+ ...parseUrl(referrer),
11643
11393
  };
11644
11394
  };
11645
11395
  const getTimeContext = () => {
@@ -11664,11 +11414,8 @@
11664
11414
  };
11665
11415
  };
11666
11416
 
11667
- const getWindowContext = () => {
11668
- const height = window.height;
11669
- const width = window.width;
11670
- const scrollY = window.scrollY;
11671
- const scrollX = window.scrollX;
11417
+ const getViewportContext = () => {
11418
+ const { height, width, scrollY, scrollX } = getWindowContext();
11672
11419
  return {
11673
11420
  height,
11674
11421
  width,
@@ -11687,7 +11434,7 @@
11687
11434
  return {
11688
11435
  ...coreGlobalContext,
11689
11436
  ...getTimeContext(),
11690
- window: getWindowContext(),
11437
+ window: getViewportContext(),
11691
11438
  "~sdkver": libraryVersion,
11692
11439
  };
11693
11440
  };
@@ -12100,10 +11847,10 @@
12100
11847
  const createRulesEngine = ({
12101
11848
  config,
12102
11849
  eventManager,
12103
- createNamespacedStorage,
12104
11850
  consent,
12105
11851
  getBrowser,
12106
11852
  logger,
11853
+ platformServices,
12107
11854
  }) => {
12108
11855
  const { orgId, personalizationStorageEnabled } = config;
12109
11856
  const collect = createCollect({
@@ -12111,7 +11858,7 @@
12111
11858
  mergeDecisionsMeta,
12112
11859
  });
12113
11860
 
12114
- const storage = createNamespacedStorage(
11861
+ const storage = platformServices.storage.createNamespacedStorage(
12115
11862
  `${sanitizeOrgIdForCookieName(orgId)}.decisioning.`,
12116
11863
  );
12117
11864
  if (!personalizationStorageEnabled) {
@@ -12125,7 +11872,7 @@
12125
11872
  const decisionProvider = createDecisionProvider({ eventRegistry });
12126
11873
  const contextProvider = createContextProvider({
12127
11874
  eventRegistry,
12128
- window,
11875
+ getWindowContext: platformServices.globals.getWindowContext,
12129
11876
  getBrowser,
12130
11877
  });
12131
11878
 
@@ -12149,9 +11896,7 @@
12149
11896
  if (personalizationStorageEnabled) {
12150
11897
  consent
12151
11898
  .awaitConsent()
12152
- .then(() => {
12153
- eventRegistry.setStorage(storage.persistent);
12154
- })
11899
+ .then(() => eventRegistry.setStorage(storage.persistent))
12155
11900
  .catch(() => {
12156
11901
  if (storage) {
12157
11902
  clearLocalStorage(storage.persistent);
@@ -12684,9 +12429,8 @@
12684
12429
  governing permissions and limitations under the License.
12685
12430
  */
12686
12431
 
12687
- const getPageSurface = () => {
12688
- const pageLocation = createGetPageLocation$1({ window: window });
12689
- return buildPageSurface(pageLocation);
12432
+ const getPageSurface = (getLocation) => {
12433
+ return buildPageSurface(getLocation);
12690
12434
  };
12691
12435
 
12692
12436
  const getConciergeSessionCookie = ({ loggingCookieJar, config }) => {
@@ -12959,6 +12703,7 @@
12959
12703
  lifecycle,
12960
12704
  consent,
12961
12705
  session,
12706
+ getPageLocation,
12962
12707
  }) => {
12963
12708
  const { edgeDomain, datastreamId, onBeforeEventSend, conversation } = config;
12964
12709
  return (options) => {
@@ -12980,7 +12725,7 @@
12980
12725
 
12981
12726
  const event = eventManager.createEvent();
12982
12727
  if (message || data) {
12983
- const pageSurface = getPageSurface();
12728
+ const pageSurface = getPageSurface(getPageLocation);
12984
12729
  event.mergeQuery({
12985
12730
  conversation: {
12986
12731
  surfaces: [pageSurface],
@@ -13236,8 +12981,8 @@
13236
12981
  lifecycle,
13237
12982
  cookieTransfer,
13238
12983
  createResponse,
12984
+ platformServices,
13239
12985
  }) => {
13240
- const { fetch } = window;
13241
12986
  const session = {
13242
12987
  id: getConciergeSessionCookie({ loggingCookieJar, config }),
13243
12988
  };
@@ -13266,13 +13011,16 @@
13266
13011
  sendConversationServiceRequest,
13267
13012
  decodeKndctrCookie,
13268
13013
  session,
13014
+ getPageLocation: platformServices.globals.getPageLocation,
13269
13015
  });
13270
13016
 
13271
13017
  return {
13272
13018
  lifecycle: {
13273
13019
  onBeforeEvent({ event }) {
13274
13020
  if (config.conversation.collectSources) {
13275
- const parsedParams = queryString.parse(window.location.search);
13021
+ const parsedParams = queryString.parse(
13022
+ platformServices.globals.getLocationSearch(),
13023
+ );
13276
13024
  const source = parsedParams[SOURCES_QUERY_PARAM];
13277
13025
  if (source) {
13278
13026
  event.mergeXdm({ channel: { referringSource: source } });
@@ -14860,7 +14608,7 @@
14860
14608
  */
14861
14609
 
14862
14610
 
14863
- var createCookieManager = ({ orgId, logger }) => {
14611
+ var createCookieManager = ({ orgId, logger, cookieJar }) => {
14864
14612
  const loggingCookieJar = createLoggingCookieJar({ logger, cookieJar });
14865
14613
 
14866
14614
  const getCookieName = (key, useNamespace = true) =>
@@ -16392,11 +16140,13 @@
16392
16140
  sendEdgeNetworkRequest,
16393
16141
  consent,
16394
16142
  getBrowser,
16143
+ platformServices,
16395
16144
  }) => {
16396
16145
  const componentConfig = config.advertising;
16397
16146
  const cookieManager = createCookieManager({
16398
16147
  orgId: config.orgId,
16399
16148
  logger,
16149
+ cookieJar: platformServices.cookie,
16400
16150
  });
16401
16151
 
16402
16152
  // One shared iframe call — both collectSurferId and hashedIpHandler use it
@@ -21115,8 +20865,9 @@
21115
20865
  );
21116
20866
 
21117
20867
  const cacheValue = `${ecid}${serializedPushSubscriptionDetails}`;
20868
+ const storedValue = await storage.getItem(SUBSCRIPTION_DETAILS);
21118
20869
 
21119
- if (cacheValue === storage.getItem(SUBSCRIPTION_DETAILS)) {
20870
+ if (cacheValue === storedValue) {
21120
20871
  logger.info(
21121
20872
  "Subscription details have not changed. Not sending to the server.",
21122
20873
  );
@@ -21170,17 +20921,16 @@
21170
20921
  *
21171
20922
  * @param {Object} options
21172
20923
  * @param {{ orgId: string, datastreamId: string, edgeDomain: string, edgeBasePath: string, pushNotifications: { vapidPublicKey: string, appId: string, trackingDatasetId: string }}} options.config
21173
- * @param {StorageCreator} options.createNamespacedStorage
21174
20924
  * @param {EventManager} options.eventManager
21175
20925
  * @param {Logger} options.logger
21176
20926
  * @param {ConsentManager} options.consent
21177
20927
  * @param {IdentityManager} options.identity
21178
20928
  * @param {function(): string} options.getBrowser
21179
20929
  * @param {EdgeRequestExecutor} options.sendEdgeNetworkRequest
20930
+ * @param {PlatformServices} options.platformServices
21180
20931
  * @returns {{ lifecycle: object, commands: { sendPushSubscription: object } }}
21181
20932
  */
21182
20933
  const createPushNotifications = ({
21183
- createNamespacedStorage,
21184
20934
  eventManager,
21185
20935
  config,
21186
20936
  logger,
@@ -21188,6 +20938,7 @@
21188
20938
  identity,
21189
20939
  getBrowser,
21190
20940
  sendEdgeNetworkRequest,
20941
+ platformServices,
21191
20942
  }) => {
21192
20943
  return {
21193
20944
  lifecycle: {
@@ -21227,7 +20978,7 @@
21227
20978
  },
21228
20979
  } = config || {};
21229
20980
 
21230
- const storage = createNamespacedStorage(
20981
+ const storage = platformServices.storage.createNamespacedStorage(
21231
20982
  `${sanitizeOrgIdForCookieName(orgId)}.pushNotifications.`,
21232
20983
  );
21233
20984
 
@@ -21822,7 +21573,7 @@
21822
21573
 
21823
21574
 
21824
21575
  /**
21825
- * @param {{ logger: import('@adobe/alloy-core/core/types.js').Logger }} dependencies
21576
+ * @param {{ logger: import("@adobe/alloy-core/core/types.js").Logger }} params
21826
21577
  * @returns {NetworkService}
21827
21578
  */
21828
21579
  const createBrowserNetworkService = ({ logger }) => {
@@ -21831,7 +21582,6 @@
21831
21582
  const sendBeaconRequest =
21832
21583
  typeof navigator.sendBeacon === "function"
21833
21584
  ? injectSendBeaconRequest({
21834
- // bind() avoids "illegal invocation" when sendBeacon loses its receiver.
21835
21585
  sendBeacon: navigator.sendBeacon.bind(navigator),
21836
21586
  sendFetchRequest,
21837
21587
  logger,
@@ -21914,6 +21664,134 @@
21914
21664
  },
21915
21665
  });
21916
21666
 
21667
+ /*! js-cookie v3.0.7 | MIT */
21668
+ function assign (target) {
21669
+ for (var i = 1; i < arguments.length; i++) {
21670
+ var source = arguments[i];
21671
+ for (var key in source) {
21672
+ if (key === '__proto__') continue
21673
+ target[key] = source[key];
21674
+ }
21675
+ }
21676
+ return target
21677
+ }
21678
+
21679
+ var defaultConverter = {
21680
+ read: function (value) {
21681
+ if (value[0] === '"') {
21682
+ value = value.slice(1, -1);
21683
+ }
21684
+ return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
21685
+ },
21686
+ write: function (value) {
21687
+ return encodeURIComponent(value).replace(
21688
+ /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
21689
+ decodeURIComponent
21690
+ )
21691
+ }
21692
+ };
21693
+
21694
+ function init(converter, defaultAttributes) {
21695
+ function set(name, value, attributes) {
21696
+ if (typeof document === 'undefined') {
21697
+ return
21698
+ }
21699
+
21700
+ attributes = assign({}, defaultAttributes, attributes);
21701
+
21702
+ if (typeof attributes.expires === 'number') {
21703
+ attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
21704
+ }
21705
+ if (attributes.expires) {
21706
+ attributes.expires = attributes.expires.toUTCString();
21707
+ }
21708
+
21709
+ name = encodeURIComponent(name)
21710
+ .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
21711
+ .replace(/[()]/g, escape);
21712
+
21713
+ var stringifiedAttributes = '';
21714
+ for (var attributeName in attributes) {
21715
+ if (!attributes[attributeName]) {
21716
+ continue
21717
+ }
21718
+
21719
+ stringifiedAttributes += '; ' + attributeName;
21720
+
21721
+ if (attributes[attributeName] === true) {
21722
+ continue
21723
+ }
21724
+
21725
+ // Considers RFC 6265 section 5.2:
21726
+ // ...
21727
+ // 3. If the remaining unparsed-attributes contains a %x3B (";")
21728
+ // character:
21729
+ // Consume the characters of the unparsed-attributes up to,
21730
+ // not including, the first %x3B (";") character.
21731
+ // ...
21732
+ stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
21733
+ }
21734
+
21735
+ return (document.cookie =
21736
+ name + '=' + converter.write(value, name) + stringifiedAttributes)
21737
+ }
21738
+
21739
+ function get(name) {
21740
+ if (typeof document === 'undefined' || (arguments.length && !name)) {
21741
+ return
21742
+ }
21743
+
21744
+ // To prevent the for loop in the first place assign an empty array
21745
+ // in case there are no cookies at all.
21746
+ var cookies = document.cookie ? document.cookie.split('; ') : [];
21747
+ var jar = {};
21748
+ for (var i = 0; i < cookies.length; i++) {
21749
+ var parts = cookies[i].split('=');
21750
+ var value = parts.slice(1).join('=');
21751
+
21752
+ try {
21753
+ var found = decodeURIComponent(parts[0]);
21754
+ if (!(found in jar)) jar[found] = converter.read(value, found);
21755
+ if (name === found) {
21756
+ break
21757
+ }
21758
+ } catch {
21759
+ // Do nothing...
21760
+ }
21761
+ }
21762
+
21763
+ return name ? jar[name] : jar
21764
+ }
21765
+
21766
+ return Object.create(
21767
+ {
21768
+ set,
21769
+ get,
21770
+ remove: function (name, attributes) {
21771
+ set(
21772
+ name,
21773
+ '',
21774
+ assign({}, attributes, {
21775
+ expires: -1
21776
+ })
21777
+ );
21778
+ },
21779
+ withAttributes: function (attributes) {
21780
+ return init(this.converter, assign({}, this.attributes, attributes))
21781
+ },
21782
+ withConverter: function (converter) {
21783
+ return init(assign({}, this.converter, converter), this.attributes)
21784
+ }
21785
+ },
21786
+ {
21787
+ attributes: { value: Object.freeze(defaultAttributes) },
21788
+ converter: { value: Object.freeze(converter) }
21789
+ }
21790
+ )
21791
+ }
21792
+
21793
+ var api = init(defaultConverter, { path: '/' });
21794
+
21917
21795
  /*
21918
21796
  Copyright 2026 Adobe. All rights reserved.
21919
21797
  This file is licensed to you under the Apache License, Version 2.0 (the "License");
@@ -21934,8 +21812,9 @@
21934
21812
  * @param {{ get: Function, set: Function, remove: Function, withConverter: Function }} [jar]
21935
21813
  * @returns {CookieService}
21936
21814
  */
21937
- const createBrowserCookieService = (jar = cookieJar) => ({
21815
+ const createBrowserCookieService = (jar = api) => ({
21938
21816
  get: (name) => jar.get(name),
21817
+ getAll: () => jar.get(),
21939
21818
  set: (name, value, options) => jar.set(name, value, options),
21940
21819
  remove: (name, options) => {
21941
21820
  jar.remove(name, options);
@@ -22068,9 +21947,6 @@
22068
21947
  governing permissions and limitations under the License.
22069
21948
  */
22070
21949
 
22071
- /* eslint-disable dot-notation */
22072
-
22073
- /** @import { GlobalsService } from "@adobe/alloy-core/services" */
22074
21950
 
22075
21951
  /** @returns {GlobalsService} */
22076
21952
  const createBrowserGlobalsService = () => ({
@@ -22081,8 +21957,21 @@
22081
21957
  },
22082
21958
  getMonitors: () => window["__alloyMonitors"] || [],
22083
21959
  getLocationSearch: () => window.location.search,
21960
+ getLocationHash: () => window.location.hash,
22084
21961
  getUserAgent: () => window.navigator.userAgent,
22085
21962
  getHostname: () => window.location.hostname,
21963
+ getPageLocation: () => window.location,
21964
+ isPageSsl: () => window.location.protocol === "https:",
21965
+ fireReferrerHideableImage: injectFireReferrerHideableImage(),
21966
+ getWindowContext: () => ({
21967
+ title: document.title,
21968
+ url: window.location.href,
21969
+ referrer: document.referrer,
21970
+ height: window.innerHeight,
21971
+ width: window.innerWidth,
21972
+ scrollY: window.scrollY,
21973
+ scrollX: window.scrollX,
21974
+ }),
22086
21975
  });
22087
21976
 
22088
21977
  /*
@@ -22099,11 +21988,10 @@
22099
21988
 
22100
21989
 
22101
21990
  /**
22102
- * @param {{ logger: import('@adobe/alloy-core/core/types.js').Logger }} dependencies
22103
21991
  * @returns {PlatformServices}
22104
21992
  */
22105
- const createBrowserPlatformServices = ({ logger }) => ({
22106
- network: createBrowserNetworkService({ logger }),
21993
+ const createBrowserPlatformServices = () => ({
21994
+ createNetworkService: (logger) => createBrowserNetworkService({ logger }),
22107
21995
  storage: createBrowserStorageService(),
22108
21996
  cookie: createBrowserCookieService(),
22109
21997
  runtime: createBrowserRuntimeService(),
@@ -22123,10 +22011,15 @@
22123
22011
  governing permissions and limitations under the License.
22124
22012
  */
22125
22013
 
22126
- const createCustomInstance = ({ components = [], ...options } = {}) =>
22014
+ const createCustomInstance = ({
22015
+ components = [],
22016
+ monitors = [],
22017
+ ...options
22018
+ } = {}) =>
22127
22019
  createCustomInstance$1(
22128
22020
  {
22129
22021
  ...options,
22022
+ monitors,
22130
22023
  components: [...Object.values(allRequiredComponents), ...components],
22131
22024
  },
22132
22025
  createBrowserPlatformServices,