Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bugfender/bugfender-capacitor
https://github.com/bugfender/bugfender-capacitor
Last synced: 2 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/bugfender/bugfender-capacitor
- Owner: bugfender
- Created: 2022-05-30T09:19:04.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-19T06:52:06.000Z (about 2 months ago)
- Last Synced: 2024-11-03T08:33:58.738Z (10 days ago)
- Language: TypeScript
- Size: 1.34 MB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
# @bugfender/capacitor
Remote logging, crash reporting and in-app user feedback with [Bugfender](https://bugfender.com) and [Capacitor](https://capacitorjs.com).
This module is a plugin for Capacitor since version 4. You can use `@bugfender/capacitor` in Ionic projects for iOS, Android, web and electron platforms.
## Installation
```bash
npm install @bugfender/capacitor @bugfender/sdk @bugfender/common
npx cap sync
```## Usage
Import Bugfender like this:
```bash
import { Bugfender } from '@bugfender/capacitor';
```**Note:** in an Ionic/Capacitor project, always import `@bugfender/capacitor` instead of `@bugfender/sdk`.
This will enable the native features of the SDK that you wouldn't get otherwise.## API
Please check the following URL for a complete API reference: [https://js.bugfender.com](https://js.bugfender.com).
* [`init(...)`](#init)
* [`forceSendOnce()`](#forcesendonce)
* [`getDeviceURL()`](#getdeviceurl)
* [`getSessionURL()`](#getsessionurl)
* [`getUserFeedback(...)`](#getuserfeedback)
* [`log(...)`](#log)
* [`log(...)`](#log)
* [`warn(...)`](#warn)
* [`warn(...)`](#warn)
* [`error(...)`](#error)
* [`error(...)`](#error)
* [`trace(...)`](#trace)
* [`trace(...)`](#trace)
* [`info(...)`](#info)
* [`info(...)`](#info)
* [`fatal(...)`](#fatal)
* [`fatal(...)`](#fatal)
* [`removeDeviceKey(...)`](#removedevicekey)
* [`sendLog(...)`](#sendlog)
* [`sendIssue(...)`](#sendissue)
* [`sendCrash(...)`](#sendcrash)
* [`sendUserFeedback(...)`](#senduserfeedback)
* [`setDeviceKey(...)`](#setdevicekey)
* [`setForceEnabled(...)`](#setforceenabled)
* [Interfaces](#interfaces)
* [Type Aliases](#type-aliases)
* [Enums](#enums)### init(...)
```typescript
init(options: SDKOptions) => Promise
```| Param | Type |
| ------------- | ------------------------------------------------- |
| **`options`** |SDKOptions
|--------------------
### forceSendOnce()
```typescript
forceSendOnce() => void
```--------------------
### getDeviceURL()
```typescript
getDeviceURL() => Promise
```**Returns:**
Promise<string>
--------------------
### getSessionURL()
```typescript
getSessionURL() => Promise
```**Returns:**
Promise<string>
--------------------
### getUserFeedback(...)
```typescript
getUserFeedback(options?: UserFeedbackOptions | undefined) => Promise
```| Param | Type |
| ------------- | ------------------------------------------------------------------- |
| **`options`** |UserFeedbackOptions
|**Returns:**
Promise<UserFeedbackResult>
--------------------
### log(...)
```typescript
log(obj: unknown, ...objs: unknown[]) => void
```| Param | Type |
| ---------- | ---------------------- |
| **`obj`** |unknown
|
| **`objs`** |unknown[]
|--------------------
### log(...)
```typescript
log(msg: string, ...subst: unknown[]) => void
```| Param | Type |
| ----------- | ---------------------- |
| **`msg`** |string
|
| **`subst`** |unknown[]
|--------------------
### warn(...)
```typescript
warn(obj: unknown, ...objs: unknown[]) => void
```| Param | Type |
| ---------- | ---------------------- |
| **`obj`** |unknown
|
| **`objs`** |unknown[]
|--------------------
### warn(...)
```typescript
warn(msg: string, ...subst: unknown[]) => void
```| Param | Type |
| ----------- | ---------------------- |
| **`msg`** |string
|
| **`subst`** |unknown[]
|--------------------
### error(...)
```typescript
error(obj: unknown, ...objs: unknown[]) => void
```| Param | Type |
| ---------- | ---------------------- |
| **`obj`** |unknown
|
| **`objs`** |unknown[]
|--------------------
### error(...)
```typescript
error(msg: string, ...subst: unknown[]) => void
```| Param | Type |
| ----------- | ---------------------- |
| **`msg`** |string
|
| **`subst`** |unknown[]
|--------------------
### trace(...)
```typescript
trace(obj: unknown, ...objs: unknown[]) => void
```| Param | Type |
| ---------- | ---------------------- |
| **`obj`** |unknown
|
| **`objs`** |unknown[]
|--------------------
### trace(...)
```typescript
trace(msg: string, ...subst: unknown[]) => void
```| Param | Type |
| ----------- | ---------------------- |
| **`msg`** |string
|
| **`subst`** |unknown[]
|--------------------
### info(...)
```typescript
info(obj: unknown, ...objs: unknown[]) => void
```| Param | Type |
| ---------- | ---------------------- |
| **`obj`** |unknown
|
| **`objs`** |unknown[]
|--------------------
### info(...)
```typescript
info(msg: string, ...subst: unknown[]) => void
```| Param | Type |
| ----------- | ---------------------- |
| **`msg`** |string
|
| **`subst`** |unknown[]
|--------------------
### fatal(...)
```typescript
fatal(obj: unknown, ...objs: unknown[]) => void
```| Param | Type |
| ---------- | ---------------------- |
| **`obj`** |unknown
|
| **`objs`** |unknown[]
|--------------------
### fatal(...)
```typescript
fatal(msg: string, ...subst: unknown[]) => void
```| Param | Type |
| ----------- | ---------------------- |
| **`msg`** |string
|
| **`subst`** |unknown[]
|--------------------
### removeDeviceKey(...)
```typescript
removeDeviceKey(key: string) => void
```| Param | Type |
| --------- | ------------------- |
| **`key`** |string
|--------------------
### sendLog(...)
```typescript
sendLog(log: LogEntry) => void
```| Param | Type |
| --------- | --------------------------------------------- |
| **`log`** |LogEntry
|--------------------
### sendIssue(...)
```typescript
sendIssue(title: string, text: string) => Promise
```| Param | Type |
| ----------- | ------------------- |
| **`title`** |string
|
| **`text`** |string
|**Returns:**
Promise<string>
--------------------
### sendCrash(...)
```typescript
sendCrash(title: string, text: string) => Promise
```| Param | Type |
| ----------- | ------------------- |
| **`title`** |string
|
| **`text`** |string
|**Returns:**
Promise<string>
--------------------
### sendUserFeedback(...)
```typescript
sendUserFeedback(title: string, text: string) => Promise
```| Param | Type |
| ----------- | ------------------- |
| **`title`** |string
|
| **`text`** |string
|**Returns:**
Promise<string>
--------------------
### setDeviceKey(...)
```typescript
setDeviceKey(key: string, value: DeviceKeyValue) => void
```| Param | Type |
| ----------- | --------------------------------------------------------- |
| **`key`** |string
|
| **`value`** |DeviceKeyValue
|--------------------
### setForceEnabled(...)
```typescript
setForceEnabled(state: boolean) => void
```| Param | Type |
| ----------- | -------------------- |
| **`state`** |boolean
|--------------------
### Interfaces
#### SDKOptions
| Prop | Type | Description |
| ----------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
| **`appKey`** |string
| The app key to log into |
| **`apiURL`** |string
| Base URL to Bugfender API |
| **`build`** |string
| App build identifier |
| **`baseURL`** |string
| Base URL to Bugfender web dashboard |
| **`debug`** |boolean
| Set SDK in debug mode |
| **`deviceName`** |string
| Device name, this will be shown on the dashboard devices list. Defaults to browser + OS. |
| **`overrideConsoleMethods`** |boolean
| Override default `window.console` so it also logs to Bugfender. Defaults to `true`. |
| **`printToConsole`** |boolean
| Print also with `window.console` when Bugfender logging methods are called. Defaults to `true`. |
| **`logBrowserEvents`** |boolean
| Register a handler for most common browser events to report them to Bugfender. Defaults to `true`. |
| **`logUIEvents`** |boolean
| Register a handler for most common UI events to report them to Bugfender. Defaults to `true`. |
| **`registerErrorHandler`** |boolean
| Register error handler for uncaught errors that reports a crash to Bugfender. Defaults to `true`. |
| **`version`** |string
| App version identifier |
| **`maximumLocalStorageSize`** |number
| Set the maximum size to store local log files in bytes. Range accepted is from 1MB to 50MB. Defaults to 5MB. **iOS & Android only**. |
| **`enableLogcatLogging`** |boolean
| Logs all logs written via Logcat. Defaults to `false`. **Android only**. |#### UserFeedbackResultSuccess
| Prop | Type | Description |
| ----------------- | ------------------- | ------------------------------- |
| **`isSent`** |true
| The user has sent the feedback. |
| **`feedbackURL`** |string
| Bugfender URL for the feedback. |#### UserFeedbackResultCancel
| Prop | Type | Description |
| ------------ | ------------------ | ------------------------------------------------- |
| **`isSent`** |false
| The user has closed the modal without sending it. |#### UserFeedbackOptions
Options object for `Bugfender.getUserFeedback` with customised modal strings.
| Prop | Type | Description |
| ------------------------- | ------------------- | ----------------------------------------------------------- |
| **`title`** |string
| Default: `Feedback`. |
| **`hint`** |string
| Default: `Please insert your feedback here and click send`. |
| **`subjectPlaceholder`** |string
| Default: `Subject…`. |
| **`feedbackPlaceholder`** |string
| Default: `Your feedback…`. |
| **`submitLabel`** |string
| Default: `Send`. |
| **`closeLabel`** |string
| Default: `Close`. **iOS only**. |#### LogEntry
Log Entry object interface
| Prop | Type | Description |
| ------------ | --------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| **`line`** |number
| The line number where the log was triggered from |
| **`level`** |LogLevel
| The log's level based on LogLevel constant |
| **`tag`** |string
| The log's tag |
| **`method`** |string
| The method name where the log was triggered from |
| **`file`** |string
| The file name where the log was triggered from |
| **`text`** |string \| unknown[]
| Text can be either: - `string` with the content - `unknown[]` array compatible with `console.*` signature |
| **`url`** |string
| The log's origin URL. This attribute is ignored on Android & iOS |### Type Aliases
#### UserFeedbackResult
UserFeedbackResultSuccess | UserFeedbackResultCancel
#### DeviceKeyValue
string | number | boolean
### Enums
#### LogLevel
| Members | Value |
| ------------- | -------------- |
| **`Debug`** |0
|
| **`Warning`** |1
|
| **`Error`** |2
|
| **`Trace`** |3
|
| **`Info`** |4
|
| **`Fatal`** |5
|