Skip to content

Commit 57f652d

Browse files
committed
build out the sample app
1 parent b848e91 commit 57f652d

7 files changed

Lines changed: 136 additions & 23 deletions

File tree

packages/vue-sdk/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ const huddle = useFeature("huddle");
217217
218218
### `useTrack()`
219219
220-
`useTrack()` lets you send custom events to Bucket. Use this whenever a user _uses_ a feature. Create [features](https://docs.bucket.co/introduction/concepts/feature) in Bucket based off of these events to analyze feature usage.
220+
`useTrack()` lets you send custom events to Bucket. Use this whenever a user _uses_ a feature.
221221
222222
```vue
223223
<script setup lang="ts">

packages/vue-sdk/dev/plain/App.vue

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ import { ref } from "vue";
44
import { BucketProvider } from "../../src";
55
66
import MissingKeyMessage from "./components/MissingKeyMessage.vue";
7+
import RequestFeedback from "./components/RequestFeedback.vue";
8+
import Section from "./components/Section.vue";
79
import StartHuddleButton from "./components/StartHuddleButton.vue";
8-
9-
const publishableKey = import.meta.env.VITE_PUBLISHABLE_KEY || "";
10+
import Track from "./components/Track.vue";
1011
1112
const user = ref({ id: "123", name: "John Doe" });
13+
const publishableKey = import.meta.env.VITE_PUBLISHABLE_KEY || "";
1214
</script>
1315

1416
<template>
@@ -23,7 +25,11 @@ const user = ref({ id: "123", name: "John Doe" });
2325
>
2426
<template #loading>......loading......</template>
2527
<StartHuddleButton />
28+
<Track />
29+
<RequestFeedback />
30+
31+
<Section title="Set User ID">
32+
<input v-model="user.id" />
33+
</Section>
2634
</BucketProvider>
27-
<input v-model="user.id" />
28-
<span>{{ user.id }}</span>
2935
</template>

packages/vue-sdk/dev/plain/components/MissingKeyMessage.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,4 @@
2121
</div>
2222
</template>
2323

24-
<script setup lang="ts">
25-
// No additional logic needed for this component
26-
</script>
24+
<script setup lang="ts"></script>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<script setup lang="ts">
2+
import { useRequestFeedback } from "../../../src";
3+
4+
import Section from "./Section.vue";
5+
6+
const requestFeedback = useRequestFeedback();
7+
</script>
8+
9+
<template>
10+
<Section title="Request Feedback">
11+
<div style="display: flex; gap: 10px; flex-wrap: wrap">
12+
<button
13+
@click="
14+
(e) =>
15+
requestFeedback({
16+
featureKey: 'demo-feature',
17+
title: 'How satisfied are you with this feature?',
18+
position: {
19+
type: 'POPOVER',
20+
anchor: e.currentTarget as HTMLElement,
21+
},
22+
})
23+
"
24+
>
25+
Request Feedback (Popover)
26+
</button>
27+
28+
<button
29+
@click="
30+
requestFeedback({
31+
featureKey: 'demo-feature',
32+
title: 'How was your experience?',
33+
position: {
34+
type: 'MODAL',
35+
},
36+
})
37+
"
38+
>
39+
Request Feedback (Modal)
40+
</button>
41+
42+
<button
43+
@click="
44+
requestFeedback({
45+
featureKey: 'demo-feature',
46+
title: 'What do you think about our product?',
47+
position: {
48+
type: 'MODAL',
49+
},
50+
openWithCommentVisible: true,
51+
})
52+
"
53+
>
54+
Request Feedback (Modal with Comment)
55+
</button>
56+
</div>
57+
</Section>
58+
</template>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<script setup lang="ts">
2+
defineProps<{
3+
title: string;
4+
}>();
5+
</script>
6+
<template>
7+
<div
8+
style="
9+
padding: 20px;
10+
margin: 10px;
11+
border: 2px solid;
12+
border-radius: 8px;
13+
14+
font-family: Arial, sans-serif;
15+
"
16+
>
17+
<h3 style="margin: 0 0 10px 0">{{ title }}</h3>
18+
<div style="margin: 10px 0 0 0">
19+
<slot />
20+
</div>
21+
</div>
22+
</template>
Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,36 @@
11
<script setup lang="ts">
22
import { useFeature } from "../../../src";
33
4+
import Section from "./Section.vue";
5+
46
const huddle = useFeature("huddle");
57
</script>
68
<template>
7-
<div>
8-
Huddle: {{ huddle.isEnabled }}
9-
<span v-if="huddle.isLoading">Loading...</span>
10-
<span v-else-if="!huddle.isEnabled">Not enabled</span>
11-
<span v-else>
12-
<button @click="huddle.track()">
13-
{{ huddle.config.payload?.buttonTitle ?? "Start Huddle" }}
14-
</button>
15-
<button
16-
@click="huddle.requestFeedback({ title: 'Do you like huddles?' })"
17-
>
18-
Request Feedback
19-
</button>
20-
</span>
21-
</div>
9+
<Section title="Huddle">
10+
<div style="display: flex; gap: 10px; flex-wrap: wrap">
11+
<div>Huddle enabled: {{ huddle.isEnabled }}</div>
12+
<div v-if="huddle.isLoading">Loading...</div>
13+
<div v-else style="display: flex; gap: 10px; flex-wrap: wrap">
14+
<div>
15+
<button @click="huddle.track()">
16+
{{
17+
huddle.config.payload?.buttonTitle ?? "Start Huddle (track event)"
18+
}}
19+
</button>
20+
</div>
21+
<div>
22+
<button
23+
@click="
24+
(e) =>
25+
huddle.requestFeedback({
26+
title: 'Do you like huddles?',
27+
})
28+
"
29+
>
30+
Trigger survey
31+
</button>
32+
</div>
33+
</div>
34+
</div>
35+
</Section>
2236
</template>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<script setup lang="ts">
2+
import { useTrack } from "../../../src";
3+
4+
import Section from "./Section.vue";
5+
6+
const track = useTrack();
7+
</script>
8+
9+
<template>
10+
<Section title="Custom track event">
11+
<button @click="track('Huddle Started', { huddleType: 'voice' })">
12+
Send custom track event
13+
</button>
14+
</Section>
15+
</template>

0 commit comments

Comments
 (0)