@banta/sdk 5.5.2 → 5.6.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.
@@ -43,7 +43,7 @@ export declare class BantaComponent {
43
43
  pointOpen: ChatMessage;
44
44
  pointSubChat: ChatSourceBase;
45
45
  closeAux(): void;
46
- getViewType(message: ChatMessage): "chat" | "comment";
46
+ getViewType(message: ChatMessage): "comment" | "chat";
47
47
  upvoteMessage(message: ChatMessage): Promise<void>;
48
48
  showProfile(user: User): void;
49
49
  profileUser: User;
@@ -23,7 +23,8 @@ import * as i18 from "@angular/material/snack-bar";
23
23
  import * as i19 from "@angular/cdk/overlay";
24
24
  import * as i20 from "@angular/cdk/portal";
25
25
  export declare class BantaSdkModule {
26
- constructor(chatBackend: ChatBackendBase);
26
+ chatBackend: ChatBackendBase;
27
+ constructor();
27
28
  static configure(options?: SdkOptions): ModuleWithProviders<BantaSdkModule>;
28
29
  static ɵfac: i0.ɵɵFactoryDeclaration<BantaSdkModule, never>;
29
30
  static ɵmod: i0.ɵɵNgModuleDeclaration<BantaSdkModule, [typeof i1.BantaComponent, typeof i2.BantaLogoComponent, typeof i3.LiveMessageComponent], [typeof i4.CommonModule, typeof i5.FormsModule, typeof i6.BantaCommonModule, typeof i7.CommentsModule, typeof i8.ChatModule, typeof i9.EmojiModule, typeof i10.MatIconModule, typeof i11.MatButtonModule, typeof i12.MatTooltipModule, typeof i13.MatMenuModule, typeof i14.MatDialogModule, typeof i15.MatFormFieldModule, typeof i16.MatInputModule, typeof i17.MatProgressSpinnerModule, typeof i18.MatSnackBarModule, typeof i19.OverlayModule, typeof i20.PortalModule], [typeof i1.BantaComponent, typeof i2.BantaLogoComponent, typeof i3.LiveMessageComponent, typeof i6.BantaCommonModule, typeof i8.ChatModule, typeof i7.CommentsModule, typeof i9.EmojiModule]>;
@@ -2,12 +2,10 @@ import { ChatMessage, CommentsOrder, FilterMode, Notification, Topic, UrlCard }
2
2
  import { Observable } from "rxjs";
3
3
  import { ChatBackendBase, ChatSourceOptions } from "./chat-backend-base";
4
4
  import { ChatSourceBase } from "./chat-source-base";
5
- import { SdkOptions } from "./sdk-options";
6
5
  import * as i0 from "@angular/core";
7
6
  export declare class ChatBackend extends ChatBackendBase {
8
7
  private options;
9
8
  private platformId;
10
- constructor(options: SdkOptions, platformId: any);
11
9
  get serviceUrl(): string;
12
10
  private connectToService;
13
11
  private isServer;
@@ -19,11 +19,11 @@ export declare class ChatSource extends SocketRPC implements ChatSourceBase {
19
19
  private _state;
20
20
  get sortOrder(): "newest" | "oldest" | "likes";
21
21
  get filterMode(): string;
22
- get state(): "lost" | "connected" | "connecting" | "restored";
23
- set state(value: "lost" | "connected" | "connecting" | "restored");
22
+ get state(): "connecting" | "connected" | "lost" | "restored";
23
+ set state(value: "connecting" | "connected" | "lost" | "restored");
24
24
  private _connectionStateChanged;
25
25
  private _connectionStateChanged$;
26
- get connectionStateChanged(): import("rxjs").Observable<"lost" | "connected" | "connecting" | "restored">;
26
+ get connectionStateChanged(): import("rxjs").Observable<"connecting" | "connected" | "lost" | "restored">;
27
27
  private wasRestored;
28
28
  bind(socket: DurableSocket): Promise<this>;
29
29
  private mapOrUpdateMessages;
@@ -88,6 +88,7 @@ export declare class BantaCommentsComponent {
88
88
  waitForThreadView(): Promise<CommentViewComponent>;
89
89
  markLoaded: () => void;
90
90
  loaded: Promise<void>;
91
+ get sourceState(): "no-source" | "connecting" | "connected" | "lost" | "restored";
91
92
  private updateLoading;
92
93
  private _signInSelected;
93
94
  private _permissionDeniedError;
@@ -152,6 +153,7 @@ export declare class BantaCommentsComponent {
152
153
  private _filterMode;
153
154
  get filterMode(): string;
154
155
  set filterMode(value: string);
156
+ initialMessageCount: number;
155
157
  private _metadata;
156
158
  /**
157
159
  * Arbitrary metadata to send to the chat server. This can be used to provide context about the client to the server
@@ -199,5 +201,5 @@ export declare class BantaCommentsComponent {
199
201
  startEditing(message: ChatMessage): Promise<void>;
200
202
  saveEdit(message: ChatMessage, text: string): Promise<void>;
201
203
  static ɵfac: i0.ɵɵFactoryDeclaration<BantaCommentsComponent, never>;
202
- static ɵcmp: i0.ɵɵComponentDeclaration<BantaCommentsComponent, "banta-comments", never, { "customMenuItems": { "alias": "customMenuItems"; "required": false; }; "url": { "alias": "url"; "required": false; }; "maxCommentLength": { "alias": "maxCommentLength"; "required": false; }; "loadingMessages": { "alias": "loadingMessages"; "required": false; }; "useInlineReplies": { "alias": "useInlineReplies"; "required": false; }; "signInLabel": { "alias": "signInLabel"; "required": false; }; "sendLabel": { "alias": "sendLabel"; "required": false; }; "signingInLabel": { "alias": "signingInLabel"; "required": false; }; "replyLabel": { "alias": "replyLabel"; "required": false; }; "sendingLabel": { "alias": "sendingLabel"; "required": false; }; "permissionDeniedLabel": { "alias": "permissionDeniedLabel"; "required": false; }; "postCommentLabel": { "alias": "postCommentLabel"; "required": false; }; "postReplyLabel": { "alias": "postReplyLabel"; "required": false; }; "allowAttachments": { "alias": "allowAttachments"; "required": false; }; "fixedHeight": { "alias": "fixedHeight"; "required": false; }; "maxMessages": { "alias": "maxMessages"; "required": false; }; "maxVisibleMessages": { "alias": "maxVisibleMessages"; "required": false; }; "genericAvatarUrl": { "alias": "genericAvatarUrl"; "required": false; }; "shouldInterceptMessageSend": { "alias": "shouldInterceptMessageSend"; "required": false; }; "participants": { "alias": "participants"; "required": false; }; "source": { "alias": "source"; "required": false; }; "hashtags": { "alias": "hashtags"; "required": false; }; "topicID": { "alias": "topicID"; "required": false; }; "sortOrder": { "alias": "sortOrder"; "required": false; }; "filterMode": { "alias": "filterMode"; "required": false; }; "metadata": { "alias": "metadata"; "required": false; }; }, { "signInSelected": "signInSelected"; "editAvatarSelected": "editAvatarSelected"; "permissionDeniedError": "permissionDeniedError"; "upvoted": "upvoted"; "reported": "reported"; "selected": "selected"; "userSelected": "userSelected"; "usernameSelected": "usernameSelected"; "avatarSelected": "avatarSelected"; "shared": "shared"; }, ["sendReplyOptionsTemplate"], never, false, never>;
204
+ static ɵcmp: i0.ɵɵComponentDeclaration<BantaCommentsComponent, "banta-comments", never, { "customMenuItems": { "alias": "customMenuItems"; "required": false; }; "url": { "alias": "url"; "required": false; }; "maxCommentLength": { "alias": "maxCommentLength"; "required": false; }; "loadingMessages": { "alias": "loadingMessages"; "required": false; }; "useInlineReplies": { "alias": "useInlineReplies"; "required": false; }; "signInLabel": { "alias": "signInLabel"; "required": false; }; "sendLabel": { "alias": "sendLabel"; "required": false; }; "signingInLabel": { "alias": "signingInLabel"; "required": false; }; "replyLabel": { "alias": "replyLabel"; "required": false; }; "sendingLabel": { "alias": "sendingLabel"; "required": false; }; "permissionDeniedLabel": { "alias": "permissionDeniedLabel"; "required": false; }; "postCommentLabel": { "alias": "postCommentLabel"; "required": false; }; "postReplyLabel": { "alias": "postReplyLabel"; "required": false; }; "allowAttachments": { "alias": "allowAttachments"; "required": false; }; "fixedHeight": { "alias": "fixedHeight"; "required": false; }; "maxMessages": { "alias": "maxMessages"; "required": false; }; "maxVisibleMessages": { "alias": "maxVisibleMessages"; "required": false; }; "genericAvatarUrl": { "alias": "genericAvatarUrl"; "required": false; }; "shouldInterceptMessageSend": { "alias": "shouldInterceptMessageSend"; "required": false; }; "participants": { "alias": "participants"; "required": false; }; "source": { "alias": "source"; "required": false; }; "hashtags": { "alias": "hashtags"; "required": false; }; "topicID": { "alias": "topicID"; "required": false; }; "sortOrder": { "alias": "sortOrder"; "required": false; }; "filterMode": { "alias": "filterMode"; "required": false; }; "initialMessageCount": { "alias": "initialMessageCount"; "required": false; }; "metadata": { "alias": "metadata"; "required": false; }; }, { "signInSelected": "signInSelected"; "editAvatarSelected": "editAvatarSelected"; "permissionDeniedError": "permissionDeniedError"; "upvoted": "upvoted"; "reported": "reported"; "selected": "selected"; "userSelected": "userSelected"; "usernameSelected": "usernameSelected"; "avatarSelected": "avatarSelected"; "shared": "shared"; }, ["sendReplyOptionsTemplate"], never, false, never>;
203
205
  }
@@ -26,7 +26,29 @@ export declare class CommentViewComponent {
26
26
  isViewingMore: boolean;
27
27
  isLoadingMore: boolean;
28
28
  hasMore: boolean;
29
+ get previousMessages(): ChatMessage[];
30
+ get nextMessages(): ChatMessage[];
31
+ /**
32
+ * While this is called "new" messages, it really represents the messages that would be visible *at the beginning
33
+ * of the sort order*, which can be flipped by the newestLast feature (used for replies mode).
34
+ *
35
+ * So, when newestLast is false, regardless of the current sortOrder, newMessages are conceptually
36
+ * *above* the visible set of messages.
37
+ *
38
+ * When newestLast is true (as in replies mode), regardless of the current sortOrder, newMessages are conceptually
39
+ * *below* the visible set of messages.
40
+ */
29
41
  newMessages: ChatMessage[];
42
+ /**
43
+ * While this is called "older" messages, it really represents the messages that would be visible *at the end of the
44
+ * sort order*, which can be flipped by the newestLast feature (useds for replies mode).
45
+ *
46
+ * So, when newestLast is false, regardless of the current sortOrder, olderMessages are conceptually *below*
47
+ * the visible set of messages.
48
+ *
49
+ * When newestLast is true (as in replies mode), regardless of the current sortOrder, olderMessages are conceptually
50
+ * *above* the visible set of messages.
51
+ */
30
52
  olderMessages: ChatMessage[];
31
53
  maxMessages: number;
32
54
  maxVisibleMessages: number;
@@ -97,9 +119,50 @@ export declare class CommentViewComponent {
97
119
  deleteMessage(message: ChatMessage): void;
98
120
  private setSource;
99
121
  private getInitialMessages;
122
+ debugMessages(): void;
123
+ zeroPad(number: number | string, count?: number): string;
124
+ leftPad(str: string, count?: number): string;
100
125
  messageIdentity(index: number, chatMessage: ChatMessage): string;
101
- showNew(event: MouseEvent): Promise<void>;
126
+ get sourceSortOrder(): "newest" | "oldest" | "likes";
127
+ get sourceFilterMode(): string;
128
+ /**
129
+ * Show the newest content.
130
+ * - If an unnatural sort order is active (ie Oldest or Likes), it will be changed to Newest.
131
+ * - The new content will be placed where new content goes based on newestLast (replies mode), so if it is true, the content is
132
+ * placed at the end, otherwise it is placed at the beginning.
133
+ *
134
+ * @param event
135
+ * @returns
136
+ */
137
+ showNewest(event: MouseEvent): Promise<void>;
138
+ get showDebug(): boolean;
139
+ get shouldShowNext(): boolean;
140
+ get shouldShowPrevious(): boolean;
141
+ get pageSize(): number;
142
+ showPrevious(): Promise<void>;
143
+ get sortNextLabel(): "Older" | "Newer" | "Less Likes" | "More";
144
+ get sortPreviousLabel(): "Older" | "Newer" | "More" | "More Likes";
145
+ get nextLabel(): "Older" | "Newer" | "Less Likes" | "More" | "More Likes";
146
+ get previousLabel(): "Older" | "Newer" | "Less Likes" | "More" | "More Likes";
147
+ /**
148
+ * Show more content
149
+ * - When in replies mode (newestLast), the content is added at the top
150
+ * - When in normal mode, the content is added at the bottom
151
+ * - The current sort order does *not* factor in here, which is why it is showMore() not showEarlier().
152
+ *
153
+ * @returns
154
+ */
155
+ showNext(): Promise<void>;
156
+ /**
157
+ * Show more content
158
+ * - When in replies mode (newestLast), the content is added at the top
159
+ * - When in normal mode, the content is added at the bottom
160
+ * - The current sort order does *not* factor in here, which is why it is showMore() not showEarlier().
161
+ *
162
+ * @returns
163
+ */
102
164
  showMore(): Promise<void>;
165
+ private heldMessages;
103
166
  private addMessage;
104
167
  private incrementPagingCursors;
105
168
  /**
@@ -1,15 +1,13 @@
1
1
  import { PipeTransform } from '@angular/core';
2
2
  import * as marked from 'marked';
3
- import { DomSanitizer } from '@angular/platform-browser';
4
- import { SdkOptions } from '../sdk-options';
5
3
  import * as i0 from "@angular/core";
6
4
  export declare class BantaMarkdownToHtmlPipe implements PipeTransform {
7
5
  private sanitizer;
8
6
  private sdkOptions;
9
- constructor(sanitizer: DomSanitizer, sdkOptions: SdkOptions);
7
+ constructor();
10
8
  private get emojiUrl();
11
9
  renderer: marked.Renderer;
12
10
  transform(value: string): import("@angular/platform-browser").SafeHtml;
13
- static ɵfac: i0.ɵɵFactoryDeclaration<BantaMarkdownToHtmlPipe, [null, { optional: true; }]>;
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<BantaMarkdownToHtmlPipe, never>;
14
12
  static ɵpipe: i0.ɵɵPipeDeclaration<BantaMarkdownToHtmlPipe, "bantaMarkdownToHtml", false>;
15
13
  }
@@ -1,11 +1,8 @@
1
1
  import { OnInit } from '@angular/core';
2
- import { DomSanitizer } from '@angular/platform-browser';
3
- import { SdkOptions } from '../../sdk-options';
4
2
  import * as i0 from "@angular/core";
5
3
  export declare class EmojiSelectorPanelComponent implements OnInit {
6
4
  private sanitizer;
7
5
  private sdkOptions;
8
- constructor(sanitizer: DomSanitizer, sdkOptions: SdkOptions);
9
6
  categories: any[];
10
7
  activeCategory: string;
11
8
  searchResults: any[];
@@ -21,6 +18,6 @@ export declare class EmojiSelectorPanelComponent implements OnInit {
21
18
  showSearch(): void;
22
19
  private get emojiUrl();
23
20
  ngOnInit(): void;
24
- static ɵfac: i0.ɵɵFactoryDeclaration<EmojiSelectorPanelComponent, [null, { optional: true; }]>;
21
+ static ɵfac: i0.ɵɵFactoryDeclaration<EmojiSelectorPanelComponent, never>;
25
22
  static ɵcmp: i0.ɵɵComponentDeclaration<EmojiSelectorPanelComponent, "emoji-selector-panel", never, {}, { "selected": "selected"; }, never, never, false, never>;
26
23
  }
@@ -1,5 +1,8 @@
1
+ import { InjectionToken, Type } from "@angular/core";
2
+ import { ChatBackendBase } from "./chat-backend-base";
1
3
  export interface SdkOptions {
2
4
  serviceUrl?: string;
3
5
  emojiUrl?: string;
6
+ backendClass?: Type<ChatBackendBase>;
4
7
  }
5
- export declare const BANTA_SDK_OPTIONS = "BANTA_SDK_OPTIONS";
8
+ export declare const BANTA_SDK_OPTIONS: InjectionToken<SdkOptions>;
@@ -36,7 +36,7 @@ export declare class StaticChatSource implements ChatSourceBase {
36
36
  unlikeMessage(messageId: string): Promise<void>;
37
37
  editMessage(messageId: string, text: string): Promise<void>;
38
38
  deleteMessage(messageId: string): Promise<void>;
39
- connectionStateChanged: Subject<"lost" | "connected" | "connecting" | "restored">;
39
+ connectionStateChanged: Subject<"connecting" | "connected" | "lost" | "restored">;
40
40
  state: 'connecting' | 'connected' | 'lost' | 'restored';
41
41
  get errorState(): any;
42
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@banta/sdk",
3
- "version": "5.5.2",
3
+ "version": "5.6.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"