@eventop/sdk 1.0.5 → 1.0.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.
Files changed (46) hide show
  1. package/dist/index.cjs +4 -4
  2. package/dist/index.d.ts +259 -0
  3. package/dist/index.js +4 -4
  4. package/dist/react/index.cjs +473 -0
  5. package/dist/react/index.d.ts +208 -0
  6. package/dist/react/index.js +467 -0
  7. package/package.json +1 -1
  8. package/dist/cjs/client.js +0 -54
  9. package/dist/cjs/errors.js +0 -28
  10. package/dist/cjs/index.js +0 -32
  11. package/dist/cjs/resources/checkout.js +0 -18
  12. package/dist/cjs/resources/customers.js +0 -1
  13. package/dist/cjs/resources/subscriptions.js +0 -18
  14. package/dist/cjs/resources/webhooks.js +0 -60
  15. package/dist/cjs/types.js +0 -2
  16. package/dist/client.js +0 -63
  17. package/dist/errors.js +0 -33
  18. package/dist/esm/client.js +0 -45
  19. package/dist/esm/errors.js +0 -26
  20. package/dist/esm/index.js +0 -14
  21. package/dist/esm/resources/checkout.js +0 -14
  22. package/dist/esm/resources/customers.js +0 -1
  23. package/dist/esm/resources/subscriptions.js +0 -14
  24. package/dist/esm/resources/webhooks.js +0 -23
  25. package/dist/esm/types.js +0 -1
  26. package/dist/resources/checkout.js +0 -33
  27. package/dist/resources/customers.js +0 -1
  28. package/dist/resources/subscriptions.js +0 -33
  29. package/dist/resources/webhooks.js +0 -60
  30. package/dist/types/client.d.ts +0 -9
  31. package/dist/types/client.d.ts.map +0 -1
  32. package/dist/types/errors.d.ts +0 -15
  33. package/dist/types/errors.d.ts.map +0 -1
  34. package/dist/types/index.d.ts +0 -13
  35. package/dist/types/index.d.ts.map +0 -1
  36. package/dist/types/resources/checkout.d.ts +0 -10
  37. package/dist/types/resources/checkout.d.ts.map +0 -1
  38. package/dist/types/resources/customers.d.ts +0 -1
  39. package/dist/types/resources/customers.d.ts.map +0 -1
  40. package/dist/types/resources/subscriptions.d.ts +0 -10
  41. package/dist/types/resources/subscriptions.d.ts.map +0 -1
  42. package/dist/types/resources/webhooks.d.ts +0 -9
  43. package/dist/types/resources/webhooks.d.ts.map +0 -1
  44. package/dist/types/types.d.ts +0 -44
  45. package/dist/types/types.d.ts.map +0 -1
  46. package/dist/types.js +0 -2
