@shotik/mcp 0.1.1 → 0.2.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 +13 -1
- package/README.ru.md +13 -1
- package/audit/checklist.json +1006 -0
- package/audit/index.mjs +127 -0
- package/data/PROTOCOL.md +391 -17
- package/data/flutter/README.md +35 -8
- package/data/flutter/README.ru.md +74 -5
- package/data/react-native/README.md +36 -1
- package/data/react-native/README.ru.md +37 -1
- package/data/react-native/recipe.json +1 -1
- package/data/react-native/src/analytics/README.md +10 -6
- package/data/react-native/src/analytics/recipe.json +1 -1
- package/package.json +3 -2
- package/server.mjs +15 -2
|
@@ -18,10 +18,31 @@
|
|
|
18
18
|
экрана; счётчики непрочитанного; push-токен.
|
|
19
19
|
- Виджет: нижняя шторка из обычных виджетов Flutter (без вида Material или Cupertino), открывается пружиной, закрывается
|
|
20
20
|
свайпом вниз; по желанию плавающая кнопка со счётчиком; светлая и тёмная темы, крупный шрифт, подписи для
|
|
21
|
-
VoiceOver/TalkBack, RTL, тексты на английском и русском по языку устройства.
|
|
21
|
+
VoiceOver/TalkBack, RTL, тексты на английском и русском по языку устройства. Экраны v1.1: строка согласия на ответы
|
|
22
|
+
ИИ, кнопки действий под ответами (выполняется, готово, не получилось), подсказка после сбоя, «Это помогло?», экран
|
|
23
|
+
подписки с честной отменой (одна необязательная причина, «Отменить в App Store» или Google Play на том же экране, не
|
|
24
|
+
больше одного варианта от основателя с равным весом), экран возврата, где сначала помощь, «Оценить {app}» и удаление
|
|
25
|
+
данных с подтверждением.
|
|
22
26
|
- Аналитика: экраны через `NavigatorObserver` (MaterialApp, CupertinoApp, GoRouter), тапы по именам виджетов, ключам и
|
|
23
27
|
`Semantics(identifier:)`, вайрфреймы без единого символа текста, `ShotikMask` для всего личного, согласие
|
|
24
|
-
пользователя, подключение `in_app_purchase` одной
|
|
28
|
+
пользователя, подключение `in_app_purchase` одной строкой, время отклика на тап, а также упавшие и медленные запросы
|
|
29
|
+
через `HttpOverrides` (поверх ваших; только метод, хост, шаблон пути, статус и длительность).
|
|
30
|
+
- Приватность на устройстве: подпись тапа только из `Semantics(label:)` или ключа (`labels: Labels.visible` вернёт
|
|
31
|
+
видимый текст), почта, телефоны, id и токены вырезаются из подписей, ошибок и свойств событий, ключи с личными
|
|
32
|
+
данными отбрасываются, у тапов внутри маски и в полях пароля нет координат.
|
|
33
|
+
- Смена состояния экрана (пейджеры, пошаговые формы) как события `state`, время в текстовых полях без самого текста и
|
|
34
|
+
покупки по данным магазина (продления и переходы с триала) из customer info RevenueCat или `in_app_purchase`.
|
|
35
|
+
- Каждое касание это тап, долгое нажатие, свайп, перетаскивание, щипок или прокрутка (у событий `gesture` нет
|
|
36
|
+
координат), одно событие `scroll` на контейнер после остановки (со страницей `PageView`), собственная цена SDK в
|
|
37
|
+
`close` (`perf`).
|
|
38
|
+
- Реплей вайрфреймов: ключевые кадры и диффы без текста и без содержимого полей. Сессии из выборки отправляют их сразу,
|
|
39
|
+
остальные держат последние 30 с на устройстве и отправляют только после rage-, мёртвого или безответного тапа,
|
|
40
|
+
упавшего сразу после тапа запроса, ошибки или краша. `enable(replay: false)` выключает реплей, `wifiOnly: true`
|
|
41
|
+
держит отправку, пока ваш колбэк `wifi` не ответит true (своей зависимости для сети SDK не добавляет). Для
|
|
42
|
+
ярлыка приватности App Store (Product Interaction, не связано с пользователем, аналитика) реплей собирает раскладку
|
|
43
|
+
экрана в виде прямоугольников (тип, положение, размер, цвет фона, скругление), имя экрана, смещения прокрутки, типы
|
|
44
|
+
жестов с расстояниями и id сессии и установки; никогда текст, значения полей, картинки, веб-контент и координаты
|
|
45
|
+
касаний. Сервер хранит фрагменты 30 дней.
|
|
25
46
|
- Flutter 3.24+ и Dart 3.5+. iOS 13+ как Swift-пакет (без CocoaPods), Android minSdk 21.
|
|
26
47
|
|
|
27
48
|
## 1. Подключите пакет
|
|
@@ -108,8 +129,15 @@ await ShotikSupport.setPushToken(token, platform: Platform.isIOS ? 'ios' : 'andr
|
|
|
108
129
|
## 7. Маскирование, согласие, покупки
|
|
109
130
|
|
|
110
131
|
**Маскирование.** Текстовые поля (всё, что построено на `EditableText`) скрыты всегда: у их тапов нет подписи, а в
|
|
111
|
-
вайрфрейме это пустой
|
|
112
|
-
|
|
132
|
+
вайрфрейме это пустой прямоугольник; у полей пароля (`obscureText`) нет и координат тапа. Всё остальное личное
|
|
133
|
+
оберните в `ShotikMask(child: ...)` или пометьте ключом `key: const ShotikMaskKey()` (для соседних виджетов
|
|
134
|
+
`ShotikMaskKey('pan')` с разными значениями). Маска действует и на реплей, и отключить её нельзя. Символов в вайрфреймах не бывает вообще: текст рисуется серыми полосками размером
|
|
135
|
+
со строку.
|
|
136
|
+
|
|
137
|
+
**Подписи тапов.** По умолчанию (`labels: Labels.a11y`) подпись берётся из `Semantics(label:)` или из ключа
|
|
138
|
+
(`ValueKey('startTrial')` → «Start trial»), видимый текст не уходит. `ShotikAnalytics.enable(labels: Labels.visible)`
|
|
139
|
+
возвращает видимый текст, `Labels.none` отключает подписи. Ключи вида `email`, `phone`, `name`, `token`, `password`,
|
|
140
|
+
`address` в `track` и `identify` отбрасываются (`plan_name` тоже: назовите его `plan`).
|
|
113
141
|
|
|
114
142
|
**Согласие.** По умолчанию аналитика включена. Чтобы дождаться ответа пользователя:
|
|
115
143
|
|
|
@@ -121,13 +149,25 @@ ShotikAnalytics.optOut(); // очистит очере
|
|
|
121
149
|
|
|
122
150
|
Ответ запоминается между запусками.
|
|
123
151
|
|
|
152
|
+
**Удаление данных.** `await ShotikAnalytics.forget()` по запросу пользователя очищает очередь, вайрфреймы и реплей на
|
|
153
|
+
устройстве, просит сервер удалить события, вайрфреймы и реплей этой установки и начинает новую анонимную установку.
|
|
154
|
+
Вернёт `false`, если сервер недоступен (id сохраняется, вызовите ещё раз). Согласие на это не влияет.
|
|
155
|
+
|
|
156
|
+
**Реплей.** Включён по умолчанию; `ShotikAnalytics.enable(replay: false)` выключает его. Только по Wi-Fi:
|
|
157
|
+
`enable(wifiOnly: true, wifi: () async => onWifi)`, где `onWifi` даёт ваш способ проверки сети (например
|
|
158
|
+
connectivity_plus); без колбэка ничего не отправляется.
|
|
159
|
+
|
|
124
160
|
**Покупки через in_app_purchase** одной строкой:
|
|
125
161
|
|
|
126
162
|
```dart
|
|
127
163
|
ShotikAnalytics.watchPurchases(InAppPurchase.instance.purchaseStream, products: productDetails);
|
|
128
164
|
```
|
|
129
165
|
|
|
130
|
-
|
|
166
|
+
**RevenueCat**: `Purchases.addCustomerInfoUpdateListener(ShotikAnalytics.customerInfo)`, а после восстановления
|
|
167
|
+
`ShotikAnalytics.customerInfo(await Purchases.restorePurchases(), quiet: true)`. Продления (`renew`), переход с триала
|
|
168
|
+
(`conv`) и покупки из пейволов RevenueCat придут по одному разу; сами сообщайте только `start`, `cancel` и `fail`.
|
|
169
|
+
|
|
170
|
+
Другие магазины (свой сервер): `ShotikAnalytics.purchase(product: 'pro.annual', status: 'done', price: 39.99, currency: 'USD')`,
|
|
131
171
|
где `status` — `start`, `done`, `fail` или `cancel`.
|
|
132
172
|
|
|
133
173
|
## 8. Вложения (по желанию)
|
|
@@ -135,6 +175,35 @@ ShotikAnalytics.watchPurchases(InAppPurchase.instance.purchaseStream, products:
|
|
|
135
175
|
«Снимок экрана» работает сразу. Для «Фото» передайте SDK свой выбор картинки (любой плагин, который у вас уже есть):
|
|
136
176
|
`ShotikSupport.attachmentPicker = () async => LocalAttachment(bytes: ..., type: 'image/jpeg')`.
|
|
137
177
|
|
|
178
|
+
## 9. ИИ, подписка, действия, отзывы (v1.1)
|
|
179
|
+
|
|
180
|
+
```dart
|
|
181
|
+
ShotikSupport.aiConsent = true; // если согласие на ответы ИИ вы уже спросили сами
|
|
182
|
+
ShotikSupport.onAction = (a) async => ActionResult.done; // кнопки под сообщениями: RevenueCat, in_app_purchase, свой код
|
|
183
|
+
ShotikSupport.openUrl = (url) => launchUrl(Uri.parse(url));
|
|
184
|
+
ShotikSupport.requestReview = () => InAppReview.instance.requestReview();
|
|
185
|
+
ShotikSupport.appStoreId = '6470000000';
|
|
186
|
+
|
|
187
|
+
await ShotikSupport.setSubscription(Subscription(status: 'active', product: 'pro.annual', period: 'P1Y', price: '39,99 €'));
|
|
188
|
+
await ShotikSupport.setAiConsent(false); // «Только человек»
|
|
189
|
+
await ShotikSupport.reviewMoment('goal_reached'); // успех в приложении
|
|
190
|
+
ShotikSupport.friction(const Friction(kind: 'purchase_fail', screen: 'paywall'));
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Поля задайте до `Shotik.configure`. Без `onAction` (или если он вернул `null`) кнопки открывают страницы магазина через
|
|
194
|
+
`openUrl`. `reviewMoment` зовёт `requestReview` только когда проходят правила основателя: нужное число успехов, дни с
|
|
195
|
+
установки, один раз на версию, не чаще 3 раз в год, тишина после проблем, возврата или отмены. `friction` показывает
|
|
196
|
+
плашку «Что-то не так? Напишите нам» не чаще раза за сессию. У клиента (`ShotikSupport.client`) есть `runAction`,
|
|
197
|
+
`rate`, `track`, `openFriction`, `dismissFriction`, `askForOffer(reason)` (у устройства есть только подпись предложения,
|
|
198
|
+
запрос открывает переписку с основателем) и состояние `aiConsent`, `subscription`, `widget`, `friction`.
|
|
199
|
+
`await ShotikSupport.deleteMyData()` по запросу пользователя сразу стирает на устройстве переписки, id, согласие,
|
|
200
|
+
историю запросов отзыва, push-токен и аналитику установки, затем сервер удаляет их у себя. Без сети вернёт
|
|
201
|
+
`EraseResult.pending` и повторит при возврате в приложение и после перезапуска.
|
|
202
|
+
|
|
203
|
+
Виджет сам показывает строку согласия, кнопки действий, «Это помогло?», строки «Подписка», «Оценить {app}» и «Удалить
|
|
204
|
+
мои данные». `ShotikSupportWidget.builder(appName: 'Walkito')` подставляет имя в «Оценить {app}»; плашку после сбоя
|
|
205
|
+
можно поставить самому через `ShotikFrictionChip()` и `frictionChip: false`.
|
|
206
|
+
|
|
138
207
|
## Как опознаются тапы в debug и release
|
|
139
208
|
|
|
140
209
|
Тап записывается с путём элемента вроде `PlanCard>Btn#annual`, ключом разработчика отдельно в `id` (`annual`) и
|
|
@@ -92,7 +92,7 @@ Images upload to the Shotik server (8 MB cap) and show in your Shotik inbox.
|
|
|
92
92
|
|
|
93
93
|
### Icons (optional)
|
|
94
94
|
|
|
95
|
-
With `react-native-svg` installed (Expo apps usually have it), the widget draws its icons from the
|
|
95
|
+
With `react-native-svg` installed (Expo apps usually have it), the widget draws its icons from the Pikaicons free pack (MIT).
|
|
96
96
|
Without it, simple built-in shapes stand in.
|
|
97
97
|
|
|
98
98
|
## 3. Open it
|
|
@@ -153,6 +153,41 @@ const { conversations, messages, unread, unreadBy, typing, status, open, send, r
|
|
|
153
153
|
| `receiptOf(message, list, conversation, offline?)` | `sending · queued · failed · sent · delivered · seen` for your messages. Delivered = reached Shotik; seen = you read it there. |
|
|
154
154
|
| `SupportClient` (`@shotik/react-native/client`) | The platform-free core, usable outside React. |
|
|
155
155
|
|
|
156
|
+
### Consent, actions, subscription and rating (protocol v1.1)
|
|
157
|
+
|
|
158
|
+
```tsx
|
|
159
|
+
ShotikSupport.configure({
|
|
160
|
+
appKey: 'spk_…',
|
|
161
|
+
serverUrl: 'https://support.example.com',
|
|
162
|
+
appStoreId: '1234567890', // write-review and store links
|
|
163
|
+
onAction: async (a) => { // buttons under messages and the Subscription screen
|
|
164
|
+
if (a.kind === 'restore') return (await Purchases.restorePurchases()) ? 'done' : 'failed'
|
|
165
|
+
// return nothing to fall back to the store pages (Manage subscription, refund, review, https links)
|
|
166
|
+
}
|
|
167
|
+
})
|
|
168
|
+
ShotikSupport.client?.setSubscription({ status: 'active', product: 'Pro yearly', price: '$39.99', renewsAt, willRenew: true, store: 'app_store' })
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
- **AI consent.** Until the user picks, one line above the composer says "Replies may be drafted by AI and checked by the
|
|
172
|
+
team." with Allow / Only a person (`setAiConsent`). Pass `aiConsent` to `configure` if your app already asked.
|
|
173
|
+
- **Action buttons.** Founder and AI replies can carry up to 3 buttons. A tap runs `onAction`, or the store page when
|
|
174
|
+
there is no handler. While it runs the button shows progress, then a tick or a failed mark.
|
|
175
|
+
- **Subscription.** With `setSubscription`, the widget home shows a Subscription row. It opens Manage subscription,
|
|
176
|
+
Restore purchases and Redeem code (each only when it can run), Request a refund and Cancel subscription. Cancel asks one
|
|
177
|
+
optional reason and keeps "Cancel in App Store" on the same screen. If you set an alternative for that reason in
|
|
178
|
+
Shotik, it shows once, next to "Continue to cancel" at the same size. Taking it opens a chat to you, and your reply
|
|
179
|
+
sends the code. "Subscribed by mistake" goes straight to the refund screen, which offers Restore and Chat first and
|
|
180
|
+
keeps Request a refund in view.
|
|
181
|
+
- **Rate {app}.** A home row opens the store's write-review page. Pass `appName` to the provider for the label.
|
|
182
|
+
- **Friction chip.** After `friction(…)` (a failed purchase, rage taps, a repeated error) the widget shows "Something
|
|
183
|
+
wrong? Write to us". Place it yourself with `<SupportFrictionChip style={…}/>` and `frictionChip={false}` on the
|
|
184
|
+
provider.
|
|
185
|
+
- **Rating.** A resolved conversation asks "Did this help?" once (Yes / No, then an optional line after No).
|
|
186
|
+
- **Delete my data** (Apple 5.1.1(v), GDPR). The last home row, always there. After a confirm it calls `deleteMyData()`:
|
|
187
|
+
the device forgets at once (chats, queue, ids, analytics), and the server erases the rest. Offline it says it will
|
|
188
|
+
finish once the device is back online and retries on its own. Call `ShotikSupport.client?.deleteMyData()` from your
|
|
189
|
+
own settings too.
|
|
190
|
+
|
|
156
191
|
Conversation status `needs_human` shows a "A person will reply" strip above the composer. Replies are labelled **AI** or
|
|
157
192
|
with `teamName`. After an AI answer the thread offers its quick replies (from the answer, or the defaults you set in
|
|
158
193
|
Shotik as `support.quickReplies:<appId>`) and "Talk to a person".
|
|
@@ -89,7 +89,7 @@ export default function RootLayout() {
|
|
|
89
89
|
|
|
90
90
|
### Иконки (необязательно)
|
|
91
91
|
|
|
92
|
-
С `react-native-svg` (в Expo-приложениях он обычно есть) виджет рисует иконки из набора
|
|
92
|
+
С `react-native-svg` (в Expo-приложениях он обычно есть) виджет рисует иконки из бесплатного набора Pikaicons (MIT). Без него — простые
|
|
93
93
|
встроенные формы.
|
|
94
94
|
|
|
95
95
|
## 3. Откройте чат
|
|
@@ -150,6 +150,42 @@ const { conversations, messages, unread, unreadBy, typing, status, open, send, r
|
|
|
150
150
|
| `receiptOf(message, list, conversation, offline?)` | `sending · queued · failed · sent · delivered · seen` для ваших сообщений. Доставлено = дошло до Shotik; прочитано = вы открыли его там. |
|
|
151
151
|
| `SupportClient` (`@shotik/react-native/client`) | Ядро без привязки к платформе, работает и вне React. |
|
|
152
152
|
|
|
153
|
+
### Согласие, кнопки, подписка и оценка (протокол v1.1)
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
ShotikSupport.configure({
|
|
157
|
+
appKey: 'spk_…',
|
|
158
|
+
serverUrl: 'https://support.example.com',
|
|
159
|
+
appStoreId: '1234567890', // ссылки на отзыв и в магазин
|
|
160
|
+
onAction: async (a) => { // кнопки под сообщениями и экран «Подписка»
|
|
161
|
+
if (a.kind === 'restore') return (await Purchases.restorePurchases()) ? 'done' : 'failed'
|
|
162
|
+
// ничего не вернули: откроется страница магазина (подписки, возврат, отзыв, https-ссылки)
|
|
163
|
+
}
|
|
164
|
+
})
|
|
165
|
+
ShotikSupport.client?.setSubscription({ status: 'active', product: 'Pro yearly', price: '$39.99', renewsAt, willRenew: true, store: 'app_store' })
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
- **Согласие на ИИ.** Пока пользователь не выбрал, над полем ввода стоит строка «Ответы может готовить ИИ, команда их
|
|
169
|
+
проверяет.» с кнопками «Разрешить» и «Только человек» (`setAiConsent`). Если приложение уже спросило, передайте
|
|
170
|
+
`aiConsent` в `configure`.
|
|
171
|
+
- **Кнопки в сообщениях.** Ответ команды или ИИ может нести до 3 кнопок. Нажатие вызывает `onAction`, а без него открывает
|
|
172
|
+
страницу магазина. Пока действие идёт, на кнопке видно, что идёт работа, потом появляется галочка или знак ошибки.
|
|
173
|
+
- **Подписка.** После `setSubscription` на главной виджета появляется строка «Подписка». В ней «Управлять подпиской»,
|
|
174
|
+
«Восстановить покупки» и «Ввести код» (каждая, только когда её можно выполнить), «Запросить возврат» и «Отменить
|
|
175
|
+
подписку». Отмена задаёт один необязательный вопрос о причине, и «Отменить в App Store» остаётся на том же экране. Если
|
|
176
|
+
для этой причины в Shotik задан другой вариант, он показывается один раз рядом с «Продолжить отмену» в том же размере.
|
|
177
|
+
Выбор открывает чат с вами, а код приходит в вашем ответе. «Подписка оформлена по ошибке» сразу ведёт на экран
|
|
178
|
+
возврата: там сначала «Восстановить покупки» и «Написать нам», а «Запросить возврат» видно без прокрутки.
|
|
179
|
+
- **Оценить {app}.** Строка на главной открывает страницу отзыва в магазине. Для подписи передайте провайдеру `appName`.
|
|
180
|
+
- **Подсказка при проблеме.** После `friction(…)` (неудачная покупка, гневные нажатия, повторная ошибка) виджет
|
|
181
|
+
показывает «Что-то не так? Напишите нам». Чтобы разместить её самостоятельно, используйте
|
|
182
|
+
`<SupportFrictionChip style={…}/>` и `frictionChip={false}` у провайдера.
|
|
183
|
+
- **Оценка.** Решённый разговор один раз спрашивает «Это помогло?»: «Да» или «Нет», после «Нет» можно оставить строку.
|
|
184
|
+
- **Удалить мои данные** (Apple 5.1.1(v), GDPR). Последняя строка на главной, видна всегда. После подтверждения вызывает
|
|
185
|
+
`deleteMyData()`: устройство сразу всё забывает (переписки, очередь, id, аналитику), а сервер стирает остальное. Без
|
|
186
|
+
сети виджет говорит, что удаление завершится, когда появится связь, и повторяет запрос сам. Из своих настроек
|
|
187
|
+
вызывайте `ShotikSupport.client?.deleteMyData()`.
|
|
188
|
+
|
|
153
189
|
## Аналитика
|
|
154
190
|
|
|
155
191
|
В том же пакете есть аналитика: `@shotik/react-native/analytics`, с тем же ключом.
|
|
@@ -6,7 +6,7 @@ See how people really use your app (what they tap, where they get stuck, which s
|
|
|
6
6
|
import { ShotikAnalytics, ShotikAnalyticsRoot, ShotikMask, useShotikExpoRouter } from '@shotik/react-native/analytics'
|
|
7
7
|
|
|
8
8
|
ShotikAnalytics.init({ appKey: 'spk_…', serverUrl: 'https://…' }) // the same key as Support
|
|
9
|
-
ShotikAnalytics.trackRevenueCat(Purchases) // optional:
|
|
9
|
+
ShotikAnalytics.trackRevenueCat(Purchases) // optional: purchases, renewals and trial conversions
|
|
10
10
|
|
|
11
11
|
export default function RootLayout() {
|
|
12
12
|
useShotikExpoRouter() // React Navigation: ShotikAnalytics.trackNavigation(ref)
|
|
@@ -17,15 +17,19 @@ ShotikAnalytics.track('walk_started', { minutes: 10 }) // your own
|
|
|
17
17
|
ShotikAnalytics.identify(user.id) // after sign-in; ShotikAnalytics.reset() on sign-out
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
**What it captures on its own:** sessions, app open and close, screens (route patterns, never params), time on screen and scroll depth, taps with the element and position (for heatmaps), rage taps
|
|
20
|
+
**What it captures on its own:** sessions, app open and close, screens (route patterns, never params), time on screen and scroll depth, taps with the element and position (for heatmaps), rage taps, taps that do nothing and how fast each tap got a response, in-screen steps (a fingerprint of which buttons are on screen, so onboarding pagers and multi-step paywalls split into steps), how long people spend in each text field (never what they type), JS errors and crashes, failed and slow network requests (method, host and a templated path only), slow screens and JS stalls, purchases, renewals and trial conversions (RevenueCat, from its customerInfo listener), the release (app version, build, Expo update id and channel when expo-updates is installed) gestures (long press, swipe, pan, pinch) and where each scroll container settled (with the carousel page), and, for 20% of sessions, wireframes of each screen plus a wireframe replay. Every other session keeps the last 30 s of replay in memory and sends it only after a rage, dead, unresponsive or error tap, an error or a crash, so a calm session sends none. `replay: false` turns replay off; `replay: { wifiOnly: true }` sends it only on Wi-Fi (needs `@react-native-community/netinfo` or `expo-network`). Each session's last close carries what the SDK itself cost (p95 tap and walk ms, bytes sent).
|
|
21
21
|
|
|
22
22
|
**Privacy by default:**
|
|
23
|
-
- It never reads text input values.
|
|
24
|
-
- Tap labels
|
|
23
|
+
- It never reads text input values. Field timing carries how long a field was focused, an edit count and whether it ended up filled.
|
|
24
|
+
- Tap labels are accessibility labels (or a name made from the testID) by default: `labels: 'visible'` also sends short visible control text, `labels: 'none'` sends none. Emails, phone numbers, long numbers, ids and tokens are redacted on the device, here and in error messages, custom props and request paths.
|
|
25
|
+
- Custom prop keys that look like personal data (`email`, `phone`, `name`, `token`, `password`, `address`) are dropped, with a warning in development.
|
|
26
|
+
- Replay is wireframes too: boxes, text bars and one box for inputs, masked views and web views; gestures and scrolls carry distances and offsets, never touch positions.
|
|
25
27
|
- Wireframes are on for 20% of sessions by default (`snapshots: 0.2`; `snapshots: 0` turns them off). They hold boxes only (kind and position), draw text as bars with no characters, and contain no images.
|
|
26
|
-
- `<ShotikMask>`
|
|
28
|
+
- `<ShotikMask>` (or `shotikMask` on any view) hides it from labels, wireframes, replay and tap positions; secure text inputs are always masked. Masking can't be turned off: there is no option that unmasks inputs, and replay never reads text from any view, masked or not.
|
|
27
29
|
- `init({ consent: 'pending' })` keeps events on the device until `ShotikAnalytics.setConsent('granted')`. `optOut()` drops them.
|
|
28
|
-
-
|
|
30
|
+
- `ShotikAnalytics.forget()` answers a user's data deletion request: it drops what is still on the device, has the server delete everything recorded for the install (events, wireframes, replay) and starts over as a new install. It resolves `false` when the server can't be reached; call it again to retry.
|
|
31
|
+
|
|
32
|
+
**What replay collects** (for the App Store privacy label, all under Product Interaction, not linked to the user, used for analytics): screen layouts as boxes (kind, position, size, background color, corner radius), the screen's route pattern, scroll offsets, gesture kinds with distances, and the session and install ids it belongs to. Never text, input values, images, web content or touch positions. Keyframes and diffs are kept 30 days unless an insight cites the session.
|
|
29
33
|
|
|
30
34
|
**Footprint:** a single capture-phase touch listener, a 500 ms stall timer, and batched uploads (up to 300 events every 10 s and on background). Batches are dictionary-packed, and the queue persists offline. Nothing runs on the touch path except an O(depth) walk up the tree.
|
|
31
35
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shotik/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "MCP server with Shotik's SDK install recipes, guides and protocol, so coding agents add Shotik Support and Analytics to an app themselves.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"server.mjs",
|
|
28
28
|
"sources.json",
|
|
29
|
+
"audit",
|
|
29
30
|
"data",
|
|
30
31
|
"README.md",
|
|
31
32
|
"README.ru.md",
|
|
@@ -36,7 +37,7 @@
|
|
|
36
37
|
},
|
|
37
38
|
"scripts": {
|
|
38
39
|
"prepack": "node scripts/bundle.mjs",
|
|
39
|
-
"test": "node --test test.mjs"
|
|
40
|
+
"test": "node --test test.mjs test-audit.mjs"
|
|
40
41
|
},
|
|
41
42
|
"publishConfig": {
|
|
42
43
|
"access": "public"
|
package/server.mjs
CHANGED
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
// npx -y @shotik/mcp
|
|
5
5
|
// claude mcp add shotik -- npx -y @shotik/mcp
|
|
6
6
|
// Newline-delimited JSON-RPC 2.0 on stdin/stdout; nothing else is written to stdout. No dependencies. The only network
|
|
7
|
-
// calls are store_check's reads of Apple's public lookup and review RSS.
|
|
7
|
+
// calls are store_check's reads of Apple's public lookup and review RSS, and the audit tools' posts to SHOTIK_WEB.
|
|
8
8
|
import { existsSync, readFileSync, readdirSync } from 'node:fs'
|
|
9
9
|
import { dirname, join, resolve } from 'node:path'
|
|
10
10
|
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
11
11
|
import readline from 'node:readline'
|
|
12
|
+
import { auditChecklist, publishFindings } from './audit/index.mjs'
|
|
12
13
|
|
|
13
14
|
const here = dirname(fileURLToPath(import.meta.url))
|
|
14
15
|
const pkg = JSON.parse(readFileSync(join(here, 'package.json'), 'utf8'))
|
|
@@ -90,6 +91,18 @@ const TOOLS = [
|
|
|
90
91
|
{ name: 'store_check', description: "Check an app's App Store listing against its category: listing facts, category and subtype, what the top apps in that subtype do on onboarding and paywall, trial and subscription wording, days since the last update, screenshots, rating and recent reviews. Reads Apple's public lookup and review RSS; in-app purchase prices are never known, so never state them. Show the user the signals and key points in their language, then end with the last line of the result (\"See it on your screens in Shotik\" and its shotik://continue link) exactly as given.",
|
|
91
92
|
inputSchema: { type: 'object', properties: { app: { type: 'string', description: 'App Store link, id123, a bare id, or the app name' }, lang: { type: 'string', enum: ['en', 'ru'], description: 'Language of the answer and of the Shotik link (default en)' }, country: { type: 'string', description: 'Two-letter storefront for an id or a name (default us; a link keeps its own)' } }, required: ['app'] },
|
|
92
93
|
run: storeCheck },
|
|
94
|
+
{ name: 'shotik_audit_checklist', description: "Start a Shotik web audit: tells shotik.app the agent connected, then returns the onboarding, paywall, purchase and Apple-rule checklist (what to look for per stack, why it costs money, evidence refs, fix examples) and the findings schema. Walk it against the app's code, then call shotik_publish_findings.",
|
|
95
|
+
inputSchema: { type: 'object', properties: { code: { type: 'string', description: 'The audit code from shotik.app/start (6-8 letters and digits)' }, stack: { type: 'array', items: { type: 'string' }, description: 'Stacks to focus on: react-native, expo, swift, swiftui, flutter, kotlin (default all)' } }, required: ['code'] },
|
|
96
|
+
run: auditChecklist },
|
|
97
|
+
{ name: 'shotik_publish_findings', description: 'Publish audit findings to the Shotik project page and return its URL. Findings only: repo-relative file and line, title, why, optional evidence ref and a diff of at most 20 lines; never whole files or secrets. Send done: true with the last batch.',
|
|
98
|
+
inputSchema: { type: 'object', properties: { code: { type: 'string', description: 'The audit code from shotik.app/start (6-8 letters and digits)' },
|
|
99
|
+
app: { type: 'object', properties: { name: { type: 'string', maxLength: 100 }, platform: { type: 'string', enum: ['ios', 'android', 'both'] }, stack: { type: 'array', items: { type: 'string', maxLength: 40 }, minItems: 1, maxItems: 8 } }, required: ['name', 'platform', 'stack'] },
|
|
100
|
+
findings: { type: 'array', minItems: 1, maxItems: 60, items: { type: 'object', properties: {
|
|
101
|
+
severity: { type: 'string', enum: ['high', 'medium', 'low'] }, area: { type: 'string', enum: ['onboarding', 'paywall', 'purchase', 'apple-rule'] },
|
|
102
|
+
file: { type: 'string', maxLength: 200, description: 'Repo-relative path' }, line: { type: 'integer', minimum: 1 }, title: { type: 'string', maxLength: 120 }, why: { type: 'string', maxLength: 600 },
|
|
103
|
+
evidence: { type: 'string', pattern: '^brain:[a-z0-9-]+/[A-Za-z0-9._-]+$' }, diff: { type: 'string', maxLength: 2000, description: 'At most 20 lines' } }, required: ['severity', 'area', 'file', 'line', 'title', 'why'] } },
|
|
104
|
+
done: { type: 'boolean' } }, required: ['code', 'app', 'findings'] },
|
|
105
|
+
run: publishFindings },
|
|
93
106
|
]
|
|
94
107
|
|
|
95
108
|
const RESOURCES = [
|
|
@@ -102,7 +115,7 @@ const RESOURCES = [
|
|
|
102
115
|
].filter(Boolean)),
|
|
103
116
|
].filter((r) => has(r.file))
|
|
104
117
|
|
|
105
|
-
const INSTRUCTIONS = 'Shotik adds in-app support chat and product analytics to mobile apps. To integrate: call detect_project on the app folder, then get_recipe for the SDK it names and follow the steps in order (each step has a done check, so re-running is safe). Ask the user for APP_KEY (Shotik → Support → SDK, spk_…, safe to ship) and SERVER_URL. Install from the registry (' + SDKS.map((s) => s.install).join('; ') + '), never by copying SDK folders. To review an App Store listing against its category, call store_check.'
|
|
118
|
+
const INSTRUCTIONS = 'Shotik adds in-app support chat and product analytics to mobile apps. To integrate: call detect_project on the app folder, then get_recipe for the SDK it names and follow the steps in order (each step has a done check, so re-running is safe). Ask the user for APP_KEY (Shotik → Support → SDK, spk_…, safe to ship) and SERVER_URL. Install from the registry (' + SDKS.map((s) => s.install).join('; ') + '), never by copying SDK folders. To review an App Store listing against its category, call store_check. For a shotik.app audit code, call shotik_audit_checklist, then shotik_publish_findings.'
|
|
106
119
|
|
|
107
120
|
const send = (m) => process.stdout.write(JSON.stringify(m) + '\n')
|
|
108
121
|
const text = (v) => ({ content: [{ type: 'text', text: typeof v === 'string' ? v : JSON.stringify(v, null, 2) }] })
|