@guidelytech/guide-runtime 0.10.0 → 0.12.0

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.
@@ -1,4 +1,4 @@
1
- import { MessengerConversation, ConversationMessagesResponse, MessengerMessage, SdkArticlesResponse, ResourceCenterArticle, SdkHowTosResponse, SdkHowTo, MessengerPageContent, FileComplaintResponse, MessengerConfig, ResourceCenterConfig } from '@guidelytech/shared';
1
+ import { FeedbackPriority, FeedbackStatus, PublicFeedbackList, PublicFeedbackRequestDetail, PublicFeedbackRequest, FeedbackUpdatesResponse, MessengerConversation, ConversationMessagesResponse, MessengerMessage, SdkArticlesResponse, ResourceCenterArticle, SdkHowTosResponse, SdkHowTo, MessengerPageContent, FileComplaintResponse, MessengerConfig, ResourceCenterConfig, RuleGroup } from '@guidelytech/shared';
2
2
  import { H as HelpGuideRef } from './help-view-B4oPbhpO.cjs';
3
3
 
4
4
  /** What the messenger sends to file a complaint (the transport adds the visitor and page). */
@@ -15,6 +15,56 @@ interface ComplaintInput {
15
15
  } | null;
16
16
  }
17
17
 
18
+ type IdeaSort = "top" | "new" | "trending";
19
+ type IdeaFilter = "open" | "all" | "mine" | "following";
20
+ /** What the Ideas tab asks for (the transport adds the visitor). */
21
+ interface IdeaListQuery {
22
+ q?: string;
23
+ sort: IdeaSort;
24
+ filter: IdeaFilter;
25
+ status?: FeedbackStatus;
26
+ productArea?: string;
27
+ page: number;
28
+ }
29
+ /** A new idea (the transport adds the visitor and the page). */
30
+ interface IdeaInput {
31
+ title: string;
32
+ description: string;
33
+ productArea?: string | null;
34
+ priority: FeedbackPriority;
35
+ /** Suggested from this Scout conversation (Scout offered it). */
36
+ conversationId?: string | null;
37
+ }
38
+ interface IdeaVoteInput {
39
+ priority: FeedbackPriority;
40
+ note?: string;
41
+ conversationId?: string | null;
42
+ }
43
+ /** Server access for the Ideas tab. Every method is optional: transports before Ideas lack them. */
44
+ interface IdeasApi {
45
+ listIdeas?(query: IdeaListQuery): Promise<PublicFeedbackList>;
46
+ /** Reads one idea with its comments (and counts the view). */
47
+ getIdea?(id: string): Promise<PublicFeedbackRequestDetail>;
48
+ submitIdea?(input: IdeaInput): Promise<PublicFeedbackRequestDetail>;
49
+ voteIdea?(id: string, vote: IdeaVoteInput): Promise<PublicFeedbackRequest>;
50
+ unvoteIdea?(id: string): Promise<PublicFeedbackRequest>;
51
+ followIdea?(id: string, follow: boolean): Promise<PublicFeedbackRequest>;
52
+ commentIdea?(id: string, body: string): Promise<PublicFeedbackRequestDetail>;
53
+ similarIdeas?(title: string): Promise<PublicFeedbackRequest[]>;
54
+ ideaUpdates?(): Promise<FeedbackUpdatesResponse>;
55
+ markIdeaUpdatesRead?(ids?: string[]): Promise<FeedbackUpdatesResponse>;
56
+ /** A short-lived link into the hosted feedback portal. */
57
+ ideaPortalLink?(): Promise<string>;
58
+ }
59
+
60
+ /** Where the visitor left the launcher. `y`: 0 = the default bottom spot, 1 = as high as it goes. */
61
+ interface LauncherSpot {
62
+ side: "left" | "right";
63
+ y: number;
64
+ }
65
+ /** Reads a stored spot, ignoring anything malformed. */
66
+ declare function parseLauncherSpot(raw: unknown): LauncherSpot | null;
67
+
18
68
  /** Callbacks the transport invokes while a message is sent and Scout replies. */
