UNPKG

3.01 kBTypeScriptView Raw
1export declare enum Framework {
2 WebUnknown = "0",
3 React = "1",
4 NextJs = "2",
5 Angular = "3",
6 VueJs = "4",
7 Nuxt = "5",
8 Svelte = "6",
9 ServerSideUnknown = "100",
10 ReactSSR = "101",
11 NextJsSSR = "102",
12 AngularSSR = "103",
13 VueJsSSR = "104",
14 NuxtSSR = "105",
15 SvelteSSR = "106",
16 ReactNative = "201",
17 Expo = "202"
18}
19export declare enum Category {
20 API = "api",
21 Auth = "auth",
22 Analytics = "analytics",
23 DataStore = "datastore",
24 Geo = "geo",
25 InAppMessaging = "inappmessaging",
26 Interactions = "interactions",
27 Predictions = "predictions",
28 PubSub = "pubsub",
29 PushNotification = "pushnotification",
30 Storage = "storage"
31}
32export declare enum AnalyticsAction {
33 Record = "1",
34 UpdateEndpoint = "2"
35}
36export declare enum ApiAction {
37 GraphQl = "1",
38 Get = "2",
39 Post = "3",
40 Put = "4",
41 Patch = "5",
42 Del = "6",
43 Head = "7"
44}
45export declare enum AuthAction {
46 FederatedSignIn = "30"
47}
48export declare enum DataStoreAction {
49 Subscribe = "1",
50 GraphQl = "2"
51}
52export declare enum GeoAction {
53 None = "0"
54}
55export declare enum InAppMessagingAction {
56 None = "0"
57}
58export declare enum InteractionsAction {
59 None = "0"
60}
61export declare enum PredictionsAction {
62 Convert = "1",
63 Identify = "2",
64 Interpret = "3"
65}
66export declare enum PubSubAction {
67 Subscribe = "1"
68}
69export declare enum PushNotificationAction {
70 None = "0"
71}
72export declare enum StorageAction {
73 Put = "1",
74 Get = "2",
75 List = "3",
76 Copy = "4",
77 Remove = "5",
78 GetProperties = "6"
79}
80type ActionMap = {
81 [Category.Auth]: AuthAction;
82 [Category.API]: ApiAction;
83 [Category.Analytics]: AnalyticsAction;
84 [Category.DataStore]: DataStoreAction;
85 [Category.Geo]: GeoAction;
86 [Category.InAppMessaging]: InAppMessagingAction;
87 [Category.Interactions]: InteractionsAction;
88 [Category.Predictions]: PredictionsAction;
89 [Category.PubSub]: PubSubAction;
90 [Category.PushNotification]: PushNotificationAction;
91 [Category.Storage]: StorageAction;
92};
93type UserAgentDetailsWithCategory<T extends Category> = CustomUserAgentDetailsBase & {
94 category: T;
95 action: T extends keyof ActionMap ? ActionMap[T] : never;
96};
97type CustomUserAgentDetailsBase = {
98 framework?: Framework;
99};
100export type CustomUserAgentDetails = (CustomUserAgentDetailsBase & {
101 category?: never;
102 action?: never;
103}) | UserAgentDetailsWithCategory<Category.API> | UserAgentDetailsWithCategory<Category.Auth> | UserAgentDetailsWithCategory<Category.Analytics> | UserAgentDetailsWithCategory<Category.DataStore> | UserAgentDetailsWithCategory<Category.Geo> | UserAgentDetailsWithCategory<Category.Interactions> | UserAgentDetailsWithCategory<Category.InAppMessaging> | UserAgentDetailsWithCategory<Category.Predictions> | UserAgentDetailsWithCategory<Category.PubSub> | UserAgentDetailsWithCategory<Category.PushNotification> | UserAgentDetailsWithCategory<Category.Storage>;
104export {};