@leanbase-giangnd/js 0.0.0 → 0.0.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/LICENSE +37 -0
- package/dist/index.cjs +24 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +24 -1
- package/dist/index.mjs.map +1 -1
- package/dist/leanbase.iife.js +29 -3
- package/dist/leanbase.iife.js.map +1 -1
- package/package.json +46 -47
- package/src/leanbase.ts +26 -0
- package/src/version.ts +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Copyright 2025 Leanflag Limited
|
|
2
|
+
This project is a fork of PostHog/posthog-js.
|
|
3
|
+
|
|
4
|
+
All rights reserved. This software is proprietary to Leanflag Limited and may only be used for Leanflag Limited products and internal purposes. Redistribution, modification, or commercial use outside of Leanflag Limited is strictly prohibited without explicit written permission from Leanflag Limited.
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
Copyright 2020 Posthog / Hiberly, Inc.
|
|
10
|
+
|
|
11
|
+
Copyright 2015 Mixpanel, Inc.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
Some files in this codebase contain code from getsentry/sentry-javascript by Software, Inc. dba Sentry.
|
|
15
|
+
In such cases it is explicitly stated in the file header. This license only applies to the relevant code in such cases.
|
|
16
|
+
|
|
17
|
+
MIT License
|
|
18
|
+
|
|
19
|
+
Copyright (c) 2012 Functional Software, Inc. dba Sentry
|
|
20
|
+
|
|
21
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
22
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
23
|
+
the Software without restriction, including without limitation the rights to
|
|
24
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
25
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
26
|
+
so, subject to the following conditions:
|
|
27
|
+
|
|
28
|
+
The above copyright notice and this permission notice shall be included in all
|
|
29
|
+
copies or substantial portions of the Software.
|
|
30
|
+
|
|
31
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
32
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
33
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
34
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
35
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
36
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
37
|
+
SOFTWARE.
|
package/dist/index.cjs
CHANGED
|
@@ -1185,7 +1185,7 @@ const detectDeviceType = function (user_agent) {
|
|
|
1185
1185
|
}
|
|
1186
1186
|
};
|
|
1187
1187
|
|
|
1188
|
-
var version = "0.0.
|
|
1188
|
+
var version = "0.0.2";
|
|
1189
1189
|
var packageInfo = {
|
|
1190
1190
|
version: version};
|
|
1191
1191
|
|
|
@@ -5822,6 +5822,29 @@ class Leanbase extends core.PostHogCore {
|
|
|
5822
5822
|
if (!fetchFn) {
|
|
5823
5823
|
return Promise.reject(new Error('Fetch API is not available in this environment.'));
|
|
5824
5824
|
}
|
|
5825
|
+
try {
|
|
5826
|
+
const isPost = !options.method || options.method.toUpperCase() === 'POST';
|
|
5827
|
+
const isBatchEndpoint = typeof url === 'string' && url.endsWith('/batch/');
|
|
5828
|
+
if (isPost && isBatchEndpoint && options && options.body) {
|
|
5829
|
+
let parsed = null;
|
|
5830
|
+
try {
|
|
5831
|
+
const bodyString = typeof options.body === 'string' ? options.body : String(options.body);
|
|
5832
|
+
parsed = JSON.parse(bodyString);
|
|
5833
|
+
} catch {
|
|
5834
|
+
parsed = null;
|
|
5835
|
+
}
|
|
5836
|
+
if (parsed && core.isArray(parsed.batch)) {
|
|
5837
|
+
const hasSnapshot = parsed.batch.some(item => item && item.event === '$snapshot');
|
|
5838
|
+
if (hasSnapshot) {
|
|
5839
|
+
const host = this.config && this.config.host || '';
|
|
5840
|
+
const newUrl = host ? `${host.replace(/\/$/, '')}/s/` : url;
|
|
5841
|
+
return fetchFn(newUrl, options);
|
|
5842
|
+
}
|
|
5843
|
+
}
|
|
5844
|
+
}
|
|
5845
|
+
} catch {
|
|
5846
|
+
return fetchFn(url, options);
|
|
5847
|
+
}
|
|
5825
5848
|
return fetchFn(url, options);
|
|
5826
5849
|
}
|
|
5827
5850
|
setConfig(config) {
|