Skip to content

Instantly share code, notes, and snippets.

@CanYumusak
Created February 22, 2026 21:15
Show Gist options
  • Select an option

  • Save CanYumusak/497ba341e4b8a682ab621afe1f58354c to your computer and use it in GitHub Desktop.

Select an option

Save CanYumusak/497ba341e4b8a682ab621afe1f58354c to your computer and use it in GitHub Desktop.
TürkONfigurator dealer embed feature for presentation

Dealer ID Embed Feature - TL;DR

Database Breaking Changes (discounts.db)

Add 2 new tables:

CREATE TABLE IF NOT EXISTS dealer (
    dealer_id TEXT PRIMARY KEY,
    name TEXT NOT NULL,
    email_recipient TEXT NULL,
    email_from_name TEXT NULL,
    confirmation_template_path TEXT NULL
);

CREATE TABLE IF NOT EXISTS dealer_origin (
    origin_id INTEGER PRIMARY KEY AUTOINCREMENT,
    dealer_id TEXT NOT NULL,
    origin TEXT NOT NULL,
    FOREIGN KEY (dealer_id) REFERENCES dealer(dealer_id)
);

Existing table (no changes): dealer_discounts(serial_no, series_id, discount)

Migration file: queries/dealer/01-add-dealer.sql ✓ (already exists)

How Dealers Embed

Add query params to the iframe URL:

<iframe src="https://your-tuerkonfigurator.com?embed=true&dealer_id=123"></iframe>

What It Does

  1. Dealer identification - Reads dealer_id from URL param → sends X-Dealer-Id header on all API calls
  2. Dealer-specific discounts - Uses existing dealer_discounts table with serial_no
  3. Customizable sender (email_from_name) ← Absender
  4. Custom email recipient - Order offers go to dealer's email_recipient
  5. Custom confirmation template - Per-dealer template path
  6. CORS/origin allowlist - From dealer_origin table for security
  7. Model filtering - Per dealer (future use)

Key Files

  • Backend: DealerContext.kt, DealerRepository.kt, OrderRouting.kt
  • Frontend: web/b2c/src/App.tsx (reads dealer_id, sets axios header)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment