@vanira/sdk 0.0.42 → 0.0.43

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 (44) hide show
  1. package/dist/VaniraAI-D2KUxJJO.js +682 -0
  2. package/dist/VaniraAI-EFYOmJ2E.cjs +1 -0
  3. package/dist/__tests__/adapters.test.d.ts +14 -0
  4. package/dist/adapters/PeerConnectionAdapter.d.ts +90 -0
  5. package/dist/adapters/browser/BrowserAudioAdapter.d.ts +9 -0
  6. package/dist/adapters/browser/BrowserDataChannelAdapter.d.ts +16 -0
  7. package/dist/adapters/browser/BrowserMediaAdapter.d.ts +10 -0
  8. package/dist/adapters/browser/BrowserPeerAdapter.d.ts +9 -0
  9. package/dist/adapters/browser/index.d.ts +4 -0
  10. package/dist/adapters/interfaces.d.ts +70 -0
  11. package/dist/adapters/react-native/RNAudioAdapter.d.ts +9 -0
  12. package/dist/adapters/react-native/RNDataChannelAdapter.d.ts +16 -0
  13. package/dist/adapters/react-native/RNMediaAdapter.d.ts +17 -0
  14. package/dist/adapters/react-native/RNPeerAdapter.d.ts +19 -0
  15. package/dist/adapters/react-native/index.d.ts +4 -0
  16. package/dist/browser.d.ts +1 -0
  17. package/dist/core/VaniraAI.d.ts +2 -0
  18. package/dist/index.d.ts +21 -3
  19. package/dist/platforms/browser.cjs +8 -0
  20. package/dist/platforms/browser.d.ts +28 -0
  21. package/dist/platforms/browser.js +479 -0
  22. package/dist/platforms/react-native.cjs +1 -0
  23. package/dist/platforms/react-native.d.ts +46 -0
  24. package/dist/platforms/react-native.js +116 -0
  25. package/dist/react/PresetRenderer.d.ts +1 -2
  26. package/dist/react/index.d.ts +0 -4
  27. package/dist/react-native.d.ts +1 -0
  28. package/dist/runtime/browserRuntime.d.ts +17 -0
  29. package/dist/runtime/reactNativeRuntime.d.ts +18 -0
  30. package/dist/runtime/types.d.ts +96 -0
  31. package/dist/types.d.ts +36 -4
  32. package/dist/ui/presets/WidgetPresetRenderer.d.ts +2 -0
  33. package/dist/vanira-sdk.es.js +1788 -231
  34. package/dist/vanira-sdk.js +36 -36
  35. package/dist/vanira-sdk.js.map +1 -1
  36. package/dist/vanira-sdk.umd.js +1538 -0
  37. package/package.json +18 -3
  38. package/dist/react/presets/CalendarPreset.d.ts +0 -4
  39. package/dist/react/presets/CameraPreset.d.ts +0 -16
  40. package/dist/react/presets/FormPreset.d.ts +0 -4
  41. package/dist/react/presets/NavigatePreset.d.ts +0 -16
  42. package/dist/react/presets/UploadPreset.d.ts +0 -17
  43. package/dist/react/registry.d.ts +0 -3
  44. package/dist/react/types.d.ts +0 -21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vanira/sdk",
3
- "version": "0.0.42",
3
+ "version": "0.0.43",
4
4
  "description": "Vanira Voice & Chat Widget SDK — embed conversational AI into any website with one script tag",
5
5
  "author": "Vanira <developers@vanira.io>",
6
6
  "license": "MIT",
@@ -28,6 +28,16 @@
28
28
  "require": "./dist/vanira-sdk.umd.js",
29
29
  "types": "./dist/index.d.ts"
30
30
  },
31
+ "./browser": {
32
+ "import": "./dist/platforms/browser.js",
33
+ "require": "./dist/platforms/browser.cjs",
34
+ "types": "./dist/platforms/browser.d.ts"
35
+ },
36
+ "./react-native": {
37
+ "import": "./dist/platforms/react-native.js",
38
+ "require": "./dist/platforms/react-native.cjs",
39
+ "types": "./dist/platforms/react-native.d.ts"
40
+ },
31
41
  "./style.css": "./dist/style.css"
32
42
  },
