Skip to content

Commit f524d74

Browse files
Merge main into issue-429-image-content-type
2 parents de97533 + cbce8b0 commit f524d74

76 files changed

Lines changed: 16056 additions & 3180 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/integration-tests/Cargo.lock

Lines changed: 5 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/js/lib/src/integrations/didomi/index.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
11
import { log } from '../../core/log';
22

3-
const DEFAULT_SDK_PATH = 'https://sdk.privacy-center.org/';
4-
const CONSENT_PROXY_PATH = '/integrations/didomi/consent/';
3+
const DEFAULT_CONSENT_PROXY_PATH = '/integrations/didomi/consent/';
54

65
type DidomiConfig = {
76
sdkPath?: string;
87
[key: string]: unknown;
98
};
109

11-
type DidomiWindow = Window & { didomiConfig?: DidomiConfig };
10+
type DidomiWindow = Window & {
11+
didomiConfig?: DidomiConfig;
12+
__tsjs_didomi?: { proxyPath?: string };
13+
};
14+
15+
/** Read the server-injected proxy path, falling back to the default. */
16+
function getConsentProxyPath(win: DidomiWindow): string {
17+
return win.__tsjs_didomi?.proxyPath ?? DEFAULT_CONSENT_PROXY_PATH;
18+
}
1219

1320
function buildProxySdkPath(win: DidomiWindow): string {
21+
const proxyPath = getConsentProxyPath(win);
1422
const base = win.location?.origin ?? win.location?.href;
15-
if (!base) return CONSENT_PROXY_PATH;
16-
const url = new URL(CONSENT_PROXY_PATH, base);
23+
if (!base) return proxyPath;
24+
const url = new URL(proxyPath, base);
1725
return `${url.origin}${url.pathname}`;
1826
}
1927

@@ -25,7 +33,7 @@ export function installDidomiSdkProxy(): boolean {
2533
const previousSdkPath =
2634
typeof config.sdkPath === 'string' && config.sdkPath.length > 0
2735
? config.sdkPath
28-
: DEFAULT_SDK_PATH;
36+
: 'https://sdk.privacy-center.org/';
2937

3038
const proxiedSdkPath = buildProxySdkPath(win);
3139
config.sdkPath = proxiedSdkPath;

crates/js/lib/test/integrations/didomi/index.test.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ import { installDidomiSdkProxy } from '../../../src/integrations/didomi';
44

55
const ORIGINAL_WINDOW = global.window;
66

7+
type TestDidomiWindow = Window & {
8+
didomiConfig?: any;
9+
__tsjs_didomi?: { proxyPath?: string };
10+
};
11+
712
function createWindow(url: string) {
813
return {
914
location: new URL(url) as unknown as Location,
10-
} as Window & { didomiConfig?: any };
15+
} as TestDidomiWindow;
1116
}
1217

1318
describe('integrations/didomi', () => {
@@ -41,4 +46,12 @@ describe('integrations/didomi', () => {
4146
'https://example.com/integrations/didomi/consent/'
4247
);
4348
});
49+
50+
it('uses the server-injected custom proxy path', () => {
51+
testWindow.__tsjs_didomi = { proxyPath: '/my-custom-consent/' };
52+
53+
installDidomiSdkProxy();
54+
55+
expect(testWindow.didomiConfig.sdkPath).toBe('https://example.com/my-custom-consent/');
56+
});
4457
});

crates/trusted-server-adapter-fastly/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ workspace = true
99
[dependencies]
1010
async-trait = { workspace = true }
1111
base64 = { workspace = true }
12+
bytes = { workspace = true }
1213
chrono = { workspace = true }
1314
edgezero-adapter-fastly = { workspace = true, features = ["fastly"] }
1415
edgezero-core = { workspace = true }

0 commit comments

Comments
 (0)