1.0.5 • Published 12 months ago

@lead82/ticketing-sdk v1.0.5

Weekly downloads
-
License
ISC
Repository
-
Last release
12 months ago

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.

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

1 year ago