Upsells API - Flow Diagram

%%{init: {
  "theme": "base",
  "themeVariables": {
    "fontSize": "18px",
    "background": "transparent",
    "primaryColor": "#ffffff",
    "primaryBorderColor": "#64748b",
    "lineColor": "#64748b",
    "edgeLabelBackground": "#ffffff",
    "actorBkg": "#038851",
    "actorTextColor": "#ffffff",
    "actorBorder": "#026139",
    "actorLineColor": "#94a3b8",
    "signalColor": "#64748b",
    "signalTextColor": "#059669",
    "noteBkgColor": "#e6f4ee",
    "noteTextColor": "#02502f",
    "noteBorderColor": "#038851",
    "activationBkgColor": "#c6ebdc",
    "activationBorderColor": "#026139",
    "sequenceNumberColor": "#ffffff"
  }
}}%%
flowchart TD
    A["Receive basket"] --> B{"Menu published?"}
    B -- "No" --> Z1["Return empty list"]:::warn
    B -- "Yes" --> C["Check menu availability"]
    C --> D["Build eligible product pool"]
    D --> E1["Order history signal"]
    D --> E2["AI menu understanding signal"]
    E1 --> F["Combine signals into ranking"]:::good
    E2 --> F
    F --> G["Merge overrides"]
    G --> H["Final availability check"]
    H --> J(["Return ranked suggestions"]):::good
    classDef warn fill:#FFF3E0,stroke:#F5A623,stroke-width:2px,color:#7A4A00;
    classDef good fill:#E8F5E9,stroke:#2E7D32,stroke-width:2px,color:#1B4332;