@mobilon-dev/chotto 0.3.108 → 0.3.109

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.
Files changed (27) hide show
  1. package/README.md +33 -0
  2. package/dist/chotto.css +1 -1
  3. package/dist/components/2_chatinput_elements/ButtonWabaTemplateSelector/ButtonWabaTemplateSelector.vue.js +32 -27
  4. package/dist/components/2_chatinput_elements/FileUploader/FileUploader.vue.js +1 -1
  5. package/dist/components/2_chatinput_elements/FileUploader/FileUploader.vue2.js +58 -54
  6. package/dist/components/2_chatinput_elements/WABAAttachmentSection/WABAAttachmentSection.vue.js +2 -2
  7. package/dist/components/2_chatinput_elements/WABAAttachmentSection/WABAAttachmentSection.vue2.js +55 -56
  8. package/dist/components/2_elements/AudioRecorder/AudioRecorder.vue.js +2 -2
  9. package/dist/components/2_elements/AudioRecorder/AudioRecorder.vue2.js +42 -35
  10. package/dist/components/2_elements/VideoRecorder/VideoRecorder.vue.js +2 -2
  11. package/dist/components/2_elements/VideoRecorder/VideoRecorder.vue2.js +29 -22
  12. package/dist/hooks/uploadFile/types.js +4 -0
  13. package/dist/hooks/uploadFile/uploadFile.js +12 -13
  14. package/dist/hooks/uploadFile/useChottoUploader.js +56 -0
  15. package/dist/index.js +157 -152
  16. package/dist/types/components/2_chatinput_elements/ButtonWabaTemplateSelector/ButtonWabaTemplateSelector.vue.d.ts +2 -0
  17. package/dist/types/components/2_chatinput_elements/FileUploader/FileUploader.vue.d.ts +11 -0
  18. package/dist/types/components/2_chatinput_elements/FileUploader/stories/FileUploader.stories.d.ts +2 -0
  19. package/dist/types/components/2_chatinput_elements/WABAAttachmentSection/WABAAttachmentSection.vue.d.ts +13 -1
  20. package/dist/types/components/2_chatinput_elements/WABAAttachmentSection/stories/WABAAttachmentSection.stories.d.ts +11 -1
  21. package/dist/types/components/2_elements/AudioRecorder/AudioRecorder.vue.d.ts +11 -0
  22. package/dist/types/components/2_elements/VideoRecorder/VideoRecorder.vue.d.ts +11 -0
  23. package/dist/types/hooks/uploadFile/index.d.ts +2 -0
  24. package/dist/types/hooks/uploadFile/types.d.ts +12 -0
  25. package/dist/types/hooks/uploadFile/uploadFile.d.ts +2 -3
  26. package/dist/types/hooks/uploadFile/useChottoUploader.d.ts +16 -0
  27. package/package.json +1 -1
package/README.md CHANGED
@@ -332,6 +332,39 @@ console.log(t('component.ChatInput.InputPlaceholder'))
332
332
  }
333
333
  ```
334
334
 
335
+ ## 📎 Загрузка файлов
336
+
337
+ По умолчанию `FileUploader`, `AudioRecorder` и `VideoRecorder` грузят файл через legacy adapter: `POST {filebumpUrl}/upload`. Host-приложение может подставить свой uploader **без правок internals** компонентов.
338
+
339
+ Приоритет: prop `uploader` → `inject(chottoUploadFileKey)` → default + `filebump-url`.
340
+
341
+ ```vue
342
+ <script setup>
343
+ import { FileUploader, type ChottoUploadFileFn } from '@mobilon-dev/chotto'
344
+
345
+ const uploadFile: ChottoUploadFileFn = async (file, meta) => {
346
+ // meta.kind: 'file' | 'audio' | 'video'
347
+ return hostUpload(file, meta) // { url, filename }
348
+ }
349
+ </script>
350
+
351
+ <template>
352
+ <FileUploader :uploader="uploadFile" />
353
+ <!-- filebump-url не нужен, если передан uploader -->
354
+ </template>
355
+ ```
356
+
357
+ Чтобы recorder’ы в слотах `ChatInput` использовали тот же adapter:
358
+
359
+ ```ts
360
+ import { provide } from 'vue'
361
+ import { chottoUploadFileKey } from '@mobilon-dev/chotto'
362
+
363
+ provide(chottoUploadFileKey, uploadFile)
364
+ ```
365
+
366
+ Без `uploader` и без `filebump-url` загрузка не выполняется (ошибка в консоли, сообщение не отправляется). Существующий prop `filebump-url` сохранён: потребители без кастомного adapter работают как раньше.
367
+
335
368
  ## 🔌 Интеграция с бэкендом
336
369
 
337
370
  ### Data Provider