19
69
  interface MessengerStreamHandlers {
20
70
  /** A new conversation was created (first message only). */
@@ -24,8 +74,9 @@ interface MessengerStreamHandlers {
24
74
  onDone(message: MessengerMessage | null, conversation: MessengerConversation): void;
25
75
  onError(message: string): void;
26
76
  }
27
- /** Server access for the messenger; implemented by sdk-core over the public SDK API. */
28
- interface MessengerApi {
77
+
78
+ /** Server access for the messenger; implemented by sdk-core over the public SDK API. The Ideas methods ({@link IdeasApi}) are optional. */
79
+ interface MessengerApi extends IdeasApi {
29
80
  listConversations(): Promise<MessengerConversation[]>;
30
81
  loadMessages(conversationId: string, since?: string | null): Promise<ConversationMessagesResponse>;
31
82
  start(text: string, handlers: MessengerStreamHandlers): Promise<void>;
@@ -43,7 +94,7 @@ interface MessengerApi {
43
94
  /** Files a complaint (transports before complaints lack it; the messenger then hides the form). */
44
95
  fileComplaint?(input: ComplaintInput): Promise<FileComplaintResponse>;
45
96
  }
46
- type MessengerTab = "home" | "messages" | "help" | "news";
97
+ type MessengerTab = "home" | "messages" | "help" | "ideas" | "news";
47
98
  /** A guide the visitor started and didn't finish. */
48
99
  interface MessengerResumeGuide {
49
100
  id: string;
@@ -71,6 +122,9 @@ interface MessengerNewsItem {
71
122
  imageUrl: string | null;
72
123
  publishedAt: string;
73
124
  unread: boolean;
125
+ /** Resource-center "What's new" entries: open this help article, or this link, instead of starting a guide. */
126
+ articleId?: string | null;
127
+ url?: string | null;
74
128
  }
75
129
  /** What the SDK knows about the visitor right now, read each time the messenger renders. */
76
130
  interface MessengerVisitor {
@@ -108,9 +162,15 @@ interface MessengerOptions {
108
162
  name?: string | null;
109
163
  };
110
164
  onResumeGuide?: (guideId: string, stepId: string) => void;
165
+ /** Evaluates a resource-center section's targeting for the current visitor (absent = every section shows). */
166
+ evaluate?: (rules: RuleGroup) => boolean;
111
167
  /** The visitor saw these announcements (News tab opened). */
112
168
  onNewsSeen?: (ids: string[]) => void;
113
169
  hideLauncher?: boolean;
170
+ /** Where the visitor last dragged the launcher on this device (null = the configured corner). */
171
+ launcherSpot?: LauncherSpot | null;
172
+ /** The visitor dragged the launcher somewhere else (save it for next time). */
173
+ onLauncherMove?: (spot: LauncherSpot) => void;
114
174
  /** Poll intervals (ms): open thread, and unread badge while closed. */
115
175
  pollMs?: {
116
176
  thread: number;
@@ -128,6 +188,8 @@ interface MessengerWidget {
128
188
  openArticle(id: string): void;
129
189
  /** Opens the complaint form, optionally with a category picked (when the project takes complaints). */
130
190
  openComplaint(categoryId?: string): void;
191
+ /** Opens the Ideas tab, or one idea (when the project turned Ideas on). */
192
+ openIdeas(requestId?: string): void;
131
193
  /** Re-reads the visitor (page changed, progress made) and re-renders what is showing. */
132
194
  refresh(): void;
133
195
  destroy(): void;
@@ -138,4 +200,4 @@ declare function relativeTime(iso: string, now?: number): string;
138
200
  /** Intercom-style messenger: launcher + panel with Home, Messages (chat with Scout / the team) and Help tabs. */
139
201
  declare function renderMessenger(options: MessengerOptions): MessengerWidget;
140
202
 
141
- export { type MessengerApi, type MessengerChecklistProgress, type MessengerNewsItem, type MessengerOptions, type MessengerResumeGuide, type MessengerStreamHandlers, type MessengerTab, type MessengerVisitor, type MessengerWidget, personalGreeting, relativeTime, renderMessenger };
203
+ export { type IdeaInput, type IdeaListQuery, type IdeaVoteInput, type IdeasApi, type LauncherSpot, type MessengerApi, type MessengerChecklistProgress, type MessengerNewsItem, type MessengerOptions, type MessengerResumeGuide, type MessengerStreamHandlers, type MessengerTab, type MessengerVisitor, type MessengerWidget, parseLauncherSpot, personalGreeting, relativeTime, renderMessenger };
@@ -1,4 +1,4 @@
1
- import { MessengerConversation, ConversationMessagesResponse, MessengerMessage, SdkArticlesResponse, ResourceCenterArticle, SdkHowTosResponse, SdkHowTo, MessengerPageContent, FileComplaintResponse, MessengerConfig, ResourceCenterConfig } from '@guidelytech/shared';
1
+ import { FeedbackPriority, FeedbackStatus, PublicFeedbackList, PublicFeedbackRequestDetail, PublicFeedbackRequest, FeedbackUpdatesResponse, MessengerConversation, ConversationMessagesResponse, MessengerMessage, SdkArticlesResponse, ResourceCenterArticle, SdkHowTosResponse, SdkHowTo, MessengerPageContent, FileComplaintResponse, MessengerConfig, ResourceCenterConfig, RuleGroup } from '@guidelytech/shared';
2
2
  import { H as HelpGuideRef } from './help-view-B4oPbhpO.js';
3
3
 
4
4
  /** What the messenger sends to file a complaint (the transport adds the visitor and page). */
@@ -15,6 +15,56 @@ interface ComplaintInput {
15
15
  } | null;
16
16
  }
17
17
 
18
+ type IdeaSort = "top" | "new" | "trending";
19
+ type IdeaFilter = "open" | "all" | "mine" | "following";
20
+ /** What the Ideas tab asks for (the transport adds the visitor). */
21
+ interface IdeaListQuery {
22
+ q?: string;
23
+ sort: IdeaSort;
24
+ filter: IdeaFilter;
25
+ status?: FeedbackStatus;
26
+ productArea?: string;
27
+ page: number;
28
+ }
29
+ /** A new idea (the transport adds the visitor and the page). */
30
+ interface IdeaInput {
31
+ title: string;
32
+ description: string;
33
+ productArea?: string | null;
34
+ priority: FeedbackPriority;
35
+ /** Suggested from this Scout conversation (Scout offered it). */
36
+ conversationId?: string | null;
37
+ }
38
+ interface IdeaVoteInput {
39
+ priority: FeedbackPriority;
40
+ note?: string;
41
+ conversationId?: string | null;
42
+ }
43
+ /** Server access for the Ideas tab. Every method is optional: transports before Ideas lack them. */
44
+ interface IdeasApi {
45
+ listIdeas?(query: IdeaListQuery): Promise<PublicFeedbackList>;
46
+ /** Reads one idea with its comments (and counts the view). */
47
+ getIdea?(id: string): Promise<PublicFeedbackRequestDetail>;
48
+ submitIdea?(input: IdeaInput): Promise<PublicFeedbackRequestDetail>;
49
+ voteIdea?(id: string, vote: IdeaVoteInput): Promise<PublicFeedbackRequest>;
50
+ unvoteIdea?(id: string): Promise<PublicFeedbackRequest>;
51
+ followIdea?(id: string, follow: boolean): Promise<PublicFeedbackRequest>;
52
+ commentIdea?(id: string, body: string): Promise<PublicFeedbackRequestDetail>;
53
+ similarIdeas?(title: string): Promise<PublicFeedbackRequest[]>;
54
+ ideaUpdates?(): Promise<FeedbackUpdatesResponse>;
55
+ markIdeaUpdatesRead?(ids?: string[]): Promise<FeedbackUpdatesResponse>;
56
+ /** A short-lived link into the hosted feedback portal. */
57
+ ideaPortalLink?(): Promise<string>;
58
+ }
59
+
60
+ /** Where the visitor left the launcher. `y`: 0 = the default bottom spot, 1 = as high as it goes. */
61
+ interface LauncherSpot {
62
+ side: "left" | "right";
63
+ y: number;
64
+ }
65
+ /** Reads a stored spot, ignoring anything malformed. */
66
+ declare function parseLauncherSpot(raw: unknown): LauncherSpot | null;
67
+
18
68
  /** Callbacks the transport invokes while a message is sent and Scout replies. */
19
69
  interface MessengerStreamHandlers {
20
70
  /** A new conversation was created (first message only). */
@@ -24,8 +74,9 @@ interface MessengerStreamHandlers {
24
74
  onDone(message: MessengerMessage | null, conversation: MessengerConversation): void;
25
75
  onError(message: string): void;
26
76
  }
27
- /** Server access for the messenger; implemented by sdk-core over the public SDK API. */
28
- interface MessengerApi {
77
+
78
+ /** Server access for the messenger; implemented by sdk-core over the public SDK API. The Ideas methods ({@link IdeasApi}) are optional. */
79
+ interface MessengerApi extends IdeasApi {
29
80
  listConversations(): Promise<MessengerConversation[]>;
30
81
  loadMessages(conversationId: string, since?: string | null): Promise<ConversationMessagesResponse>;
31
82
  start(text: string, handlers: MessengerStreamHandlers): Promise<void>;
@@ -43,7 +94,7 @@ interface MessengerApi {
43
94
  /** Files a complaint (transports before complaints lack it; the messenger then hides the form). */
44
95
  fileComplaint?(input: ComplaintInput): Promise<FileComplaintResponse>;
45
96
  }
46
- type MessengerTab = "home" | "messages" | "help" | "news";
97
+ type MessengerTab = "home" | "messages" | "help" | "ideas" | "news";
47
98
  /** A guide the visitor started and didn't finish. */
48
99
  interface MessengerResumeGuide {
49
100
  id: string;
@@ -71,6 +122,9 @@ interface MessengerNewsItem {
71
122
  imageUrl: string | null;
72
123
  publishedAt: string;
73
124
  unread: boolean;
125
+ /** Resource-center "What's new" entries: open this help article, or this link, instead of starting a guide. */
126
+ articleId?: string | null;
127
+ url?: string | null;
74
128
  }
75
129
  /** What the SDK knows about the visitor right now, read each time the messenger renders. */
76
130
  interface MessengerVisitor {
@@ -108,9 +162,15 @@ interface MessengerOptions {
108
162
  name?: string | null;
109
163
  };
110
164
  onResumeGuide?: (guideId: string, stepId: string) => void;
165
+ /** Evaluates a resource-center section's targeting for the current visitor (absent = every section shows). */
166
+ evaluate?: (rules: RuleGroup) => boolean;
111
167
  /** The visitor saw these announcements (News tab opened). */
112
168
  onNewsSeen?: (ids: string[]) => void;
113
169
  hideLauncher?: boolean;
170
+ /** Where the visitor last dragged the launcher on this device (null = the configured corner). */
171
+ launcherSpot?: LauncherSpot | null;
172
+ /** The visitor dragged the launcher somewhere else (save it for next time). */
173
+ onLauncherMove?: (spot: LauncherSpot) => void;
114
174
  /** Poll intervals (ms): open thread, and unread badge while closed. */
115
175
  pollMs?: {
116
176
  thread: number;
@@ -128,6 +188,8 @@ interface MessengerWidget {
128
188
  openArticle(id: string): void;
129
189
  /** Opens the complaint form, optionally with a category picked (when the project takes complaints). */
130
190
  openComplaint(categoryId?: string): void;
191
+ /** Opens the Ideas tab, or one idea (when the project turned Ideas on). */
192
+ openIdeas(requestId?: string): void;
131
193
  /** Re-reads the visitor (page changed, progress made) and re-renders what is showing. */
132
194
  refresh(): void;
133
195
  destroy(): void;
@@ -138,4 +200,4 @@ declare function relativeTime(iso: string, now?: number): string;
138
200
  /** Intercom-style messenger: launcher + panel with Home, Messages (chat with Scout / the team) and Help tabs. */
139
201
  declare function renderMessenger(options: MessengerOptions): MessengerWidget;
140
202
 
141
- export { type MessengerApi, type MessengerChecklistProgress, type MessengerNewsItem, type MessengerOptions, type MessengerResumeGuide, type MessengerStreamHandlers, type MessengerTab, type MessengerVisitor, type MessengerWidget, personalGreeting, relativeTime, renderMessenger };
203
+ export { type IdeaInput, type IdeaListQuery, type IdeaVoteInput, type IdeasApi, type LauncherSpot, type MessengerApi, type MessengerChecklistProgress, type MessengerNewsItem, type MessengerOptions, type MessengerResumeGuide, type MessengerStreamHandlers, type MessengerTab, type MessengerVisitor, type MessengerWidget, parseLauncherSpot, personalGreeting, relativeTime, renderMessenger };