npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

retrip-widget

v1.1.4

Published

Embeddable widget for Retrip AI-powered travel quotations

Readme

retrip-widget

Embeddable AI-powered travel quotation widget for Retrip.

npm version License: MIT

What is this?

An embeddable widget component that enables travel agencies to integrate Retrip's AI-powered quotation system directly into their website. Place it anywhere on your page - it renders as an inline component that users can interact with to get travel quotes.

Features

  • 🎨 Shadow DOM Isolation: Styles won't conflict with your website's CSS
  • 🔌 Web Component: Works with any framework (React, Vue, Angular, vanilla HTML)
  • 📱 Fully Responsive: Adapts to mobile screens
  • Built with React: Modern UI with Tailwind CSS styling
  • 💬 AI-Powered: Integrated with Retrip's AI agent system
  • 📎 File Attachments: Support for images and documents
  • Accessible: Proper ARIA attributes for screen readers

Preview

The widget renders as an embedded input component with quote cards displayed below. You control where it appears on your page by placing the <retrip-widget> element in your desired location.

Installation

Via CDN (Easiest)

<!DOCTYPE html>
<html>
  <head>
    <title>My Travel Agency</title>
  </head>
  <body>
    <!-- Your content -->

    <!-- Retrip Widget - place where you want it to appear -->
    <div style="max-width: 600px; margin: 2rem auto; padding: 1rem;">
      <retrip-widget agent-id="my-agent-123"></retrip-widget>
    </div>

    <script src="https://unpkg.com/retrip-widget@latest/dist/widget.umd.js"></script>
  </body>
</html>

Via NPM

npm install retrip-widget
// In your app entry point
import "retrip-widget";

// Now the <retrip-widget> custom element is available

Usage

Basic Example

<div style="max-width: 600px; margin: 2rem auto;">
  <retrip-widget agent-id="my-agent-123"></retrip-widget>
</div>

The widget will render inline at the location where you place the <retrip-widget> element. Wrap it in a container div to control its width and positioning.

React Example

import "retrip-widget";

export default function ContactPage() {
  const agentId = process.env.NEXT_PUBLIC_RETRIP_AGENT_ID;

  return (
    <div className="container mx-auto py-8">
      <h1>Get a Travel Quote</h1>
      <p>Enter your travel preferences below:</p>
      <div className="max-w-2xl mx-auto mt-6">
        <retrip-widget agent-id={agentId} />
      </div>
    </div>
  );
}

Vue Example

<template>
  <div class="max-w-2xl mx-auto p-6">
    <h1>Get a Travel Quote</h1>
    <retrip-widget :agent-id="agentId" />
  </div>
</template>

<script setup>
import "retrip-widget";

const agentId = import.meta.env.VITE_RETRIP_AGENT_ID;
</script>

Angular Example

// app.module.ts
import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";

@NgModule({
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class AppModule {}
<!-- component.html -->
<retrip-widget [attr.agent-id]="agentId"></retrip-widget>

Configuration

Attributes

| Attribute | Type | Required | Default | Description | | ---------- | -------- | -------- | ----------- | ----------------------------------------------------------- | | agent-id | string | Yes | "unknown" | Your Retrip agent identifier. Displayed in the chat header. |

TypeScript Types

declare global {
  namespace JSX {
    interface IntrinsicElements {
      "retrip-widget": {
        "agent-id": string;
      };
    }
  }
}

Placement Tips

The widget renders inline at the location where you place it. For best results:

  • Container Width: Use a container with max-width: 600px or similar
  • Spacing: Add padding/margin around the widget for better UX
  • Visibility: Ensure the parent container is visible (not display: none)
  • Responsive: The widget adapts to its container width

Example with proper container:

<div style="max-width: 600px; margin: 2rem auto; padding: 1rem;">
  <retrip-widget agent-id="my-agent-123"></retrip-widget>
</div>

Widget Behavior

UI Components

The widget consists of:

  1. Input Area:

    • Text input for travel preferences
    • File attachment support
    • Submit button
    • Action buttons (attachments, speech input, search)
  2. Quote Cards:

    • Displayed below the input after submission
    • Shows destination, dates, pricing, and details
    • Multiple quotes displayed in a responsive grid

Interactions

  • Type your travel preferences → Submit
  • Attach files (images, PDFs) → Supported
  • View quote cards → Displayed below input
  • Responsive layout → Adapts to container width

Current Functionality

Note: This is an early version. Current capabilities:

  • ✅ Opens/closes chat interface
  • ✅ Message input and submission
  • ✅ Displays agent ID
  • ⏳ Message history (placeholder UI only)
  • ⏳ AI agent integration (coming soon)
  • ⏳ File attachments (coming soon)
  • ⏳ Live status updates (coming soon)

Messages are currently logged to the browser console. Full AI integration is in development.

Styling

Shadow DOM Isolation

The widget uses Shadow DOM, meaning:

✅ Your site's CSS won't break the widget ✅ The widget's CSS won't affect your site ✅ No class name conflicts

Design

  • Colors: Modern design system with light/dark mode support
  • Font: System fonts (Inter, system-ui)
  • Layout: Responsive, adapts to container width
  • Styling: Fully isolated via Shadow DOM

Browser Support

| Browser | Min Version | Notes | | ------- | ----------- | ------------ | | Chrome | 90+ | Full support | | Firefox | 88+ | Full support | | Safari | 14+ | Full support | | Edge | 90+ | Full support |

Requirements:

  • Custom Elements v1 API
  • Shadow DOM v1 API
  • ES6+ JavaScript

Troubleshooting

Widget doesn't appear

  1. Check browser console for errors
  2. Verify the script loaded: console.log(customElements.get('retrip-widget')
  3. Ensure agent-id attribute is set Widget placement: The widget renders inline where you place it. Make sure:
  • The element is inside a visible container (not display: none)
  • The container has sufficient width (recommended: at least 400px)
  • The widget isn't hidden by CSS (overflow: hidden, z-index, etc.)

Widget appears but is invisible

Check that:

  • The container has dimensions (width/height)
  • No CSS is hiding the widget (opacity: 0, visibility: hidden)
  • Shadow DOM is supported in your browser

Styles look wrong

The widget uses Shadow DOM for isolation. If styles are broken, it's likely an internal issue—please file an issue.

Changelog

See CHANGELOG.md for version history.

Development

This package is part of the Retrip monorepo.

Local Development

# Clone the repository
git clone https://github.com/retrip-ai/retrip.git
cd retrip

# Install dependencies
bun install

# Start development server
cd packages/retrip-widget
bun dev

Open http://localhost:5173 to see the widget in action.

Building

bun run build

Output: dist/widget.umd.js (for CDN) and dist/widget.js (for bundlers)

Contributing

Contributions are welcome! Please see the Retrip Contributing Guide.

License

MIT © Retrip

Support


Made with ❤️ by the Retrip team