diff --git a/src/core/tools/media_buy_create.py b/src/core/tools/media_buy_create.py index 5e7b70acf..e5a1fd28a 100644 --- a/src/core/tools/media_buy_create.py +++ b/src/core/tools/media_buy_create.py @@ -537,6 +537,9 @@ def execute_approved_media_buy(media_buy_id: str, tenant_id: str) -> tuple[bool, from src.core.database.models import Creative as CreativeModel from src.core.database.models import CreativeAssignment + # Import adapter helper here (used for both creative upload and order approval) + from src.core.helpers.adapter_helpers import get_adapter + # Get all creative assignments for this media buy stmt_assignments = select(CreativeAssignment).filter_by(media_buy_id=media_buy_id) assignments = session.scalars(stmt_assignments).all() @@ -621,9 +624,6 @@ def execute_approved_media_buy(media_buy_id: str, tenant_id: str) -> tuple[bool, assets.append(asset) - # Import adapter helper at this scope level for both creative upload and order approval - from src.core.helpers.adapter_helpers import get_adapter - if assets: logger.info(f"[APPROVAL] Uploading {len(assets)} creatives to adapter") diff --git a/templates/add_product.html b/templates/add_product.html index 432a89516..5cedcc17a 100644 --- a/templates/add_product.html +++ b/templates/add_product.html @@ -537,10 +537,13 @@

Property Authorization (AdCP) *

- -

Targeting Configuration (Optional)

-
- 💡 Tip: Configure custom targeting (key-value pairs) to define who will see ads for this product. + +

+ Custom Targeting (Optional) +

+
+ 💡 Who Sees This: Configure custom targeting (key-value pairs) to define which audience segments will see ads for this product. +
Example: sport=basketball, genre=action, age=18-34
{# Simple targeting selector - matches existing UI patterns #} diff --git a/templates/components/targeting_selector_simple.html b/templates/components/targeting_selector_simple.html index 5f22cfbe3..bb84f4cce 100644 --- a/templates/components/targeting_selector_simple.html +++ b/templates/components/targeting_selector_simple.html @@ -123,7 +123,9 @@

🎯 Custom Targeting

document.addEventListener('DOMContentLoaded', async function() { try { const tenantId = '{{ tenant_id }}'; - const response = await fetch(`/api/tenant/${tenantId}/targeting/all`); + const response = await fetch(`/api/tenant/${tenantId}/targeting/all`, { + credentials: 'same-origin' + }); const data = await response.json(); availableKeys = data.customKeys || []; @@ -169,7 +171,9 @@

🎯 Custom Targeting

try { const tenantId = '{{ tenant_id }}'; - const response = await fetch(`/api/tenant/${tenantId}/targeting/values/${keyId}`); + const response = await fetch(`/api/tenant/${tenantId}/targeting/values/${keyId}`, { + credentials: 'same-origin' + }); const data = await response.json(); availableValues[keyId] = data.values || []; diff --git a/templates/edit_product.html b/templates/edit_product.html index dbee1d747..3bafdb9e2 100644 --- a/templates/edit_product.html +++ b/templates/edit_product.html @@ -120,20 +120,17 @@

Pricing Options (Recommended)<

{% endif %} - -

Targeting Configuration (Optional)

-
- 💡 Tip: Configure custom targeting (key-value pairs) to define who will see ads for this product. + +

+ Custom Targeting (Optional) +

+
+ 💡 Who Sees This: Configure custom targeting (key-value pairs) to define which audience segments will see ads for this product. +
Example: sport=basketball, genre=action, age=18-34
{# Simple targeting selector - matches existing UI patterns #} -
- DEBUG: About to include targeting selector widget -
{% include 'components/targeting_selector_simple.html' %} -
- DEBUG: Finished including targeting selector widget -
diff --git a/templates/targeting_browser.html b/templates/targeting_browser.html index dc31c0d76..d2280408a 100644 --- a/templates/targeting_browser.html +++ b/templates/targeting_browser.html @@ -4,6 +4,11 @@ {% block content %}