rename mixan to OPENPANEL!

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-03-11 13:40:46 +01:00
parent 6d4f9010d4
commit e6c0bc2ec8
201 changed files with 1193 additions and 1047 deletions

View File

@@ -1,11 +1,11 @@
import Script from 'next/script';
import type {
MixanEventOptions,
MixanWebOptions,
OpenpanelEventOptions,
OpenpanelWebOptions,
PostEventPayload,
UpdateProfilePayload,
} from '@mixan/web';
} from '@openpanel/web';
const CDN_URL = 'http://localhost:3002/op.js';
@@ -27,7 +27,7 @@ declare global {
}
}
type OpenpanelProviderProps = MixanWebOptions & {
type OpenpanelProviderProps = OpenpanelWebOptions & {
profileId?: string;
cdnUrl?: string;
};
@@ -98,7 +98,7 @@ export function setProfileId(profileId: string) {
export function increment(
property: string,
value: number,
options?: MixanEventOptions
options?: OpenpanelEventOptions
) {
window.op('increment', property, value, options);
}
@@ -106,7 +106,7 @@ export function increment(
export function decrement(
property: string,
value: number,
options?: MixanEventOptions
options?: OpenpanelEventOptions
) {
window.op('decrement', property, value, options);
}

View File

@@ -1,5 +1,5 @@
{
"name": "@mixan/nextjs",
"name": "@openpanel/nextjs",
"version": "0.0.1",
"module": "index.ts",
"scripts": {
@@ -10,16 +10,16 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@mixan/sdk": "workspace:*",
"@mixan/web": "workspace:*"
"@openpanel/sdk": "workspace:*",
"@openpanel/web": "workspace:*"
},
"peerDependencies": {
"next": "^13.0.0"
},
"devDependencies": {
"@mixan/eslint-config": "workspace:*",
"@mixan/prettier-config": "workspace:*",
"@mixan/tsconfig": "workspace:*",
"@openpanel/eslint-config": "workspace:*",
"@openpanel/prettier-config": "workspace:*",
"@openpanel/tsconfig": "workspace:*",
"eslint": "^8.48.0",
"prettier": "^3.0.3",
"tsup": "^7.2.0",
@@ -28,8 +28,8 @@
"eslintConfig": {
"root": true,
"extends": [
"@mixan/eslint-config/base"
"@openpanel/eslint-config/base"
]
},
"prettier": "@mixan/prettier-config"
"prettier": "@openpanel/prettier-config"
}

View File

@@ -1,5 +1,5 @@
{
"extends": "@mixan/tsconfig/base.json",
"extends": "@openpanel/tsconfig/base.json",
"compilerOptions": {
"outDir": "dist"
}

View File

@@ -1,6 +1,6 @@
import { defineConfig } from 'tsup';
import config from '@mixan/tsconfig/tsup.config.json' assert { type: 'json' };
import config from '@openpanel/tsconfig/tsup.config.json' assert { type: 'json' };
export default defineConfig({
...(config as any),

View File

@@ -2,13 +2,13 @@ import { AppState, Platform } from 'react-native';
import * as Application from 'expo-application';
import Constants from 'expo-constants';
import type { MixanOptions, PostEventPayload } from '@mixan/sdk';
import { Mixan } from '@mixan/sdk';
import type { OpenpanelOptions, PostEventPayload } from '@openpanel/sdk';
import { Openpanel } from '@openpanel/sdk';
type MixanNativeOptions = MixanOptions;
type OpenpanelNativeOptions = OpenpanelOptions;
export class MixanNative extends Mixan<MixanNativeOptions> {
constructor(options: MixanNativeOptions) {
export class OpenpanelNative extends Openpanel<OpenpanelNativeOptions> {
constructor(options: OpenpanelNativeOptions) {
super(options);
this.api.headers['User-Agent'] = Constants.getWebViewUserAgentAsync();

View File

@@ -1,5 +1,5 @@
{
"name": "@mixan/react-native",
"name": "@openpanel/react-native",
"version": "0.0.1",
"module": "index.ts",
"scripts": {
@@ -9,12 +9,12 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@mixan/sdk": "workspace:*"
"@openpanel/sdk": "workspace:*"
},
"devDependencies": {
"@mixan/eslint-config": "workspace:*",
"@mixan/prettier-config": "workspace:*",
"@mixan/tsconfig": "workspace:*",
"@openpanel/eslint-config": "workspace:*",
"@openpanel/prettier-config": "workspace:*",
"@openpanel/tsconfig": "workspace:*",
"eslint": "^8.48.0",
"prettier": "^3.0.3",
"tsup": "^7.2.0",
@@ -28,8 +28,8 @@
"eslintConfig": {
"root": true,
"extends": [
"@mixan/eslint-config/base"
"@openpanel/eslint-config/base"
]
},
"prettier": "@mixan/prettier-config"
"prettier": "@openpanel/prettier-config"
}

View File

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

View File

@@ -1,6 +1,6 @@
import { defineConfig } from 'tsup';
import config from '@mixan/tsconfig/tsup.config.json' assert { type: 'json' };
import config from '@openpanel/tsconfig/tsup.config.json' assert { type: 'json' };
export default defineConfig({
...(config as any),

View File

@@ -1,6 +1,6 @@
// NEW
export interface MixanEventOptions {
export interface OpenpanelEventOptions {
profileId?: string;
}
@@ -9,7 +9,7 @@ export interface PostEventPayload {
timestamp: string;
deviceId?: string;
profileId?: string;
properties?: Record<string, unknown> & MixanEventOptions;
properties?: Record<string, unknown> & OpenpanelEventOptions;
}
export interface UpdateProfilePayload {
@@ -33,7 +33,7 @@ export interface DecrementProfilePayload {
value: number;
}
export interface MixanOptions {
export interface OpenpanelOptions {
url: string;
clientId: string;
clientSecret?: string;
@@ -43,7 +43,7 @@ export interface MixanOptions {
removeDeviceId?: () => void;
}
export interface MixanState {
export interface OpenpanelState {
deviceId?: string;
profileId?: string;
properties: Record<string, unknown>;
@@ -127,19 +127,19 @@ function createApi(_url: string) {
};
}
export class Mixan<Options extends MixanOptions = MixanOptions> {
export class Openpanel<Options extends OpenpanelOptions = OpenpanelOptions> {
public options: Options;
public api: ReturnType<typeof createApi>;
private state: MixanState = {
private state: OpenpanelState = {
properties: {},
};
constructor(options: Options) {
this.options = options;
this.api = createApi(options.url);
this.api.headers['mixan-client-id'] = options.clientId;
this.api.headers['openpanel-client-id'] = options.clientId;
if (this.options.clientSecret) {
this.api.headers['mixan-client-secret'] = this.options.clientSecret;
this.api.headers['openpanel-client-secret'] = this.options.clientSecret;
}
}
@@ -163,7 +163,7 @@ export class Mixan<Options extends MixanOptions = MixanOptions> {
public increment(
property: string,
value: number,
options?: MixanEventOptions
options?: OpenpanelEventOptions
) {
const profileId = options?.profileId ?? this.state.profileId;
if (!profileId) {
@@ -179,7 +179,7 @@ export class Mixan<Options extends MixanOptions = MixanOptions> {
public decrement(
property: string,
value: number,
options?: MixanEventOptions
options?: OpenpanelEventOptions
) {
const profileId = options?.profileId ?? this.state.profileId;
if (!profileId) {

View File

@@ -1,5 +1,5 @@
{
"name": "@mixan/sdk",
"name": "@openpanel/sdk",
"version": "0.0.1",
"module": "index.ts",
"scripts": {
@@ -10,9 +10,9 @@
},
"dependencies": {},
"devDependencies": {
"@mixan/eslint-config": "workspace:*",
"@mixan/prettier-config": "workspace:*",
"@mixan/tsconfig": "workspace:*",
"@openpanel/eslint-config": "workspace:*",
"@openpanel/prettier-config": "workspace:*",
"@openpanel/tsconfig": "workspace:*",
"eslint": "^8.48.0",
"prettier": "^3.0.3",
"tsup": "^7.2.0",
@@ -21,8 +21,8 @@
"eslintConfig": {
"root": true,
"extends": [
"@mixan/eslint-config/base"
"@openpanel/eslint-config/base"
]
},
"prettier": "@mixan/prettier-config"
"prettier": "@openpanel/prettier-config"
}

View File

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

View File

@@ -1,6 +1,6 @@
import { defineConfig } from 'tsup';
import config from '@mixan/tsconfig/tsup.config.json' assert {
import config from '@openpanel/tsconfig/tsup.config.json' assert {
type: 'json'
}

View File

@@ -1,4 +1,4 @@
import { MixanWeb as Openpanel } from './index';
import { OpenpanelWeb as Openpanel } from './index';
declare global {
interface Window {

View File

@@ -1,9 +1,9 @@
import type { MixanOptions, PostEventPayload } from '@mixan/sdk';
import { Mixan } from '@mixan/sdk';
import type { OpenpanelOptions, PostEventPayload } from '@openpanel/sdk';
import { Openpanel } from '@openpanel/sdk';
export * from '@mixan/sdk';
export * from '@openpanel/sdk';
export type MixanWebOptions = MixanOptions & {
export type OpenpanelWebOptions = OpenpanelOptions & {
trackOutgoingLinks?: boolean;
trackScreenViews?: boolean;
trackAttributes?: boolean;
@@ -16,10 +16,10 @@ function toCamelCase(str: string) {
);
}
export class MixanWeb extends Mixan<MixanWebOptions> {
export class OpenpanelWeb extends Openpanel<OpenpanelWebOptions> {
private lastPath = '';
constructor(options: MixanWebOptions) {
constructor(options: OpenpanelWebOptions) {
super(options);
if (!this.isServer()) {

View File

@@ -1,5 +1,5 @@
{
"name": "@mixan/web",
"name": "@openpanel/web",
"version": "0.0.1",
"module": "index.ts",
"scripts": {
@@ -10,12 +10,12 @@
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@mixan/sdk": "workspace:*"
"@openpanel/sdk": "workspace:*"
},
"devDependencies": {
"@mixan/eslint-config": "workspace:*",
"@mixan/prettier-config": "workspace:*",
"@mixan/tsconfig": "workspace:*",
"@openpanel/eslint-config": "workspace:*",
"@openpanel/prettier-config": "workspace:*",
"@openpanel/tsconfig": "workspace:*",
"eslint": "^8.48.0",
"prettier": "^3.0.3",
"tsup": "^7.2.0",
@@ -24,8 +24,8 @@
"eslintConfig": {
"root": true,
"extends": [
"@mixan/eslint-config/base"
"@openpanel/eslint-config/base"
]
},
"prettier": "@mixan/prettier-config"
"prettier": "@openpanel/prettier-config"
}

View File

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

View File

@@ -1,6 +1,6 @@
import { defineConfig } from 'tsup';
import config from '@mixan/tsconfig/tsup.config.json' assert { type: 'json' };
import config from '@openpanel/tsconfig/tsup.config.json' assert { type: 'json' };
export default defineConfig({
...(config as any),