JSPM

@lead82/ticketing-sdk

1.0.5
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 3
    • Score
      100M100P100Q20834F
    • License ISC

    SDK for reporting bugs and suggesting features

    Package Exports

    • @lead82/ticketing-sdk
    • @lead82/ticketing-sdk/dist/index.esm.js
    • @lead82/ticketing-sdk/dist/index.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@lead82/ticketing-sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Ticketing SDK

    The Ticketing SDK allows you to easily integrate bug reporting and feature request functionality into your applications. With this SDK, your users can submit issues directly to your bug tracking system.

    Installation

    Install the SDK using:

    npm install @lead82/ticketing-sdk
    pnpm install @lead82/ticketing-sdk
    yarn add @lead82/ticketing-sdk
    bun add @lead82/ticketing-sdk

    Quick Start

    1. Import and initialize the SDK:
    import TicketingSDK from '@lead82/ticketing-sdk';
    
    const ticketer = new TicketingSDK('YOUR_CLIENT_ID', 'YOUR_API_KEY', 'YOUR_PROJECT_KEY');
    1. Use the createTicket method to submit a bug report or feature request:
    ticketer.createTicket({
      title: 'Button not working',
      description: 'The submit button on the contact form is not responding when clicked.',
      type: 'bug',
      priority: 'medium',
      userEmail: 'user@example.com',
      url: 'https://api.example.com/database'
    })
    .then(response => console.log('Ticket created:', response))
    .catch(error => console.error('Error creating ticket:', error));

    API Reference

    createTicket(data)

    Reports an issue to the bug tracking system.

    Parameters

    • data (Object):
      • title (string, required): A brief description of the issue
      • description (string): Detailed information about the issue
      • type (string): Either 'bug' or 'feature'
      • priority (string): 'low', 'medium', 'high', or 'critical'
      • userEmail (string): Email of the user reporting the issue
      • url (string): URL where the issue occurred

    Returns

    A Promise that resolves with the created ticket information.

    Usage Examples

    React Component

    import React, { useState } from 'react';
    import { useSession } from 'next-auth/react';
    import TicketingSDK from '@lead82/ticketing-sdk';
    
    const ticketer = new TicketingSDK('YOUR_CLIENT_ID', 'YOUR_API_KEY', 'YOUR_PROJECT_KEY');
    
    function ReportBugForm() {
      const session = useSession()
      const [title, setTitle] = useState('')
      const [description, setDescription] = useState('')
      const handleSubmit = async (e) => {
        e.preventDefault()
        try {
          const response = await ticketer.createTicket({
            title, //'Bug in checkout process'
            description, //'Payment fails when using Visa card'
            type: 'bug', // You could add a "bug or feature" dropdown to your form and make it more general
            priority: 'medium', // either set a default to "low" or "medium" or use NLP to determine priority level
            userEmail: session.user.email,
            url: window.location.href
          });
          console.log(response)
        } catch (error) {
          console.error('Failed to report bug:', error);
        }
      };
    
      return (
            <form onSubmit={handleSubmit}>
                <input name="title" placeholder="Issue title" onChange={e => setTitle(e.target.value)} />
                <input name="description" placeholder="Issue description"  onChange={e => setTitle(e.target.value)} />
                <button type="submit">Report a Bug</button>
            </form>
        );
    }

    Configuration

    To use this SDK, you need to obtain an API key and a project key from your dashboard. Visit [https://ticketing.lead82.io/documentation] to generate these keys.

    Browser Support

    This SDK is compatible with modern browsers and can be used in projects built with frameworks like React, Vue, and Angular.

    Node.js Support

    The SDK can also be used in Node.js environments for server-side applications.

    TypeScript Support

    This package includes TypeScript declarations.

    Contributing

    We welcome contributions to the Bug Reporter SDK! Please see our CONTRIBUTING.md for details on how to submit pull requests, report issues, and suggest improvements.

    License

    This project is licensed under the MIT License - see the LICENSE.md file for details.

    Support

    If you encounter any issues or have questions about using the Bug Reporter SDK, please contact our support team at hello@lead82.io or visit our support page.

    Changelog

    See CHANGELOG.md for details on each release.

    Security

    Please report any security issues to security@lead82.io.