Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/wide-papers-kneel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
1 change: 1 addition & 0 deletions packages/core/src/core/network/injectSendNetworkRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default ({
// not recursive (it doesn't call toJSON() on the event objects).
// Parsing the result of JSON.stringify(), however, gives the
// fully recursive raw data.

const stringifiedPayload = JSON.stringify(payload);
const parsedPayload = JSON.parse(stringifiedPayload);

Expand Down
1 change: 1 addition & 0 deletions packages/core/test/integration/helpers/alloy/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ export default {
edgeDomain: import.meta.env.VITE_EDGE_DOMAIN || "edge.adobedc.net",
edgeBasePath: import.meta.env.VITE_EDGE_BASE_PATH || "ee",
thirdPartyCookiesEnabled: false,
debugEnabled: false,
};
8 changes: 7 additions & 1 deletion packages/core/test/integration/helpers/alloy/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ export default async () => {
alloyScriptTag.setAttribute("async", true);
alloyScriptTag.src = "/dist/alloy.js";

document.body.appendChild(alloyScriptTag);
await new Promise((resolve, reject) => {
alloyScriptTag.onload = () => resolve();
alloyScriptTag.onerror = () =>
reject(new Error("Failed to load /dist/alloy.js"));
document.body.appendChild(alloyScriptTag);
});

return window.alloy;
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"payload": [
{
"sessionId": "test-session-id-12345"
"sessionId": "test-session-id-123456789012345678901234"
}
],
"type": "media-analytics:new-session"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const test = baseTest.extend({
alloy: [
async ({}, use) => {
await setupBaseCode();
const alloy = setupAlloy();
const alloy = await setupAlloy();

// Make alloy available in the test context
await use(alloy);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
/*
Copyright 2025 Adobe. All rights reserved.
This file is licensed to you under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy
of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/

import { http, HttpResponse } from "msw";
import { test, describe, expect } from "../../helpers/testsSetup/extend.js";
import { sendEventHandler } from "../../helpers/mswjs/handlers.js";
Expand Down Expand Up @@ -45,7 +53,7 @@ const cleanupAll = () => {
* matching what the real Edge Network returns.
*/
const setConsentAcceptHandler = http.post(
/https:\/\/edge\.adobedc\.net\/ee\/v1\/privacy\/set-consent/,
/https:\/\/edge\.adobedc\.net\/ee\/(?:[^/]+\/)?v1\/privacy\/set-consent/,
async (req) => {
const url = new URL(req.request.url);
const configId = url.searchParams.get("configId");
Expand Down Expand Up @@ -181,9 +189,7 @@ describe("Advertising - Consent gate", () => {
typeof call.request.body === "string"
? JSON.parse(call.request.body)
: call.request.body;
return (
body?.events?.[0]?.xdm?.eventType === "advertising.enrichment_ct"
);
return body?.events?.[0]?.xdm?.eventType === "advertising.enrichment_ct";
});
expect(conversionCall).toBeTruthy();

Expand Down Expand Up @@ -211,7 +217,7 @@ describe("Advertising - Consent gate", () => {
cleanupAll();

const setConsentDeclineHandler = http.post(
/https:\/\/edge\.adobedc\.net\/ee\/v1\/privacy\/set-consent/,
/https:\/\/edge\.adobedc\.net\/ee\/(?:[^/]+\/)?v1\/privacy\/set-consent/,
async (req) => {
const url = new URL(req.request.url);
const configId = url.searchParams.get("configId");
Expand Down Expand Up @@ -283,9 +289,7 @@ describe("Advertising - Consent gate", () => {
typeof call.request.body === "string"
? JSON.parse(call.request.body)
: call.request.body;
return (
body?.events?.[0]?.xdm?.eventType === "advertising.enrichment_ct"
);
return body?.events?.[0]?.xdm?.eventType === "advertising.enrichment_ct";
});
expect(conversionCall).toBeFalsy();

Expand Down