give global properties __ prefix to easier find them

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-02-28 10:21:37 +01:00
parent 3679caf547
commit a898cfb14a
8 changed files with 49 additions and 399 deletions

View File

@@ -1,6 +1,7 @@
import type {
DecrementProfilePayload,
IncrementProfilePayload,
MixanEventOptions,
PostEventPayload,
UpdateProfilePayload,
} from '@mixan/types';
@@ -21,10 +22,6 @@ export interface MixanState {
properties: Record<string, unknown>;
}
export interface MixanEventOptions {
profileId?: string;
}
function awaitProperties(
properties: Record<string, string | Promise<string | null>>
): Promise<Record<string, string>> {
@@ -168,10 +165,7 @@ export class Mixan<Options extends MixanOptions = MixanOptions> {
});
}
public event(
name: string,
properties?: Record<string, unknown> & MixanEventOptions
) {
public event(name: string, properties?: PostEventPayload['properties']) {
const profileId = properties?.profileId ?? this.state.profileId;
delete properties?.profileId;
this.api
@@ -200,7 +194,6 @@ export class Mixan<Options extends MixanOptions = MixanOptions> {
}
public clear() {
this.state.properties = {};
this.state.deviceId = undefined;
this.state.profileId = undefined;
if (this.options.removeDeviceId) {