Skip to content

Commit aa9e6e6

Browse files
committed
wip
1 parent 01c3426 commit aa9e6e6

File tree

11 files changed

+516
-122
lines changed

11 files changed

+516
-122
lines changed

packages/signals/signals-runtime/bundle-dts.js

Lines changed: 0 additions & 80 deletions
This file was deleted.
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
/* These types will be used in the segment app UI for autocomplete */
2+
/* eslint-disable */
3+
4+
5+
interface BaseSignal {
6+
type: string;
7+
}
8+
type SignalOfType<AllSignals extends BaseSignal, SignalType extends AllSignals["type"]> = AllSignals & {
9+
type: SignalType;
10+
};
11+
interface ISignalsRuntime<Signal extends BaseSignal> {
12+
find: <SignalType extends Signal["type"]>(fromSignal: Signal, signalType: SignalType, predicate?: (signal: SignalOfType<Signal, SignalType>) => boolean) => SignalOfType<Signal, SignalType> | undefined;
13+
}
14+
type JSONPrimitive = string | number | boolean | null;
15+
type JSONValue = JSONPrimitive | JSONObject | JSONArray;
16+
type JSONObject = {
17+
[member: string]: JSONValue;
18+
};
19+
type JSONArray = JSONValue[];
20+
interface SegmentEvent {
21+
type: string;
22+
[key: string]: any;
23+
}
24+
type MobileSignalTypes = MobileSignal["type"];
25+
type MobileSignal = MobileInteractionSignal | MobileNavigationSignal | MobileNetworkSignal | MobileLocalDataSignal | MobileInstrumentationSignal | MobileUserDefinedSignal;
26+
interface MobileRawSignal extends BaseSignal {
27+
anonymousId: string;
28+
type: string;
29+
data: any;
30+
timestamp: string;
31+
index: any;
32+
}
33+
interface MobileNavigationData {
34+
action: string;
35+
screen: string;
36+
}
37+
interface MobileNavigationSignal extends MobileRawSignal {
38+
data: MobileNavigationData;
39+
}
40+
interface MobileInteractionData {
41+
component: string;
42+
info: string;
43+
data: any;
44+
}
45+
interface MobileInteractionSignal extends MobileRawSignal {
46+
type: "interaction";
47+
data: MobileInteractionData;
48+
}
49+
interface MobileNetworkData {
50+
action: string;
51+
url: string;
52+
data: any;
53+
}
54+
interface MobileNetworkSignal extends MobileRawSignal {
55+
static: "network";
56+
data: MobileNetworkData;
57+
}
58+
interface MobileLocalData {
59+
action: string;
60+
identifier: string;
61+
data: string;
62+
}
63+
interface MobileLocalDataSignal extends MobileRawSignal {
64+
type: "localData";
65+
data: MobileLocalData;
66+
}
67+
interface MobileUserDefinedSignal extends MobileRawSignal {
68+
type: "userDefined";
69+
data: any;
70+
}
71+
interface MobileInstrumentationData {
72+
type: "instrumentation";
73+
rawEvent: any;
74+
}
75+
interface MobileInstrumentationSignal extends MobileRawSignal {
76+
data: MobileInstrumentationData;
77+
}
78+
79+
80+
81+
declare const signals: ISignalsRuntime<MobileSignal>
82+
declare const SignalType: {
83+
Interaction: 'interaction'
84+
Navigation: 'navigation'
85+
Network: 'network'
86+
LocalData: 'localData'
87+
Instrumentation: 'instrumentation'
88+
UserDefined: 'userDefined'
89+
}
90+
declare const EventType: {
91+
Track: 'track'
92+
Page: 'page'
93+
Screen: 'screen'
94+
Identify: 'identify'
95+
Group: 'group'
96+
Alias: 'alias'
97+
}
98+
99+
declare const NavigationAction: {
100+
Forward: 'forward'
101+
Backward: 'backward'
102+
Modal: 'modal'
103+
Entering: 'entering'
104+
Leaving: 'leaving'
105+
Page: 'page'
106+
Popup: 'popup'
107+
}
108+
109+
declare const NetworkAction: Readonly<{
110+
Request: 'request'
111+
Response: 'response'
112+
}>
113+
114+
declare const LocalDataAction: Readonly<{
115+
Loaded: 'loaded'
116+
Updated: 'updated'
117+
Saved: 'saved'
118+
Deleted: 'deleted'
119+
Undefined: 'undefined'
120+
}>
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
/* These types will be used in the segment app UI for autocomplete */
2+
/* eslint-disable */
3+
4+
5+
interface BaseSignal {
6+
type: string;
7+
}
8+
type SignalOfType<AllSignals extends BaseSignal, SignalType extends AllSignals["type"]> = AllSignals & {
9+
type: SignalType;
10+
};
11+
interface ISignalsRuntime<Signal extends BaseSignal> {
12+
find: <SignalType extends Signal["type"]>(fromSignal: Signal, signalType: SignalType, predicate?: (signal: SignalOfType<Signal, SignalType>) => boolean) => SignalOfType<Signal, SignalType> | undefined;
13+
}
14+
type JSONPrimitive = string | number | boolean | null;
15+
type JSONValue = JSONPrimitive | JSONObject | JSONArray;
16+
type JSONObject = {
17+
[member: string]: JSONValue;
18+
};
19+
type JSONArray = JSONValue[];
20+
interface SegmentEvent {
21+
type: string;
22+
[key: string]: any;
23+
}
24+
type WebSignalTypes = WebSignal["type"];
25+
interface WebAppSignal<T extends WebSignalTypes, Data> extends BaseSignal {
26+
type: T;
27+
data: Data;
28+
metadata?: Record<string, any>;
29+
}
30+
type WebInteractionData = WebClickData | WebSubmitData | WebChangeData;
31+
interface WebSerializedTarget {
32+
[key: string]: any;
33+
}
34+
type WebClickData = {
35+
eventType: "click";
36+
target: WebSerializedTarget;
37+
};
38+
type WebSubmitData = {
39+
eventType: "submit";
40+
submitter: WebSerializedTarget;
41+
};
42+
type WebChangeData = {
43+
eventType: "change";
44+
[key: string]: unknown;
45+
};
46+
type WebInteractionSignal = WebAppSignal<"interaction", WebInteractionData>;
47+
interface WebBaseNavigationData<ActionType extends string> {
48+
action: ActionType;
49+
url: string;
50+
hash: string;
51+
}
52+
interface WebURLChangeNavigationData extends WebBaseNavigationData<"urlChange"> {
53+
prevUrl: string;
54+
}
55+
interface WebPageChangeNavigationData extends WebBaseNavigationData<"pageLoad"> {
56+
}
57+
type WebNavigationData = WebURLChangeNavigationData | WebPageChangeNavigationData;
58+
type WebNavigationSignal = WebAppSignal<"navigation", WebNavigationData>;
59+
interface WebInstrumentationData {
60+
rawEvent: unknown;
61+
}
62+
type WebInstrumentationSignal = WebAppSignal<"instrumentation", WebInstrumentationData>;
63+
interface WebNetworkSignalMetadata {
64+
filters: {
65+
allowed: string[];
66+
disallowed: string[];
67+
};
68+
}
69+
interface WebBaseNetworkData {
70+
action: string;
71+
url: string;
72+
data: JSONValue;
73+
}
74+
interface WebNetworkRequestData extends WebBaseNetworkData {
75+
action: "request";
76+
url: string;
77+
method: string;
78+
}
79+
interface WebNetworkResponseData extends WebBaseNetworkData {
80+
action: "response";
81+
url: string;
82+
}
83+
type WebNetworkData = WebNetworkRequestData | WebNetworkResponseData;
84+
type WebNetworkSignal = WebAppSignal<"network", WebNetworkData>;
85+
interface WebUserDefinedSignalData {
86+
[key: string]: any;
87+
}
88+
type WebUserDefinedSignal = WebAppSignal<"userDefined", WebUserDefinedSignalData>;
89+
type WebSignal = WebInteractionSignal | WebNavigationSignal | WebInstrumentationSignal | WebNetworkSignal | WebUserDefinedSignal;
90+
91+
92+
93+
declare const signals: ISignalsRuntime<WebSignal>
94+
declare const SignalType: {
95+
Interaction: 'interaction'
96+
Navigation: 'navigation'
97+
Network: 'network'
98+
LocalData: 'localData'
99+
Instrumentation: 'instrumentation'
100+
UserDefined: 'userDefined'
101+
}
102+
declare const EventType: {
103+
Track: 'track'
104+
Page: 'page'
105+
Screen: 'screen'
106+
Identify: 'identify'
107+
Group: 'group'
108+
Alias: 'alias'
109+
}
110+
declare const NavigationAction: {
111+
URLChange: 'urlChange'
112+
PageLoad: 'pageLoad'
113+
}

0 commit comments

Comments
 (0)