@the-seeker/feedback-react-native 0.0.0-stage → 0.2.1
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 +266 -2
- package/dist/core/author-token.d.ts +16 -0
- package/dist/core/author-token.js +96 -0
- package/dist/core/client.d.ts +55 -0
- package/dist/core/client.js +98 -0
- package/dist/core/config.d.ts +59 -0
- package/dist/core/config.js +112 -0
- package/dist/core/posts-schema.d.ts +306 -0
- package/dist/core/posts-schema.js +131 -0
- package/dist/core/posts.d.ts +67 -0
- package/dist/core/posts.js +113 -0
- package/dist/core/request.d.ts +53 -0
- package/dist/core/request.js +88 -0
- package/dist/core/survey.d.ts +12 -0
- package/dist/core/survey.js +26 -0
- package/dist/core/texts.d.ts +196 -0
- package/dist/core/texts.js +232 -0
- package/dist/core/theme.d.ts +6 -0
- package/dist/core/theme.js +55 -0
- package/dist/core/transport.d.ts +9 -0
- package/dist/core/transport.js +37 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +34 -0
- package/dist/ui/Attachments.d.ts +9 -0
- package/dist/ui/Attachments.js +27 -0
- package/dist/ui/FeedbackForm.d.ts +8 -0
- package/dist/ui/FeedbackForm.js +92 -0
- package/dist/ui/FeedbackPostScreen.d.ts +8 -0
- package/dist/ui/FeedbackPostScreen.js +74 -0
- package/dist/ui/FeedbackSheet.d.ts +2 -0
- package/dist/ui/FeedbackSheet.js +14 -0
- package/dist/ui/FollowUpSheet.d.ts +17 -0
- package/dist/ui/FollowUpSheet.js +50 -0
- package/dist/ui/Inline.d.ts +6 -0
- package/dist/ui/Inline.js +16 -0
- package/dist/ui/Launcher.d.ts +1 -0
- package/dist/ui/Launcher.js +16 -0
- package/dist/ui/MyFeedbackModal.d.ts +10 -0
- package/dist/ui/MyFeedbackModal.js +45 -0
- package/dist/ui/MyFeedbackScreen.d.ts +9 -0
- package/dist/ui/MyFeedbackScreen.js +88 -0
- package/dist/ui/PostThread.d.ts +17 -0
- package/dist/ui/PostThread.js +57 -0
- package/dist/ui/Provider.d.ts +24 -0
- package/dist/ui/Provider.js +186 -0
- package/dist/ui/SurveyPrompt.d.ts +2 -0
- package/dist/ui/SurveyPrompt.js +52 -0
- package/dist/ui/context.d.ts +122 -0
- package/dist/ui/context.js +28 -0
- package/dist/ui/device.d.ts +10 -0
- package/dist/ui/device.js +22 -0
- package/dist/ui/forms.d.ts +32 -0
- package/dist/ui/forms.js +62 -0
- package/dist/ui/motion.d.ts +1 -0
- package/dist/ui/motion.js +23 -0
- package/dist/ui/post-format.d.ts +19 -0
- package/dist/ui/post-format.js +79 -0
- package/dist/ui/post-pieces.d.ts +24 -0
- package/dist/ui/post-pieces.js +60 -0
- package/dist/ui/post-styles.d.ts +317 -0
- package/dist/ui/post-styles.js +103 -0
- package/dist/ui/post-view-model.d.ts +52 -0
- package/dist/ui/post-view-model.js +181 -0
- package/dist/ui/primitives.d.ts +33 -0
- package/dist/ui/primitives.js +55 -0
- package/dist/ui/prop-state.d.ts +9 -0
- package/dist/ui/prop-state.js +27 -0
- package/dist/ui/storage.d.ts +15 -0
- package/dist/ui/storage.js +35 -0
- package/dist/ui/styles.d.ts +774 -0
- package/dist/ui/styles.js +185 -0
- package/dist/ui/surfaces.d.ts +13 -0
- package/dist/ui/surfaces.js +41 -0
- package/dist/ui/tokens.d.ts +16 -0
- package/dist/ui/tokens.js +62 -0
- package/dist/ui/useMyPosts.d.ts +35 -0
- package/dist/ui/useMyPosts.js +124 -0
- package/dist/ui/useSurvey.d.ts +12 -0
- package/dist/ui/useSurvey.js +52 -0
- package/package.json +32 -3
package/README.md
CHANGED
|
@@ -1,3 +1,267 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @the-seeker/feedback-react-native
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
devstage 피드백을 React Native·Expo 앱에 붙이는 SDK입니다. 순수 JS라 네이티브 모듈·prebuild 없이 Expo Go에서도 동작합니다. 웹 위젯과 같은 설정(문구·테마·표시 방식·설문)을 devstage에서 그대로 가져오고, 앱 사용자가 앱 안에서 보낸 피드백과 운영팀 답변을 확인하고 추가 의견을 남기는 **내 피드백** 화면을 제공합니다(0.2.0).
|
|
4
|
+
|
|
5
|
+
자세한 설치 가이드: https://docs.theseeker.io/feedback/app-install
|
|
6
|
+
|
|
7
|
+
## 설치
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx expo install @the-seeker/feedback-react-native
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Expo가 아닌 React Native 앱은 `npm i @the-seeker/feedback-react-native`. 요구 버전: `react >= 18`, `react-native >= 0.74`.
|
|
14
|
+
|
|
15
|
+
## 1. devstage에 앱 등록 (필수)
|
|
16
|
+
|
|
17
|
+
devstage 대시보드 → 피드백 → **위젯 설정 → 허용 앱**에 앱 ID를 추가하세요. 앱 ID는 iOS bundle identifier 또는 Android applicationId입니다(예: `com.example.app`). 두 플랫폼의 ID가 다르면 둘 다 등록하고 `appId={Platform.select({ ios: "com.example.app", default: "com.example.android" })}`처럼 플랫폼별 값을 넘기세요.
|
|
18
|
+
|
|
19
|
+
- 등록하지 않은 앱 ID로 요청하면 서버가 `403 APP_NOT_ALLOWED`를 돌려주고, 피드백 UI는 나타나지 않습니다(`onError("APP_NOT_ALLOWED")`).
|
|
20
|
+
- 위젯 키(`fbw_…`)는 같은 화면의 **설치** 탭에서 복사합니다.
|
|
21
|
+
|
|
22
|
+
## 2. Provider 추가
|
|
23
|
+
|
|
24
|
+
Provider는 앱 최상단(루트 화면 바로 바깥)에 둡니다. 런처 버튼과 설문 카드는 Provider의 부모 뷰를 기준으로 화면 하단에 떠 있습니다.
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import { TheSeekerFeedbackProvider } from "@the-seeker/feedback-react-native";
|
|
28
|
+
|
|
29
|
+
export default function App() {
|
|
30
|
+
return (
|
|
31
|
+
<TheSeekerFeedbackProvider widgetKey="fbw_..." appId="com.example.app" userId={user?.id} screen="/home">
|
|
32
|
+
<RootNavigator />
|
|
33
|
+
</TheSeekerFeedbackProvider>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
설정을 불러오지 못하면(네트워크 오류, 미등록 앱, 꺼진 위젯) children만 그대로 렌더하고 `onError(code)`를 호출합니다. 개발 빌드에서는 `console.warn`도 남깁니다.
|
|
39
|
+
|
|
40
|
+
### Props
|
|
41
|
+
|
|
42
|
+
| Prop | 타입 | 기본값 | 설명 |
|
|
43
|
+
| --- | --- | --- | --- |
|
|
44
|
+
| `widgetKey` | `string` | 필수 | 위젯 공개 키 |
|
|
45
|
+
| `appId` | `string` | 필수 | 허용 앱에 등록한 앱 ID. `X-TheSeeker-App` 헤더와 `pageUrl`(`app://<appId>/<screen>`)에 쓰입니다 |
|
|
46
|
+
| `baseUrl` | `string` | `"https://devstage.app"` | 서버 주소. 이전 주소를 계속 쓰려면 `"https://crm.theseeker.io"`를 넘기세요 |
|
|
47
|
+
| `userId` | `string \| number \| null` | `null` | 제출에 붙는 사용자 ID(`uid`, 최대 128자) |
|
|
48
|
+
| `locale` | `"ko" \| "en" \| "auto"` | `"ko"` | `auto`는 기기 언어가 `en*`이면 영어, 아니면 한국어 |
|
|
49
|
+
| `screen` | `string` | `"/"` | 현재 화면 경로. 설문 경로 패턴과 `pageUrl`에 쓰입니다 |
|
|
50
|
+
| `launcher` | `boolean` | `true` | `false`면 표시 방식이 launcher여도 플로팅 버튼을 숨깁니다 |
|
|
51
|
+
| `pickImages` | `() => Promise<ImageAsset[]>` | 없음 | 있으면(그리고 위젯의 이미지 첨부가 켜져 있으면) 폼에 첨부 버튼이 생깁니다 |
|
|
52
|
+
| `storage` | `{ getItem, setItem }` | 메모리 | 설문 재노출 쿨다운과 작성자 토큰 저장소(동기·비동기 모두 가능). 내 피드백은 이 값을 넘겨야 켜집니다 |
|
|
53
|
+
| `randomBytes` | `(size) => Uint8Array \| Promise<Uint8Array>` | 없음 | `globalThis.crypto.getRandomValues`가 없을 때 작성자 토큰에 쓰는 보안 난수(예: `expo-crypto`의 `getRandomBytes`) |
|
|
54
|
+
| `client` | `ClientMetadata` | `Platform`에서 생성 | `{ platform, osVersion?, appVersion?, deviceModel?, deviceType? }` |
|
|
55
|
+
| `onSubmitted` | `(id, kind) => void` | 없음 | 제출 성공. `kind`는 `"feedback" \| "nps" \| "csat"` |
|
|
56
|
+
| `onError` | `(code) => void` | 없음 | 설정 로드 실패 또는 제출 실패 코드 |
|
|
57
|
+
|
|
58
|
+
`appVersion`·`deviceModel`은 SDK가 알 수 없으니 필요하면 `expo-application`·`expo-device` 값으로 `client`를 직접 넘기세요.
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import * as Application from "expo-application";
|
|
62
|
+
import * as Device from "expo-device";
|
|
63
|
+
|
|
64
|
+
const client = {
|
|
65
|
+
platform: Platform.OS === "ios" ? "ios" : "android",
|
|
66
|
+
osVersion: Device.osVersion ?? undefined,
|
|
67
|
+
appVersion: Application.nativeApplicationVersion ?? undefined,
|
|
68
|
+
deviceModel: Device.modelName ?? undefined,
|
|
69
|
+
deviceType: Device.deviceType === Device.DeviceType.TABLET ? "tablet" : "phone",
|
|
70
|
+
} as const;
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## 3. 훅 API
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
import { useTheSeekerFeedback } from "@the-seeker/feedback-react-native";
|
|
77
|
+
|
|
78
|
+
function HelpButton() {
|
|
79
|
+
const feedback = useTheSeekerFeedback();
|
|
80
|
+
return <Button title="의견 보내기" onPress={feedback.open} disabled={!feedback.ready} />;
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
| 필드 | 설명 |
|
|
85
|
+
| --- | --- |
|
|
86
|
+
| `ready` | 위젯 설정을 불러왔으면 `true` |
|
|
87
|
+
| `config` | 파싱된 위젯 설정(`WidgetConfig \| null`) |
|
|
88
|
+
| `open()` / `close()` | 피드백 바텀 시트 열기·닫기(설정 로드 전에는 열리지 않음). `close()`는 열려 있는 내 피드백 화면도 닫습니다 |
|
|
89
|
+
| `presentFeedback()` | `open()`과 같습니다 |
|
|
90
|
+
| `myFeedbackReady` | 이 설치에서 내 피드백 화면을 쓸 수 있으면 `true`(아래 8절 조건) |
|
|
91
|
+
| `openMyFeedback()` / `presentMyFeedback()` | 내 피드백 화면 열기(`myFeedbackReady`가 아니면 아무 일도 하지 않음) |
|
|
92
|
+
| `unreadCount` | 아직 읽지 않은 답변이 달린 글 수(내 피드백을 쓸 수 없으면 `0`) |
|
|
93
|
+
| `refreshUnread()` | 읽지 않은 답변 수를 다시 가져옵니다. 앱이 다시 화면에 올 때마다 자동으로도 갱신됩니다 |
|
|
94
|
+
| `setScreen(path)` | 현재 화면 경로 변경. 설문 조건을 다시 평가합니다 |
|
|
95
|
+
| `setUser(id)` | 사용자 ID 변경(`null`로 해제) |
|
|
96
|
+
| `setContact(value)` | 연락처 미리 채우기. 폼과 `submit`의 기본값이 됩니다 |
|
|
97
|
+
| `setLocale(locale)` | `"ko" \| "en" \| "auto"` |
|
|
98
|
+
| `submit({ message, contact?, images? })` | UI 없이 직접 제출 → `{ ok: true, id } \| { ok: false, code }` |
|
|
99
|
+
|
|
100
|
+
`setScreen`·`setUser`·`setLocale`로 바꾼 값은 같은 이름의 prop이 바뀌면 prop 값으로 돌아갑니다. Provider 밖에서 훅을 부르면 `TheSeekerFeedbackContextError`를 던집니다.
|
|
101
|
+
|
|
102
|
+
`submit` 실패 코드: `WIDGET_NOT_FOUND`(설정 로드 전·실패), `VALIDATION_ERROR`(빈 내용 등), `IMAGES_DISABLED`, `TOO_MANY_IMAGES`, `IMAGE_TOO_LARGE`, `INVALID_IMAGE`, `RATE_LIMITED`, `APP_NOT_ALLOWED`, `NETWORK_ERROR`, `ELIGIBILITY`(내 피드백이 켜진 사이트의 작성 조건 미충족).
|
|
103
|
+
|
|
104
|
+
내 피드백을 쓸 수 있으면 폼과 `submit`은 새 글 API(`POST /api/feedback/app/posts`, 작성자 토큰 포함)로 보내 내 피드백 목록에 남깁니다. 그렇지 않으면 0.1.x와 같은 기존 위젯 API로 보냅니다. 설문 응답은 항상 기존 API를 씁니다.
|
|
105
|
+
|
|
106
|
+
## 4. 표시 방식
|
|
107
|
+
|
|
108
|
+
devstage 위젯 설정의 **표시 방식**을 따릅니다.
|
|
109
|
+
|
|
110
|
+
| 표시 방식 | 앱에서의 동작 |
|
|
111
|
+
| --- | --- |
|
|
112
|
+
| launcher | 화면 하단 플로팅 버튼(위치·버튼 문구 설정 반영, 영어는 영어 버튼 문구) → 바텀 시트 폼 |
|
|
113
|
+
| inline | 자동 UI 없음. `<TheSeekerFeedbackInline />`을 원하는 화면에 배치 |
|
|
114
|
+
| manual | 버튼 없음. `open()`으로 바텀 시트를 엽니다 |
|
|
115
|
+
|
|
116
|
+
`open()`과 `<TheSeekerFeedbackInline style={...} />`은 어느 방식에서든 쓸 수 있습니다. 테마(라이트·다크·자동), 강조색, 외형 색상·모서리 반경도 devstage 설정을 따르며, 자동은 기기 다크 모드를 따릅니다.
|
|
117
|
+
|
|
118
|
+
## 5. 화면 경로와 설문
|
|
119
|
+
|
|
120
|
+
devstage에서 만든 NPS·CSAT 설문은 웹 위젯과 같은 규칙으로 뜹니다: 경로 패턴(`/home*`)이 `screen`과 맞고, 쿨다운이 지났고, 표본 비율에 들면 `delaySeconds` 뒤 하단 카드로 표시됩니다. 화면이 바뀔 때마다 다시 평가하며, 한 Provider 수명 동안 설문당 한 번만 뜹니다.
|
|
121
|
+
|
|
122
|
+
expo-router:
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
// app/_layout.tsx
|
|
126
|
+
import { Stack, usePathname } from "expo-router";
|
|
127
|
+
|
|
128
|
+
export default function RootLayout() {
|
|
129
|
+
const pathname = usePathname();
|
|
130
|
+
return (
|
|
131
|
+
<TheSeekerFeedbackProvider widgetKey="fbw_..." appId="com.example.app" screen={pathname}>
|
|
132
|
+
<Stack />
|
|
133
|
+
</TheSeekerFeedbackProvider>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
React Navigation:
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
function Navigation() {
|
|
142
|
+
const { setScreen } = useTheSeekerFeedback();
|
|
143
|
+
const ref = useNavigationContainerRef();
|
|
144
|
+
return (
|
|
145
|
+
<NavigationContainer ref={ref} onStateChange={() => setScreen(`/${ref.getCurrentRoute()?.name ?? ""}`)}>
|
|
146
|
+
{/* … */}
|
|
147
|
+
</NavigationContainer>
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
제출 데이터의 `pageUrl`은 `app://<appId>/<screen>`(예: `app://com.example.app/home`)입니다.
|
|
153
|
+
|
|
154
|
+
## 6. 이미지 첨부 어댑터 (expo-image-picker)
|
|
155
|
+
|
|
156
|
+
```tsx
|
|
157
|
+
import * as ImagePicker from "expo-image-picker";
|
|
158
|
+
import type { PickImages } from "@the-seeker/feedback-react-native";
|
|
159
|
+
|
|
160
|
+
const pickImages: PickImages = async () => {
|
|
161
|
+
const result = await ImagePicker.launchImageLibraryAsync({
|
|
162
|
+
mediaTypes: ["images"],
|
|
163
|
+
allowsMultipleSelection: true,
|
|
164
|
+
selectionLimit: 4,
|
|
165
|
+
quality: 0.8,
|
|
166
|
+
});
|
|
167
|
+
if (result.canceled) return [];
|
|
168
|
+
return result.assets.map((asset, index) => ({
|
|
169
|
+
uri: asset.uri,
|
|
170
|
+
mimeType: asset.mimeType ?? "image/jpeg",
|
|
171
|
+
fileName: asset.fileName ?? `image-${index + 1}.jpg`,
|
|
172
|
+
fileSize: asset.fileSize,
|
|
173
|
+
}));
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
<TheSeekerFeedbackProvider pickImages={pickImages} /* … */ />;
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
PNG·JPEG·WebP·GIF, 최대 4장, 장당 2MB까지 첨부됩니다. 형식이 맞지 않거나 큰 이미지는 폼이 안내 문구와 함께 제외합니다. HEIC 사진이나 큰 사진은 `expo-image-manipulator`로 JPEG 변환·축소한 뒤 넘기세요.
|
|
180
|
+
|
|
181
|
+
## 7. storage 어댑터
|
|
182
|
+
|
|
183
|
+
기본 저장소는 메모리라 앱을 다시 시작하면 설문 쿨다운이 초기화됩니다. 쿨다운을 유지하려면 영구 저장소를 넘기세요. 키는 `tsfb:survey:<설문 ID>`, 값은 표시·닫기·응답 시각(ms)입니다.
|
|
184
|
+
|
|
185
|
+
```tsx
|
|
186
|
+
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
187
|
+
|
|
188
|
+
<TheSeekerFeedbackProvider storage={AsyncStorage} /* … */ />;
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
// mmkv: an existing react-native-mmkv instance
|
|
193
|
+
const storage = {
|
|
194
|
+
getItem: (key: string) => mmkv.getString(key) ?? null,
|
|
195
|
+
setItem: (key: string, value: string) => mmkv.set(key, value),
|
|
196
|
+
};
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## 8. 내 피드백 (답변 확인·추가 의견)
|
|
200
|
+
|
|
201
|
+
앱 사용자는 브라우저로 나가지 않고 앱 안에서 자기가 보낸 피드백을 다시 봅니다.
|
|
202
|
+
|
|
203
|
+
- **내 피드백**: 내가 쓴 글 목록(제목·한 줄·상태·`답변 완료`/`답변 대기`·날짜·새 답변 점).
|
|
204
|
+
- **피드백 글 상세**: 맨 위에 내 글, 그 아래 날짜가 붙은 **운영팀 답변** 블록, 상태 변경 줄(예: `예정으로 변경 · 11월 20일`), 내가 덧붙인 **추가 의견** 블록이 시간순으로 쌓입니다. 맨 아래 **추가 의견 남기기** 버튼이 작성 시트를 엽니다. 닫힌 글이거나 서버가 막은 글에는 버튼이 없습니다.
|
|
205
|
+
- **단방향 사이트**: 답변·추가 의견 없이 **접수됨 · 현재 상태** 단계만 보입니다.
|
|
206
|
+
- 보내기 시트 머리에 **내 피드백** 버튼(읽지 않은 답변 수 포함)이 생기고, 런처 버튼에는 읽지 않은 답변이 있을 때 점이 붙습니다.
|
|
207
|
+
|
|
208
|
+
```tsx
|
|
209
|
+
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
210
|
+
import "react-native-get-random-values"; // 앱 진입 파일 맨 위에서 한 번
|
|
211
|
+
|
|
212
|
+
<TheSeekerFeedbackProvider widgetKey="fbw_..." appId="com.example.app" storage={AsyncStorage}>
|
|
213
|
+
<App />
|
|
214
|
+
</TheSeekerFeedbackProvider>;
|
|
215
|
+
|
|
216
|
+
function SettingsRows() {
|
|
217
|
+
const { presentFeedback, presentMyFeedback, myFeedbackReady, unreadCount } = useTheSeekerFeedback();
|
|
218
|
+
return (
|
|
219
|
+
<>
|
|
220
|
+
<Row title="피드백 보내기" onPress={presentFeedback} />
|
|
221
|
+
{myFeedbackReady ? <Row title="내 피드백" badge={unreadCount} onPress={presentMyFeedback} /> : null}
|
|
222
|
+
</>
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
켜지는 조건(하나라도 빠지면 내 피드백 버튼·배지가 숨고, 피드백 보내기는 0.1.x처럼 그대로 동작합니다):
|
|
228
|
+
|
|
229
|
+
1. 서버가 새 API를 제공하고 사이트가 있음(`GET /api/feedback/app/site`가 `SITE_NOT_FOUND`가 아님) 그리고 사이트 설정의 `myPostsEnabled`가 켜져 있음.
|
|
230
|
+
2. `storage`를 넘김. 작성자 토큰이 메모리에만 있으면 앱을 다시 켰을 때 내 글을 잃으므로 기본 메모리 저장소로는 켜지지 않습니다.
|
|
231
|
+
3. 보안 난수가 있음. Hermes에는 `crypto.getRandomValues`가 없으니 `react-native-get-random-values`를 설치해 진입 파일 맨 위에서 import하거나, `randomBytes` prop으로 `expo-crypto`의 `getRandomBytes`를 넘기세요. 둘 다 없으면 `AuthorTokenUnavailable`로 기능을 숨기며, `Math.random`으로 대신하지 않습니다.
|
|
232
|
+
|
|
233
|
+
작성자 토큰은 설치마다 만드는 32바이트 난수(base64url 43자)로 `tsfb:author:<widgetKey>` 키에 저장되고 `X-Devstage-Author` 헤더로만 전송됩니다. 앱을 지웠다가 다시 설치하면 이전 글은 목록에서 보이지 않습니다(이메일을 남긴 경우 답변 알림 메일은 계속 갑니다).
|
|
234
|
+
|
|
235
|
+
UI 없이 쓰려면 `createPostsClient({ publicKey, appId, authorToken })`와 `getOrCreateAuthorToken(storage, widgetKey)`를 직접 쓰세요. 메서드: `getSite()`, `createPost(input, images?)`, `listMyPosts(cursor?)`, `getPost(number)`, `addFollowUp(number, body)`, `getUnread()`. 각 메서드는 `{ ok: true, value } | { ok: false, code }`를 돌려줍니다.
|
|
236
|
+
|
|
237
|
+
### 이미 출시한 앱
|
|
238
|
+
|
|
239
|
+
0.1.x 앱은 `https://crm.theseeker.io`로 계속 동작합니다. 0.2.1의 기본 주소는 `https://devstage.app`이며, 새 빌드에서도 이전 주소를 쓰려면 `baseUrl="https://crm.theseeker.io"`를 넘기세요.
|
|
240
|
+
|
|
241
|
+
## 테스트 ID (Detox·Maestro)
|
|
242
|
+
|
|
243
|
+
`theseeker-feedback-launcher`, `theseeker-feedback-message`, `theseeker-feedback-contact`, `theseeker-feedback-attach`, `theseeker-feedback-remove-<n>`, `theseeker-feedback-submit`, `theseeker-feedback-thanks`, `theseeker-feedback-scrim`, `theseeker-feedback-inline`, `theseeker-feedback-mine`, `theseeker-my-feedback-close`, `theseeker-my-feedback-write`, `theseeker-my-feedback-empty-write`, `theseeker-my-feedback-post-<number>`, `theseeker-post-back`, `theseeker-post-follow-up`, `theseeker-follow-up-body`, `theseeker-follow-up-cancel`, `theseeker-follow-up-submit`, `theseeker-survey`, `theseeker-survey-score-<n>`, `theseeker-survey-follow-up`, `theseeker-survey-send`, `theseeker-survey-close`.
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## English
|
|
248
|
+
|
|
249
|
+
Pure-JS React Native / Expo SDK for devstage feedback. No native modules; works in Expo Go. Full guide: https://docs.theseeker.io/feedback/app-install
|
|
250
|
+
|
|
251
|
+
1. **Install**: `npx expo install @the-seeker/feedback-react-native` (peer deps: `react >= 18`, `react-native >= 0.74`).
|
|
252
|
+
2. **Register your app ID** (iOS bundle identifier / Android applicationId) in the devstage dashboard → Feedback → Widget settings → **Allowed apps**. Unregistered IDs get `403 APP_NOT_ALLOWED` and no UI renders.
|
|
253
|
+
3. **Wrap your app** near the root:
|
|
254
|
+
|
|
255
|
+
```tsx
|
|
256
|
+
<TheSeekerFeedbackProvider widgetKey="fbw_..." appId="com.example.app" locale="en" screen={pathname}>
|
|
257
|
+
<App />
|
|
258
|
+
</TheSeekerFeedbackProvider>
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
- Props: `widgetKey`, `appId` (required); `baseUrl` (default `"https://devstage.app"`; pass `"https://crm.theseeker.io"` to keep the legacy host), `userId`, `locale` (`"ko" | "en" | "auto"`, default `"ko"`), `screen` (default `"/"`), `launcher` (default `true`), `pickImages`, `storage` (default in-memory), `randomBytes`, `client`, `onSubmitted(id, kind)`, `onError(code)`.
|
|
262
|
+
- Hook: `useTheSeekerFeedback()` returns `{ ready, config, open, close, presentFeedback, myFeedbackReady, openMyFeedback, presentMyFeedback, unreadCount, refreshUnread, setScreen, setUser, setContact, setLocale, submit }`; `submit({ message, contact?, images? })` resolves to `{ ok: true, id } | { ok: false, code }`. It throws `TheSeekerFeedbackContextError` outside the provider.
|
|
263
|
+
- My feedback (0.2.1): in-app list of the user's posts, the post with dated team answers, status lines and follow-ups, and an "Add a follow-up" sheet; one-way sites show "Received · Current status" only. It turns on when the site enables it (`myPostsEnabled`), a persistent `storage` is passed and a secure RNG exists (`react-native-get-random-values` or the `randomBytes` prop). Otherwise it stays hidden and sending works exactly as in 0.1.x. The per-install author token (32 random bytes, base64url) is stored under `tsfb:author:<widgetKey>` and sent as `X-Devstage-Author`.
|
|
264
|
+
- Display modes follow the devstage setting: `launcher` (floating button → bottom sheet), `inline` (place `<TheSeekerFeedbackInline />` yourself), `manual` (call `open()`).
|
|
265
|
+
- Surveys (NPS/CSAT) use the web widget rules: path pattern vs `screen`, cooldown read from `storage` (`tsfb:survey:<id>`), sample rate, then `delaySeconds`; at most once per provider lifetime.
|
|
266
|
+
- Images: pass a `pickImages` adapter (see the expo-image-picker example above). PNG, JPEG, WebP or GIF, up to 4 images, 2 MB each.
|
|
267
|
+
- Submissions are sent with `X-TheSeeker-App: <appId>` and `pageUrl = app://<appId>/<screen>`.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FeedbackStorage } from "../ui/storage";
|
|
2
|
+
/** App-provided secure RNG (e.g. `expo-crypto`'s `getRandomBytes`), used when `globalThis.crypto` is missing. */
|
|
3
|
+
export type RandomBytes = (size: number) => Uint8Array | Promise<Uint8Array>;
|
|
4
|
+
export type AuthorTokenProblem = "no_secure_random" | "invalid_random_bytes" | "storage_failed";
|
|
5
|
+
/** No token can be issued: my-feedback screens stay hidden; plain feedback sending keeps working. */
|
|
6
|
+
export declare class AuthorTokenUnavailable extends Error {
|
|
7
|
+
readonly reason: AuthorTokenProblem;
|
|
8
|
+
constructor(reason: AuthorTokenProblem, detail?: string);
|
|
9
|
+
}
|
|
10
|
+
export declare function authorTokenStorageKey(publicKey: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* The install's author token for `publicKey`: 32 secure random bytes as 43 base64url characters,
|
|
13
|
+
* stored under `tsfb:author:<publicKey>`. Concurrent callers share one creation, so a double-mounted
|
|
14
|
+
* provider never ends up holding a token that another call overwrote. Never falls back to `Math.random`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getOrCreateAuthorToken(storage: FeedbackStorage, publicKey: string, randomBytes?: RandomBytes): Promise<string>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthorTokenUnavailable = void 0;
|
|
4
|
+
exports.authorTokenStorageKey = authorTokenStorageKey;
|
|
5
|
+
exports.getOrCreateAuthorToken = getOrCreateAuthorToken;
|
|
6
|
+
const storage_1 = require("../ui/storage");
|
|
7
|
+
/** No token can be issued: my-feedback screens stay hidden; plain feedback sending keeps working. */
|
|
8
|
+
class AuthorTokenUnavailable extends Error {
|
|
9
|
+
constructor(reason, detail) {
|
|
10
|
+
super(`Author token unavailable: ${reason}${detail === undefined ? "" : ` (${detail})`}`);
|
|
11
|
+
this.reason = reason;
|
|
12
|
+
this.name = "AuthorTokenUnavailable";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.AuthorTokenUnavailable = AuthorTokenUnavailable;
|
|
16
|
+
const TOKEN_BYTES = 32;
|
|
17
|
+
const TOKEN_SHAPE = /^[A-Za-z0-9_-]{43}$/;
|
|
18
|
+
const BASE64URL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
19
|
+
const pending = new WeakMap();
|
|
20
|
+
function authorTokenStorageKey(publicKey) {
|
|
21
|
+
return `tsfb:author:${publicKey}`;
|
|
22
|
+
}
|
|
23
|
+
function encodeBase64Url(bytes) {
|
|
24
|
+
let out = "";
|
|
25
|
+
for (let index = 0; index < bytes.length; index += 3) {
|
|
26
|
+
const second = bytes[index + 1];
|
|
27
|
+
const third = bytes[index + 2];
|
|
28
|
+
const triple = ((bytes[index] ?? 0) << 16) | ((second ?? 0) << 8) | (third ?? 0);
|
|
29
|
+
out += BASE64URL.charAt((triple >> 18) & 63) + BASE64URL.charAt((triple >> 12) & 63);
|
|
30
|
+
if (second !== undefined)
|
|
31
|
+
out += BASE64URL.charAt((triple >> 6) & 63);
|
|
32
|
+
if (third !== undefined)
|
|
33
|
+
out += BASE64URL.charAt(triple & 63);
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
/** `globalThis.crypto.getRandomValues` (Hermes polyfill, Node, web) read without assuming DOM typings. */
|
|
38
|
+
function platformRandom() {
|
|
39
|
+
const crypto = Reflect.get(globalThis, "crypto");
|
|
40
|
+
if (typeof crypto !== "object" || crypto === null)
|
|
41
|
+
return null;
|
|
42
|
+
const fill = Reflect.get(crypto, "getRandomValues");
|
|
43
|
+
if (typeof fill !== "function")
|
|
44
|
+
return null;
|
|
45
|
+
return (bytes) => {
|
|
46
|
+
Reflect.apply(fill, crypto, [bytes]);
|
|
47
|
+
return bytes;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
async function secureBytes(randomBytes) {
|
|
51
|
+
const platform = platformRandom();
|
|
52
|
+
if (platform !== null)
|
|
53
|
+
return platform(new Uint8Array(TOKEN_BYTES));
|
|
54
|
+
if (randomBytes === undefined)
|
|
55
|
+
throw new AuthorTokenUnavailable("no_secure_random");
|
|
56
|
+
let bytes;
|
|
57
|
+
try {
|
|
58
|
+
bytes = await randomBytes(TOKEN_BYTES);
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
if (error instanceof Error)
|
|
62
|
+
throw new AuthorTokenUnavailable("invalid_random_bytes", error.message);
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
if (!(bytes instanceof Uint8Array) || bytes.length !== TOKEN_BYTES)
|
|
66
|
+
throw new AuthorTokenUnavailable("invalid_random_bytes");
|
|
67
|
+
return bytes;
|
|
68
|
+
}
|
|
69
|
+
async function loadOrCreate(storage, key, randomBytes) {
|
|
70
|
+
const stored = await (0, storage_1.readStorage)(storage, key);
|
|
71
|
+
if (!stored.ok)
|
|
72
|
+
throw new AuthorTokenUnavailable("storage_failed", stored.error.message);
|
|
73
|
+
if (stored.value !== null && TOKEN_SHAPE.test(stored.value))
|
|
74
|
+
return stored.value;
|
|
75
|
+
const token = encodeBase64Url(await secureBytes(randomBytes));
|
|
76
|
+
const failure = await (0, storage_1.writeStorage)(storage, key, token);
|
|
77
|
+
if (failure !== null)
|
|
78
|
+
throw new AuthorTokenUnavailable("storage_failed", failure.message);
|
|
79
|
+
return token;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* The install's author token for `publicKey`: 32 secure random bytes as 43 base64url characters,
|
|
83
|
+
* stored under `tsfb:author:<publicKey>`. Concurrent callers share one creation, so a double-mounted
|
|
84
|
+
* provider never ends up holding a token that another call overwrote. Never falls back to `Math.random`.
|
|
85
|
+
*/
|
|
86
|
+
function getOrCreateAuthorToken(storage, publicKey, randomBytes) {
|
|
87
|
+
const key = authorTokenStorageKey(publicKey);
|
|
88
|
+
const inFlight = pending.get(storage) ?? new Map();
|
|
89
|
+
pending.set(storage, inFlight);
|
|
90
|
+
const existing = inFlight.get(key);
|
|
91
|
+
if (existing !== undefined)
|
|
92
|
+
return existing;
|
|
93
|
+
const created = loadOrCreate(storage, key, randomBytes).finally(() => inFlight.delete(key));
|
|
94
|
+
inFlight.set(key, created);
|
|
95
|
+
return created;
|
|
96
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { WidgetConfig } from "./config";
|
|
2
|
+
import type { FeedbackErrorCode, FeedbackPayload, ImageAsset } from "./request";
|
|
3
|
+
import type { ClientResponse } from "./transport";
|
|
4
|
+
/** Origin used when no `baseUrl` is given. */
|
|
5
|
+
export declare const DEFAULT_BASE_URL = "https://devstage.app";
|
|
6
|
+
export type NativeFilePart = Readonly<{
|
|
7
|
+
uri: string;
|
|
8
|
+
type: string;
|
|
9
|
+
name: string;
|
|
10
|
+
}>;
|
|
11
|
+
export interface FormDataLike {
|
|
12
|
+
append(name: string, value: string | NativeFilePart): void;
|
|
13
|
+
}
|
|
14
|
+
export interface XhrLike {
|
|
15
|
+
open(method: string, url: string): void;
|
|
16
|
+
setRequestHeader(name: string, value: string): void;
|
|
17
|
+
send(body: FormDataLike): void;
|
|
18
|
+
onload: (() => void) | null;
|
|
19
|
+
onerror: (() => void) | null;
|
|
20
|
+
ontimeout: (() => void) | null;
|
|
21
|
+
readonly status: number;
|
|
22
|
+
readonly responseText: string;
|
|
23
|
+
timeout: number;
|
|
24
|
+
}
|
|
25
|
+
export type FetchInit = Readonly<{
|
|
26
|
+
method: "GET" | "POST";
|
|
27
|
+
headers: Readonly<Record<string, string>>;
|
|
28
|
+
body?: string | FormDataLike;
|
|
29
|
+
}>;
|
|
30
|
+
export type FetchImpl = (url: string, init: FetchInit) => Promise<ClientResponse>;
|
|
31
|
+
export type FeedbackClientOptions = Readonly<{
|
|
32
|
+
baseUrl?: string;
|
|
33
|
+
widgetKey: string;
|
|
34
|
+
appId: string;
|
|
35
|
+
fetchImpl?: FetchImpl;
|
|
36
|
+
FormDataImpl?: new () => FormDataLike;
|
|
37
|
+
XMLHttpRequestImpl?: new () => XhrLike;
|
|
38
|
+
}>;
|
|
39
|
+
export type Failure = Readonly<{
|
|
40
|
+
ok: false;
|
|
41
|
+
code: FeedbackErrorCode;
|
|
42
|
+
}>;
|
|
43
|
+
export type ConfigResult = Readonly<{
|
|
44
|
+
ok: true;
|
|
45
|
+
config: WidgetConfig;
|
|
46
|
+
}> | Failure;
|
|
47
|
+
export type SubmitResult = Readonly<{
|
|
48
|
+
ok: true;
|
|
49
|
+
id: string;
|
|
50
|
+
}> | Failure;
|
|
51
|
+
export interface FeedbackClient {
|
|
52
|
+
fetchConfig(): Promise<ConfigResult>;
|
|
53
|
+
submit(payload: FeedbackPayload, images?: readonly ImageAsset[]): Promise<SubmitResult>;
|
|
54
|
+
}
|
|
55
|
+
export declare function createFeedbackClient(options: FeedbackClientOptions): FeedbackClient;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_BASE_URL = void 0;
|
|
4
|
+
exports.createFeedbackClient = createFeedbackClient;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const config_1 = require("./config");
|
|
7
|
+
const request_1 = require("./request");
|
|
8
|
+
const transport_1 = require("./transport");
|
|
9
|
+
/** Origin used when no `baseUrl` is given. */
|
|
10
|
+
exports.DEFAULT_BASE_URL = "https://devstage.app";
|
|
11
|
+
const errorSchema = zod_1.z.object({
|
|
12
|
+
error: zod_1.z.enum([
|
|
13
|
+
"APP_NOT_ALLOWED",
|
|
14
|
+
"ORIGIN_NOT_ALLOWED",
|
|
15
|
+
"RATE_LIMITED",
|
|
16
|
+
"VALIDATION_ERROR",
|
|
17
|
+
"IMAGES_DISABLED",
|
|
18
|
+
"TOO_MANY_IMAGES",
|
|
19
|
+
"IMAGE_TOO_LARGE",
|
|
20
|
+
"INVALID_IMAGE",
|
|
21
|
+
"WIDGET_NOT_FOUND",
|
|
22
|
+
"NETWORK_ERROR",
|
|
23
|
+
]),
|
|
24
|
+
});
|
|
25
|
+
const successSchema = zod_1.z.object({ id: zod_1.z.string().min(1) });
|
|
26
|
+
function responseError(body, status) {
|
|
27
|
+
const parsed = errorSchema.safeParse(body);
|
|
28
|
+
if (parsed.success)
|
|
29
|
+
return { ok: false, code: parsed.data.error };
|
|
30
|
+
switch (status) {
|
|
31
|
+
case 429:
|
|
32
|
+
return { ok: false, code: "RATE_LIMITED" };
|
|
33
|
+
case 413:
|
|
34
|
+
return { ok: false, code: "IMAGE_TOO_LARGE" };
|
|
35
|
+
case 404:
|
|
36
|
+
return { ok: false, code: "WIDGET_NOT_FOUND" };
|
|
37
|
+
default:
|
|
38
|
+
return { ok: false, code: "VALIDATION_ERROR" };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async function parseSubmitResponse(response) {
|
|
42
|
+
const raw = await response.json();
|
|
43
|
+
if (response.status !== 201)
|
|
44
|
+
return responseError(raw, response.status);
|
|
45
|
+
const parsed = successSchema.safeParse(raw);
|
|
46
|
+
return parsed.success ? { ok: true, id: parsed.data.id } : { ok: false, code: "VALIDATION_ERROR" };
|
|
47
|
+
}
|
|
48
|
+
function createFeedbackClient(options) {
|
|
49
|
+
const { widgetKey, appId, baseUrl = exports.DEFAULT_BASE_URL, fetchImpl = fetch, FormDataImpl = FormData, XMLHttpRequestImpl = globalThis.XMLHttpRequest, } = options;
|
|
50
|
+
return {
|
|
51
|
+
async fetchConfig() {
|
|
52
|
+
try {
|
|
53
|
+
const response = await fetchImpl((0, request_1.configUrl)(baseUrl, widgetKey), { method: "GET", headers: (0, request_1.appHeaders)(appId) });
|
|
54
|
+
const body = await response.json();
|
|
55
|
+
if (response.status !== 200)
|
|
56
|
+
return responseError(body, response.status);
|
|
57
|
+
const config = (0, config_1.parseWidgetConfig)(body);
|
|
58
|
+
return config === null ? { ok: false, code: "WIDGET_NOT_FOUND" } : { ok: true, config };
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
if (error instanceof Error)
|
|
62
|
+
return { ok: false, code: "NETWORK_ERROR" };
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
async submit(payload, images = []) {
|
|
67
|
+
const validation = (0, request_1.validateImages)(images);
|
|
68
|
+
if (validation !== "ok")
|
|
69
|
+
return { ok: false, code: validation };
|
|
70
|
+
try {
|
|
71
|
+
const url = `${baseUrl.replace(/\/+$/, "")}/api/feedback/widget`;
|
|
72
|
+
let body = JSON.stringify(payload);
|
|
73
|
+
let headers = { ...(0, request_1.appHeaders)(appId), "Content-Type": "application/json" };
|
|
74
|
+
if (images.length > 0) {
|
|
75
|
+
const form = new FormDataImpl();
|
|
76
|
+
form.append("payload", JSON.stringify(payload));
|
|
77
|
+
for (const image of images)
|
|
78
|
+
form.append("image", { uri: image.uri, type: image.mimeType, name: image.fileName });
|
|
79
|
+
if (XMLHttpRequestImpl !== undefined)
|
|
80
|
+
return await parseSubmitResponse(await (0, transport_1.xhrPost)(XMLHttpRequestImpl, url, (0, request_1.appHeaders)(appId), form));
|
|
81
|
+
body = form;
|
|
82
|
+
headers = { ...(0, request_1.appHeaders)(appId) };
|
|
83
|
+
}
|
|
84
|
+
const response = await fetchImpl(url, {
|
|
85
|
+
method: "POST",
|
|
86
|
+
headers,
|
|
87
|
+
body,
|
|
88
|
+
});
|
|
89
|
+
return await parseSubmitResponse(response);
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
if (error instanceof Error)
|
|
93
|
+
return { ok: false, code: "NETWORK_ERROR" };
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { FormTexts, Locale } from "./texts";
|
|
2
|
+
export declare const ACCENTS: {
|
|
3
|
+
readonly neutral: "#111827";
|
|
4
|
+
readonly blue: "#2563eb";
|
|
5
|
+
readonly green: "#16a34a";
|
|
6
|
+
readonly violet: "#7c3aed";
|
|
7
|
+
readonly orange: "#ea580c";
|
|
8
|
+
readonly rose: "#e11d48";
|
|
9
|
+
};
|
|
10
|
+
export declare const RADII: {
|
|
11
|
+
readonly panel: 14;
|
|
12
|
+
readonly field: 10;
|
|
13
|
+
readonly button: 24;
|
|
14
|
+
};
|
|
15
|
+
export type Theme = "light" | "dark" | "system" | "auto";
|
|
16
|
+
export type Scheme = "light" | "dark";
|
|
17
|
+
export type ContactMode = "email" | "text" | "hidden";
|
|
18
|
+
export type PaletteColors = Readonly<{
|
|
19
|
+
accent: string;
|
|
20
|
+
accentText: string;
|
|
21
|
+
background: string;
|
|
22
|
+
text: string;
|
|
23
|
+
mutedText: string;
|
|
24
|
+
border: string;
|
|
25
|
+
}>;
|
|
26
|
+
export type Radii = Readonly<{
|
|
27
|
+
panel: number;
|
|
28
|
+
field: number;
|
|
29
|
+
button: number;
|
|
30
|
+
}>;
|
|
31
|
+
export type Appearance = Readonly<{
|
|
32
|
+
light: Partial<PaletteColors>;
|
|
33
|
+
dark: Partial<PaletteColors>;
|
|
34
|
+
radius: Radii;
|
|
35
|
+
font: "default" | "inherit";
|
|
36
|
+
}>;
|
|
37
|
+
export type Survey = Readonly<{
|
|
38
|
+
id: string;
|
|
39
|
+
type: "nps" | "csat";
|
|
40
|
+
question: string;
|
|
41
|
+
followUp: string | null;
|
|
42
|
+
delaySeconds: number;
|
|
43
|
+
pathPattern: string | null;
|
|
44
|
+
sampleRate: number;
|
|
45
|
+
cooldownDays: number;
|
|
46
|
+
}>;
|
|
47
|
+
export type WidgetConfig = Readonly<{
|
|
48
|
+
position: "bottom-right" | "bottom-left";
|
|
49
|
+
labels: Readonly<Record<Locale, string>>;
|
|
50
|
+
accentName: keyof typeof ACCENTS;
|
|
51
|
+
appearance: Appearance;
|
|
52
|
+
theme: Theme;
|
|
53
|
+
contactMode: ContactMode;
|
|
54
|
+
texts: Readonly<Record<Locale, FormTexts>>;
|
|
55
|
+
mode: "launcher" | "inline" | "manual";
|
|
56
|
+
images: boolean;
|
|
57
|
+
survey: Survey | null;
|
|
58
|
+
}>;
|
|
59
|
+
export declare function parseWidgetConfig(input: unknown): WidgetConfig | null;
|