obi-sdk 0.3.12 → 0.4.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 CHANGED
@@ -21,6 +21,7 @@ The loader accepts the following configuration options:
21
21
  | `apiKey` | string | - | Your Obi API key (required for production) |
22
22
  | `user` | object | - | User information with `id` (required), `email` (optional) and `metadata` (optional) |
23
23
  | `isActive` | boolean | `true` | Whether to show the widget. Set to `false` to disable the widget for specific users |
24
+ | `linkOnlyAccess` | boolean | `false` | Hide the widget unless accessed via a session link. Perfect for trial periods where only customers with direct links should see the widget |
24
25
  | `primaryColor` | string | - | Custom primary color for the widget UI (CSS color value) |
25
26
  | `secondaryColor` | string | - | Custom secondary color for the widget UI (CSS color value) |
26
27
 
@@ -41,6 +42,30 @@ window.obiWidgetConfig = {
41
42
  }
42
43
  ```
43
44
 
45
+ ## Trial Mode / Link-Only Access
46
+
47
+ The `linkOnlyAccess` option is perfect for trial periods where you want to control who can see and interact with the widget. When enabled, the widget remains hidden until a session is started via a direct link.
48
+
49
+ ```js
50
+ window.obiWidgetConfig = {
51
+ apiKey: "YOUR_API_KEY",
52
+ linkOnlyAccess: true, // Widget only visible when accessed via session link
53
+ }
54
+ ```
55
+
56
+ This is ideal for:
57
+
58
+ - Trial periods where only specific customers should see the widget
59
+ - Beta testing with selected users
60
+ - Controlled rollouts using session-specific links
61
+ - Demo environments where widget access is link-based
62
+
63
+ When `linkOnlyAccess` is `true`:
64
+
65
+ - Widget is invisible to regular website visitors
66
+ - Widget becomes visible only when a session is started (e.g., via URL parameters)
67
+ - Once a session ends, the widget returns to hidden state
68
+
44
69
  ## Session Persistence
45
70
 
46
71
  The SDK now supports session persistence across page reloads and navigation. If a user refreshes the page or navigates to another page on your site, the session with Obi will be automatically restored when they return, providing a seamless experience.
package/dist/loader.d.ts CHANGED
@@ -10,9 +10,12 @@ interface ObiWidgetConfig {
10
10
  user?: {
11
11
  id: string;
12
12
  email?: string;
13
- metadata?: any;
14
- };
13
+ metadata?: Record<string, any>;
14
+ } | null;
15
15
  isActive?: boolean;
16
+ linkOnlyAccess?: boolean;
17
+ primaryColor?: string;
18
+ secondaryColor?: string;
16
19
  }
17
20
  declare class ObiWidgetLoader {
18
21
  private config;