@pillar-ai/sdk 0.1.5 → 0.1.7

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
@@ -1,6 +1,6 @@
1
1
  # @pillar-ai/sdk
2
2
 
3
- Pillar Embedded Help SDK - Add contextual help, tooltips, and AI chat to your application.
3
+ Pillar Embedded Help SDK - Add contextual help and AI chat to your application.
4
4
 
5
5
  ## Installation
6
6
 
@@ -10,36 +10,12 @@ npm install @pillar-ai/sdk
10
10
 
11
11
  ## Quick Start
12
12
 
13
- ### Script Tag (CDN)
14
-
15
- ```html
16
- <script src="https://cdn.trypillar.com/sdk/pillar.min.js"></script>
17
- <script>
18
- Pillar.init({
19
- helpCenter: 'your-help-center',
20
- publicKey: 'pk_live_xxx',
21
- });
22
- </script>
23
- ```
24
-
25
- Or with auto-initialization via data attributes:
26
-
27
- ```html
28
- <script
29
- src="https://cdn.trypillar.com/sdk/pillar.min.js"
30
- data-help-center="your-help-center"
31
- data-public-key="pk_live_xxx"
32
- ></script>
33
- ```
34
-
35
- ### ES Modules
36
-
37
13
  ```javascript
38
- import { Pillar } from '@pillar-ai/sdk';
14
+ import { Pillar } from "@pillar-ai/sdk";
39
15
 
40
16
  await Pillar.init({
41
- helpCenter: 'your-help-center',
42
- publicKey: 'pk_live_xxx',
17
+ helpCenter: "your-help-center",
18
+ publicKey: "pk_live_xxx",
43
19
  });
44
20
  ```
45
21
 
