Skip to content

Commit feff9ea

Browse files
authored
chore: add readme, fix type (#7)
* fix typo
1 parent b77e1ad commit feff9ea

File tree

6 files changed

+109
-11
lines changed

6 files changed

+109
-11
lines changed

.env.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VITE_TELEMENTRYDECK_APP_ID=telementryDeckAppId
1+
VITE_TELEMETRYDECK_APP_ID=telementryDeckAppId

README.md

+101-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,107 @@
1-
# Vue 3 + TypeScript + Vite
1+
# telemetrydeck-vue
2+
3+
A library for using TelemetryDeck in your React app.
24

35
[![semantic-release: angular](https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release)
46

7+
## Installation
8+
9+
```shell
10+
npm i @peerigon/telemetrydeck-vue --save
11+
```
12+
13+
## Setup
14+
15+
Set up the plugin in your application setup:
16+
17+
```javascript
18+
import TelemetryDeckPlugin from '@peerigon/telemetrydeck-vue';
19+
20+
const app = createApp(App);
21+
app.use(TelemetryDeckPlugin, {
22+
appID: "{your telemetrydeck appID}",
23+
testMode: true, // optional - defaults to false
24+
clientUser: 'Guest' // optional - defaults to 'Guest'
25+
});
26+
27+
app.mount('#app');
28+
```
29+
30+
## Basic Usage
31+
32+
```vue
33+
<script setup lang="ts">
34+
import { useTelemetryDeck } from "@peerigon/telemetrydeck-vue";
35+
const { signal, queue, setClientUser } = useTelemetryDeck();
36+
37+
const changeClientUserClick = () => {
38+
setClientUser('user' + Math.floor(Math.random() * 1000));
39+
};
40+
41+
const buttonSignalClick = () => {
42+
signal('example_signal_event_name', {
43+
custom_data: 'other_data', // any custom data as required
44+
});
45+
};
46+
47+
const buttonQueueClick = () => {
48+
queue('example_queue_event_name', {
49+
custom_data: 'other_data', // any custom data as required
50+
});
51+
};
52+
53+
const buttonSignalClickWithOptions = () => {
54+
signal('example_signal_event_name_with_options', {
55+
custom_data: 'other_data', // any custom data as required
56+
}, {
57+
testMode: true,
58+
clientUser: 'other_user',
59+
appID: 'other_app_id',
60+
}); // telemetryDeck options (optional)
61+
};
62+
63+
const buttonQueueClickWithOptions = () => {
64+
queue('example_queue_event_name_with_options', {
65+
custom_data: 'other_data', // any custom data as required
66+
}, {
67+
testMode: true,
68+
clientUser: 'other_user',
69+
appID: 'other_app_id',
70+
}); // telemetryDeck options (optional)
71+
};
72+
</script>
73+
74+
<template>
75+
<div>
76+
<div>
77+
<button id="btnSignalClick" @click="buttonSignalClick">Log a click with signal</button>
78+
<button id="btnQueueClick" @click="buttonQueueClick">Log a click with queue</button>
79+
<button id="btnSetClient" @click="changeClientUserClick">Change user</button>
80+
</div>
81+
<div>
82+
<button id="btnSignalClickWithOptions" @click="buttonSignalClickWithOptions">Log a click with signal with Options</button>
83+
<button id="btnQueueClickWithOptions" @click="buttonQueueClickWithOptions">Log a click with queue with Options</button>
84+
</div>
85+
</div>
86+
</template>
87+
```
88+
89+
## Contributions
90+
91+
### Local Development
92+
93+
To run the plugin locally for development:
94+
95+
1. Install Node.js v20
96+
2. Run `npm i`
97+
3. create .env file from .env.example and add your test telemetryDeck appID. Create an account here: [telemetrydeck.com](https://telemetrydeck.com/)
98+
3. Run `npm run dev`
99+
4. Navigate to [http://localhost:5173/](http://localhost:5173/) for the test page
5100

101+
### Tests
6102

7-
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
103+
Run the tests with:
8104

9-
Learn more about the recommended Project Setup and IDE Support in the [Vue Docs TypeScript Guide](https://vuejs.org/guide/typescript/overview.html#project-setup).
105+
```shell
106+
npm run test
107+
```

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "telementrydeck-vue",
2+
"name": "@peerigon/telemetrydeck-vue",
33
"private": false,
44
"version": "0.0.0",
55
"type": "module",

src/main.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { createApp } from 'vue'
22
import './style.css'
33
import App from './App.vue'
4-
import TelementryDeckPlugin from './'
4+
import TelemetryDeckPlugin from './'
55

66
const app = createApp(App)
7-
app.use(TelementryDeckPlugin, {
8-
appID: import.meta.env.VITE_TELEMENTRYDECK_APP_ID || 'test-app-id',
7+
app.use(TelemetryDeckPlugin, {
8+
appID: import.meta.env.VITE_TELEMETRYDECK_APP_ID || 'test-app-id',
99
testMode: true,
1010
})
1111

src/vite-env.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/// <reference types="vite/client" />
22

33
interface ImportMetaEnv {
4-
readonly VITE_TELEMENTRYDECK_APP_ID: string;
4+
readonly VITE_TELEMETRYDECK_APP_ID: string;
55
}
66

77
interface ImportMeta {

0 commit comments

Comments
 (0)