add native and web sdks

This commit is contained in:
Carl-Gerhard Lindesvärd
2023-11-06 08:52:58 +01:00
parent ce26b24c1b
commit 4ddafcad07
33 changed files with 812 additions and 68 deletions

View 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,
});
}
}

View 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"
}

View File

View File

@@ -0,0 +1,6 @@
{
"extends": "@mixan/tsconfig/sdk.json",
"compilerOptions": {
"outDir": "dist"
}
}

View 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);