@floe-ai/sdk 0.1.0-dev.2 → 0.1.0-dev.21

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.
@@ -1,26 +1,8 @@
1
- declare interface ContextData {
2
- screenshot?: string;
3
- url: string;
4
- structure: PageStructure;
5
- timestamp: number;
6
- userProfile?: any;
7
- }
8
-
9
- declare interface ElementInfo {
10
- selector: string;
11
- type: string;
12
- text?: string;
13
- visible: boolean;
14
- position: DOMRect;
15
- attributes: Record<string, string>;
16
- }
17
-
18
- declare class EventEmitter {
19
- private events;
20
- on(event: string, listener: (...args: any[]) => void): this;
21
- off(event: string, listener: (...args: any[]) => void): this;
22
- emit(event: string, ...args: any[]): boolean;
23
- }
1
+ import { ContextData } from './types';
2
+ import { EventEmitter } from './types';
3
+ import { ScreenshotOptions } from './types';
4
+ import { SDKConfig } from './types';
5
+ import { UIAction } from './types';
24
6
 
25
7
  /**
26
8
  * Initialize Floe SDK
@@ -72,6 +54,20 @@ export declare interface FloeConfig {
72
54
  userInfo?: FloeUserInfo;
73
55
  /** Skip the welcome modal for returning users */
74
56
  skipOnboardingModal?: boolean;
57
+ /** Nudge configuration - Intercom Fin-style sliding notification */
58
+ nudge?: FloeNudgeConfig;
59
+ }
60
+
61
+ /**
62
+ * Nudge configuration for Intercom Fin-style sliding notification
63
+ */
64
+ export declare interface FloeNudgeConfig {
65
+ /** Main nudge message (default: "Hi 👋 How can I help you today?") */
66
+ text?: string;
67
+ /** Auto-show nudge when minimized (default: true) */
68
+ autoShow?: boolean;
69
+ /** Auto-hide after ms, 0 = never (default: 0) */
70
+ autoHideDelay?: number;
75
71
  }
76
72
 
77
73
  /**
@@ -126,6 +122,7 @@ declare class OnboardingSDK extends EventEmitter {
126
122
  private botAudioAnalyzer;
127
123
  private userAudioAnalyzer;
128
124
  private userMicStream;
125
+ private userMicStreamRequestId;
129
126
  private audioElements;
130
127
  private pageTracker;
131
128
  private screenShareEnabled;
@@ -138,12 +135,18 @@ declare class OnboardingSDK extends EventEmitter {
138
135
  private endUserStatus;
139
136
  private connectionProgress;
140
137
  private isReturningUser;
138
+ private hasSkippedOnboarding;
141
139
  private _isMinimized;
142
140
  constructor(config: SDKConfig);
143
141
  /**
144
142
  * Generate unique session ID
145
143
  */
146
144
  private generateSessionId;
145
+ /**
146
+ * Validate client key and check if bot is enabled for this site.
147
+ * This is called before showing any UI to ensure the bot should be displayed.
148
+ */
149
+ private validateClientKeyAndBotStatus;
147
150
  /**
148
151
  * Start screen sharing: sends the tab/window as a WebRTC video track to Pipecat.
149
152
  */
