@sudobility/types 1.8.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +285 -0
- package/README.md +310 -0
- package/dist/index.cjs +62 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -0
- package/dist/types/blockchain/common.cjs +102 -0
- package/dist/types/blockchain/common.d.ts +262 -0
- package/dist/types/blockchain/common.d.ts.map +1 -0
- package/dist/types/blockchain/common.js +102 -0
- package/dist/types/blockchain/common.js.map +1 -0
- package/dist/types/blockchain/index.cjs +18 -0
- package/dist/types/blockchain/index.d.ts +4 -0
- package/dist/types/blockchain/index.d.ts.map +1 -0
- package/dist/types/blockchain/index.js +18 -0
- package/dist/types/blockchain/index.js.map +1 -0
- package/dist/types/blockchain/validation.cjs +88 -0
- package/dist/types/blockchain/validation.d.ts +9 -0
- package/dist/types/blockchain/validation.d.ts.map +1 -0
- package/dist/types/blockchain/validation.js +88 -0
- package/dist/types/blockchain/validation.js.map +1 -0
- package/dist/types/business/enums.cjs +314 -0
- package/dist/types/business/enums.d.ts +227 -0
- package/dist/types/business/enums.d.ts.map +1 -0
- package/dist/types/business/enums.js +314 -0
- package/dist/types/business/enums.js.map +1 -0
- package/dist/types/business/index.cjs +33 -0
- package/dist/types/business/index.d.ts +5 -0
- package/dist/types/business/index.d.ts.map +1 -0
- package/dist/types/business/index.js +33 -0
- package/dist/types/business/index.js.map +1 -0
- package/dist/types/business/wallet-status.cjs +38 -0
- package/dist/types/business/wallet-status.d.ts +32 -0
- package/dist/types/business/wallet-status.d.ts.map +1 -0
- package/dist/types/business/wallet-status.js +38 -0
- package/dist/types/business/wallet-status.js.map +1 -0
- package/dist/types/common.cjs +6 -0
- package/dist/types/common.d.ts +142 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/common.js +6 -0
- package/dist/types/common.js.map +1 -0
- package/dist/types/config/app-config.cjs +6 -0
- package/dist/types/config/app-config.d.ts +67 -0
- package/dist/types/config/app-config.d.ts.map +1 -0
- package/dist/types/config/app-config.js +6 -0
- package/dist/types/config/app-config.js.map +1 -0
- package/dist/types/config/environment.cjs +24 -0
- package/dist/types/config/environment.d.ts +68 -0
- package/dist/types/config/environment.d.ts.map +1 -0
- package/dist/types/config/environment.js +24 -0
- package/dist/types/config/environment.js.map +1 -0
- package/dist/types/config/index.cjs +6 -0
- package/dist/types/config/index.d.ts +4 -0
- package/dist/types/config/index.d.ts.map +1 -0
- package/dist/types/config/index.js +6 -0
- package/dist/types/config/index.js.map +1 -0
- package/dist/types/index.cjs +35 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +35 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/indexer/index.cjs +19 -0
- package/dist/types/indexer/index.d.ts +3 -0
- package/dist/types/indexer/index.d.ts.map +1 -0
- package/dist/types/indexer/index.js +19 -0
- package/dist/types/indexer/index.js.map +1 -0
- package/dist/types/indexer/indexer-guards.cjs +145 -0
- package/dist/types/indexer/indexer-guards.d.ts +26 -0
- package/dist/types/indexer/indexer-guards.d.ts.map +1 -0
- package/dist/types/indexer/indexer-guards.js +145 -0
- package/dist/types/indexer/indexer-guards.js.map +1 -0
- package/dist/types/indexer/indexer-responses.cjs +8 -0
- package/dist/types/indexer/indexer-responses.d.ts +136 -0
- package/dist/types/indexer/indexer-responses.d.ts.map +1 -0
- package/dist/types/indexer/indexer-responses.js +8 -0
- package/dist/types/indexer/indexer-responses.js.map +1 -0
- package/dist/types/infrastructure/analytics.cjs +212 -0
- package/dist/types/infrastructure/analytics.d.ts +449 -0
- package/dist/types/infrastructure/analytics.d.ts.map +1 -0
- package/dist/types/infrastructure/analytics.js +212 -0
- package/dist/types/infrastructure/analytics.js.map +1 -0
- package/dist/types/infrastructure/api.cjs +17 -0
- package/dist/types/infrastructure/api.d.ts +152 -0
- package/dist/types/infrastructure/api.d.ts.map +1 -0
- package/dist/types/infrastructure/api.js +17 -0
- package/dist/types/infrastructure/api.js.map +1 -0
- package/dist/types/infrastructure/index.cjs +14 -0
- package/dist/types/infrastructure/index.d.ts +9 -0
- package/dist/types/infrastructure/index.d.ts.map +1 -0
- package/dist/types/infrastructure/index.js +14 -0
- package/dist/types/infrastructure/index.js.map +1 -0
- package/dist/types/infrastructure/navigation.cjs +3 -0
- package/dist/types/infrastructure/navigation.d.ts +56 -0
- package/dist/types/infrastructure/navigation.d.ts.map +1 -0
- package/dist/types/infrastructure/navigation.js +3 -0
- package/dist/types/infrastructure/navigation.js.map +1 -0
- package/dist/types/infrastructure/network.cjs +18 -0
- package/dist/types/infrastructure/network.d.ts +48 -0
- package/dist/types/infrastructure/network.d.ts.map +1 -0
- package/dist/types/infrastructure/network.js +18 -0
- package/dist/types/infrastructure/network.js.map +1 -0
- package/dist/types/infrastructure/wallet.cjs +37 -0
- package/dist/types/infrastructure/wallet.d.ts +33 -0
- package/dist/types/infrastructure/wallet.d.ts.map +1 -0
- package/dist/types/infrastructure/wallet.js +37 -0
- package/dist/types/infrastructure/wallet.js.map +1 -0
- package/dist/types/kyc/index.cjs +19 -0
- package/dist/types/kyc/index.d.ts +2 -0
- package/dist/types/kyc/index.d.ts.map +1 -0
- package/dist/types/kyc/index.js +19 -0
- package/dist/types/kyc/index.js.map +1 -0
- package/dist/types/kyc/kyc-types.cjs +12 -0
- package/dist/types/kyc/kyc-types.d.ts +260 -0
- package/dist/types/kyc/kyc-types.d.ts.map +1 -0
- package/dist/types/kyc/kyc-types.js +12 -0
- package/dist/types/kyc/kyc-types.js.map +1 -0
- package/dist/types/mailer/index.cjs +19 -0
- package/dist/types/mailer/index.d.ts +2 -0
- package/dist/types/mailer/index.d.ts.map +1 -0
- package/dist/types/mailer/index.js +19 -0
- package/dist/types/mailer/index.js.map +1 -0
- package/dist/types/mailer/mail-types.cjs +38 -0
- package/dist/types/mailer/mail-types.d.ts +296 -0
- package/dist/types/mailer/mail-types.d.ts.map +1 -0
- package/dist/types/mailer/mail-types.js +38 -0
- package/dist/types/mailer/mail-types.js.map +1 -0
- package/dist/types/wildduck/index.cjs +19 -0
- package/dist/types/wildduck/index.d.ts +2 -0
- package/dist/types/wildduck/index.d.ts.map +1 -0
- package/dist/types/wildduck/index.js +19 -0
- package/dist/types/wildduck/index.js.map +1 -0
- package/dist/types/wildduck/wildduck-types.cjs +48 -0
- package/dist/types/wildduck/wildduck-types.d.ts +1239 -0
- package/dist/types/wildduck/wildduck-types.d.ts.map +1 -0
- package/dist/types/wildduck/wildduck-types.js +48 -0
- package/dist/types/wildduck/wildduck-types.js.map +1 -0
- package/dist/utils/async-helpers.cjs +130 -0
- package/dist/utils/async-helpers.d.ts +35 -0
- package/dist/utils/async-helpers.d.ts.map +1 -0
- package/dist/utils/async-helpers.js +130 -0
- package/dist/utils/async-helpers.js.map +1 -0
- package/dist/utils/auth/auth.cjs +96 -0
- package/dist/utils/auth/auth.d.ts +40 -0
- package/dist/utils/auth/auth.d.ts.map +1 -0
- package/dist/utils/auth/auth.js +96 -0
- package/dist/utils/auth/auth.js.map +1 -0
- package/dist/utils/auth/index.cjs +14 -0
- package/dist/utils/auth/index.d.ts +2 -0
- package/dist/utils/auth/index.d.ts.map +1 -0
- package/dist/utils/auth/index.js +14 -0
- package/dist/utils/auth/index.js.map +1 -0
- package/dist/utils/blockchain/address.cjs +231 -0
- package/dist/utils/blockchain/address.d.ts +65 -0
- package/dist/utils/blockchain/address.d.ts.map +1 -0
- package/dist/utils/blockchain/address.js +231 -0
- package/dist/utils/blockchain/address.js.map +1 -0
- package/dist/utils/blockchain/event-helpers.cjs +143 -0
- package/dist/utils/blockchain/event-helpers.d.ts +87 -0
- package/dist/utils/blockchain/event-helpers.d.ts.map +1 -0
- package/dist/utils/blockchain/event-helpers.js +143 -0
- package/dist/utils/blockchain/event-helpers.js.map +1 -0
- package/dist/utils/blockchain/index.cjs +30 -0
- package/dist/utils/blockchain/index.d.ts +8 -0
- package/dist/utils/blockchain/index.d.ts.map +1 -0
- package/dist/utils/blockchain/index.js +30 -0
- package/dist/utils/blockchain/index.js.map +1 -0
- package/dist/utils/blockchain/rpc-helpers.cjs +865 -0
- package/dist/utils/blockchain/rpc-helpers.d.ts +251 -0
- package/dist/utils/blockchain/rpc-helpers.d.ts.map +1 -0
- package/dist/utils/blockchain/rpc-helpers.js +865 -0
- package/dist/utils/blockchain/rpc-helpers.js.map +1 -0
- package/dist/utils/constants/application.cjs +158 -0
- package/dist/utils/constants/application.d.ts +119 -0
- package/dist/utils/constants/application.d.ts.map +1 -0
- package/dist/utils/constants/application.js +158 -0
- package/dist/utils/constants/application.js.map +1 -0
- package/dist/utils/constants/index.cjs +30 -0
- package/dist/utils/constants/index.d.ts +7 -0
- package/dist/utils/constants/index.d.ts.map +1 -0
- package/dist/utils/constants/index.js +30 -0
- package/dist/utils/constants/index.js.map +1 -0
- package/dist/utils/constants/status-values.cjs +14 -0
- package/dist/utils/constants/status-values.d.ts +12 -0
- package/dist/utils/constants/status-values.d.ts.map +1 -0
- package/dist/utils/constants/status-values.js +14 -0
- package/dist/utils/constants/status-values.js.map +1 -0
- package/dist/utils/formatting/currency.cjs +36 -0
- package/dist/utils/formatting/currency.d.ts +26 -0
- package/dist/utils/formatting/currency.d.ts.map +1 -0
- package/dist/utils/formatting/currency.js +36 -0
- package/dist/utils/formatting/currency.js.map +1 -0
- package/dist/utils/formatting/date.cjs +138 -0
- package/dist/utils/formatting/date.d.ts +33 -0
- package/dist/utils/formatting/date.d.ts.map +1 -0
- package/dist/utils/formatting/date.js +138 -0
- package/dist/utils/formatting/date.js.map +1 -0
- package/dist/utils/formatting/index.cjs +37 -0
- package/dist/utils/formatting/index.d.ts +4 -0
- package/dist/utils/formatting/index.d.ts.map +1 -0
- package/dist/utils/formatting/index.js +37 -0
- package/dist/utils/formatting/index.js.map +1 -0
- package/dist/utils/formatting/string.cjs +193 -0
- package/dist/utils/formatting/string.d.ts +69 -0
- package/dist/utils/formatting/string.d.ts.map +1 -0
- package/dist/utils/formatting/string.js +193 -0
- package/dist/utils/formatting/string.js.map +1 -0
- package/dist/utils/index.cjs +28 -0
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +28 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logging/index.cjs +16 -0
- package/dist/utils/logging/index.d.ts +5 -0
- package/dist/utils/logging/index.d.ts.map +1 -0
- package/dist/utils/logging/index.js +16 -0
- package/dist/utils/logging/index.js.map +1 -0
- package/dist/utils/logging/logger.cjs +92 -0
- package/dist/utils/logging/logger.d.ts +70 -0
- package/dist/utils/logging/logger.d.ts.map +1 -0
- package/dist/utils/logging/logger.js +92 -0
- package/dist/utils/logging/logger.js.map +1 -0
- package/dist/utils/url/index.cjs +13 -0
- package/dist/utils/url/index.d.ts +5 -0
- package/dist/utils/url/index.d.ts.map +1 -0
- package/dist/utils/url/index.js +13 -0
- package/dist/utils/url/index.js.map +1 -0
- package/dist/utils/url/url-params.cjs +128 -0
- package/dist/utils/url/url-params.d.ts +36 -0
- package/dist/utils/url/url-params.d.ts.map +1 -0
- package/dist/utils/url/url-params.js +128 -0
- package/dist/utils/url/url-params.js.map +1 -0
- package/dist/utils/validation/index.cjs +25 -0
- package/dist/utils/validation/index.d.ts +5 -0
- package/dist/utils/validation/index.d.ts.map +1 -0
- package/dist/utils/validation/index.js +25 -0
- package/dist/utils/validation/index.js.map +1 -0
- package/dist/utils/validation/type-validation.cjs +167 -0
- package/dist/utils/validation/type-validation.d.ts +68 -0
- package/dist/utils/validation/type-validation.d.ts.map +1 -0
- package/dist/utils/validation/type-validation.js +167 -0
- package/dist/utils/validation/type-validation.js.map +1 -0
- package/dist/utils/validation/web3-username-validator.cjs +132 -0
- package/dist/utils/validation/web3-username-validator.d.ts +43 -0
- package/dist/utils/validation/web3-username-validator.d.ts.map +1 -0
- package/dist/utils/validation/web3-username-validator.js +132 -0
- package/dist/utils/validation/web3-username-validator.js.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Analytics types and interfaces
|
|
4
|
+
* Platform-agnostic analytics service interface for dependency injection
|
|
5
|
+
*
|
|
6
|
+
* @ai-context Core analytics interface for dependency injection
|
|
7
|
+
* @ai-pattern Service interface with comprehensive event tracking
|
|
8
|
+
* @ai-platform Cross-platform compatible (Web, React Native, Node.js)
|
|
9
|
+
* @ai-usage Implement this interface to create analytics services for Firebase, Mixpanel, etc.
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AnalyticsEventBuilder = exports.AnalyticsEvent = void 0;
|
|
13
|
+
/**
|
|
14
|
+
* Standardized analytics events enumeration.
|
|
15
|
+
*
|
|
16
|
+
* Provides consistent event naming for common application analytics scenarios.
|
|
17
|
+
* Organized by functional categories for better code organization and analytics reporting.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Use predefined events for consistency
|
|
22
|
+
* analytics.track(AnalyticsEvent.USER_LOGIN, { method: 'email' });
|
|
23
|
+
* analytics.track(AnalyticsEvent.EMAIL_OPENED, { email_id: 'msg-123' });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
var AnalyticsEvent;
|
|
27
|
+
(function (AnalyticsEvent) {
|
|
28
|
+
/** User successfully logged into the application */
|
|
29
|
+
AnalyticsEvent["USER_LOGIN"] = "user_login";
|
|
30
|
+
/** User logged out of the application */
|
|
31
|
+
AnalyticsEvent["USER_LOGOUT"] = "user_logout";
|
|
32
|
+
/** New user completed account registration */
|
|
33
|
+
AnalyticsEvent["USER_SIGNUP"] = "user_signup";
|
|
34
|
+
/** User sent an email message */
|
|
35
|
+
AnalyticsEvent["EMAIL_SENT"] = "email_sent";
|
|
36
|
+
/** User received a new email message */
|
|
37
|
+
AnalyticsEvent["EMAIL_RECEIVED"] = "email_received";
|
|
38
|
+
/** User opened an email message (consolidated from EMAIL_OPENED and EMAIL_OPEN) */
|
|
39
|
+
AnalyticsEvent["EMAIL_OPENED"] = "email_opened";
|
|
40
|
+
/** User replied to an email message */
|
|
41
|
+
AnalyticsEvent["EMAIL_REPLY"] = "email_reply";
|
|
42
|
+
/** User forwarded an email message */
|
|
43
|
+
AnalyticsEvent["EMAIL_FORWARD"] = "email_forward";
|
|
44
|
+
/** User deleted an email message */
|
|
45
|
+
AnalyticsEvent["EMAIL_DELETE"] = "email_delete";
|
|
46
|
+
/** User starred an email message */
|
|
47
|
+
AnalyticsEvent["EMAIL_STAR"] = "email_star";
|
|
48
|
+
/** User composed a new email */
|
|
49
|
+
AnalyticsEvent["EMAIL_COMPOSE"] = "email_compose";
|
|
50
|
+
/** User clicked a link within an email */
|
|
51
|
+
AnalyticsEvent["EMAIL_CLICKED"] = "email_clicked";
|
|
52
|
+
/** User viewed a web page */
|
|
53
|
+
AnalyticsEvent["PAGE_VIEW"] = "page_view";
|
|
54
|
+
/** User viewed a mobile screen */
|
|
55
|
+
AnalyticsEvent["SCREEN_VIEW"] = "screen_view";
|
|
56
|
+
/** User switched between folders */
|
|
57
|
+
AnalyticsEvent["FOLDER_SWITCH"] = "folder_switch";
|
|
58
|
+
/** User viewed subscription options */
|
|
59
|
+
AnalyticsEvent["SUBSCRIPTION_VIEW"] = "subscription_view";
|
|
60
|
+
/** User purchased a subscription */
|
|
61
|
+
AnalyticsEvent["SUBSCRIPTION_PURCHASE"] = "subscription_purchase";
|
|
62
|
+
/** User cancelled a subscription */
|
|
63
|
+
AnalyticsEvent["SUBSCRIPTION_CANCEL"] = "subscription_cancel";
|
|
64
|
+
/** User performed a search */
|
|
65
|
+
AnalyticsEvent["SEARCH_PERFORMED"] = "search_performed";
|
|
66
|
+
/** User changed application settings */
|
|
67
|
+
AnalyticsEvent["SETTINGS_CHANGED"] = "settings_changed";
|
|
68
|
+
/** An application error occurred */
|
|
69
|
+
AnalyticsEvent["ERROR_OCCURRED"] = "error_occurred";
|
|
70
|
+
/** User viewed an A/B test variant */
|
|
71
|
+
AnalyticsEvent["AB_TEST_VIEWED"] = "ab_test_viewed";
|
|
72
|
+
/** User converted on an A/B test */
|
|
73
|
+
AnalyticsEvent["AB_TEST_CONVERTED"] = "ab_test_converted";
|
|
74
|
+
/** Custom application-specific event */
|
|
75
|
+
AnalyticsEvent["CUSTOM_EVENT"] = "custom_event";
|
|
76
|
+
})(AnalyticsEvent || (exports.AnalyticsEvent = AnalyticsEvent = {}));
|
|
77
|
+
/**
|
|
78
|
+
* Utility class for building standardized analytics event properties.
|
|
79
|
+
*
|
|
80
|
+
* Provides static methods to create consistent event property objects
|
|
81
|
+
* for common analytics scenarios. Ensures proper naming conventions
|
|
82
|
+
* and includes standard fields like timestamps.
|
|
83
|
+
*
|
|
84
|
+
* @ai-utility-class Event property builders
|
|
85
|
+
* @ai-pattern Factory pattern for event properties
|
|
86
|
+
* @ai-standardization Ensures consistent event property naming
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* // Use builders to create standardized event properties
|
|
91
|
+
* const properties = AnalyticsEventBuilder.emailAction('read', 'email-123', 'inbox');
|
|
92
|
+
* analytics.trackEvent(AnalyticsEvent.EMAIL_OPENED, properties);
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
class AnalyticsEventBuilder {
|
|
96
|
+
/**
|
|
97
|
+
* Build properties for email action events.
|
|
98
|
+
*
|
|
99
|
+
* @param action Email action performed (read, sent, archived, etc.)
|
|
100
|
+
* @param emailId Unique identifier for the email
|
|
101
|
+
* @param folder Email folder context (inbox, sent, trash, etc.)
|
|
102
|
+
* @returns Standardized event properties object
|
|
103
|
+
*
|
|
104
|
+
* @ai-builder Email action properties
|
|
105
|
+
* @ai-standardization Consistent email event tracking
|
|
106
|
+
*/
|
|
107
|
+
static emailAction(action, emailId, folder) {
|
|
108
|
+
return {
|
|
109
|
+
action,
|
|
110
|
+
email_id: emailId,
|
|
111
|
+
folder,
|
|
112
|
+
timestamp: Date.now(),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Build properties for page/screen view events.
|
|
117
|
+
*
|
|
118
|
+
* @param pageName Human-readable page name
|
|
119
|
+
* @param pagePath URL path or screen identifier
|
|
120
|
+
* @returns Standardized page view properties
|
|
121
|
+
*
|
|
122
|
+
* @ai-builder Navigation tracking properties
|
|
123
|
+
* @ai-cross-platform Works for web pages and mobile screens
|
|
124
|
+
*/
|
|
125
|
+
static pageView(pageName, pagePath) {
|
|
126
|
+
return {
|
|
127
|
+
page_name: pageName,
|
|
128
|
+
page_path: pagePath,
|
|
129
|
+
timestamp: Date.now(),
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Build properties for error tracking events.
|
|
134
|
+
*
|
|
135
|
+
* @param errorType Category of error (network, validation, runtime, etc.)
|
|
136
|
+
* @param errorMessage Error message or description
|
|
137
|
+
* @param pageName Page/screen where error occurred
|
|
138
|
+
* @returns Standardized error event properties
|
|
139
|
+
*
|
|
140
|
+
* @ai-builder Error tracking properties
|
|
141
|
+
* @ai-debugging Consistent error event structure
|
|
142
|
+
*/
|
|
143
|
+
static error(errorType, errorMessage, pageName) {
|
|
144
|
+
return {
|
|
145
|
+
error_type: errorType,
|
|
146
|
+
error_message: errorMessage,
|
|
147
|
+
page_name: pageName,
|
|
148
|
+
timestamp: Date.now(),
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Build properties for subscription/revenue events.
|
|
153
|
+
*
|
|
154
|
+
* @param action Subscription action (subscribe, upgrade, cancel, etc.)
|
|
155
|
+
* @param planType Subscription plan type (free, premium, pro, etc.)
|
|
156
|
+
* @param amount Monetary amount (for revenue tracking)
|
|
157
|
+
* @param currency Currency code (USD, EUR, etc.)
|
|
158
|
+
* @returns Standardized subscription event properties
|
|
159
|
+
*
|
|
160
|
+
* @ai-builder Revenue tracking properties
|
|
161
|
+
* @ai-business-metrics Subscription and revenue analytics
|
|
162
|
+
*/
|
|
163
|
+
static subscription(action, planType, amount, currency) {
|
|
164
|
+
return {
|
|
165
|
+
action,
|
|
166
|
+
plan_type: planType,
|
|
167
|
+
amount,
|
|
168
|
+
currency,
|
|
169
|
+
timestamp: Date.now(),
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Build properties for user engagement events.
|
|
174
|
+
*
|
|
175
|
+
* @param feature Feature name or component identifier
|
|
176
|
+
* @param interaction Type of interaction (click, scroll, hover, etc.)
|
|
177
|
+
* @param duration Time spent on interaction (milliseconds)
|
|
178
|
+
* @returns Standardized engagement event properties
|
|
179
|
+
*
|
|
180
|
+
* @ai-builder User engagement properties
|
|
181
|
+
* @ai-ux-analytics User experience and interaction tracking
|
|
182
|
+
*/
|
|
183
|
+
static engagement(feature, interaction, duration) {
|
|
184
|
+
return {
|
|
185
|
+
feature,
|
|
186
|
+
interaction,
|
|
187
|
+
duration,
|
|
188
|
+
timestamp: Date.now(),
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Build properties for performance monitoring events.
|
|
193
|
+
*
|
|
194
|
+
* @param metric Performance metric name (load_time, api_response, etc.)
|
|
195
|
+
* @param value Metric value (usually in milliseconds)
|
|
196
|
+
* @param context Additional context about the performance event
|
|
197
|
+
* @returns Standardized performance event properties
|
|
198
|
+
*
|
|
199
|
+
* @ai-builder Performance monitoring properties
|
|
200
|
+
* @ai-performance Application performance tracking
|
|
201
|
+
*/
|
|
202
|
+
static performance(metric, value, context) {
|
|
203
|
+
return {
|
|
204
|
+
metric,
|
|
205
|
+
value,
|
|
206
|
+
context,
|
|
207
|
+
timestamp: Date.now(),
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
exports.AnalyticsEventBuilder = AnalyticsEventBuilder;
|
|
212
|
+
//# sourceMappingURL=analytics.js.map
|
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Analytics types and interfaces
|
|
3
|
+
* Platform-agnostic analytics service interface for dependency injection
|
|
4
|
+
*
|
|
5
|
+
* @ai-context Core analytics interface for dependency injection
|
|
6
|
+
* @ai-pattern Service interface with comprehensive event tracking
|
|
7
|
+
* @ai-platform Cross-platform compatible (Web, React Native, Node.js)
|
|
8
|
+
* @ai-usage Implement this interface to create analytics services for Firebase, Mixpanel, etc.
|
|
9
|
+
*/
|
|
10
|
+
import { Optional } from '../common';
|
|
11
|
+
/**
|
|
12
|
+
* Flexible analytics event properties interface.
|
|
13
|
+
*
|
|
14
|
+
* Supports arbitrary key-value pairs for analytics event metadata
|
|
15
|
+
* with common data types used in analytics tracking.
|
|
16
|
+
*/
|
|
17
|
+
export interface AnalyticsEventProperties {
|
|
18
|
+
/** Flexible analytics properties supporting common data types */
|
|
19
|
+
[key: string]: Optional<string | number | boolean>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Standardized analytics events enumeration.
|
|
23
|
+
*
|
|
24
|
+
* Provides consistent event naming for common application analytics scenarios.
|
|
25
|
+
* Organized by functional categories for better code organization and analytics reporting.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* // Use predefined events for consistency
|
|
30
|
+
* analytics.track(AnalyticsEvent.USER_LOGIN, { method: 'email' });
|
|
31
|
+
* analytics.track(AnalyticsEvent.EMAIL_OPENED, { email_id: 'msg-123' });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare enum AnalyticsEvent {
|
|
35
|
+
/** User successfully logged into the application */
|
|
36
|
+
USER_LOGIN = "user_login",
|
|
37
|
+
/** User logged out of the application */
|
|
38
|
+
USER_LOGOUT = "user_logout",
|
|
39
|
+
/** New user completed account registration */
|
|
40
|
+
USER_SIGNUP = "user_signup",
|
|
41
|
+
/** User sent an email message */
|
|
42
|
+
EMAIL_SENT = "email_sent",
|
|
43
|
+
/** User received a new email message */
|
|
44
|
+
EMAIL_RECEIVED = "email_received",
|
|
45
|
+
/** User opened an email message (consolidated from EMAIL_OPENED and EMAIL_OPEN) */
|
|
46
|
+
EMAIL_OPENED = "email_opened",
|
|
47
|
+
/** User replied to an email message */
|
|
48
|
+
EMAIL_REPLY = "email_reply",
|
|
49
|
+
/** User forwarded an email message */
|
|
50
|
+
EMAIL_FORWARD = "email_forward",
|
|
51
|
+
/** User deleted an email message */
|
|
52
|
+
EMAIL_DELETE = "email_delete",
|
|
53
|
+
/** User starred an email message */
|
|
54
|
+
EMAIL_STAR = "email_star",
|
|
55
|
+
/** User composed a new email */
|
|
56
|
+
EMAIL_COMPOSE = "email_compose",
|
|
57
|
+
/** User clicked a link within an email */
|
|
58
|
+
EMAIL_CLICKED = "email_clicked",
|
|
59
|
+
/** User viewed a web page */
|
|
60
|
+
PAGE_VIEW = "page_view",
|
|
61
|
+
/** User viewed a mobile screen */
|
|
62
|
+
SCREEN_VIEW = "screen_view",
|
|
63
|
+
/** User switched between folders */
|
|
64
|
+
FOLDER_SWITCH = "folder_switch",
|
|
65
|
+
/** User viewed subscription options */
|
|
66
|
+
SUBSCRIPTION_VIEW = "subscription_view",
|
|
67
|
+
/** User purchased a subscription */
|
|
68
|
+
SUBSCRIPTION_PURCHASE = "subscription_purchase",
|
|
69
|
+
/** User cancelled a subscription */
|
|
70
|
+
SUBSCRIPTION_CANCEL = "subscription_cancel",
|
|
71
|
+
/** User performed a search */
|
|
72
|
+
SEARCH_PERFORMED = "search_performed",
|
|
73
|
+
/** User changed application settings */
|
|
74
|
+
SETTINGS_CHANGED = "settings_changed",
|
|
75
|
+
/** An application error occurred */
|
|
76
|
+
ERROR_OCCURRED = "error_occurred",
|
|
77
|
+
/** User viewed an A/B test variant */
|
|
78
|
+
AB_TEST_VIEWED = "ab_test_viewed",
|
|
79
|
+
/** User converted on an A/B test */
|
|
80
|
+
AB_TEST_CONVERTED = "ab_test_converted",
|
|
81
|
+
/** Custom application-specific event */
|
|
82
|
+
CUSTOM_EVENT = "custom_event"
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Core analytics service interface for tracking user behavior and app performance.
|
|
86
|
+
*
|
|
87
|
+
* This interface provides a complete analytics abstraction that can be implemented
|
|
88
|
+
* by various analytics providers (Firebase Analytics, Mixpanel, Adobe Analytics, etc.).
|
|
89
|
+
*
|
|
90
|
+
* @ai-interface-type Service Provider
|
|
91
|
+
* @ai-implementation-examples Firebase Analytics, Mixpanel, Adobe Analytics
|
|
92
|
+
*/
|
|
93
|
+
export interface AnalyticsService {
|
|
94
|
+
/**
|
|
95
|
+
* Initialize analytics service with configuration.
|
|
96
|
+
*
|
|
97
|
+
* @param config Analytics configuration including API keys and settings
|
|
98
|
+
* @returns Promise that resolves when initialization is complete
|
|
99
|
+
*
|
|
100
|
+
* @ai-pattern Async initialization pattern
|
|
101
|
+
* @example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* await analytics.initialize({
|
|
104
|
+
* apiKey: 'your-api-key',
|
|
105
|
+
* enabled: true,
|
|
106
|
+
* debugMode: false
|
|
107
|
+
* });
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
initialize(config: AnalyticsConfig): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Track a user event with optional properties.
|
|
113
|
+
*
|
|
114
|
+
* @param event Event name (use AnalyticsEvent enum or custom string)
|
|
115
|
+
* @param properties Additional event properties for context
|
|
116
|
+
*
|
|
117
|
+
* @ai-pattern Event tracking with typed enums
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* analytics.trackEvent(AnalyticsEvent.USER_LOGIN, {
|
|
121
|
+
* login_method: 'email',
|
|
122
|
+
* user_type: 'premium'
|
|
123
|
+
* });
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
trackEvent(event: AnalyticsEvent | string, properties?: Optional<AnalyticsEventProperties>): void;
|
|
127
|
+
/**
|
|
128
|
+
* Set a user property for analytics segmentation.
|
|
129
|
+
*
|
|
130
|
+
* @param key Property name
|
|
131
|
+
* @param value Property value
|
|
132
|
+
*
|
|
133
|
+
* @ai-pattern User property management
|
|
134
|
+
*/
|
|
135
|
+
setUserProperty(key: string, value: string): void;
|
|
136
|
+
/**
|
|
137
|
+
* Set the user ID for analytics tracking.
|
|
138
|
+
*
|
|
139
|
+
* @param userId Unique user identifier
|
|
140
|
+
*
|
|
141
|
+
* @ai-pattern User identification
|
|
142
|
+
*/
|
|
143
|
+
setUserId(userId: string): void;
|
|
144
|
+
/**
|
|
145
|
+
* Set multiple user properties in a single call.
|
|
146
|
+
*
|
|
147
|
+
* @param properties Object containing key-value pairs of user properties
|
|
148
|
+
*
|
|
149
|
+
* @ai-pattern Batch property setting
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* analytics.setUserProperties({
|
|
153
|
+
* subscription_tier: 'premium',
|
|
154
|
+
* signup_date: '2024-01-15',
|
|
155
|
+
* preferred_language: 'en'
|
|
156
|
+
* });
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
setUserProperties(properties: Record<string, string>): void;
|
|
160
|
+
/**
|
|
161
|
+
* Track screen or page views for navigation analytics.
|
|
162
|
+
*
|
|
163
|
+
* @param screenName Name of the screen/page being viewed
|
|
164
|
+
* @param properties Additional context about the screen view
|
|
165
|
+
*
|
|
166
|
+
* @ai-pattern Navigation tracking
|
|
167
|
+
* @ai-cross-platform Works for both React (pages) and React Native (screens)
|
|
168
|
+
*/
|
|
169
|
+
trackScreen(screenName: string, properties?: Optional<AnalyticsEventProperties>): void;
|
|
170
|
+
/**
|
|
171
|
+
* Track application errors for monitoring and debugging.
|
|
172
|
+
*
|
|
173
|
+
* @param error Error object containing error details
|
|
174
|
+
* @param context Additional context about when/where the error occurred
|
|
175
|
+
*
|
|
176
|
+
* @ai-pattern Error tracking and monitoring
|
|
177
|
+
* @example
|
|
178
|
+
* ```typescript
|
|
179
|
+
* try {
|
|
180
|
+
* // some operation
|
|
181
|
+
* } catch (error) {
|
|
182
|
+
* analytics.trackError(error, {
|
|
183
|
+
* component: 'EmailComposer',
|
|
184
|
+
* action: 'send_email'
|
|
185
|
+
* });
|
|
186
|
+
* }
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
trackError(error: Error, context?: Optional<AnalyticsEventProperties>): void;
|
|
190
|
+
/**
|
|
191
|
+
* Track timing events for performance monitoring.
|
|
192
|
+
*
|
|
193
|
+
* @param category Timing category (e.g., 'api_call', 'page_load')
|
|
194
|
+
* @param variable Specific timing variable name
|
|
195
|
+
* @param time Time in milliseconds
|
|
196
|
+
* @param label Optional label for additional context
|
|
197
|
+
*
|
|
198
|
+
* @ai-pattern Performance monitoring
|
|
199
|
+
* @example
|
|
200
|
+
* ```typescript
|
|
201
|
+
* const startTime = Date.now();
|
|
202
|
+
* // ... perform operation
|
|
203
|
+
* const duration = Date.now() - startTime;
|
|
204
|
+
* analytics.trackTiming('api_call', 'fetch_emails', duration, 'inbox');
|
|
205
|
+
* ```
|
|
206
|
+
*/
|
|
207
|
+
trackTiming(category: string, variable: string, time: number, label?: Optional<string>): void;
|
|
208
|
+
/**
|
|
209
|
+
* Check if analytics tracking is currently enabled.
|
|
210
|
+
*
|
|
211
|
+
* @returns true if analytics is enabled, false otherwise
|
|
212
|
+
*
|
|
213
|
+
* @ai-pattern State checking
|
|
214
|
+
*/
|
|
215
|
+
isEnabled(): boolean;
|
|
216
|
+
/**
|
|
217
|
+
* Enable or disable analytics tracking.
|
|
218
|
+
*
|
|
219
|
+
* @param enabled Whether to enable analytics tracking
|
|
220
|
+
*
|
|
221
|
+
* @ai-pattern Feature toggle
|
|
222
|
+
* @ai-privacy Respects user privacy preferences
|
|
223
|
+
*/
|
|
224
|
+
setEnabled(enabled: boolean): void;
|
|
225
|
+
/**
|
|
226
|
+
* Reset all user-specific analytics data (call on logout).
|
|
227
|
+
*
|
|
228
|
+
* @ai-pattern User session management
|
|
229
|
+
* @ai-privacy Clears user data on logout for privacy
|
|
230
|
+
*/
|
|
231
|
+
resetUser(): void;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Configuration interface for analytics service initialization.
|
|
235
|
+
*
|
|
236
|
+
* @ai-config-interface Analytics service configuration
|
|
237
|
+
* @ai-pattern Configuration object pattern
|
|
238
|
+
* @ai-security Contains sensitive data (API keys) - handle securely
|
|
239
|
+
*/
|
|
240
|
+
export interface AnalyticsConfig {
|
|
241
|
+
/** API key for the analytics service (Firebase, Mixpanel, etc.) */
|
|
242
|
+
apiKey?: Optional<string>;
|
|
243
|
+
/** Application identifier for the analytics platform */
|
|
244
|
+
appId?: Optional<string>;
|
|
245
|
+
/** Google Analytics measurement ID (for Firebase Analytics) */
|
|
246
|
+
measurementId?: Optional<string>;
|
|
247
|
+
/** Whether analytics tracking is enabled */
|
|
248
|
+
enabled: boolean;
|
|
249
|
+
/** Enable debug mode for development/testing */
|
|
250
|
+
debugMode: boolean;
|
|
251
|
+
/** Pre-set user ID for analytics (optional) */
|
|
252
|
+
userId?: Optional<string>;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Extended analytics interface specifically designed for email applications.
|
|
256
|
+
*
|
|
257
|
+
* Provides email-specific tracking methods while inheriting all base analytics functionality.
|
|
258
|
+
* Perfect for email clients, marketing platforms, and communication apps.
|
|
259
|
+
*
|
|
260
|
+
* @ai-interface-type Extended Service Provider
|
|
261
|
+
* @ai-domain Email and communication applications
|
|
262
|
+
* @ai-inheritance Extends AnalyticsService with email-specific methods
|
|
263
|
+
*
|
|
264
|
+
* @example
|
|
265
|
+
* ```typescript
|
|
266
|
+
* class EmailAppAnalytics implements EmailAnalyticsService {
|
|
267
|
+
* // Implement all AnalyticsService methods plus email-specific ones
|
|
268
|
+
* trackEmailAction(action: 'sent' | 'read' | 'archived', emailId: string) { ... }
|
|
269
|
+
* }
|
|
270
|
+
* ```
|
|
271
|
+
*/
|
|
272
|
+
export interface EmailAnalyticsService extends AnalyticsService {
|
|
273
|
+
/**
|
|
274
|
+
* Track email-specific user actions.
|
|
275
|
+
*
|
|
276
|
+
* @param action The email action performed (sent, read, archived, deleted, etc.)
|
|
277
|
+
* @param emailId Unique identifier for the email
|
|
278
|
+
* @param properties Additional context about the email action
|
|
279
|
+
*
|
|
280
|
+
* @ai-pattern Domain-specific event tracking
|
|
281
|
+
* @ai-use-case Email client analytics, engagement tracking
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```typescript
|
|
285
|
+
* analytics.trackEmailAction('read', 'email-123', {
|
|
286
|
+
* folder: 'inbox',
|
|
287
|
+
* sender: 'user@example.com',
|
|
288
|
+
* subject_length: 45
|
|
289
|
+
* });
|
|
290
|
+
* ```
|
|
291
|
+
*/
|
|
292
|
+
trackEmailAction(action: string, emailId: string, properties?: Optional<AnalyticsEventProperties>): void;
|
|
293
|
+
/**
|
|
294
|
+
* Track user navigation between different sections of the app.
|
|
295
|
+
*
|
|
296
|
+
* @param from Previous screen/page identifier
|
|
297
|
+
* @param to Current screen/page identifier
|
|
298
|
+
* @param properties Additional navigation context
|
|
299
|
+
*
|
|
300
|
+
* @ai-pattern Navigation flow tracking
|
|
301
|
+
* @ai-use-case User journey analysis, UX optimization
|
|
302
|
+
*/
|
|
303
|
+
trackNavigation(from: string, to: string, properties?: Optional<AnalyticsEventProperties>): void;
|
|
304
|
+
/**
|
|
305
|
+
* Track subscription-related events (upgrades, cancellations, etc.).
|
|
306
|
+
*
|
|
307
|
+
* @param action Subscription action (subscribe, upgrade, cancel, renew)
|
|
308
|
+
* @param planType Type of subscription plan (free, premium, pro, etc.)
|
|
309
|
+
* @param properties Additional subscription context
|
|
310
|
+
*
|
|
311
|
+
* @ai-pattern Revenue and subscription tracking
|
|
312
|
+
* @ai-use-case Subscription analytics, churn analysis
|
|
313
|
+
*
|
|
314
|
+
* @example
|
|
315
|
+
* ```typescript
|
|
316
|
+
* analytics.trackSubscription('upgrade', 'premium', {
|
|
317
|
+
* previous_plan: 'free',
|
|
318
|
+
* billing_cycle: 'monthly',
|
|
319
|
+
* revenue: 9.99
|
|
320
|
+
* });
|
|
321
|
+
* ```
|
|
322
|
+
*/
|
|
323
|
+
trackSubscription(action: string, planType?: Optional<string>, properties?: Optional<AnalyticsEventProperties>): void;
|
|
324
|
+
/**
|
|
325
|
+
* Track search queries and results.
|
|
326
|
+
*
|
|
327
|
+
* @param query The search query entered by user
|
|
328
|
+
* @param resultsCount Number of results returned
|
|
329
|
+
* @param properties Additional search context
|
|
330
|
+
*
|
|
331
|
+
* @ai-pattern Search analytics
|
|
332
|
+
* @ai-use-case Search optimization, content discovery analysis
|
|
333
|
+
*/
|
|
334
|
+
trackSearch(query: string, resultsCount: number, properties?: Optional<AnalyticsEventProperties>): void;
|
|
335
|
+
/**
|
|
336
|
+
* Track A/B test interactions for experimental features.
|
|
337
|
+
*
|
|
338
|
+
* @param testName Name/identifier of the A/B test
|
|
339
|
+
* @param variant Which variant the user is seeing (A, B, control, etc.)
|
|
340
|
+
* @param action Whether user viewed or converted on the test
|
|
341
|
+
* @param conversionType Type of conversion if action is 'converted'
|
|
342
|
+
*
|
|
343
|
+
* @ai-pattern A/B testing and experimentation
|
|
344
|
+
* @ai-use-case Feature testing, conversion optimization
|
|
345
|
+
*
|
|
346
|
+
* @example
|
|
347
|
+
* ```typescript
|
|
348
|
+
* // When user sees the test
|
|
349
|
+
* analytics.trackABTest('new-compose-ui', 'variant-b', 'viewed');
|
|
350
|
+
*
|
|
351
|
+
* // When user converts
|
|
352
|
+
* analytics.trackABTest('new-compose-ui', 'variant-b', 'converted', 'email-sent');
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
355
|
+
trackABTest(testName: string, variant: string, action: 'viewed' | 'converted', conversionType?: Optional<string>): void;
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Utility class for building standardized analytics event properties.
|
|
359
|
+
*
|
|
360
|
+
* Provides static methods to create consistent event property objects
|
|
361
|
+
* for common analytics scenarios. Ensures proper naming conventions
|
|
362
|
+
* and includes standard fields like timestamps.
|
|
363
|
+
*
|
|
364
|
+
* @ai-utility-class Event property builders
|
|
365
|
+
* @ai-pattern Factory pattern for event properties
|
|
366
|
+
* @ai-standardization Ensures consistent event property naming
|
|
367
|
+
*
|
|
368
|
+
* @example
|
|
369
|
+
* ```typescript
|
|
370
|
+
* // Use builders to create standardized event properties
|
|
371
|
+
* const properties = AnalyticsEventBuilder.emailAction('read', 'email-123', 'inbox');
|
|
372
|
+
* analytics.trackEvent(AnalyticsEvent.EMAIL_OPENED, properties);
|
|
373
|
+
* ```
|
|
374
|
+
*/
|
|
375
|
+
export declare class AnalyticsEventBuilder {
|
|
376
|
+
/**
|
|
377
|
+
* Build properties for email action events.
|
|
378
|
+
*
|
|
379
|
+
* @param action Email action performed (read, sent, archived, etc.)
|
|
380
|
+
* @param emailId Unique identifier for the email
|
|
381
|
+
* @param folder Email folder context (inbox, sent, trash, etc.)
|
|
382
|
+
* @returns Standardized event properties object
|
|
383
|
+
*
|
|
384
|
+
* @ai-builder Email action properties
|
|
385
|
+
* @ai-standardization Consistent email event tracking
|
|
386
|
+
*/
|
|
387
|
+
static emailAction(action: string, emailId: string, folder?: Optional<string>): AnalyticsEventProperties;
|
|
388
|
+
/**
|
|
389
|
+
* Build properties for page/screen view events.
|
|
390
|
+
*
|
|
391
|
+
* @param pageName Human-readable page name
|
|
392
|
+
* @param pagePath URL path or screen identifier
|
|
393
|
+
* @returns Standardized page view properties
|
|
394
|
+
*
|
|
395
|
+
* @ai-builder Navigation tracking properties
|
|
396
|
+
* @ai-cross-platform Works for web pages and mobile screens
|
|
397
|
+
*/
|
|
398
|
+
static pageView(pageName: string, pagePath: string): AnalyticsEventProperties;
|
|
399
|
+
/**
|
|
400
|
+
* Build properties for error tracking events.
|
|
401
|
+
*
|
|
402
|
+
* @param errorType Category of error (network, validation, runtime, etc.)
|
|
403
|
+
* @param errorMessage Error message or description
|
|
404
|
+
* @param pageName Page/screen where error occurred
|
|
405
|
+
* @returns Standardized error event properties
|
|
406
|
+
*
|
|
407
|
+
* @ai-builder Error tracking properties
|
|
408
|
+
* @ai-debugging Consistent error event structure
|
|
409
|
+
*/
|
|
410
|
+
static error(errorType: string, errorMessage: string, pageName?: Optional<string>): AnalyticsEventProperties;
|
|
411
|
+
/**
|
|
412
|
+
* Build properties for subscription/revenue events.
|
|
413
|
+
*
|
|
414
|
+
* @param action Subscription action (subscribe, upgrade, cancel, etc.)
|
|
415
|
+
* @param planType Subscription plan type (free, premium, pro, etc.)
|
|
416
|
+
* @param amount Monetary amount (for revenue tracking)
|
|
417
|
+
* @param currency Currency code (USD, EUR, etc.)
|
|
418
|
+
* @returns Standardized subscription event properties
|
|
419
|
+
*
|
|
420
|
+
* @ai-builder Revenue tracking properties
|
|
421
|
+
* @ai-business-metrics Subscription and revenue analytics
|
|
422
|
+
*/
|
|
423
|
+
static subscription(action: string, planType?: Optional<string>, amount?: Optional<number>, currency?: Optional<string>): AnalyticsEventProperties;
|
|
424
|
+
/**
|
|
425
|
+
* Build properties for user engagement events.
|
|
426
|
+
*
|
|
427
|
+
* @param feature Feature name or component identifier
|
|
428
|
+
* @param interaction Type of interaction (click, scroll, hover, etc.)
|
|
429
|
+
* @param duration Time spent on interaction (milliseconds)
|
|
430
|
+
* @returns Standardized engagement event properties
|
|
431
|
+
*
|
|
432
|
+
* @ai-builder User engagement properties
|
|
433
|
+
* @ai-ux-analytics User experience and interaction tracking
|
|
434
|
+
*/
|
|
435
|
+
static engagement(feature: string, interaction: string, duration?: Optional<number>): AnalyticsEventProperties;
|
|
436
|
+
/**
|
|
437
|
+
* Build properties for performance monitoring events.
|
|
438
|
+
*
|
|
439
|
+
* @param metric Performance metric name (load_time, api_response, etc.)
|
|
440
|
+
* @param value Metric value (usually in milliseconds)
|
|
441
|
+
* @param context Additional context about the performance event
|
|
442
|
+
* @returns Standardized performance event properties
|
|
443
|
+
*
|
|
444
|
+
* @ai-builder Performance monitoring properties
|
|
445
|
+
* @ai-performance Application performance tracking
|
|
446
|
+
*/
|
|
447
|
+
static performance(metric: string, value: number, context?: Optional<string>): AnalyticsEventProperties;
|
|
448
|
+
}
|
|
449
|
+
//# sourceMappingURL=analytics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../../src/types/infrastructure/analytics.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC;;;;;GAKG;AACH,MAAM,WAAW,wBAAwB;IACvC,iEAAiE;IACjE,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;CACpD;AAED;;;;;;;;;;;;GAYG;AACH,oBAAY,cAAc;IACxB,oDAAoD;IACpD,UAAU,eAAe;IACzB,yCAAyC;IACzC,WAAW,gBAAgB;IAC3B,8CAA8C;IAC9C,WAAW,gBAAgB;IAE3B,iCAAiC;IACjC,UAAU,eAAe;IACzB,wCAAwC;IACxC,cAAc,mBAAmB;IACjC,mFAAmF;IACnF,YAAY,iBAAiB;IAC7B,uCAAuC;IACvC,WAAW,gBAAgB;IAC3B,sCAAsC;IACtC,aAAa,kBAAkB;IAC/B,oCAAoC;IACpC,YAAY,iBAAiB;IAC7B,oCAAoC;IACpC,UAAU,eAAe;IACzB,gCAAgC;IAChC,aAAa,kBAAkB;IAC/B,0CAA0C;IAC1C,aAAa,kBAAkB;IAE/B,6BAA6B;IAC7B,SAAS,cAAc;IACvB,kCAAkC;IAClC,WAAW,gBAAgB;IAC3B,oCAAoC;IACpC,aAAa,kBAAkB;IAE/B,uCAAuC;IACvC,iBAAiB,sBAAsB;IACvC,oCAAoC;IACpC,qBAAqB,0BAA0B;IAC/C,oCAAoC;IACpC,mBAAmB,wBAAwB;IAE3C,8BAA8B;IAC9B,gBAAgB,qBAAqB;IACrC,wCAAwC;IACxC,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