package/dist/index.cjs CHANGED
@@ -30,16 +30,16 @@ function useFeatureScope() {
30
30
  *
31
31
  * The live map of everything currently mounted in the React tree.
32
32
  *
33
- * Features — registered by ShepherdTarget
34
- * Flow steps — registered by ShepherdStep, attached to a feature by id
33
+ * Features — registered by EventopTarget
34
+ * Flow steps — registered by EventopStep, attached to a feature by id
35
35
  *
36
36
  * Both features and steps can live anywhere in the component tree.
37
- * They don't need to be co-located. A ShepherdStep just needs to know
37
+ * They don't need to be co-located. An EventopStep just needs to know
38
38
  * which feature id it belongs to.
39
39
  *
40
40
  * Nested steps:
41
41
  * Steps can themselves have children steps (sub-steps) by passing
42
- * a parentStep prop to ShepherdStep. This lets you model flows like:
42
+ * a parentStep prop to EventopStep. This lets you model flows like:
43
43
  *
44
44
  * Feature: "Create styled text"
45
45
  * Step 0: Click Add Text
@@ -0,0 +1,259 @@
1
+ // ─── Step ────────────────────────────────────────────────────────────────────
2
+
3
+ export interface Step {
4
+ id?: string;
5
+ title: string;
6
+ text: string;
7
+ selector?: string;
8
+ position?: 'top' | 'bottom' | 'left' | 'right' | 'auto';
9
+ }
10
+
11
+ // ─── AdvanceOn ───────────────────────────────────────────────────────────────
12
+
13
+ export interface AdvanceOn {
14
+ /** CSS selector for the element to listen on. Defaults to the feature element. */
15
+ selector?: string;
16
+ /** DOM event name e.g. 'click', 'blur', 'change' */
17
+ event: string;
18
+ /** Milliseconds to wait before advancing (default: 300) */
19
+ delay?: number;
20
+ }
21
+
22
+ // ─── Flow step (multi-step feature) ──────────────────────────────────────────
23
+
24
+ export interface FlowStep {
25
+ /** CSS selector for this step's target element */
26
+ selector?: string;
27
+ /** Wait for this selector to appear in the DOM before showing the step */
28
+ waitFor?: string | null;
29
+ /** Auto-advance config */
30
+ advanceOn?: AdvanceOn | null;
31
+ }
32
+
33
+ // ─── Screen ──────────────────────────────────────────────────────────────────
34
+
35
+ export interface Screen {
36
+ /** Unique screen identifier */
37
+ id: string;
38
+ /** Returns true if the user is currently on this screen */
39
+ check: () => boolean;
40
+ /** Navigate to this screen. Can be async. */
41
+ navigate?: () => void | Promise<void>;
42
+ /** CSS selector to wait for after navigating */
43
+ waitFor?: string;
44
+ }
45
+
46
+ // ─── Feature ─────────────────────────────────────────────────────────────────
47
+
48
+ export interface Feature {
49
+ /** Unique feature id — referenced by the AI when building tour steps */
50
+ id: string;
51
+ /** Human-readable name the AI reads to understand the feature */
52
+ name: string;
53
+ /** What the feature does — AI uses this to match user intent */
54
+ description?: string;
55
+ /** CSS selector for the feature's primary DOM element */
56
+ selector: string;
57
+ /** Additional related selectors for context */
58
+ relatedSelectors?: Record<string, string>;
59
+ /** Auto-advance when this event fires */
60
+ advanceOn?: AdvanceOn | null;
61
+ /** Wait for this selector before showing the step */
62
+ waitFor?: string | null;
63
+ /**
64
+ * Multi-step flow. Each entry is a sequential sub-step.
65
+ * Developer lists selectors; AI generates the copy for each.
66
+ */
67
+ flow?: FlowStep[];
68
+ /**
69
+ * Screen this feature lives on.
70
+ * SDK navigates to the correct screen before showing the step.
71
+ */
72
+ screen?: Screen;
73
+ }
74
+
75
+ // ─── Theme ───────────────────────────────────────────────────────────────────
76
+
77
+ export interface ThemeTokens {
78
+ accent?: string;
79
+ accentSecondary?: string;
80
+ bg?: string;
81
+ surface?: string;
82
+ border?: string;
83
+ text?: string;
84
+ textDim?: string;
85
+ radius?: string;
86
+ fontFamily?: string;
87
+ }
88
+
89
+ export interface Theme {
90
+ /** 'auto' reads prefers-color-scheme. Default: 'auto' */
91
+ mode?: 'auto' | 'light' | 'dark';
92
+ /** Named preset. Overridden by tokens if both are provided. */
93
+ preset?: 'default' | 'minimal' | 'soft';
94
+ /** Override individual design tokens */
95
+ tokens?: ThemeTokens;
96
+ }
97
+
98
+ // ─── Position ────────────────────────────────────────────────────────────────
99
+
100
+ export interface Position {
101
+ /** Which corner to anchor the chat bubble. Default: 'bottom-right' */
102
+ corner?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
103
+ /** Horizontal offset in px. Default: 28 */
104
+ offsetX?: number;
105
+ /** Vertical offset in px. Default: 28 */
106
+ offsetY?: number;
107
+ }
108
+
109
+ // ─── Config ──────────────────────────────────────────────────────────────────
110
+
111
+ export interface Config {
112
+ /** Your app's display name. Required. */
113
+ appName: string;
114
+ /** Name shown in the chat header. Default: 'AI Guide' */
115
+ assistantName?: string;
116
+ /** Feature definitions the AI can reference. Required. */
117
+ features: Feature[];
118
+ /** Clickable suggestion chips shown on first open */
119
+ suggestions?: string[];
120
+ theme?: Theme;
121
+ position?: Position;
122
+ /** @internal — set by provider factories */
123
+ _providerName?: string;
124
+ }
125
+
126
+ // ─── Provider ────────────────────────────────────────────────────────────────
127
+
128
+ export interface ProviderArgs {
129
+ systemPrompt: string;
130
+ messages: Array<{ role: 'user' | 'assistant'; content: string }>;
131
+ }
132
+
133
+ export interface ProviderResult {
134
+ message: string;
135
+ steps: Step[];
136
+ }
137
+
138
+ export type ProviderFn = (args: ProviderArgs) => Promise<ProviderResult>;
139
+
140
+ export interface ClaudeOptions {
141
+ apiKey: string;
142
+ /** Default: 'claude-sonnet-4-20250514' */
143
+ model?: string;
144
+ }
145
+
146
+ export interface OpenAIOptions {
147
+ apiKey: string;
148
+ /** Default: 'gpt-4o' */
149
+ model?: string;
150
+ }
151
+
152
+ export interface GeminiOptions {
153
+ apiKey: string;
154
+ /** Default: 'gemini-2.5-flash' */
155
+ model?: string;
156
+ }
157
+
158
+ export interface Providers {
159
+ /**
160
+ * Anthropic Claude provider.
161
+ * @warning Never use apiKey in client-side code. Use providers.custom() in production.
162
+ */
163
+ claude(opts: ClaudeOptions): ProviderFn;
164
+ /**
165
+ * OpenAI provider.
166
+ * @warning Never use apiKey in client-side code. Use providers.custom() in production.
167
+ */
168
+ openai(opts: OpenAIOptions): ProviderFn;
169
+ /**
170
+ * Google Gemini provider.
171
+ * @warning Never use apiKey in client-side code. Use providers.custom() in production.
172
+ */
173
+ gemini(opts: GeminiOptions): ProviderFn;
174
+ /**
175
+ * Custom provider — proxy through your own server.
176
+ * Recommended for production. Keeps API keys off the browser.
177
+ *
178
+ * @example
179
+ * providers.custom(async ({ systemPrompt, messages }) => {
180
+ * const res = await fetch('/api/guide', {
181
+ * method: 'POST',
182
+ * headers: { 'Content-Type': 'application/json' },
183
+ * body: JSON.stringify({ systemPrompt, messages }),
184
+ * });
185
+ * return res.json();
186
+ * })
187
+ */
188
+ custom(fn: ProviderFn): ProviderFn;
189
+ }
190
+
191
+ // ─── Init options ─────────────────────────────────────────────────────────────
192
+
193
+ export interface InitOptions {
194
+ provider: ProviderFn;
195
+ config: Config;
196
+ }
197
+
198
+ // ─── Main SDK ────────────────────────────────────────────────────────────────
199
+
200
+ export interface EventopSDK {
201
+ providers: Providers;
202
+
203
+ /** Initialize the SDK. Must be called once before any other method. */
204
+ init(opts: InitOptions): void;
205
+
206
+ /** Open the chat panel */
207
+ open(): void;
208
+
209
+ /** Close the chat panel */
210
+ close(): void;
211
+
212
+ /**
213
+ * Run a tour manually, bypassing the AI.
214
+ * Useful for testing or hardcoded flows.
215
+ */
216
+ runTour(steps: Step[], options?: { showProgress?: boolean; waitTimeout?: number }): Promise<void>;
217
+
218
+ /**
219
+ * Hard cancel the active tour.
220
+ * Clears all pause state — no resume available after this.
221
+ */
222
+ cancelTour(): void;
223
+
224
+ /**
225
+ * Resume a paused tour from where the user left off.
226
+ * Called automatically by the resume button in the chat panel.
227
+ */
228
+ resumeTour(): void;
229
+
230
+ /**
231
+ * Advance the current tour step programmatically.
232
+ * Call after async validation succeeds.
233
+ *
234
+ * @example
235
+ * const ok = await validateEmail(email);
236
+ * if (ok) EventopAI.stepComplete();
237
+ */
238
+ stepComplete(): void;
239
+
240
+ /**
241
+ * Block tour advancement and show an inline error in the current step tooltip.
242
+ *
243
+ * @example
244
+ * EventopAI.stepFail('Please enter a valid email address.');
245
+ */
246
+ stepFail(message: string): void;
247
+
248
+ /** Returns true if a tour is currently running */
249
+ isActive(): boolean;
250
+
251
+ /** Returns true if a tour is paused (cancelled but resumable) */
252
+ isPaused(): boolean;
253
+
254
+ /** @internal — used by the React/Vue packages to sync live feature registry */
255
+ _updateConfig(partial: Partial<Config>): void;
256
+ }
257
+
258
+ declare const EventopAI: EventopSDK;
259
+ export default EventopAI;
package/dist/index.js CHANGED
@@ -28,16 +28,16 @@ function useFeatureScope() {
28
28
  *
29
29
  * The live map of everything currently mounted in the React tree.
30
30
  *
31
- * Features — registered by ShepherdTarget
32
- * Flow steps — registered by ShepherdStep, attached to a feature by id
31
+ * Features — registered by EventopTarget
32
+ * Flow steps — registered by EventopStep, attached to a feature by id
33
33
  *
34
34
  * Both features and steps can live anywhere in the component tree.
35
- * They don't need to be co-located. A ShepherdStep just needs to know
35
+ * They don't need to be co-located. An EventopStep just needs to know
36
36
  * which feature id it belongs to.
37
37
  *
38
38
  * Nested steps:
39
39
  * Steps can themselves have children steps (sub-steps) by passing
40
- * a parentStep prop to ShepherdStep. This lets you model flows like:
40
+ * a parentStep prop to EventopStep. This lets you model flows like:
41
41
  *
42
42
  * Feature: "Create styled text"
43
43
  * Step 0: Click Add Text