@mintlify/common 1.0.634 → 1.0.636

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.
@@ -0,0 +1,26 @@
1
+ export declare const PAGE_VIEW_EVENT = "docs.content.view";
2
+ /**
3
+ * Analytics event names following a standardized naming convention.
4
+ *
5
+ * @description All event names follow the format: `platform.noun.action`
6
+ * - **platform**: The platform where the event occurs (e.g., 'docs')
7
+ * - **noun**: The component or feature being interacted with (e.g., 'expandable', 'search')
8
+ * - **action**: The specific action taken (e.g., 'open', 'click', 'copy')
9
+ */
10
+ export declare const ANALYTICS_EVENTS: readonly ["docs.content.view", "docs.expandable.open", "docs.expandable.close", "docs.accordion.open", "docs.accordion.close", "docs.navitem.click", "docs.navitem.cta_click", "docs.search.close", "docs.api_playground.request", "docs.search.result_click", "docs.code_block.copy", "docs.code_block.ask_ai", "docs.feedback.thumbs_up", "docs.feedback.thumbs_down", "docs.footer.powered_by_mintlify_click", "docs.assistant.enter", "docs.assistant.completed", "docs.assistant.shared", "docs.assistant.source_click", "docs.assistant.web_search_click", "docs.assistant.thumbs_up", "docs.assistant.thumbs_down", "docs.assistant.suggestion_click", "docs.assistant.starter_question_clicked", "docs.assistant.maximize_click", "docs.assistant.minimize_click", "docs.assistant.copy_response", "docs.assistant.ask_ai_on_text_selection", "docs.context_menu.copy_page", "docs.context_menu.copy_mcp_link", "docs.context_menu.ai_provider_click", "docs.context_menu.install_mcp_server"];
11
+ export type AnalyticsEvent = (typeof ANALYTICS_EVENTS)[number];
12
+ export declare function isAnalyticsEvent(value: string): value is AnalyticsEvent;
13
+ /**
14
+ * @deprecated Use the new format instead
15
+ * @Date 2025-06-16 (remove this in two months)
16
+ */
17
+ export declare const DEPRECATED_ANALYTICS_EVENTS: readonly ["expandable_open", "expandable_close", "accordion_open", "accordion_close", "header_nav_item_click", "cta_click", "scroll_to_bottom", "search_close", "api_playground_call", "search_result_click", "chat_enter", "chat_followup", "chat_completed", "code_block_copy", "chat_shared", "thumb_vote", "powered_by_mintlify_click", "ai_chat_citation_click", "ai_chat_feedback_positive_click", "ai_chat_feedback_negative_click", "ask_ai_code_block"];
18
+ /** @deprecated Use AnalyticsEvent instead */
19
+ export type DeprecatedAnalyticsEvent = (typeof DEPRECATED_ANALYTICS_EVENTS)[number];
20
+ /** @deprecated Use isAnalyticsEvent instead */
21
+ export declare function isDeprecatedAnalyticsEvent(value: string): value is DeprecatedAnalyticsEvent;
22
+ /**
23
+ * Mapping from new analytics events to their deprecated equivalents
24
+ * to maintain backward compatibility
25
+ */
26
+ export declare const analyticsEventMapping: Partial<Record<AnalyticsEvent, DeprecatedAnalyticsEvent>>;
@@ -0,0 +1,101 @@
1
+ export const PAGE_VIEW_EVENT = 'docs.content.view';
2
+ /**
3
+ * Analytics event names following a standardized naming convention.
4
+ *
5
+ * @description All event names follow the format: `platform.noun.action`
6
+ * - **platform**: The platform where the event occurs (e.g., 'docs')
7
+ * - **noun**: The component or feature being interacted with (e.g., 'expandable', 'search')
8
+ * - **action**: The specific action taken (e.g., 'open', 'click', 'copy')
9
+ */
10
+ export const ANALYTICS_EVENTS = [
11
+ PAGE_VIEW_EVENT,
12
+ 'docs.expandable.open',
13
+ 'docs.expandable.close',
14
+ 'docs.accordion.open',
15
+ 'docs.accordion.close',
16
+ 'docs.navitem.click',
17
+ 'docs.navitem.cta_click',
18
+ 'docs.search.close',
19
+ 'docs.api_playground.request',
20
+ 'docs.search.result_click',
21
+ 'docs.code_block.copy',
22
+ 'docs.code_block.ask_ai',
23
+ 'docs.feedback.thumbs_up',
24
+ 'docs.feedback.thumbs_down',
25
+ 'docs.footer.powered_by_mintlify_click',
26
+ 'docs.assistant.enter',
27
+ 'docs.assistant.completed',
28
+ 'docs.assistant.shared',
29
+ 'docs.assistant.source_click',
30
+ 'docs.assistant.web_search_click',
31
+ 'docs.assistant.thumbs_up',
32
+ 'docs.assistant.thumbs_down',
33
+ 'docs.assistant.suggestion_click',
34
+ 'docs.assistant.starter_question_clicked',
35
+ 'docs.assistant.maximize_click',
36
+ 'docs.assistant.minimize_click',
37
+ 'docs.assistant.copy_response',
38
+ 'docs.assistant.ask_ai_on_text_selection',
39
+ 'docs.context_menu.copy_page',
40
+ 'docs.context_menu.copy_mcp_link',
41
+ 'docs.context_menu.ai_provider_click',
42
+ 'docs.context_menu.install_mcp_server',
43
+ ];
44
+ export function isAnalyticsEvent(value) {
45
+ return ANALYTICS_EVENTS.includes(value);
46
+ }
47
+ /**
48
+ * @deprecated Use the new format instead
49
+ * @Date 2025-06-16 (remove this in two months)
50
+ */
51
+ export const DEPRECATED_ANALYTICS_EVENTS = [
52
+ 'expandable_open',
53
+ 'expandable_close',
54
+ 'accordion_open',
55
+ 'accordion_close',
56
+ 'header_nav_item_click',
57
+ 'cta_click',
58
+ 'scroll_to_bottom',
59
+ 'search_close',
60
+ 'api_playground_call',
61
+ 'search_result_click',
62
+ 'chat_enter',
63
+ 'chat_followup',
64
+ 'chat_completed',
65
+ 'code_block_copy',
66
+ 'chat_shared',
67
+ 'thumb_vote',
68
+ 'powered_by_mintlify_click',
69
+ 'ai_chat_citation_click',
70
+ 'ai_chat_feedback_positive_click',
71
+ 'ai_chat_feedback_negative_click',
72
+ 'ask_ai_code_block',
73
+ ];
74
+ /** @deprecated Use isAnalyticsEvent instead */
75
+ export function isDeprecatedAnalyticsEvent(value) {
76
+ return DEPRECATED_ANALYTICS_EVENTS.includes(value);
77
+ }
78
+ /**
79
+ * Mapping from new analytics events to their deprecated equivalents
80
+ * to maintain backward compatibility
81
+ */
82
+ export const analyticsEventMapping = {
83
+ 'docs.expandable.open': 'expandable_open',
84
+ 'docs.expandable.close': 'expandable_close',
85
+ 'docs.accordion.open': 'accordion_open',
86
+ 'docs.accordion.close': 'accordion_close',
87
+ 'docs.navitem.click': 'header_nav_item_click',
88
+ 'docs.navitem.cta_click': 'cta_click',
89
+ 'docs.search.close': 'search_close',
90
+ 'docs.api_playground.request': 'api_playground_call',
91
+ 'docs.search.result_click': 'search_result_click',
92
+ 'docs.code_block.copy': 'code_block_copy',
93
+ 'docs.code_block.ask_ai': 'ask_ai_code_block',
94
+ 'docs.footer.powered_by_mintlify_click': 'powered_by_mintlify_click',
95
+ 'docs.assistant.enter': 'chat_enter',
96
+ 'docs.assistant.completed': 'chat_completed',
97
+ 'docs.assistant.shared': 'chat_shared',
98
+ 'docs.assistant.source_click': 'ai_chat_citation_click',
99
+ 'docs.assistant.thumbs_up': 'ai_chat_feedback_positive_click',
100
+ 'docs.assistant.thumbs_down': 'ai_chat_feedback_negative_click',
101
+ };
@@ -3,3 +3,4 @@ export * from './mdx/index.js';
3
3
  export * from './guards.js';
4
4
  export * from './asyncapi.js';
5
5
  export * from './rss.js';
6
+ export * from './AnalyticsEvent.js';
@@ -2,3 +2,4 @@ export * from './mdx/index.js';
2
2
  export * from './guards.js';
3
3
  export * from './asyncapi.js';
4
4
  export * from './rss.js';
5
+ export * from './AnalyticsEvent.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mintlify/common",
3
- "version": "1.0.634",
3
+ "version": "1.0.636",
4
4
  "description": "Commonly shared code within Mintlify",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -108,5 +108,5 @@
108
108
  "typescript": "5.5.3",
109
109
  "vitest": "2.0.4"
110
110
  },
111
- "gitHead": "1949e7980366fca0c4bb6350820ed2599dcc97b8"
111
+ "gitHead": "9ee4e5c9449d36f7716ddf5b8a011aff51e9e31f"
112
112
  }