@@ -269,6 +272,32 @@ declare class OnboardingSDK extends EventEmitter {
269
272
  * Actions: highlight, click, type, focus, hover, scroll
270
273
  */
271
274
  private handleHybridAction;
275
+ /**
276
+ * Wait for navigation to complete by polling the current URL.
277
+ * Compares normalized URL components (origin, pathname, search, hash)
278
+ * to avoid false positives from substring matching.
279
+ *
280
+ * @param expectedUrl - Absolute URL we're navigating to (already resolved)
281
+ * @param timeoutMs - Maximum time to wait in milliseconds
282
+ * @returns true if navigation was observed, false if timed out
283
+ */
284
+ private waitForNavigation;
285
+ /**
286
+ * Finalize any pending bot navigation that was interrupted by a full-page load.
287
+ *
288
+ * When navigate sets `window.location.href` for a cross-origin or MPA target the
289
+ * entire JS context is destroyed, so the optimistic sendMetadata never fires.
290
+ * The navigate handler persists a record to sessionStorage before triggering
291
+ * the navigation. On the next page load this method reads it back, validates
292
+ * that we actually arrived at the expected destination, and sends the final
293
+ * bot_action_complete metadata so the server can auto-advance the task.
294
+ *
295
+ * Called once during init() — safe to call before the WebRTC transport is
296
+ * connected because sendMetadata already guards on `this.isConnected`.
297
+ * We retry briefly after init to cover the case where the transport
298
+ * connects a moment later.
299
+ */
300
+ private _finalizePendingNavigation;
272
301
  /**
273
302
  * Check a precondition and report the result to the server.
274
303
  * Used for conditional task execution (e.g., check if an option exists before selecting it).
@@ -345,6 +374,24 @@ declare class OnboardingSDK extends EventEmitter {
345
374
  * @returns true if action succeeded
346
375
  */
347
376
  private executeActionFast;
377
+ /**
378
+ * Handle direct API execution request from server
379
+ * Part of Capability-Based Guidance - allows bot to execute APIs directly
380
+ *
381
+ * The SDK makes the fetch() call with the user's session/cookies,
382
+ * then reports the result back to the bot.
383
+ */
384
+ private handleExecuteApi;
385
+ /**
386
+ * Evaluate a JSONPath-style condition (simple implementation)
387
+ * Supports: $.path.to.value == "expected" or just $.path.to.value (truthy check)
388
+ */
389
+ private evaluateJsonPathCondition;
390
+ /**
391
+ * Extract value from object using simple JSONPath
392
+ * Supports: $.path.to.value or just path.to.value
393
+ */
394
+ private extractJsonPath;
348
395
  /**
349
396
  * Handle batched navigation request from server
350
397
  * Executes multiple navigation steps quickly without LLM round-trips
@@ -503,59 +550,4 @@ declare class OnboardingSDK extends EventEmitter {
503
550
  disconnect(): Promise<void>;
504
551
  }
505
552
 
506
- declare interface PageStructure {
507
- title: string;
508
- url: string;
509
- elements: ElementInfo[];
510
- viewport: {
511
- width: number;
512
- height: number;
513
- };
514
- }
515
-
516
- declare interface ScreenshotOptions {
517
- redact?: boolean;
518
- scale?: number;
519
- quality?: number;
520
- format?: 'webp' | 'jpeg' | 'png';
521
- }
522
-
523
- declare interface SDKConfig {
524
- clientKey: string;
525
- apiUrl?: string;
526
- enableVideo?: boolean;
527
- enableAudio?: boolean;
528
- enableScreenCapture?: boolean;
529
- redactionPatterns?: Record<string, RegExp>;
530
- debug?: boolean;
531
- industry?: string;
532
- useCase?: string;
533
- companyName?: string;
534
- companySize?: string;
535
- role?: string;
536
- userInfo?: UserInfo;
537
- skipOnboardingModal?: boolean;
538
- enableDiscoveryPopup?: boolean;
539
- }
540
-
541
- declare interface UIAction {
542
- type: 'click' | 'type' | 'select' | 'hover' | 'scroll';
543
- selector: string;
544
- value?: string;
545
- description?: string;
546
- }
547
-
548
- /**
549
- * AI Onboarding Agent SDK
550
- * Voice-first onboarding platform with WebRTC connectivity to Pipecat server
551
- */
552
- declare interface UserInfo {
553
- externalId?: string;
554
- email?: string;
555
- name?: string;
556
- company?: string;
557
- designation?: string;
558
- metadata?: Record<string, any>;
559
- }
560
-
561
553
  export { }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floe-ai/sdk",
3
- "version": "0.1.0-dev.2",
3
+ "version": "0.1.0-dev.21",
4
4
  "description": "Floe AI Onboarding SDK for React applications",
5
5
  "type": "module",
6
6
  "main": "./dist-sdk/floe-sdk.es.js",
@@ -34,12 +34,11 @@
34
34
  "preview": "vite preview",
35
35
  "serve": "node serve-dist.js",
36
36
  "serve:sdk": "vite preview --config vite.config.sdk.ts --port 5174",
37
- "clean": "rm -rf dist dist-sdk",
38
- "prepublishOnly": "npm run build:sdk"
37
+ "clean": "rm -rf dist dist-sdk"
39
38
  },
40
39
  "peerDependencies": {
41
- "react": "^18.0.0",
42
- "react-dom": "^18.0.0"
40
+ "react": "^18.0.0 || ^19.0.0",
41
+ "react-dom": "^18.0.0 || ^19.0.0"
43
42
  },
44
43
  "dependencies": {
45
44
  "@pipecat-ai/client-js": "^1.4.1",
@@ -49,8 +48,8 @@
49
48
  "@pipecat-ai/voice-ui-kit": "^0.4.2"
50
49
  },
51
50
  "devDependencies": {
52
- "@types/react": "^18.2.0",
53
- "@types/react-dom": "^18.2.0",
51
+ "@types/react": "^18.2.0 || ^19.0.0",
52
+ "@types/react-dom": "^18.2.0 || ^19.0.0",
54
53
  "@vitejs/plugin-react": "^4.2.0",
55
54
  "cors": "^2.8.5",
56
55
  "express": "^5.1.0",