tour-guide-live 0.1.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 ADDED
@@ -0,0 +1,55 @@
1
+ # tour-guide-live
2
+
3
+ Lightweight React SDK for embedding in-app product tours powered by [Tour Guide Live](https://github.com/masonbullimore/tour-guide-live).
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install tour-guide-live
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ Wrap your app with `TourProvider` and include `TourTooltip`:
14
+
15
+ ```tsx
16
+ import { TourProvider, TourTooltip } from 'tour-guide-live';
17
+
18
+ function App() {
19
+ return (
20
+ <TourProvider
21
+ apiKey="tgl_your_api_key"
22
+ userId="user-123"
23
+ apiBaseUrl="https://your-dashboard.herokuapp.com"
24
+ userAttributes={{ plan: 'pro' }}
25
+ >
26
+ <TourTooltip />
27
+ <YourApp />
28
+ </TourProvider>
29
+ );
30
+ }
31
+ ```
32
+
33
+ ### Props
34
+
35
+ | Prop | Type | Required | Description |
36
+ |------|------|----------|-------------|
37
+ | `apiKey` | `string` | Yes | Your Tour Guide Live API key |
38
+ | `userId` | `string` | Yes | Unique identifier for the current user |
39
+ | `apiBaseUrl` | `string` | No | Dashboard URL (defaults to localhost:3000) |
40
+ | `userAttributes` | `Record<string, unknown>` | No | User attributes for tour targeting |
41
+
42
+ ### Hooks
43
+
44
+ ```tsx
45
+ import { useTour } from 'tour-guide-live';
46
+
47
+ function MyComponent() {
48
+ const { startTour, endTour, currentStep } = useTour();
49
+ // ...
50
+ }
51
+ ```
52
+
53
+ ## License
54
+
55
+ MIT
@@ -0,0 +1,67 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React$1 from 'react';
3
+
4
+ type Tour = {
5
+ id: string;
6
+ name: string;
7
+ status: 'draft' | 'active';
8
+ steps: Step[];
9
+ targeting: TargetingRules;
10
+ createdAt: string;
11
+ };
12
+ type Step = {
13
+ id: string;
14
+ title: string;
15
+ body: string;
16
+ target: string;
17
+ placement: 'top' | 'bottom' | 'left' | 'right';
18
+ spotlight: boolean;
19
+ completionTrigger: 'next-button' | 'element-click' | 'url-change' | 'manual';
20
+ urlTrigger?: string;
21
+ imageUrl?: string;
22
+ };
23
+ type TargetingRules = {
24
+ urlPattern?: string;
25
+ conditions: AttributeCondition[];
26
+ trigger: 'on-page-load' | 'on-element-click';
27
+ triggerSelector?: string;
28
+ frequency: 'once' | 'until-complete' | 'every-session';
29
+ };
30
+ type AttributeCondition = {
31
+ key: string;
32
+ op: '==' | '!=' | '>' | '<' | '>=' | '<=';
33
+ value: string | number | boolean;
34
+ };
35
+ type UserProgress = {
36
+ userId: string;
37
+ tourId: string;
38
+ completedSteps: number[];
39
+ skipped: boolean;
40
+ completedAt: string | null;
41
+ };
42
+ type TourProviderProps = {
43
+ apiKey: string;
44
+ userId: string;
45
+ userAttributes?: Record<string, unknown>;
46
+ apiBaseUrl?: string;
47
+ children: React.ReactNode;
48
+ };
49
+ type TourContextValue = {
50
+ startTour: (tourId: string) => void;
51
+ endTour: () => void;
52
+ goToStep: (stepIndex: number) => void;
53
+ completeStep: () => void;
54
+ skipTour: () => void;
55
+ currentStep: Step | null;
56
+ currentStepIndex: number;
57
+ activeTourId: string | null;
58
+ activeTour: Tour | null;
59
+ isActive: boolean;
60
+ };
61
+
62
+ declare function TourProvider({ apiKey, userId, userAttributes, apiBaseUrl, children, }: TourProviderProps): react_jsx_runtime.JSX.Element;
63
+ declare function useTour(): TourContextValue;
64
+
65
+ declare function TourTooltip(): React$1.ReactPortal | null;
66
+
67
+ export { type AttributeCondition, type Step, type TargetingRules, type Tour, type TourContextValue, TourProvider, type TourProviderProps, TourTooltip, type UserProgress, useTour };
@@ -0,0 +1,67 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React$1 from 'react';
3
+
4
+ type Tour = {
5
+ id: string;
6
+ name: string;
7
+ status: 'draft' | 'active';
8
+ steps: Step[];
9
+ targeting: TargetingRules;
10
+ createdAt: string;
11
+ };
12
+ type Step = {
13
+ id: string;
14
+ title: string;
15
+ body: string;
16
+ target: string;
17
+ placement: 'top' | 'bottom' | 'left' | 'right';
18
+ spotlight: boolean;
19
+ completionTrigger: 'next-button' | 'element-click' | 'url-change' | 'manual';
20
+ urlTrigger?: string;
21
+ imageUrl?: string;
22
+ };
23
+ type TargetingRules = {
24
+ urlPattern?: string;
25
+ conditions: AttributeCondition[];
26
+ trigger: 'on-page-load' | 'on-element-click';
27
+ triggerSelector?: string;
28
+ frequency: 'once' | 'until-complete' | 'every-session';
29
+ };
30
+ type AttributeCondition = {
31
+ key: string;
32
+ op: '==' | '!=' | '>' | '<' | '>=' | '<=';
33
+ value: string | number | boolean;
34
+ };
35
+ type UserProgress = {
36
+ userId: string;
37
+ tourId: string;
38
+ completedSteps: number[];
39
+ skipped: boolean;
40
+ completedAt: string | null;
41
+ };
42
+ type TourProviderProps = {
43
+ apiKey: string;
44
+ userId: string;
45
+ userAttributes?: Record<string, unknown>;
46
+ apiBaseUrl?: string;
47
+ children: React.ReactNode;
48
+ };
49
+ type TourContextValue = {
50
+ startTour: (tourId: string) => void;
51
+ endTour: () => void;
52
+ goToStep: (stepIndex: number) => void;
53
+ completeStep: () => void;
54
+ skipTour: () => void;
55
+ currentStep: Step | null;
56
+ currentStepIndex: number;
57
+ activeTourId: string | null;
58
+ activeTour: Tour | null;
59
+ isActive: boolean;
60
+ };
61
+
62
+ declare function TourProvider({ apiKey, userId, userAttributes, apiBaseUrl, children, }: TourProviderProps): react_jsx_runtime.JSX.Element;
63
+ declare function useTour(): TourContextValue;
64
+
65
+ declare function TourTooltip(): React$1.ReactPortal | null;
66
+
67
+ export { type AttributeCondition, type Step, type TargetingRules, type Tour, type TourContextValue, TourProvider, type TourProviderProps, TourTooltip, type UserProgress, useTour };