@getuserfeedback/react-native 1.0.0

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/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # @getuserfeedback/react-native
2
+
3
+ React Native bindings for getuserfeedback.
4
+
5
+ This package is currently a scaffold for the Expo/React Native WebView integration. It exports the stable package shape and protocol-typed component APIs; WebView orchestration will land in the next implementation slice.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @getuserfeedback/react-native react-native-webview
11
+ ```
12
+
13
+ Requires React, React Native, and `react-native-webview`.
14
+
15
+ ## API
16
+
17
+ - `GetUserFeedbackProvider`
18
+ - `WidgetHost`
19
+ - `useGetUserFeedbackNative`
20
+
21
+ The host message types are re-exported from `@getuserfeedback/protocol/webview-transport` through package-owned aliases so the React Native package stays aligned with the shared WebView transport contract.
@@ -0,0 +1,25 @@
1
+ import type { ConfigureOptions, InitOptions, PublicCommandPayload } from "@getuserfeedback/protocol";
2
+ import type { WebViewCommandEnvelope, WebViewTransportNativeMessage, WebViewTransportWebMessage } from "@getuserfeedback/protocol/webview-transport";
3
+ import { type ReactElement, type ReactNode } from "react";
4
+ export type ReactNativeWidgetCommand = PublicCommandPayload;
5
+ export type ReactNativeWidgetCommandEnvelope = WebViewCommandEnvelope;
6
+ export type ReactNativeWidgetNativeMessage = WebViewTransportNativeMessage;
7
+ export type ReactNativeWidgetWebMessage = WebViewTransportWebMessage;
8
+ export interface GetUserFeedbackProviderProps {
9
+ children?: ReactNode;
10
+ initOptions: InitOptions;
11
+ configureOptions?: ConfigureOptions;
12
+ onWebMessage?: (message: WebViewTransportWebMessage) => void;
13
+ }
14
+ export interface WidgetHostProps {
15
+ onWebMessage?: (message: WebViewTransportWebMessage) => void;
16
+ nativeMessages?: readonly WebViewTransportNativeMessage[];
17
+ }
18
+ export interface GetUserFeedbackNativeContextValue {
19
+ initOptions: InitOptions;
20
+ configureOptions?: ConfigureOptions;
21
+ onWebMessage?: (message: WebViewTransportWebMessage) => void;
22
+ }
23
+ export declare function GetUserFeedbackProvider({ children, configureOptions, initOptions, onWebMessage, }: GetUserFeedbackProviderProps): ReactElement;
24
+ export declare function useGetUserFeedbackNative(): GetUserFeedbackNativeContextValue;
25
+ export declare function WidgetHost(_props: WidgetHostProps): null;
package/dist/index.js ADDED
@@ -0,0 +1,22 @@
1
+ import { createContext, createElement, useContext, useMemo, } from "react";
2
+ const GetUserFeedbackNativeContext = createContext(null);
3
+ export function GetUserFeedbackProvider({ children, configureOptions, initOptions, onWebMessage, }) {
4
+ const contextValue = useMemo(() => ({
5
+ configureOptions,
6
+ initOptions,
7
+ onWebMessage,
8
+ }), [configureOptions, initOptions, onWebMessage]);
9
+ return createElement(GetUserFeedbackNativeContext.Provider, {
10
+ value: contextValue,
11
+ }, children);
12
+ }
13
+ export function useGetUserFeedbackNative() {
14
+ const context = useContext(GetUserFeedbackNativeContext);
15
+ if (context === null) {
16
+ throw new Error("useGetUserFeedbackNative must be used within GetUserFeedbackProvider");
17
+ }
18
+ return context;
19
+ }
20
+ export function WidgetHost(_props) {
21
+ return null;
22
+ }
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@getuserfeedback/react-native",
3
+ "version": "1.0.0",
4
+ "description": "getuserfeedback React Native SDK",
5
+ "keywords": [
6
+ "getuserfeedback",
7
+ "feedback",
8
+ "widget",
9
+ "react-native",
10
+ "expo"
11
+ ],
12
+ "license": "MIT",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/getuserfeedback/getuserfeedback.git"
16
+ },
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "type": "module",
21
+ "sideEffects": false,
22
+ "main": "./dist/index.js",
23
+ "types": "./dist/index.d.ts",
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js",
28
+ "default": "./dist/index.js"
29
+ }
30
+ },
31
+ "files": [
32
+ "dist"
33
+ ],
34
+ "scripts": {
35
+ "prepack": "node scripts/prepack.cjs",
36
+ "postpack": "node scripts/postpack.cjs",
37
+ "pack:verify": "node ../../scripts/pack-and-verify.cjs --expect-dependency @getuserfeedback/protocol:../protocol/package.json",
38
+ "publish:dry-run": "node ../../scripts/publish-package.cjs . --expect-dependency @getuserfeedback/protocol:../protocol/package.json -- --dry-run",
39
+ "publish:npm": "node ../../scripts/publish-package.cjs . --expect-dependency @getuserfeedback/protocol:../protocol/package.json",
40
+ "build": "bun ../../scripts/clean-build-output.ts dist tsconfig.tsbuildinfo && tsc -b tsconfig.json",
41
+ "typecheck": "tsc -b tsconfig.json",
42
+ "test": "bun test --dots",
43
+ "lint": "ultracite check ."
44
+ },
45
+ "dependencies": {
46
+ "@getuserfeedback/protocol": "^1.1.0"
47
+ },
48
+ "peerDependencies": {
49
+ "react": ">=18.0.0",
50
+ "react-native": ">=0.73.0",
51
+ "react-native-webview": ">=13.0.0"
52
+ },
53
+ "peerDependenciesMeta": {
54
+ "react-native": {
55
+ "optional": true
56
+ },
57
+ "react-native-webview": {
58
+ "optional": true
59
+ }
60
+ },
61
+ "devDependencies": {
62
+ "rimraf": "^6.0.0",
63
+ "typescript": "^5.8.3"
64
+ }
65
+ }