Skip to content
Open
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: 1 addition & 1 deletion SEQUENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ sequenceDiagram

## Notes
- TSJS
- Served first-party at `/static/tsjs-core.min.js` (and `/static/tsjs-ext.min.js` if prebid auto-config is enabled).
- Served first-party at `/static/tsjs=tsjs-unified.min.js?v=<hash>`. The server dynamically concatenates core + enabled integration modules based on config.
- Discovers ad units and renders placeholders; either uses slot-level HTML (`/first-party/ad`) or JSON auction (`/auction`).
- Publisher HTML Rewriting
- Injects TSJS loader and rewrites absolute URLs from origin domain to first-party domain during streaming.
Expand Down
10 changes: 5 additions & 5 deletions crates/common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ Helpers:
- `rewrite_srcset(settings, srcset) -> String` — proxy absolute candidates; preserve descriptors (`1x`, `1.5x`, `100w`)
- `split_srcset_candidates(srcset) -> Vec<&str>` — robust splitting for commas with/without spaces; avoids splitting the first `data:` mediatype comma

Static bundles (served by publisher module):
JS bundles (served by publisher module):

- Unified dynamic endpoint: `/static/tsjs=<filename>`
- `tsjs-core(.min).js` — core library
- `tsjs-ext(.min).js` — Prebid.js shim/extension
- `tsjs-creative(.min).js` — creative click‑guard injected into proxied creatives
- Dynamic endpoint: `/static/tsjs=tsjs-unified.min.js?v=<hash>`
- At build time, each integration is compiled as a separate IIFE (`tsjs-core.js`, `tsjs-prebid.js`, `tsjs-creative.js`, etc.)
- At runtime, the server concatenates `tsjs-core.js` + enabled integration modules based on `IntegrationRegistry` config
- The URL filename is fixed for backward compatibility; the `?v=` hash changes when modules change

Behavior is covered by an extensive test suite in `crates/common/src/creative.rs`.

Expand Down
2 changes: 1 addition & 1 deletion crates/common/src/creative.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ pub fn rewrite_creative_html(settings: &Settings, markup: &str) -> String {
let injected = injected_ts_creative.clone();
move |el| {
if !injected.get() {
let script_tag = tsjs::unified_script_tag();
let script_tag = tsjs::tsjs_script_tag_all();
el.prepend(&script_tag, ContentType::Html);
injected.set(true);
}
Expand Down
5 changes: 3 additions & 2 deletions crates/common/src/html_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,9 @@ pub fn create_html_processor(config: HtmlProcessorConfig) -> impl StreamProcesso
origin_host: &patterns.origin_host,
document_state: &document_state,
};
// First inject the unified TSJS bundle (defines tsjs.setConfig, etc.)
snippet.push_str(&tsjs::unified_script_tag());
// First inject the TSJS bundle (defines tsjs.setConfig, etc.)
let module_ids = integrations.js_module_ids();
snippet.push_str(&tsjs::tsjs_script_tag(&module_ids));
// Then add any integration-specific head inserts (e.g., mode config)
// These run after the bundle so tsjs API is available
for insert in integrations.head_inserts(&ctx) {
Expand Down
Loading