add native and web sdks
This commit is contained in:
28
packages/sdk-native/index.ts
Normal file
28
packages/sdk-native/index.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import type { NewMixanOptions } from '@mixan/sdk';
|
||||
import { Mixan } from '@mixan/sdk';
|
||||
|
||||
export class MixanNative extends Mixan {
|
||||
constructor(options: NewMixanOptions) {
|
||||
super(options);
|
||||
}
|
||||
|
||||
async properties() {
|
||||
return {
|
||||
ip: await super.ip(),
|
||||
};
|
||||
}
|
||||
|
||||
async init(properties: Record<string, unknown>) {
|
||||
super.init({
|
||||
...(await this.properties()),
|
||||
...(properties ?? {}),
|
||||
});
|
||||
}
|
||||
|
||||
screenView(route: string, properties?: Record<string, unknown>): void {
|
||||
super.event('screen_view', {
|
||||
...properties,
|
||||
route: route,
|
||||
});
|
||||
}
|
||||
}
|
||||
31
packages/sdk-native/package.json
Normal file
31
packages/sdk-native/package.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"name": "@mixan/sdk-native",
|
||||
"version": "0.0.1",
|
||||
"module": "index.ts",
|
||||
"scripts": {
|
||||
"build": "rm -rf dist && tsup",
|
||||
"lint": "eslint .",
|
||||
"format": "prettier --check \"**/*.{mjs,ts,md,json}\"",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@mixan/sdk": "workspace:*",
|
||||
"@mixan/types": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@mixan/eslint-config": "workspace:*",
|
||||
"@mixan/prettier-config": "workspace:*",
|
||||
"@mixan/tsconfig": "workspace:*",
|
||||
"eslint": "^8.48.0",
|
||||
"prettier": "^3.0.3",
|
||||
"tsup": "^7.2.0",
|
||||
"typescript": "^5.2.2"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"extends": [
|
||||
"@mixan/eslint-config/base"
|
||||
]
|
||||
},
|
||||
"prettier": "@mixan/prettier-config"
|
||||
}
|
||||
0
packages/sdk-native/src/utils.ts
Normal file
0
packages/sdk-native/src/utils.ts
Normal file
6
packages/sdk-native/tsconfig.json
Normal file
6
packages/sdk-native/tsconfig.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "@mixan/tsconfig/sdk.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist"
|
||||
}
|
||||
}
|
||||
7
packages/sdk-native/tsup.config.ts
Normal file
7
packages/sdk-native/tsup.config.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { defineConfig } from 'tsup';
|
||||
|
||||
import config from '@mixan/tsconfig/tsup.config.json' assert {
|
||||
type: 'json'
|
||||
}
|
||||
|
||||
export default defineConfig(config as any);
|
||||
Reference in New Issue
Block a user