@upstep/react-native 0.6.10 → 0.6.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-type-check.log +4 -0
- package/LICENSE +21 -0
- package/README.md +74 -0
- package/package.json +9 -2
- package/src/FeedbackSheet.tsx +4 -51
- package/src/api.ts +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Upstep
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# @upstep/react-native
|
|
2
|
+
|
|
3
|
+
The [Upstep](https://upstep.dev) feedback SDK for React Native: a launcher button and a bottom sheet with a voting board and submit form, backed by the same project as your web app.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @upstep/react-native react-native-safe-area-context
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
`react-native-safe-area-context` is a required peer dependency (the sheet needs it for safe-area insets). Get an API key by creating a free project at [upstep.dev](https://upstep.dev).
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import { FeedbackProvider, FeedbackButton, FeedbackSheet } from "@upstep/react-native";
|
|
17
|
+
|
|
18
|
+
export default function App() {
|
|
19
|
+
return (
|
|
20
|
+
<FeedbackProvider apiKey="upstep_xxx">
|
|
21
|
+
{/* your app */}
|
|
22
|
+
<FeedbackButton />
|
|
23
|
+
<FeedbackSheet />
|
|
24
|
+
</FeedbackProvider>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Same idea as the web widget: a floating button opens a sheet with a voting board and a submit form. It reports to the same project and the same board as your web app, so mobile and web feedback end up in one place, sorted by votes.
|
|
30
|
+
|
|
31
|
+
## Shake to submit feedback
|
|
32
|
+
|
|
33
|
+
Optional, and only active if [`expo-sensors`](https://www.npmjs.com/package/expo-sensors) is installed:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install expo-sensors
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { useShakeToFeedback } from "@upstep/react-native";
|
|
41
|
+
|
|
42
|
+
function App() {
|
|
43
|
+
useShakeToFeedback(); // opens the sheet when the device is shaken
|
|
44
|
+
// ...
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
If `expo-sensors` isn't installed, the hook is a no-op — safe to call unconditionally.
|
|
49
|
+
|
|
50
|
+
## Configuration
|
|
51
|
+
|
|
52
|
+
`FeedbackProvider` takes the same options as the web SDK:
|
|
53
|
+
|
|
54
|
+
| Option | Type | Default | Description |
|
|
55
|
+
| --- | --- | --- | --- |
|
|
56
|
+
| `apiKey` | `string` | — | **Required.** Your project's API key. |
|
|
57
|
+
| `userId` | `string` | — | End-user id from your app, used to deduplicate votes per user. Call `identify(userId)` if it's only known after login. |
|
|
58
|
+
| `baseUrl` | `string` | `https://upstep.dev` | Only needed for self-hosted or staging setups. |
|
|
59
|
+
| `accentColor` | `string` | `#D97757` | Any CSS color, used for the launcher button and highlights. |
|
|
60
|
+
| `theme` | `"light" \| "dark" \| "auto"` | `"auto"` | `"auto"` follows the device color scheme. |
|
|
61
|
+
|
|
62
|
+
## API
|
|
63
|
+
|
|
64
|
+
- `<FeedbackProvider apiKey="..." />` — wraps your app, all config options above are valid props.
|
|
65
|
+
- `<FeedbackButton position? label? icon? />` — floating launcher, `position` is `"bottom-right"` (default) or `"bottom-left"`.
|
|
66
|
+
- `<FeedbackSheet />` — the modal sheet with the board and submit form. Mount once, anywhere inside the provider.
|
|
67
|
+
- `useShakeToFeedback()` — opens the sheet on a device shake, requires `expo-sensors`.
|
|
68
|
+
- `useUpstep()` — the underlying state and actions (`feedItems`, `submit`, `vote`, `openSheet`, `closeSheet`, `identify`, ...), if you want to build a custom UI instead of `FeedbackSheet`.
|
|
69
|
+
|
|
70
|
+
## Links
|
|
71
|
+
|
|
72
|
+
- [Full documentation](https://upstep.dev/#integrate)
|
|
73
|
+
- [Dashboard / sign up](https://upstep.dev/login)
|
|
74
|
+
- [@upstep/js](https://www.npmjs.com/package/@upstep/js) for web apps
|
package/package.json
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@upstep/react-native",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.12",
|
|
4
4
|
"description": "Upstep feedback SDK for React Native",
|
|
5
|
+
"homepage": "https://upstep.dev",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/TheBugEater/upstep.git",
|
|
9
|
+
"directory": "packages/sdk-react-native"
|
|
10
|
+
},
|
|
11
|
+
"bugs": "https://github.com/TheBugEater/upstep/issues",
|
|
5
12
|
"main": "./src/index.ts",
|
|
6
13
|
"types": "./src/index.ts",
|
|
7
14
|
"exports": {
|
|
@@ -12,7 +19,7 @@
|
|
|
12
19
|
}
|
|
13
20
|
},
|
|
14
21
|
"dependencies": {
|
|
15
|
-
"@upstep/types": "0.5.
|
|
22
|
+
"@upstep/types": "0.5.4"
|
|
16
23
|
},
|
|
17
24
|
"peerDependencies": {
|
|
18
25
|
"react": ">=18",
|
package/src/FeedbackSheet.tsx
CHANGED
|
@@ -66,7 +66,6 @@ export function FeedbackSheet() {
|
|
|
66
66
|
const p = isDark ? DARK : LIGHT;
|
|
67
67
|
|
|
68
68
|
const [nav, setNav] = useState<Nav>({ screen: "list" });
|
|
69
|
-
const [listTab, setListTab] = useState<"open" | "done">("open");
|
|
70
69
|
const insets = useSafeAreaInsets();
|
|
71
70
|
|
|
72
71
|
// Refresh list every time the modal opens
|
|
@@ -136,30 +135,6 @@ export function FeedbackSheet() {
|
|
|
136
135
|
)}
|
|
137
136
|
</View>
|
|
138
137
|
|
|
139
|
-
{/* Open / Completed tabs — only on list screen */}
|
|
140
|
-
{nav.screen === "list" && (
|
|
141
|
-
<View style={[styles.listTabBar, { borderBottomColor: p.border }]}>
|
|
142
|
-
<TouchableOpacity
|
|
143
|
-
onPress={() => setListTab("open")}
|
|
144
|
-
style={[styles.listTabBtn, listTab === "open" && { borderBottomColor: accentColor }]}
|
|
145
|
-
activeOpacity={0.7}
|
|
146
|
-
>
|
|
147
|
-
<Text style={[styles.listTabText, { color: listTab === "open" ? accentColor : p.textFaint }]}>
|
|
148
|
-
Open
|
|
149
|
-
</Text>
|
|
150
|
-
</TouchableOpacity>
|
|
151
|
-
<TouchableOpacity
|
|
152
|
-
onPress={() => setListTab("done")}
|
|
153
|
-
style={[styles.listTabBtn, listTab === "done" && { borderBottomColor: accentColor }]}
|
|
154
|
-
activeOpacity={0.7}
|
|
155
|
-
>
|
|
156
|
-
<Text style={[styles.listTabText, { color: listTab === "done" ? accentColor : p.textFaint }]}>
|
|
157
|
-
Completed
|
|
158
|
-
</Text>
|
|
159
|
-
</TouchableOpacity>
|
|
160
|
-
</View>
|
|
161
|
-
)}
|
|
162
|
-
|
|
163
138
|
{/* Scrollable body */}
|
|
164
139
|
<ScrollView
|
|
165
140
|
style={styles.scroll}
|
|
@@ -171,7 +146,6 @@ export function FeedbackSheet() {
|
|
|
171
146
|
<FeedListBody
|
|
172
147
|
p={p}
|
|
173
148
|
accent={accentColor}
|
|
174
|
-
tab={listTab}
|
|
175
149
|
onSelect={(id) => setNav({ screen: "detail", feedbackId: id })}
|
|
176
150
|
/>
|
|
177
151
|
)}
|
|
@@ -217,15 +191,13 @@ export function FeedbackSheet() {
|
|
|
217
191
|
// ─── FeedListBody ─────────────────────────────────────────────────────────────
|
|
218
192
|
|
|
219
193
|
function FeedListBody({
|
|
220
|
-
p, accent,
|
|
194
|
+
p, accent, onSelect,
|
|
221
195
|
}: {
|
|
222
|
-
p: Palette; accent: string;
|
|
196
|
+
p: Palette; accent: string; onSelect: (id: string) => void;
|
|
223
197
|
}) {
|
|
224
198
|
const { feedItems, feedLoading, vote } = useUpstep();
|
|
225
199
|
|
|
226
|
-
const displayItems =
|
|
227
|
-
? feedItems.filter((f) => f.status === "DONE")
|
|
228
|
-
: feedItems.filter((f) => f.status === "OPEN" || f.status === "IN_PROGRESS" || f.status === "PENDING");
|
|
200
|
+
const displayItems = feedItems.filter((f) => f.status !== "CLOSED");
|
|
229
201
|
|
|
230
202
|
if (feedLoading) {
|
|
231
203
|
return (
|
|
@@ -239,9 +211,7 @@ function FeedListBody({
|
|
|
239
211
|
return (
|
|
240
212
|
<View style={styles.centered}>
|
|
241
213
|
<Text style={[styles.emptyText, { color: p.textFaint }]}>
|
|
242
|
-
|
|
243
|
-
? "No completed items yet."
|
|
244
|
-
: "No open feedback yet. Be the first to add one."}
|
|
214
|
+
No open feedback yet. Be the first to add one.
|
|
245
215
|
</Text>
|
|
246
216
|
</View>
|
|
247
217
|
);
|
|
@@ -640,23 +610,6 @@ const styles = StyleSheet.create({
|
|
|
640
610
|
newBtn: { borderRadius: 20, paddingHorizontal: 14, paddingVertical: 7 },
|
|
641
611
|
newBtnText: { color: "#fff", fontSize: 13, fontWeight: "700" },
|
|
642
612
|
|
|
643
|
-
// List tab bar
|
|
644
|
-
listTabBar: {
|
|
645
|
-
flexDirection: "row",
|
|
646
|
-
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
647
|
-
},
|
|
648
|
-
listTabBtn: {
|
|
649
|
-
flex: 1,
|
|
650
|
-
alignItems: "center",
|
|
651
|
-
paddingVertical: 11,
|
|
652
|
-
borderBottomWidth: 2,
|
|
653
|
-
borderBottomColor: "transparent",
|
|
654
|
-
},
|
|
655
|
-
listTabText: {
|
|
656
|
-
fontSize: 13,
|
|
657
|
-
fontWeight: "600",
|
|
658
|
-
},
|
|
659
|
-
|
|
660
613
|
// Scroll — flex: 1 fills all remaining space after the fixed header
|
|
661
614
|
scroll: { flex: 1 },
|
|
662
615
|
scrollContent: { flexGrow: 1, padding: 16, paddingBottom: 32 },
|
package/src/api.ts
CHANGED
|
@@ -13,7 +13,7 @@ export class UpstepApiClient {
|
|
|
13
13
|
userId: string | undefined;
|
|
14
14
|
|
|
15
15
|
constructor(config: UpstepConfig) {
|
|
16
|
-
this.baseUrl = (config.baseUrl ?? "https://upstep.
|
|
16
|
+
this.baseUrl = (config.baseUrl ?? "https://upstep.dev").replace(/\/$/, "");
|
|
17
17
|
this.apiKey = config.apiKey;
|
|
18
18
|
if (config.userId !== undefined) this.userId = config.userId;
|
|
19
19
|
}
|