Skip to content

OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.

sdk fixes

Carl-Gerhard Lindesvärd09037969d8f4
diff --git a/apps/web/src/components/ui/key-value.tsx b/apps/web/src/components/ui/key-value.tsx
index dee0c4bd3..6b6f40e39 100644
--- a/apps/web/src/components/ui/key-value.tsx
+++ b/apps/web/src/components/ui/key-value.tsx
@@ -12,9 +12,6 @@ interface KeyValueProps {
export function KeyValue({ href, onClick, name, value }: KeyValueProps) {
const clickable = href || onClick;
const Component = href ? (Link as any) : onClick ? 'button' : 'div';
- if (!isValidElement(value)) {
- return null;
- }
return (
<Component
@@ -40,10 +37,6 @@ export function KeyValue({ href, onClick, name, value }: KeyValueProps) {
export function KeyValueSubtle({ href, onClick, name, value }: KeyValueProps) {
const clickable = href || onClick;
const Component = href ? (Link as any) : onClick ? 'button' : 'div';
- if (!isValidElement(value)) {
- return null;
- }
-
return (
<Component
className="group flex text-[10px] sm:text-xs gap-2 font-medium self-start min-w-0 max-w-full items-center"
diff --git a/packages/sdk-native/index.ts b/packages/sdk-native/index.ts
index be3663060..9d27e89cc 100644
--- a/packages/sdk-native/index.ts
+++ b/packages/sdk-native/index.ts
@@ -5,7 +5,7 @@ import Constants from 'expo-constants';
import type { MixanOptions } from '@mixan/sdk';
import { Mixan } from '@mixan/sdk';
-type MixanNativeOptions = MixanOptions
+type MixanNativeOptions = MixanOptions;
export class MixanNative extends Mixan<MixanNativeOptions> {
constructor(options: MixanNativeOptions) {
diff --git a/packages/sdk-native/package.json b/packages/sdk-native/package.json
index 767cfd487..d061e9887 100644
--- a/packages/sdk-native/package.json
+++ b/packages/sdk-native/package.json
@@ -9,13 +9,13 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
- "@mixan/sdk": "workspace:*",
- "@mixan/types": "workspace:*"
+ "@mixan/sdk": "workspace:*"
},
"devDependencies": {
"@mixan/eslint-config": "workspace:*",
"@mixan/prettier-config": "workspace:*",
"@mixan/tsconfig": "workspace:*",
+ "@mixan/types": "workspace:*",
"eslint": "^8.48.0",
"prettier": "^3.0.3",
"tsup": "^7.2.0",
diff --git a/packages/sdk-native/src/utils.ts b/packages/sdk-native/src/utils.ts
deleted file mode 100644
index e69de29bb..000000000
diff --git a/packages/sdk-next/package.json b/packages/sdk-next/package.json
index af7e888c9..4e8a64e50 100644
--- a/packages/sdk-next/package.json
+++ b/packages/sdk-next/package.json
@@ -11,8 +11,7 @@
},
"dependencies": {
"@mixan/sdk": "workspace:*",
- "@mixan/sdk-web": "workspace:*",
- "@mixan/types": "workspace:*"
+ "@mixan/sdk-web": "workspace:*"
},
"peerDependencies": {
"next": "^13.0.0"
@@ -21,6 +20,7 @@
"@mixan/eslint-config": "workspace:*",
"@mixan/prettier-config": "workspace:*",
"@mixan/tsconfig": "workspace:*",
+ "@mixan/types": "workspace:*",
"eslint": "^8.48.0",
"prettier": "^3.0.3",
"tsup": "^7.2.0",
diff --git a/packages/sdk-web/package.json b/packages/sdk-web/package.json
index 35e33737e..561995601 100644
--- a/packages/sdk-web/package.json
+++ b/packages/sdk-web/package.json
@@ -10,13 +10,13 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
- "@mixan/sdk": "workspace:*",
- "@mixan/types": "workspace:*"
+ "@mixan/sdk": "workspace:*"
},
"devDependencies": {
"@mixan/eslint-config": "workspace:*",
"@mixan/prettier-config": "workspace:*",
"@mixan/tsconfig": "workspace:*",
+ "@mixan/types": "workspace:*",
"eslint": "^8.48.0",
"prettier": "^3.0.3",
"tsup": "^7.2.0",
diff --git a/packages/sdk/index.ts b/packages/sdk/index.ts
index 3b58f863e..33d160f1c 100644
--- a/packages/sdk/index.ts
+++ b/packages/sdk/index.ts
@@ -121,10 +121,6 @@ export class Mixan<Options extends MixanOptions = MixanOptions> {
// Public
- public init(properties?: Record<string, unknown>) {
- this.state.properties = properties ?? {};
- }
-
public setProfileId(profileId: string) {
this.state.profileId = profileId;
}
@@ -206,6 +202,7 @@ export class Mixan<Options extends MixanOptions = MixanOptions> {
public clear() {
this.state.properties = {};
this.state.deviceId = undefined;
+ this.state.profileId = undefined;
if (this.options.removeDeviceId) {
this.options.removeDeviceId();
}
diff --git a/packages/sdk/package.json b/packages/sdk/package.json
index a289886eb..11487d1fc 100644
--- a/packages/sdk/package.json
+++ b/packages/sdk/package.json
@@ -8,13 +8,12 @@
"format": "prettier --check \"**/*.{mjs,ts,md,json}\"",
"typecheck": "tsc --noEmit"
},
- "dependencies": {
- "@mixan/types": "workspace:*"
- },
+ "dependencies": {},
"devDependencies": {
"@mixan/eslint-config": "workspace:*",
"@mixan/prettier-config": "workspace:*",
"@mixan/tsconfig": "workspace:*",
+ "@mixan/types": "workspace:*",
"eslint": "^8.48.0",
"prettier": "^3.0.3",
"tsup": "^7.2.0",
diff --git a/packages/types/package.json b/packages/types/package.json
index 6ebfbe75c..64eff20cb 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -11,6 +11,7 @@
"devDependencies": {
"@mixan/eslint-config": "workspace:*",
"@mixan/prettier-config": "workspace:*",
+ "@mixan/tsconfig": "workspace:*",
"eslint": "^8.48.0",
"prettier": "^3.0.3",
"tsup": "^7.2.0",
diff --git a/packages/types/tsconfig.json b/packages/types/tsconfig.json
index c58ea5710..257bf27ac 100644
--- a/packages/types/tsconfig.json
+++ b/packages/types/tsconfig.json
@@ -1,19 +1,6 @@
{
+ "extends": "@mixan/tsconfig/sdk.json",
"compilerOptions": {
- "lib": ["ESNext"],
- "module": "esnext",
- "target": "esnext",
- "moduleResolution": "bundler",
- "moduleDetection": "force",
- "allowImportingTsExtensions": true,
- "noEmit": true,
- "composite": true,
- "strict": true,
- "downlevelIteration": true,
- "skipLibCheck": true,
- "jsx": "react-jsx",
- "allowSyntheticDefaultImports": true,
- "forceConsistentCasingInFileNames": true,
- "allowJs": true
+ "outDir": "dist"
}
}
diff --git a/packages/types/tsup.config.ts b/packages/types/tsup.config.ts
index b3de6921c..f98b6b5be 100644
--- a/packages/types/tsup.config.ts
+++ b/packages/types/tsup.config.ts
@@ -1,10 +1,9 @@
import { defineConfig } from 'tsup';
+import config from '@mixan/tsconfig/tsup.config.json' assert { type: 'json' };
+
export default defineConfig({
- entry: ['index.ts'],
- format: ['cjs', 'esm'], // Build for commonJS and ESmodules
- dts: true, // Generate declaration file (.d.ts)
- splitting: false,
- sourcemap: false,
- clean: true,
+ ...(config as any),
+ entry: ['index.ts', 'cdn.ts'],
+ format: ['cjs', 'esm', 'iife'],
});
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 4fb5bcacb..8841c44da 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -865,10 +865,6 @@ importers:
version: 5.3.3
packages/sdk:
- dependencies:
- '@mixan/types':
- specifier: workspace:*
- version: link:../types
devDependencies:
'@mixan/eslint-config':
specifier: workspace:*
@@ -879,6 +875,9 @@ importers:
'@mixan/tsconfig':
specifier: workspace:*
version: link:../../tooling/typescript
+ '@mixan/types':
+ specifier: workspace:*
+ version: link:../types
eslint:
specifier: ^8.48.0
version: 8.56.0
@@ -897,9 +896,6 @@ importers:
'@mixan/sdk':
specifier: workspace:*
version: link:../sdk
- '@mixan/types':
- specifier: workspace:*
- version: link:../types
expo-application:
specifier: ~5.3.0
version: 5.3.1([email protected])
@@ -919,6 +915,9 @@ importers:
'@mixan/tsconfig':
specifier: workspace:*
version: link:../../tooling/typescript
+ '@mixan/types':
+ specifier: workspace:*
+ version: link:../types
eslint:
specifier: ^8.48.0
version: 8.56.0
@@ -940,9 +939,6 @@ importers:
'@mixan/sdk-web':
specifier: workspace:*
version: link:../sdk-web
- '@mixan/types':
- specifier: workspace:*
- version: link:../types
next:
specifier: ^13.0.0
@@ -956,6 +952,9 @@ importers:
'@mixan/tsconfig':
specifier: workspace:*
version: link:../../tooling/typescript
+ '@mixan/types':
+ specifier: workspace:*
+ version: link:../types
eslint:
specifier: ^8.48.0
version: 8.56.0
@@ -974,9 +973,6 @@ importers:
'@mixan/sdk':
specifier: workspace:*
version: link:../sdk
- '@mixan/types':
- specifier: workspace:*
- version: link:../types
devDependencies:
'@mixan/eslint-config':
specifier: workspace:*
@@ -987,6 +983,9 @@ importers:
'@mixan/tsconfig':
specifier: workspace:*
version: link:../../tooling/typescript
+ '@mixan/types':
+ specifier: workspace:*
+ version: link:../types
eslint:
specifier: ^8.48.0
version: 8.56.0
@@ -1008,6 +1007,9 @@ importers:
'@mixan/prettier-config':
specifier: workspace:*
version: link:../../tooling/prettier
+ '@mixan/tsconfig':
+ specifier: workspace:*
+ version: link:../../tooling/typescript
eslint:
specifier: ^8.48.0
version: 8.56.0