@leanbase.com/js 0.1.0 → 0.1.2
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 +9 -21
- package/dist/index.cjs +2974 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +760 -11
- package/dist/index.mjs +2975 -61
- package/dist/index.mjs.map +1 -1
- package/dist/leanbase.iife.js +3091 -134
- package/dist/leanbase.iife.js.map +1 -1
- package/package.json +1 -2
- package/src/autocapture-utils.ts +550 -0
- package/src/autocapture.ts +415 -0
- package/src/config.ts +8 -0
- package/src/constants.ts +98 -0
- package/src/extensions/rageclick.ts +34 -0
- package/src/iife.ts +31 -27
- package/src/index.ts +1 -1
- package/src/leanbase-logger.ts +7 -4
- package/src/leanbase-persistence.ts +374 -0
- package/src/leanbase.ts +366 -71
- package/src/page-view.ts +124 -0
- package/src/scroll-manager.ts +103 -0
- package/src/session-props.ts +114 -0
- package/src/sessionid.ts +330 -0
- package/src/storage.ts +410 -0
- package/src/types.ts +634 -0
- package/src/utils/blocked-uas.ts +162 -0
- package/src/utils/element-utils.ts +50 -0
- package/src/utils/event-utils.ts +304 -0
- package/src/utils/index.ts +222 -0
- package/src/utils/request-utils.ts +128 -0
- package/src/utils/simple-event-emitter.ts +27 -0
- package/src/utils/user-agent-utils.ts +357 -0
- package/src/uuidv7.ts +268 -0
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -5,15 +5,15 @@ Lightweight browser SDK for Leanbase - event tracking, autocapture, and session
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install @leanbase/js
|
|
8
|
+
npm install @leanbase.com/js
|
|
9
9
|
# or
|
|
10
|
-
pnpm add @leanbase/js
|
|
10
|
+
pnpm add @leanbase.com/js
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Quick Start
|
|
14
14
|
|
|
15
15
|
```javascript
|
|
16
|
-
import { Leanbase } from '@leanbase/js'
|
|
16
|
+
import { Leanbase } from '@leanbase.com/js'
|
|
17
17
|
|
|
18
18
|
// Initialize with your API key
|
|
19
19
|
const leanbase = new Leanbase('your-api-key')
|
|
@@ -36,7 +36,7 @@ leanbase.identify('user-123', {
|
|
|
36
36
|
Include the prebuilt IIFE bundle from a CDN and use the global `leanbase` object. Call `leanbase.init('<apiKey>', options)` once, then use `leanbase.capture(...)` and friends.
|
|
37
37
|
|
|
38
38
|
```html
|
|
39
|
-
<script src="https://unpkg.com/@leanbase/js/dist/leanbase.iife.js"></script>
|
|
39
|
+
<script src="https://unpkg.com/@leanbase.com/js/dist/leanbase.iife.js"></script>
|
|
40
40
|
<script>
|
|
41
41
|
// Initialize with your API key
|
|
42
42
|
leanbase.init('your-api-key', { host: 'https://i.leanbase.co' })
|
|
@@ -49,7 +49,7 @@ Include the prebuilt IIFE bundle from a CDN and use the global `leanbase` object
|
|
|
49
49
|
Alternatively via jsDelivr:
|
|
50
50
|
|
|
51
51
|
```html
|
|
52
|
-
<script src="https://cdn.jsdelivr.net/npm/@leanbase/js/dist/leanbase.iife.js"></script>
|
|
52
|
+
<script src="https://cdn.jsdelivr.net/npm/@leanbase.com/js/dist/leanbase.iife.js"></script>
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
## Configuration
|
|
@@ -106,18 +106,6 @@ Create an alias for the current user.
|
|
|
106
106
|
leanbase.alias('user-123')
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
### Feature Flags
|
|
110
|
-
|
|
111
|
-
```javascript
|
|
112
|
-
// Check if a feature is enabled
|
|
113
|
-
const isEnabled = leanbase.isFeatureEnabled('new-feature')
|
|
114
|
-
|
|
115
|
-
// Get feature flag value with fallback
|
|
116
|
-
const variant = leanbase.getFeatureFlag('experiment-variant', 'control')
|
|
117
|
-
|
|
118
|
-
// Reload feature flags
|
|
119
|
-
await leanbase.reloadFeatureFlags()
|
|
120
|
-
```
|
|
121
109
|
|
|
122
110
|
## Publishing
|
|
123
111
|
|
|
@@ -126,7 +114,7 @@ This monorepo uses [Changesets](https://github.com/changesets/changesets) for ve
|
|
|
126
114
|
|
|
127
115
|
To bump the version:
|
|
128
116
|
1. Create a changeset: `pnpm changeset add`
|
|
129
|
-
- Select `@leanbase/js` package
|
|
117
|
+
- Select `@leanbase.com/js` package
|
|
130
118
|
- Choose version bump type (patch, minor, major)
|
|
131
119
|
- Add a description of changes
|
|
132
120
|
2. Commit the changeset file (`.changeset/*.md`)
|
|
@@ -145,10 +133,10 @@ Added IIFE build for script-tag usage and improved documentation.
|
|
|
145
133
|
### Publishing to NPM
|
|
146
134
|
1. Ensure you have an NPM token with publish permissions
|
|
147
135
|
2. Set the token: `export NPM_TOKEN=your_token`
|
|
148
|
-
3. Publish: `pnpm --filter=@leanbase/js publish`
|
|
149
|
-
4. Or test first: `pnpm --filter=@leanbase/js exec npm publish --dry-run`
|
|
136
|
+
3. Publish: `pnpm --filter=@leanbase.com/js publish`
|
|
137
|
+
4. Or test first: `pnpm --filter=@leanbase.com/js exec npm publish --dry-run`
|
|
150
138
|
|
|
151
|
-
The package will be published to https://www.npmjs.com/package/@leanbase/js
|
|
139
|
+
The package will be published to https://www.npmjs.com/package/@leanbase.com/js
|
|
152
140
|
|
|
153
141
|
## License
|
|
154
142
|
|