ontheway-sdk 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 +110 -0
- package/dist/checklist.cjs +319 -0
- package/dist/checklist.cjs.map +1 -0
- package/dist/checklist.d.cts +58 -0
- package/dist/checklist.d.ts +58 -0
- package/dist/checklist.js +314 -0
- package/dist/checklist.js.map +1 -0
- package/dist/chunk-254YHUN3.cjs +26 -0
- package/dist/chunk-254YHUN3.cjs.map +1 -0
- package/dist/chunk-DDAAVRWG.js +23 -0
- package/dist/chunk-DDAAVRWG.js.map +1 -0
- package/dist/chunk-NRUQU5AR.cjs +94 -0
- package/dist/chunk-NRUQU5AR.cjs.map +1 -0
- package/dist/chunk-OKJ5GEH3.js +358 -0
- package/dist/chunk-OKJ5GEH3.js.map +1 -0
- package/dist/chunk-RNQLNLNI.js +91 -0
- package/dist/chunk-RNQLNLNI.js.map +1 -0
- package/dist/chunk-UE3T6TSM.cjs +361 -0
- package/dist/chunk-UE3T6TSM.cjs.map +1 -0
- package/dist/components.cjs +211 -0
- package/dist/components.cjs.map +1 -0
- package/dist/components.d.cts +51 -0
- package/dist/components.d.ts +51 -0
- package/dist/components.js +205 -0
- package/dist/components.js.map +1 -0
- package/dist/devtools.cjs +733 -0
- package/dist/devtools.cjs.map +1 -0
- package/dist/devtools.d.cts +18 -0
- package/dist/devtools.d.ts +18 -0
- package/dist/devtools.js +727 -0
- package/dist/devtools.js.map +1 -0
- package/dist/index.cjs +19 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +163 -0
- package/dist/index.d.ts +163 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/react.cjs +18 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +68 -0
- package/dist/react.d.ts +68 -0
- package/dist/react.js +5 -0
- package/dist/react.js.map +1 -0
- package/package.json +93 -0
package/dist/react.d.ts
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { OnTheWay } from './index.js';
|
|
4
|
+
|
|
5
|
+
/** Context value exposed by the OnTheWay provider */
|
|
6
|
+
interface OnTheWayContextValue {
|
|
7
|
+
/** SDK instance, null before initialisation */
|
|
8
|
+
otw: OnTheWay | null;
|
|
9
|
+
/** Whether the SDK has finished loading */
|
|
10
|
+
ready: boolean;
|
|
11
|
+
/** Start a tour by slug or ID */
|
|
12
|
+
start: (slugOrId: string) => void;
|
|
13
|
+
/** Reset a specific task */
|
|
14
|
+
reset: (slugOrId: string) => void;
|
|
15
|
+
/** Reset all tasks */
|
|
16
|
+
resetAll: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* Register a condition function for conditional triggers.
|
|
19
|
+
* The function is evaluated during auto-start when the task trigger is `'condition'`.
|
|
20
|
+
*/
|
|
21
|
+
registerCondition: (slug: string, fn: () => boolean) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Re-evaluate conditions and start eligible tours.
|
|
24
|
+
* Call after state changes that might satisfy a condition.
|
|
25
|
+
*/
|
|
26
|
+
checkConditions: () => void;
|
|
27
|
+
/** Check whether a given task has been completed */
|
|
28
|
+
isTaskCompleted: (slugOrId: string) => boolean;
|
|
29
|
+
}
|
|
30
|
+
/** Props for the OnTheWayProvider component */
|
|
31
|
+
interface OnTheWayProviderProps {
|
|
32
|
+
projectId: string;
|
|
33
|
+
apiUrl?: string;
|
|
34
|
+
onComplete?: (taskId: string) => void;
|
|
35
|
+
onSkip?: (taskId: string, stepIndex: number) => void;
|
|
36
|
+
children: ReactNode;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Provides the OnTheWay SDK to descendant components.
|
|
40
|
+
*
|
|
41
|
+
* Wrap your application (or a subtree) with this provider so that
|
|
42
|
+
* `useOnTheWay()` returns the SDK instance.
|
|
43
|
+
*
|
|
44
|
+
* On mount the provider also checks for any pending cross-page tour
|
|
45
|
+
* (persisted in `sessionStorage`) and resumes it automatically.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <OnTheWayProvider projectId="proj_abc">
|
|
50
|
+
* <App />
|
|
51
|
+
* </OnTheWayProvider>
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
declare function OnTheWayProvider({ projectId, apiUrl, onComplete, onSkip, children, }: OnTheWayProviderProps): react_jsx_runtime.JSX.Element;
|
|
55
|
+
/**
|
|
56
|
+
* Access the OnTheWay SDK from any component wrapped by `<OnTheWayProvider>`.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```tsx
|
|
60
|
+
* function HelpButton() {
|
|
61
|
+
* const { start } = useOnTheWay()
|
|
62
|
+
* return <button onClick={() => start('welcome')}>Help</button>
|
|
63
|
+
* }
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
declare function useOnTheWay(): OnTheWayContextValue;
|
|
67
|
+
|
|
68
|
+
export { type OnTheWayContextValue, OnTheWayProvider, type OnTheWayProviderProps, useOnTheWay };
|
package/dist/react.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"react.js"}
|
package/package.json
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ontheway-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Lightweight onboarding SDK based on Driver.js",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/index.d.cts",
|
|
16
|
+
"default": "./dist/index.cjs"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"./react": {
|
|
20
|
+
"import": {
|
|
21
|
+
"types": "./dist/react.d.ts",
|
|
22
|
+
"default": "./dist/react.js"
|
|
23
|
+
},
|
|
24
|
+
"require": {
|
|
25
|
+
"types": "./dist/react.d.cts",
|
|
26
|
+
"default": "./dist/react.cjs"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"./components": {
|
|
30
|
+
"import": {
|
|
31
|
+
"types": "./dist/components.d.ts",
|
|
32
|
+
"default": "./dist/components.js"
|
|
33
|
+
},
|
|
34
|
+
"require": {
|
|
35
|
+
"types": "./dist/components.d.cts",
|
|
36
|
+
"default": "./dist/components.cjs"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"./checklist": {
|
|
40
|
+
"import": {
|
|
41
|
+
"types": "./dist/checklist.d.ts",
|
|
42
|
+
"default": "./dist/checklist.js"
|
|
43
|
+
},
|
|
44
|
+
"require": {
|
|
45
|
+
"types": "./dist/checklist.d.cts",
|
|
46
|
+
"default": "./dist/checklist.cjs"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"./devtools": {
|
|
50
|
+
"import": {
|
|
51
|
+
"types": "./dist/devtools.d.ts",
|
|
52
|
+
"default": "./dist/devtools.js"
|
|
53
|
+
},
|
|
54
|
+
"require": {
|
|
55
|
+
"types": "./dist/devtools.d.cts",
|
|
56
|
+
"default": "./dist/devtools.cjs"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"main": "./dist/index.cjs",
|
|
61
|
+
"module": "./dist/index.js",
|
|
62
|
+
"types": "./dist/index.d.ts",
|
|
63
|
+
"files": [
|
|
64
|
+
"dist"
|
|
65
|
+
],
|
|
66
|
+
"scripts": {
|
|
67
|
+
"build": "tsup",
|
|
68
|
+
"dev": "tsup --watch",
|
|
69
|
+
"typecheck": "tsc --noEmit"
|
|
70
|
+
},
|
|
71
|
+
"peerDependencies": {
|
|
72
|
+
"driver.js": "^1.3.0",
|
|
73
|
+
"react": ">=18.0.0",
|
|
74
|
+
"react-dom": ">=18.0.0"
|
|
75
|
+
},
|
|
76
|
+
"peerDependenciesMeta": {
|
|
77
|
+
"react": {
|
|
78
|
+
"optional": true
|
|
79
|
+
},
|
|
80
|
+
"react-dom": {
|
|
81
|
+
"optional": true
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
"devDependencies": {
|
|
85
|
+
"driver.js": "^1.3.1",
|
|
86
|
+
"react": "^19.0.0",
|
|
87
|
+
"react-dom": "^19.0.0",
|
|
88
|
+
"@types/react": "^19.0.0",
|
|
89
|
+
"@types/react-dom": "^19.0.0",
|
|
90
|
+
"tsup": "^8.0.0",
|
|
91
|
+
"typescript": "^5.7.0"
|
|
92
|
+
}
|
|
93
|
+
}
|