Skip to content

Commit f4e5ef5

Browse files
committed
v3.0.2
1 parent 9ae23dd commit f4e5ef5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+23622
-0
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 Francisco Hodge
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
## BugBattle JavaScript SDK
2+
Achieve better app quality & ratings with comprehensive in-app bug reporting. BugBattle offers affordable In-App Bug Reporting for Apps, WebApps & Websites.
3+
4+
## ❤️ Demo
5+
6+
[https://jssdk.bugbattle.io/demo](https://jssdk.bugbattle.io/demo)
7+
8+
## ⭐️ Features
9+
10+
- Plain and instant setup
11+
- Enhance your apps with bug reporting
12+
- Easy integration
13+
- Datacenter in europe
14+
- Automatic crash detection
15+
- Multiple platforms (iOS, Android, JavaScript)
16+
17+
## 🚀 Getting started
18+
19+
1.) Register an account at [www.bugbattle.io](https://www.bugbattle.io). It's free and takes just a few seconds.
20+
21+
2.) Include the BugBattle JS SDK within your apps.
22+
23+
NPM / YARN:
24+
```
25+
npm install bugbattle --save
26+
```
27+
28+
OR add the following lines to your website's / webapp's head-tag:
29+
```
30+
<link href="https://jssdk.bugbattle.io/latest/index.css" rel="stylesheet">
31+
<script src="https://jssdk.bugbattle.io/latest/index.js"></script>
32+
<script>let BugBattle = window.BugBattle.default;</script>
33+
```
34+
35+
3.) Initialize the SDK
36+
37+
Add the following code to your app / website to initialize the BugBattle JavaScript SDK. Replace "YOUR-SDK-TOKEN-HERE" with your actual sdk token.
38+
39+
```
40+
<script>
41+
BugBattle.initialize("YOUR-SDK-TOKEN-HERE", BugBattle.FEEDBACK_BUTTON);
42+
</script>
43+
```
44+
45+
Congrats, you are now all set! Report your first bug by using the feedback button.
46+
47+
## 🤤 Customization / tracking more data
48+
49+
You can track more data (i.e. the app build number, version code or custom data) by using one of the following functions.
50+
51+
```
52+
// Set's the main color (color schema).
53+
BugBattle.setMainColor("#086EFB");
54+
55+
// Set's the app's build number.
56+
BugBattle.setAppBuildNumber(5);
57+
58+
// Set's the app's version code.
59+
BugBattle.setAppVersionCode("v5.0");
60+
61+
// Attaches custom data to the bug reports.
62+
BugBattle.setCustomData({
63+
test1: "Battle",
64+
data2: "Unicorn"
65+
});
66+
```
67+
68+
## 🤠 Activation methods
69+
70+
Currently you can choose between two activation methods, that initiate the bug reporting workflow.
71+
72+
a.) BugBattle.FEEDBACK_BUTTON - this will add a feedback bottom to the page
73+
b.) BugBattle.NONE - this allows you to manually trigger the bug reporting workflow
74+
75+
If you want to manually trigger the bug reporting workflow, simply call the following method:
76+
77+
```
78+
// Initiates the bug reporting workflow.
79+
BugBattle.startBugReporting();
80+
```
81+
82+
## 🤝 Need help?
83+
84+
We are here to help! hello@bugbattle.io

bin/postinstall

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
console.log('\x1b[36m%s\x1b[0m', `
2+
______________________________________\n`);
3+
4+
console.log('\x1b[33m%s\x1b[0m', `Thank you for installing this package !`);
5+
6+
console.log('\x1b[36m%s\x1b[0m', `
7+
______________________________________
8+
`);