@@ -48,45 +24,55 @@ await Pillar.init({
48
24
  ```javascript
49
25
  Pillar.init({
50
26
  // Required
51
- helpCenter: 'your-help-center',
52
- publicKey: 'pk_live_xxx',
27
+ helpCenter: "your-help-center",
28
+ publicKey: "pk_live_xxx",
53
29
 
54
30
  // Optional configuration
55
31
  config: {
56
32
  // Panel configuration
57
33
  panel: {
58
- position: 'right', // 'left' | 'right'
59
- mode: 'overlay', // 'overlay' | 'push'
60
- },
61
-
62
- // Floating button
63
- floatingButton: {
64
- enabled: true,
65
- position: 'bottom-right',
34
+ position: "right", // 'left' | 'right'
35
+ mode: "push", // 'overlay' | 'push'
66
36
  },
67
37
 
68
- // Tooltips
69
- tooltips: {
70
- enabled: true,
71
- trigger: 'hover', // 'hover' | 'click'
38
+ // Edge trigger (sidebar tab that opens the panel)
39
+ edgeTrigger: {
40
+ enabled: true, // Set to false to use your own custom button
72
41
  },
73
42
 
74
43
  // Theme
75
44
  theme: {
76
- mode: 'system', // 'light' | 'dark' | 'system'
45
+ mode: "auto", // 'light' | 'dark' | 'auto'
77
46
  colors: {
78
- primary: '#6366f1',
47
+ primary: "#6366f1",
79
48
  },
80
49
  },
81
50
  },
82
51
  });
83
52
  ```
84
53
 
54
+ ## Custom Trigger Button
55
+
56
+ To use your own button instead of the built-in edge trigger:
57
+
58
+ ```javascript
59
+ Pillar.init({
60
+ helpCenter: "your-help-center",
61
+ publicKey: "pk_live_xxx",
62
+ edgeTrigger: { enabled: false },
63
+ });
64
+
65
+ // Then control the panel programmatically
66
+ document.getElementById("my-help-button").addEventListener("click", () => {
67
+ Pillar.toggle();
68
+ });
69
+ ```
70
+
85
71
  ## Features
86
72
 
87
73
  - **AI Chat**: Embedded AI assistant that understands your product
74
+ - **Edge Trigger**: Built-in sidebar tab to open the help panel (or use your own button)
88
75
  - **Contextual Help**: Show relevant help based on user context
89
- - **Tooltips**: Attach interactive tooltips to any element
90
76
  - **Text Selection**: Allow users to ask questions about selected text
91
77
  - **Customizable UI**: Full control over positioning, theming, and behavior
92
78
 
@@ -52,17 +52,6 @@ export interface ServerEmbedConfig {
52
52
  position?: string;
53
53
  label?: string;
54
54
  };
55
- features?: {
56
- aiChatEnabled?: boolean;
57
- searchEnabled?: boolean;
58
- tooltipsEnabled?: boolean;
59
- };
60
- sidebarTabs?: Array<{
61
- id: string;
62
- label: string;
63
- enabled: boolean;
64
- order: number;
65
- }>;
66
55
  theme?: {
67
56
  colors?: {
68
57
  primary?: string;
@@ -3,13 +3,16 @@
3
3
  * A sidebar-style trigger that reserves space in the layout and slides out with the panel.
4
4
  * The trigger stays visible when panel opens, positioned at the panel's outer edge.
5
5
  */
6
- import type { FloatingButtonPosition, ResolvedConfig } from "../../core/config";
6
+ import type { ResolvedConfig } from "../../core/config";
7
+ import type { EventEmitter } from "../../core/events";
8
+ export type EdgeTriggerPosition = "left" | "right";
7
9
  /**
8
10
  * EdgeTrigger class that manages the edge trigger lifecycle
9
11
  * The trigger stays visible when panel opens, sliding out with it
10
12
  */
11
13
  export declare class EdgeTrigger {
12
14
  private config;
15
+ private events;
13
16
  private onClick;
14
17
  private rootContainer;
15
18
  private container;
@@ -22,13 +25,14 @@ export declare class EdgeTrigger {
22
25
  private unsubscribeActiveTab;
23
26
  private themeObserver;
24
27
  private currentTheme;
25
- constructor(config: ResolvedConfig, onClick: () => void, rootContainer?: HTMLElement | null);
28
+ constructor(config: ResolvedConfig, events: EventEmitter, onClick: () => void, rootContainer?: HTMLElement | null);
26
29
  /**
27
30
  * Handle tab click - sets active tab and opens panel
31
+ * For non-assistant tabs, emits event for customer's code to handle (e.g., Intercom, Zendesk)
28
32
  */
29
33
  private handleTabClick;
30
34
  /**
31
- * Get position as 'left' or 'right' from the floating button position config
35
+ * Get position as 'left' or 'right' from the panel position config
32
36
  */
33
37
  private getEdgePosition;
34
38
  /**
@@ -65,11 +69,7 @@ export declare class EdgeTrigger {
65
69
  /**
66
70
  * Update trigger position
67
71
  */
68
- setPosition(position: FloatingButtonPosition): void;
69
- /**
70
- * Update trigger label
71
- */
72
- setLabel(label: string): void;
72
+ setPosition(position: EdgeTriggerPosition): void;
73
73
  /**
74
74
  * Destroy the trigger
75
75
  */
@@ -1,5 +1,4 @@
1
1
  /**
2
2
  * Button Components Index
3
3
  */
4
- export { FloatingButton } from './FloatingButton';
5
- export { EdgeTrigger } from './EdgeTrigger';
4
+ export { EdgeTrigger, type EdgeTriggerPosition } from './EdgeTrigger';
@@ -2,7 +2,6 @@
2
2
  * Components Index
3
3
  */
4
4
  export { Panel, PanelContent, Header, ChatInput, PANEL_STYLES } from './Panel';
5
- export { FloatingButton } from './Button';
6
5
  export { PillarProvider, usePillar, useAPI, useEvents } from './context';
7
6
  export * from './shared';
8
7
  export * from './Views';
@@ -18,7 +18,7 @@ export declare class Pillar {
18
18
  private _planExecutor;
19
19
  private _textSelectionManager;
20
20
  private _panel;
21
- private _floatingButton;
21
+ private _edgeTrigger;
22
22
  private _initPromise;
23
23
  private _rootContainer;
24
24
  private _unsubscribeHoverMode;
@@ -4,8 +4,6 @@
4
4
  import type { Platform } from '../actions/types';
5
5
  export type PanelPosition = 'left' | 'right';
6
6
  export type PanelMode = 'overlay' | 'push';
7
- export type FloatingButtonPosition = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
8
- export type FloatingButtonStyle = 'floating' | 'edge';
9
7
  export type ThemeMode = 'light' | 'dark' | 'auto';
10
8
  /**
11
9
  * Sidebar tab configuration
@@ -15,6 +13,8 @@ export interface SidebarTabConfig {
15
13
  label: string;
16
14
  enabled: boolean;
17
15
  order: number;
16
+ /** Preset icon for this tab */
17
+ icon?: 'help' | 'support' | 'settings' | 'feedback' | 'chat' | 'calendar' | 'mail';
18
18
  }
19
19
  export declare const DEFAULT_SIDEBAR_TABS: SidebarTabConfig[];
20
20
  /**
@@ -91,18 +91,6 @@ export interface PanelConfig {
91
91
  */
92
92
  hoverBackdrop?: boolean;
93
93
  }
94
- export interface FloatingButtonConfig {
95
- enabled?: boolean;
96
- position?: FloatingButtonPosition;
97
- label?: string;
98
- /**
99
- * Button style:
100
- * - 'edge': Slim vertical tab on screen edge, expands on hover (default)
101
- * - 'floating': Traditional floating pill button
102
- * @default 'edge'
103
- */
104
- style?: FloatingButtonStyle;
105
- }
106
94
  export interface UrlParamsConfig {
107
95
  /** Whether to check URL params for auto-opening the panel (default: true) */
108
96
  enabled?: boolean;
@@ -117,6 +105,14 @@ export interface TextSelectionConfig {
117
105
  /** Label for the popover button (default: 'Ask AI') */
118
106
  label?: string;
119
107
  }
108
+ export interface EdgeTriggerConfig {
109
+ /**
110
+ * Whether to show the edge trigger sidebar tab.
111
+ * When enabled, a slim vertical tab appears on the screen edge that opens the panel.
112
+ * @default true
113
+ */
114
+ enabled?: boolean;
115
+ }
120
116
  export interface UserContext {
121
117
  id?: string;
122
118
  persona?: string;
@@ -138,7 +134,7 @@ export interface PillarConfig {
138
134
  */
139
135
  version?: string;
140
136
  panel?: PanelConfig;
141
- floatingButton?: FloatingButtonConfig;
137
+ edgeTrigger?: EdgeTriggerConfig;
142
138
  urlParams?: UrlParamsConfig;
143
139
  textSelection?: TextSelectionConfig;
144
140
  sidebarTabs?: SidebarTabConfig[];
@@ -189,7 +185,7 @@ export interface ResolvedConfig {
189
185
  /** App version for code-first actions (optional) */
190
186
  version?: string;
191
187
  panel: ResolvedPanelConfig;
192
- floatingButton: Required<FloatingButtonConfig>;
188
+ edgeTrigger: Required<EdgeTriggerConfig>;
193
189
  urlParams: Required<UrlParamsConfig>;
194
190
  textSelection: Required<TextSelectionConfig>;
195
191
  sidebarTabs: SidebarTabConfig[];
@@ -218,12 +214,6 @@ export interface ServerEmbedConfig {
218
214
  position?: string;
219
215
  label?: string;
220
216
  };
221
- features?: {
222
- aiChatEnabled?: boolean;
223
- searchEnabled?: boolean;
224
- tooltipsEnabled?: boolean;
225
- };
226
- sidebarTabs?: SidebarTabConfig[];
227
217
  theme?: {
228
218
  colors?: {
229
219
  primary?: string;
@@ -209,6 +209,14 @@ export interface PillarEvents {
209
209
  'textSelection:change': {
210
210
  enabled: boolean;
211
211
  };
212
+ 'sidebar:click': {
213
+ tabId: string;
214
+ label: string;
215
+ };
216
+ /** @deprecated Use 'sidebar:click' instead. Will be removed in next major version. */
217
+ 'support:request': {
218
+ tabId: string;
219
+ };
212
220
  }
213
221
  export declare class EventEmitter {
214
222
  private listeners;
package/dist/index.d.ts CHANGED
@@ -22,7 +22,7 @@
22
22
  */
23
23
  export { Pillar, type PillarState } from './core/Pillar';
24
24
  export { EventEmitter, type PillarEvents, type TaskExecutePayload, type CardRenderer, type CardCallbacks } from './core/events';
25
- export { type PillarConfig, type ResolvedConfig, type ResolvedPanelConfig, type PanelConfig, type FloatingButtonConfig, type UrlParamsConfig, type TextSelectionConfig, type UserContext, type PanelPosition, type PanelMode, type FloatingButtonPosition, type FloatingButtonStyle, type ThemeMode, type ThemeColors, type ThemeConfig, type ResolvedThemeConfig, type SidebarTabConfig, DEFAULT_SIDEBAR_TABS, } from './core/config';
25
+ export { type PillarConfig, type ResolvedConfig, type ResolvedPanelConfig, type PanelConfig, type EdgeTriggerConfig, type UrlParamsConfig, type TextSelectionConfig, type UserContext, type PanelPosition, type PanelMode, type ThemeMode, type ThemeColors, type ThemeConfig, type ResolvedThemeConfig, type SidebarTabConfig, DEFAULT_SIDEBAR_TABS, } from './core/config';
26
26
  export { type ProductContext, type UserProfile, type Suggestion, type AssistantContext, } from './core/context';
27
27
  export { type PlanStatus, type StepStatus, type ExecutionLocation, type ExecutionPlan, type ExecutionStep, type PlanEvents, } from './core/plan';
28
28
  export { defineActions, setClientInfo, getClientInfo, getHandler, getActionDefinition, hasAction, getActionNames, getManifest, clearRegistry, getActionCount, type ActionType, type ActionDataSchema, type ActionDefinition, type ActionDefinitions, type ActionManifest, type ActionManifestEntry, type ClientInfo, type Platform, type SyncActionDefinition, type SyncActionDefinitions, type ActionTypeDataMap, type NavigateActionData, type TriggerActionData, type InlineUIData, type ExternalLinkData, type CopyTextData, type ActionDataType, type ActionNames, type TypedTaskHandler, type TypedOnTask, type TypedPillarMethods, } from './actions';