telemetrydeck_wasm/
params.rs

1//! Reserved parameter name constants defined by TelemetryDeck
2//!
3//! This module provides pre-defined parameter names for common telemetry data.
4//! Using these constants ensures your signals are properly recognized by
5//! TelemetryDeck's analytics engine and can be used in built-in dashboards.
6//!
7//! # Example
8//!
9//! ```no_run
10//! use telemetrydeck_wasm::{TelemetryDeck, params};
11//! use std::collections::HashMap;
12//!
13//! let client = TelemetryDeck::new("YOUR-APP-ID");
14//!
15//! let mut payload = HashMap::new();
16//! payload.insert(params::device::PLATFORM.to_string(), "iOS".to_string());
17//! payload.insert(params::device::SYSTEM_VERSION.to_string(), "17.0".to_string());
18//! payload.insert(params::user_preferences::LANGUAGE.to_string(), "en".to_string());
19//!
20//! client.send("appOpened", Some("user"), Some(payload), None, None);
21//! ```
22//!
23//! # Available Parameter Categories
24//!
25//! - `accessibility` - Accessibility settings (font scale, reduced motion, etc.)
26//! - `acquisition` - User acquisition data (first session, channel, etc.)
27//! - `device` - Device information (platform, OS, architecture, etc.)
28//! - `navigation` - Navigation paths and routes
29//! - `purchase` - Purchase details (type, price, currency, etc.)
30//! - `retention` - User retention metrics (session count, duration, etc.)
31//! - `calendar` - Time-based information (day, week, month, etc.)
32//! - `run_context` - Runtime environment (locale, marketplace, etc.)
33//! - `user_preferences` - User preferences (language, color scheme, etc.)
34
35/// Accessibility-related parameters
36pub mod accessibility {
37    /// Font weight adjustment setting
38    pub const FONT_WEIGHT_ADJUSTMENT: &str = "TelemetryDeck.Accessibility.fontWeightAdjustment";
39    /// Font scale setting
40    pub const FONT_SCALE: &str = "TelemetryDeck.Accessibility.fontScale";
41    /// Whether bold text is enabled
42    pub const IS_BOLD_TEXT_ENABLED: &str = "TelemetryDeck.Accessibility.isBoldTextEnabled";
43    /// Whether darker system colors are enabled
44    pub const IS_DARKER_SYSTEM_COLORS_ENABLED: &str =
45        "TelemetryDeck.Accessibility.isDarkerSystemColorsEnabled";
46    /// Whether invert colors is enabled
47    pub const IS_INVERT_COLORS_ENABLED: &str = "TelemetryDeck.Accessibility.isInvertColorsEnabled";
48    /// Whether reduce motion is enabled
49    pub const IS_REDUCE_MOTION_ENABLED: &str = "TelemetryDeck.Accessibility.isReduceMotionEnabled";
50    /// Whether reduce transparency is enabled
51    pub const IS_REDUCE_TRANSPARENCY_ENABLED: &str =
52        "TelemetryDeck.Accessibility.isReduceTransparencyEnabled";
53    /// Whether to differentiate without color
54    pub const SHOULD_DIFFERENTIATE_WITHOUT_COLOR: &str =
55        "TelemetryDeck.Accessibility.shouldDifferentiateWithoutColor";
56}
57
58/// Acquisition-related parameters
59pub mod acquisition {
60    /// Date of first session
61    pub const FIRST_SESSION_DATE: &str = "TelemetryDeck.Acquisition.firstSessionDate";
62    /// Acquisition channel
63    pub const CHANNEL: &str = "TelemetryDeck.Acquisition.channel";
64    /// Lead identifier
65    pub const LEAD_ID: &str = "TelemetryDeck.Acquisition.leadID";
66}
67
68/// Device-related parameters
69pub mod device {
70    /// Device architecture (e.g., arm64, x86_64)
71    pub const ARCHITECTURE: &str = "TelemetryDeck.Device.architecture";
72    /// Device model name
73    pub const MODEL_NAME: &str = "TelemetryDeck.Device.modelName";
74    /// Operating system name
75    pub const OPERATING_SYSTEM: &str = "TelemetryDeck.Device.operatingSystem";
76    /// Platform name
77    pub const PLATFORM: &str = "TelemetryDeck.Device.platform";
78    /// System version (major.minor)
79    pub const SYSTEM_MAJOR_MINOR_VERSION: &str = "TelemetryDeck.Device.systemMajorMinorVersion";
80    /// System major version
81    pub const SYSTEM_MAJOR_VERSION: &str = "TelemetryDeck.Device.systemMajorVersion";
82    /// Full system version
83    pub const SYSTEM_VERSION: &str = "TelemetryDeck.Device.systemVersion";
84    /// Device brand
85    pub const BRAND: &str = "TelemetryDeck.Device.brand";
86    /// Device timezone
87    pub const TIME_ZONE: &str = "TelemetryDeck.Device.timeZone";
88    /// Device orientation
89    pub const ORIENTATION: &str = "TelemetryDeck.Device.orientation";
90    /// Screen density
91    pub const SCREEN_DENSITY: &str = "TelemetryDeck.Device.screenDensity";
92    /// Screen height in pixels
93    pub const SCREEN_HEIGHT: &str = "TelemetryDeck.Device.screenResolutionHeight";
94    /// Screen width in pixels
95    pub const SCREEN_WIDTH: &str = "TelemetryDeck.Device.screenResolutionWidth";
96}
97
98/// Navigation-related parameters
99pub mod navigation {
100    /// Navigation schema version
101    pub const SCHEMA_VERSION: &str = "TelemetryDeck.Navigation.schemaVersion";
102    /// Navigation identifier
103    pub const IDENTIFIER: &str = "TelemetryDeck.Navigation.identifier";
104    /// Source path
105    pub const SOURCE_PATH: &str = "TelemetryDeck.Navigation.sourcePath";
106    /// Destination path
107    pub const DESTINATION_PATH: &str = "TelemetryDeck.Navigation.destinationPath";
108}
109
110/// Purchase-related parameters
111pub mod purchase {
112    /// Purchase type
113    pub const TYPE: &str = "TelemetryDeck.Purchase.type";
114    /// Country code
115    pub const COUNTRY_CODE: &str = "TelemetryDeck.Purchase.countryCode";
116    /// Currency code
117    pub const CURRENCY_CODE: &str = "TelemetryDeck.Purchase.currencyCode";
118    /// Product identifier
119    pub const PRODUCT_ID: &str = "TelemetryDeck.Purchase.productID";
120    /// Offer identifier
121    pub const OFFER_ID: &str = "TelemetryDeck.Purchase.offerID";
122    /// Price in micros
123    pub const PRICE_MICROS: &str = "TelemetryDeck.Purchase.priceMicros";
124}
125
126/// Retention-related parameters
127pub mod retention {
128    /// Average session duration in seconds
129    pub const AVERAGE_SESSION_SECONDS: &str = "TelemetryDeck.Retention.averageSessionSeconds";
130    /// Distinct days used
131    pub const DISTINCT_DAYS_USED: &str = "TelemetryDeck.Retention.distinctDaysUsed";
132    /// Total sessions count
133    pub const TOTAL_SESSIONS_COUNT: &str = "TelemetryDeck.Retention.totalSessionsCount";
134    /// Previous session duration in seconds
135    pub const PREVIOUS_SESSION_SECONDS: &str = "TelemetryDeck.Retention.previousSessionSeconds";
136    /// Distinct days used in last month
137    pub const DISTINCT_DAYS_USED_LAST_MONTH: &str =
138        "TelemetryDeck.Retention.distinctDaysUsedLastMonth";
139}
140
141/// Calendar-related parameters
142pub mod calendar {
143    /// Day of month (1-31)
144    pub const DAY_OF_MONTH: &str = "TelemetryDeck.Calendar.dayOfMonth";
145    /// Day of week (1-7)
146    pub const DAY_OF_WEEK: &str = "TelemetryDeck.Calendar.dayOfWeek";
147    /// Day of year (1-366)
148    pub const DAY_OF_YEAR: &str = "TelemetryDeck.Calendar.dayOfYear";
149    /// Week of year (1-53)
150    pub const WEEK_OF_YEAR: &str = "TelemetryDeck.Calendar.weekOfYear";
151    /// Whether it's a weekend
152    pub const IS_WEEKEND: &str = "TelemetryDeck.Calendar.isWeekend";
153    /// Month of year (1-12)
154    pub const MONTH_OF_YEAR: &str = "TelemetryDeck.Calendar.monthOfYear";
155    /// Quarter of year (1-4)
156    pub const QUARTER_OF_YEAR: &str = "TelemetryDeck.Calendar.quarterOfYear";
157    /// Hour of day (0-23)
158    pub const HOUR_OF_DAY: &str = "TelemetryDeck.Calendar.hourOfDay";
159}
160
161/// Run context parameters
162pub mod run_context {
163    /// Locale setting
164    pub const LOCALE: &str = "TelemetryDeck.RunContext.locale";
165    /// Target environment
166    pub const TARGET_ENVIRONMENT: &str = "TelemetryDeck.RunContext.targetEnvironment";
167    /// Whether app is side-loaded
168    pub const IS_SIDE_LOADED: &str = "TelemetryDeck.RunContext.isSideLoaded";
169    /// Source marketplace
170    pub const SOURCE_MARKETPLACE: &str = "TelemetryDeck.RunContext.sourceMarketplace";
171}
172
173/// User preference parameters
174pub mod user_preferences {
175    /// Layout direction (LTR/RTL)
176    pub const LAYOUT_DIRECTION: &str = "TelemetryDeck.UserPreference.layoutDirection";
177    /// Region setting
178    pub const REGION: &str = "TelemetryDeck.UserPreference.region";
179    /// Language setting
180    pub const LANGUAGE: &str = "TelemetryDeck.UserPreference.language";
181    /// Color scheme preference
182    pub const COLOR_SCHEME: &str = "TelemetryDeck.UserPreference.colorScheme";
183}