build/index.css

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/index.css.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/index.js

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/index.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/env.js

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
'use strict';
2+
3+
const fs = require('fs');
4+
const path = require('path');
5+
const paths = require('./paths');
6+
7+
// Make sure that including paths.js after env.js will read .env variables.
8+
delete require.cache[require.resolve('./paths')];
9+
10+
const NODE_ENV = process.env.NODE_ENV;
11+
if (!NODE_ENV) {
12+
throw new Error(
13+
'The NODE_ENV environment variable is required but was not specified.'
14+
);
15+
}
16+
17+
// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
18+
var dotenvFiles = [
19+
`${paths.dotenv}.${NODE_ENV}.local`,
20+
`${paths.dotenv}.${NODE_ENV}`,
21+
// Don't include `.env.local` for `test` environment
22+
// since normally you expect tests to produce the same
23+
// results for everyone
24+
NODE_ENV !== 'test' && `${paths.dotenv}.local`,
25+
paths.dotenv,
26+
].filter(Boolean);
27+
28+
// Load environment variables from .env* files. Suppress warnings using silent
29+
// if this file is missing. dotenv will never modify any environment variables
30+
// that have already been set. Variable expansion is supported in .env files.
31+
// https://github.com/motdotla/dotenv
32+
// https://github.com/motdotla/dotenv-expand
33+
dotenvFiles.forEach(dotenvFile => {
34+
if (fs.existsSync(dotenvFile)) {
35+
require('dotenv-expand')(
36+
require('dotenv').config({
37+
path: dotenvFile,
38+
})
39+
);
40+
}
41+
});
42+
43+
// We support resolving modules according to `NODE_PATH`.
44+
// This lets you use absolute paths in imports inside large monorepos:
45+
// https://github.com/facebook/create-react-app/issues/253.
46+
// It works similar to `NODE_PATH` in Node itself:
47+
// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
48+
// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
49+
// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.
50+
// https://github.com/facebook/create-react-app/issues/1023#issuecomment-265344421
51+
// We also resolve them to make sure all tools using them work consistently.
52+
const appDirectory = fs.realpathSync(process.cwd());
53+
process.env.NODE_PATH = (process.env.NODE_PATH || '')
54+
.split(path.delimiter)
55+
.filter(folder => folder && !path.isAbsolute(folder))
56+
.map(folder => path.resolve(appDirectory, folder))
57+
.join(path.delimiter);
58+
59+
// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be
60+
// injected into the application via DefinePlugin in Webpack configuration.
61+
const REACT_APP = /^REACT_APP_/i;
62+
63+
function getClientEnvironment(publicUrl) {
64+
const raw = Object.keys(process.env)
65+
.filter(key => REACT_APP.test(key))
66+
.reduce(
67+
(env, key) => {
68+
env[key] = process.env[key];
69+
return env;
70+
},
71+
{
72+
// Useful for determining whether we’re running in production mode.
73+
// Most importantly, it switches React into the correct mode.
74+
NODE_ENV: process.env.NODE_ENV || 'development',
75+
// Useful for resolving the correct path to static assets in `public`.
76+
// For example, <img src={process.env.PUBLIC_URL + '/img/logo.png'} />.
77+
// This should only be used as an escape hatch. Normally you would put
78+
// images into the `src` and `import` them in code to get their paths.
79+
PUBLIC_URL: publicUrl,
80+
}
81+
);
82+
// Stringify all values so we can feed into Webpack DefinePlugin
83+
const stringified = {
84+
'process.env': Object.keys(raw).reduce((env, key) => {
85+
env[key] = JSON.stringify(raw[key]);
86+
return env;
87+
}, {}),
88+
};
89+
90+
return { raw, stringified };
91+
}
92+
93+
module.exports = getClientEnvironment;

config/getPackageJson.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
/**
5+
* A module to get package informations from package.json
6+
* @module getPackageJson
7+
* @param {...string} keys from package.json if no arguments passed it returns package.json content as object
8+
* @returns {object} with given keys or content of package.json as object
9+
*/
10+
11+
/**
12+
* Returns package info
13+
*/
14+
const getPackageJson = function(...args) {
15+
const packageJSON = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json')));
16+
if (!args.length) {
17+
return packageJSON;
18+
}
19+
return args.reduce((out, key) => {
20+
out[key] = packageJSON[key];
21+
return out;
22+
}, {});
23+
};
24+
25+
module.exports = getPackageJson;

config/jest/cssTransform.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
'use strict';
2+
3+
// This is a custom Jest transformer turning style imports into empty objects.
4+
// http://facebook.github.io/jest/docs/en/webpack.html
5+
6+
module.exports = {
7+
process() {
8+
return 'module.exports = {};';
9+
},
10+
getCacheKey() {
11+
// The output is always the same.
12+
return 'cssTransform';
13+
},
14+
};

0 commit comments

Comments
 (0)