33
43
  "files": [
@@ -36,15 +46,20 @@
36
46
  "scripts": {
37
47
  "dev": "vite",
38
48
  "build": "tsc && vite build && vite build -c vite.cdn.config.ts",
39
- "preview": "vite preview"
49
+ "preview": "vite preview",
50
+ "test": "vitest run",
51
+ "test:watch": "vitest",
52
+ "test:coverage": "vitest run --coverage"
40
53
  },
41
54
  "peerDependencies": {
42
55
  "react": ">=16",
43
56
  "react-dom": ">=16"
44
57
  },
45
58
  "devDependencies": {
59
+ "@vitest/coverage-v8": "^4.1.6",
46
60
  "typescript": "^5.0.0",
47
61
  "vite": "^5.0.0",
48
- "vite-plugin-dts": "^3.0.0"
62
+ "vite-plugin-dts": "^3.0.0",
63
+ "vitest": "^4.1.6"
49
64
  }
50
65
  }
@@ -1,4 +0,0 @@
1
- import { default as React } from 'react';
2
- import { VaniraPresetProps } from '../types';
3
-
4
- export declare const CalendarPreset: React.FC<VaniraPresetProps>;
@@ -1,16 +0,0 @@
1
- import { default as React } from 'react';
2
- import { VaniraPresetProps } from '../types';
3
-
4
- /**
5
- * Built-in Camera Preset — vanira_camera
6
- *
7
- * Opens the device camera mid-call so the user can capture a photo and send it
8
- * to the agent via client.uploadMedia() (same pipeline as file uploads).
9
- *
10
- * client_fields / arguments:
11
- * - title: string (default: "Take a Photo")
12
- * - description: string
13
- * - reason: string (upload reason, default: "camera_capture")
14
- * - facing_mode: "environment" | "user" (default: environment — rear camera on mobile)
15
- */
16
- export declare const CameraPreset: React.FC<VaniraPresetProps>;
@@ -1,4 +0,0 @@
1
- import { default as React } from 'react';
2
- import { VaniraPresetProps } from '../types';
3
-
4
- export declare const FormPreset: React.FC<VaniraPresetProps>;
@@ -1,16 +0,0 @@
1
- import { default as React } from 'react';
2
- import { VaniraPresetProps } from '../types';
3
-
4
- /**
5
- * Built-in Navigate Preset — headless, zero-code navigation.
6
- *
7
- * Framework-agnostic: uses a custom 'vanira:navigate' event that the host
8
- * router (React Router, Next.js, TanStack, etc.) can listen to without
9
- * a global popstate which would tear down the React Router context.
10
- *
11
- * The PresetRenderer skips the overlay wrapper for this preset.
12
- *
13
- * Agent tool arguments:
14
- * - target_url: string (e.g. "/docs", "/pricing", "https://external.com")
15
- */
16
- export declare const NavigatePreset: React.FC<VaniraPresetProps>;
@@ -1,17 +0,0 @@
1
- import { default as React } from 'react';
2
- import { VaniraPresetProps } from '../types';
3
-
4
- /**
5
- * Built-in Upload Preset — vanira_upload
6
- *
7
- * Renders a drag-and-drop file uploader. On submit, calls client.uploadMedia()
8
- * which POSTs the file to /media/upload and sends client_media_update over the DataChannel.
9
- * onComplete is called with { file_name, file_type, file_size, media_id, url }.
10
- *
11
- * Supported agent tool arguments / client_fields:
12
- * - title: string (default: "Upload a File")
13
- * - description: string (default: "Drop or select any file up to 3 MB")
14
- * - reason: string (forwarded to uploadMedia, default: "upload")
15
- * - accept: string (MIME types override)
16
- */
17
- export declare const UploadPreset: React.FC<VaniraPresetProps>;
@@ -1,3 +0,0 @@
1
- import { VaniraPresetRegistry } from './types';
2
-
3
- export declare const defaultRegistry: VaniraPresetRegistry;
@@ -1,21 +0,0 @@
1
- import * as React from 'react';
2
- export interface VaniraPresetProps {
3
- /** The unique tool call execution ID from the AI */
4
- toolCallId: string;
5
- /** The dynamic configuration fields mapped from the Dashboard */
6
- clientFields: Record<string, any>;
7
- /** The parameters the AI extracted from the conversation */
8
- arguments: Record<string, any>;
9
- /** Called when the preset successfully gathers data to send back to the AI */
10
- onComplete: (result: Record<string, any> | string) => void;
11
- /** Called if the preset is cancelled or closed without data */
12
- onCancel: (reason?: string) => void;
13
- /** The live WebRTC client — available for presets that need to call SDK methods (e.g. uploadMedia) */
14
- client?: any;
15
- }
16
- export type VaniraPresetComponent = React.ComponentType<VaniraPresetProps>;
17
- export type VaniraPresetRegistry = Record<string, VaniraPresetComponent>;
18
- export interface ActivePresetState {
19
- presetId: string;
20
- toolCall: any;
21
- }