Parcourir la source

Add generated types definitions

- Generate types when running `make check`
- Check for uncommitted type changes
JC Brand il y a 1 an
Parent
commit
4486ddbfe9
100 fichiers modifiés avec 3841 ajouts et 6 suppressions
  1. 9 0
      Makefile
  2. 3 3
      package-lock.json
  3. 2 2
      package.json
  4. 1 1
      src/headless/package.json
  5. 46 0
      src/headless/tsconfig.json
  6. 9 0
      src/headless/types/index.d.ts
  7. 33 0
      src/headless/types/log.d.ts
  8. 41 0
      src/headless/types/plugins/adhoc/api.d.ts
  9. 2 0
      src/headless/types/plugins/adhoc/index.d.ts
  10. 8 0
      src/headless/types/plugins/adhoc/utils.d.ts
  11. 34 0
      src/headless/types/plugins/bookmarks/collection.d.ts
  12. 2 0
      src/headless/types/plugins/bookmarks/index.d.ts
  13. 6 0
      src/headless/types/plugins/bookmarks/model.d.ts
  14. 5 0
      src/headless/types/plugins/bookmarks/utils.d.ts
  15. 13 0
      src/headless/types/plugins/bosh/api.d.ts
  16. 2 0
      src/headless/types/plugins/bosh/index.d.ts
  17. 11 0
      src/headless/types/plugins/bosh/utils.d.ts
  18. 2 0
      src/headless/types/plugins/caps/index.d.ts
  19. 9 0
      src/headless/types/plugins/caps/utils.d.ts
  20. 80 0
      src/headless/types/plugins/chat/api.d.ts
  21. 2 0
      src/headless/types/plugins/chat/index.d.ts
  22. 78 0
      src/headless/types/plugins/chat/message.d.ts
  23. 11 0
      src/headless/types/plugins/chat/messages.d.ts
  24. 12 0
      src/headless/types/plugins/chat/model-with-contact.d.ts
  25. 247 0
      src/headless/types/plugins/chat/model.d.ts
  26. 9 0
      src/headless/types/plugins/chat/parsers.d.ts
  27. 25 0
      src/headless/types/plugins/chat/utils.d.ts
  28. 36 0
      src/headless/types/plugins/chatboxes/api.d.ts
  29. 24 0
      src/headless/types/plugins/chatboxes/chatboxes.d.ts
  30. 2 0
      src/headless/types/plugins/chatboxes/index.d.ts
  31. 8 0
      src/headless/types/plugins/chatboxes/utils.d.ts
  32. 252 0
      src/headless/types/plugins/disco/api.d.ts
  33. 9 0
      src/headless/types/plugins/disco/entities.d.ts
  34. 49 0
      src/headless/types/plugins/disco/entity.d.ts
  35. 2 0
      src/headless/types/plugins/disco/index.d.ts
  36. 6 0
      src/headless/types/plugins/disco/utils.d.ts
  37. 2 0
      src/headless/types/plugins/emoji/index.d.ts
  38. 13 0
      src/headless/types/plugins/emoji/picker.d.ts
  39. 3 0
      src/headless/types/plugins/emoji/regexes.d.ts
  40. 19 0
      src/headless/types/plugins/emoji/utils.d.ts
  41. 17 0
      src/headless/types/plugins/headlines/api.d.ts
  42. 19 0
      src/headless/types/plugins/headlines/feed.d.ts
  43. 2 0
      src/headless/types/plugins/headlines/index.d.ts
  44. 6 0
      src/headless/types/plugins/headlines/utils.d.ts
  45. 189 0
      src/headless/types/plugins/mam/api.d.ts
  46. 2 0
      src/headless/types/plugins/mam/index.d.ts
  47. 8 0
      src/headless/types/plugins/mam/placeholder.d.ts
  48. 58 0
      src/headless/types/plugins/mam/utils.d.ts
  49. 47 0
      src/headless/types/plugins/muc/affiliations/api.d.ts
  50. 83 0
      src/headless/types/plugins/muc/affiliations/utils.d.ts
  51. 114 0
      src/headless/types/plugins/muc/api.d.ts
  52. 56 0
      src/headless/types/plugins/muc/constants.d.ts
  53. 2 0
      src/headless/types/plugins/muc/index.d.ts
  54. 20 0
      src/headless/types/plugins/muc/message.d.ts
  55. 11 0
      src/headless/types/plugins/muc/messages.d.ts
  56. 671 0
      src/headless/types/plugins/muc/muc.d.ts
  57. 21 0
      src/headless/types/plugins/muc/occupant.d.ts
  58. 60 0
      src/headless/types/plugins/muc/occupants.d.ts
  59. 79 0
      src/headless/types/plugins/muc/parsers.d.ts
  60. 47 0
      src/headless/types/plugins/muc/utils.d.ts
  61. 16 0
      src/headless/types/plugins/ping/api.d.ts
  62. 2 0
      src/headless/types/plugins/ping/index.d.ts
  63. 8 0
      src/headless/types/plugins/ping/utils.d.ts
  64. 4 0
      src/headless/types/plugins/pubsub.d.ts
  65. 51 0
      src/headless/types/plugins/roster/api.d.ts
  66. 71 0
      src/headless/types/plugins/roster/contact.d.ts
  67. 85 0
      src/headless/types/plugins/roster/contacts.d.ts
  68. 4 0
      src/headless/types/plugins/roster/filter.d.ts
  69. 2 0
      src/headless/types/plugins/roster/index.d.ts
  70. 31 0
      src/headless/types/plugins/roster/presence.d.ts
  71. 8 0
      src/headless/types/plugins/roster/presences.d.ts
  72. 5 0
      src/headless/types/plugins/roster/resource.d.ts
  73. 6 0
      src/headless/types/plugins/roster/resources.d.ts
  74. 42 0
      src/headless/types/plugins/roster/utils.d.ts
  75. 2 0
      src/headless/types/plugins/smacks/index.d.ts
  76. 5 0
      src/headless/types/plugins/smacks/utils.d.ts
  77. 41 0
      src/headless/types/plugins/status/api.d.ts
  78. 2 0
      src/headless/types/plugins/status/index.d.ts
  79. 16 0
      src/headless/types/plugins/status/status.d.ts
  80. 22 0
      src/headless/types/plugins/status/utils.d.ts
  81. 69 0
      src/headless/types/plugins/vcard/api.d.ts
  82. 2 0
      src/headless/types/plugins/vcard/index.d.ts
  83. 23 0
      src/headless/types/plugins/vcard/utils.d.ts
  84. 16 0
      src/headless/types/plugins/vcard/vcard.d.ts
  85. 8 0
      src/headless/types/plugins/vcard/vcards.d.ts
  86. 85 0
      src/headless/types/shared/_converse.d.ts
  87. 10 0
      src/headless/types/shared/actions.d.ts
  88. 49 0
      src/headless/types/shared/api/events.d.ts
  89. 92 0
      src/headless/types/shared/api/index.d.ts
  90. 19 0
      src/headless/types/shared/api/presence.d.ts
  91. 33 0
      src/headless/types/shared/api/promise.d.ts
  92. 31 0
      src/headless/types/shared/api/public.d.ts
  93. 35 0
      src/headless/types/shared/api/send.d.ts
  94. 45 0
      src/headless/types/shared/api/user.d.ts
  95. 31 0
      src/headless/types/shared/chat/utils.d.ts
  96. 51 0
      src/headless/types/shared/connection/api.d.ts
  97. 9 0
      src/headless/types/shared/connection/feedback.d.ts
  98. 114 0
      src/headless/types/shared/connection/index.d.ts
  99. 3 0
      src/headless/types/shared/connection/utils.d.ts
  100. 54 0
      src/headless/types/shared/constants.d.ts

+ 9 - 0
Makefile

@@ -229,12 +229,21 @@ types:: node_modules
 ########################################################################
 ## Tests
 
+.PHONY: check-git-clean
+check-git-clean:
+	@if ! git diff-index --quiet HEAD src/types src/headless/types; then\
+		echo "Error: uncommitted type changes. Please include all type changes in your commit"\
+		exit 1;\
+	fi
+
 .PHONY: eslint
 eslint: node_modules
 	npm run lint
 
 .PHONY: check
 check: eslint | dist/converse.js dist/converse.css
+	npm run types
+	make check-git-clean
 	npm run test -- $(ARGS)
 
 .PHONY: test

+ 3 - 3
package-lock.json

@@ -1,12 +1,12 @@
 {
   "name": "converse.js",
-  "version": "10.1.5",
+  "version": "10.1.7",
   "lockfileVersion": 3,
   "requires": true,
   "packages": {
     "": {
       "name": "converse.js",
-      "version": "10.1.5",
+      "version": "10.1.7",
       "license": "MPL-2.0",
       "workspaces": [
         "src/headless"
@@ -11526,7 +11526,7 @@
     },
     "src/headless": {
       "name": "@converse/headless",
-      "version": "10.1.5",
+      "version": "10.1.7",
       "license": "MPL-2.0",
       "dependencies": {
         "@converse/openpromise": "^0.0.1",

+ 2 - 2
package.json

@@ -1,6 +1,6 @@
 {
   "name": "converse.js",
-  "version": "10.1.5",
+  "version": "10.1.7",
   "description": "Browser based XMPP chat client",
   "main": "src/index.js",
   "browser": "dist/converse.js",
@@ -41,7 +41,7 @@
     "serve": "http-server -c-1",
     "devserver": "webpack serve --config webpack/webpack.serve.js",
     "watch": "webpack --watch --config webpack/webpack.build.js --mode=development",
-    "types": "tsc --declaration --emitDeclarationOnly --allowJs",
+    "types": "tsc -p ./src/headless/tsconfig.json && tsc",
     "check:types": "tsc --noEmit"
   },
   "repository": {

+ 1 - 1
src/headless/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@converse/headless",
-  "version": "10.1.5",
+  "version": "10.1.7",
   "description": "Converse.js Headless build",
   "author": "JC Brand <jc@opkode.com>",
   "contributors": [

+ 46 - 0
src/headless/tsconfig.json

@@ -0,0 +1,46 @@
+{
+  "include": [
+      "**/*"
+  ],
+  "exclude": [
+      "**/tests/*",
+      "dist/",
+      "types/"
+  ],
+  "compilerOptions": {
+    "target": "es2016",
+    "module": "esnext",
+
+    "types": [
+      "@types/webappsec-credential-management"
+    ],
+
+    "lib": [
+      "ES2020",
+      "dom"
+    ],
+
+    "allowJs": true,
+    "checkJs": true,
+
+    // Generate d.ts files
+    "declaration": true,
+    "emitDeclarationOnly": true,
+    "declarationMap": true,
+
+    "rootDir": "./",
+    "outDir": "./types/",
+    "baseUrl": "./",
+
+    "esModuleInterop": true,
+    "forceConsistentCasingInFileNames": true,
+
+    "strict": false,
+    "noImplicitAny": false,
+
+    "skipLibCheck": true,
+
+    "moduleResolution": "node",
+    "resolveJsonModule": true
+  }
+}

+ 9 - 0
src/headless/types/index.d.ts

@@ -0,0 +1,9 @@
+export default converse;
+import api from "./shared/api/index.js";
+import { converse } from "./shared/api/public.js";
+import _converse from "./shared/_converse";
+import i18n from "./shared/i18n";
+import log from "./log.js";
+import u from "./utils/index.js";
+export { api, converse, _converse, i18n, log, u };
+//# sourceMappingURL=index.d.ts.map

+ 33 - 0
src/headless/types/log.d.ts

@@ -0,0 +1,33 @@
+export namespace LEVELS {
+    const debug: number;
+    const info: number;
+    const warn: number;
+    const error: number;
+    const fatal: number;
+}
+declare namespace _default {
+    /**
+     * The the log-level, which determines how verbose the logging is.
+     * @method log#setLogLevel
+     * @param {keyof LEVELS} level - The loglevel which allows for filtering of log messages
+     */
+    function setLogLevel(level: "debug" | "error" | "info" | "warn" | "fatal"): void;
+    /**
+     * Logs messages to the browser's developer console.
+     * Available loglevels are 0 for 'debug', 1 for 'info', 2 for 'warn',
+     * 3 for 'error' and 4 for 'fatal'.
+     * When using the 'error' or 'warn' loglevels, a full stacktrace will be
+     * logged as well.
+     * @method log#log
+     * @param {string|Element|Error} message - The message to be logged
+     * @param {string} level - The loglevel which allows for filtering of log messages
+     */
+    function log(message: string | Element | Error, level: string, style?: string): void;
+    function debug(message: any, style: any): void;
+    function error(message: any, style: any): void;
+    function info(message: any, style: any): void;
+    function warn(message: any, style: any): void;
+    function fatal(message: any, style: any): void;
+}
+export default _default;
+//# sourceMappingURL=log.d.ts.map

+ 41 - 0
src/headless/types/plugins/adhoc/api.d.ts

@@ -0,0 +1,41 @@
+declare namespace _default {
+    namespace adhoc {
+        /**
+         * @method api.adhoc.getCommands
+         * @param { String } to_jid
+         */
+        function getCommands(to_jid: string): Promise<any>;
+        /**
+         * @method api.adhoc.fetchCommandForm
+         */
+        function fetchCommandForm(command: any): Promise<{
+            sessionid: any;
+            instructions: any;
+            fields: any;
+            actions: any[];
+        } | {
+            instructions: any;
+            fields: any[];
+        }>;
+        /**
+         * @method api.adhoc.runCommand
+         * @param { String } jid
+         * @param { String } sessionid
+         * @param { 'execute' | 'cancel' | 'prev' | 'next' | 'complete' } action
+         * @param { String } node
+         * @param { Array<{ [k:string]: string }> } inputs
+         */
+        function runCommand(jid: string, sessionid: string, node: string, action: "cancel" | "execute" | "prev" | "next" | "complete", inputs: {
+            [k: string]: string;
+        }[]): Promise<{
+            note: any;
+            sessionid?: any;
+            instructions?: any;
+            fields?: any;
+            actions?: any[];
+            status: any;
+        }>;
+    }
+}
+export default _default;
+//# sourceMappingURL=api.d.ts.map

+ 2 - 0
src/headless/types/plugins/adhoc/index.d.ts

@@ -0,0 +1,2 @@
+export {};
+//# sourceMappingURL=index.d.ts.map

+ 8 - 0
src/headless/types/plugins/adhoc/utils.d.ts

@@ -0,0 +1,8 @@
+export function parseForCommands(stanza: any): any;
+export function getCommandFields(iq: any, jid: any): {
+    sessionid: any;
+    instructions: any;
+    fields: any;
+    actions: any[];
+};
+//# sourceMappingURL=utils.d.ts.map

+ 34 - 0
src/headless/types/plugins/bookmarks/collection.d.ts

@@ -0,0 +1,34 @@
+export default Bookmarks;
+declare class Bookmarks extends Collection {
+    constructor();
+    model: typeof Bookmark;
+    initialize(): Promise<void>;
+    fetched_flag: string;
+    /**
+     * @param {Bookmark} bookmark
+     */
+    openBookmarkedRoom(bookmark: Bookmark): Promise<Bookmark>;
+    fetchBookmarks(): any;
+    createBookmark(options: any): void;
+    sendBookmarkStanza(): any;
+    onBookmarkError(iq: any, options: any): void;
+    fetchBookmarksFromServer(deferred: any): void;
+    /**
+     * @param {Bookmark} bookmark
+     */
+    markRoomAsBookmarked(bookmark: Bookmark): void;
+    /**
+     * @param {Bookmark} bookmark
+     */
+    markRoomAsUnbookmarked(bookmark: Bookmark): void;
+    /**
+     * @param {Element} stanza
+     */
+    createBookmarksFromStanza(stanza: Element): void;
+    onBookmarksReceived(deferred: any, iq: any): any;
+    onBookmarksReceivedError(deferred: any, iq: any): any;
+    getUnopenedBookmarks(): Promise<any>;
+}
+import { Collection } from "@converse/skeletor";
+import Bookmark from "./model.js";
+//# sourceMappingURL=collection.d.ts.map

+ 2 - 0
src/headless/types/plugins/bookmarks/index.d.ts

@@ -0,0 +1,2 @@
+export {};
+//# sourceMappingURL=index.d.ts.map

+ 6 - 0
src/headless/types/plugins/bookmarks/model.d.ts

@@ -0,0 +1,6 @@
+export default Bookmark;
+declare class Bookmark extends Model {
+    getDisplayName(): any;
+}
+import { Model } from "@converse/skeletor";
+//# sourceMappingURL=model.d.ts.map

+ 5 - 0
src/headless/types/plugins/bookmarks/utils.d.ts

@@ -0,0 +1,5 @@
+export function checkBookmarksSupport(): Promise<any>;
+export function initBookmarks(): Promise<void>;
+export function getNicknameFromBookmark(jid: any): any;
+export function handleBookmarksPush(message: any): boolean;
+//# sourceMappingURL=utils.d.ts.map

+ 13 - 0
src/headless/types/plugins/bosh/api.d.ts

@@ -0,0 +1,13 @@
+declare namespace _default {
+    namespace tokens {
+        /**
+         * @method api.tokens.get
+         * @param {string} [id] The type of token to return ('rid' or 'sid').
+         * @returns {string} A token, either the RID or SID token depending on what's asked for.
+         * @example _converse.api.tokens.get('rid');
+         */
+        function get(id?: string): string;
+    }
+}
+export default _default;
+//# sourceMappingURL=api.d.ts.map

+ 2 - 0
src/headless/types/plugins/bosh/index.d.ts

@@ -0,0 +1,2 @@
+export {};
+//# sourceMappingURL=index.d.ts.map

+ 11 - 0
src/headless/types/plugins/bosh/utils.d.ts

@@ -0,0 +1,11 @@
+export function startNewPreboundBOSHSession(): void;
+/**
+ * @param {unknown} _
+ * @param {LoginHookPayload} payload
+ */
+export function attemptPrebind(_: unknown, payload: any): Promise<any>;
+export function saveJIDToSession(): void;
+export function clearSession(): void;
+export function restoreBOSHSession(): Promise<boolean>;
+export type LoginHookPayload = any;
+//# sourceMappingURL=utils.d.ts.map

+ 2 - 0
src/headless/types/plugins/caps/index.d.ts

@@ -0,0 +1,2 @@
+export {};
+//# sourceMappingURL=index.d.ts.map

+ 9 - 0
src/headless/types/plugins/caps/utils.d.ts

@@ -0,0 +1,9 @@
+/**
+ * Given a stanza, adds a XEP-0115 CAPS element
+ * @param {Strophe.Builder} stanza
+ */
+export function addCapsNode(stanza: any): Promise<any>;
+export namespace Strophe {
+    type Builder = any;
+}
+//# sourceMappingURL=utils.d.ts.map

+ 80 - 0
src/headless/types/plugins/chat/api.d.ts

@@ -0,0 +1,80 @@
+declare namespace _default {
+    namespace chats {
+        /**
+         * @method api.chats.create
+         * @param {string|string[]} jids An jid or array of jids
+         * @param {object} [attrs] An object containing configuration attributes.
+         * @returns {Promise<ChatBox|ChatBox[]>}
+         */
+        function create(jids: string | string[], attrs?: any): Promise<import("./model.js").default | import("./model.js").default[]>;
+        /**
+         * Opens a new one-on-one chat.
+         *
+         * @method api.chats.open
+         * @param {String|string[]} jids - e.g. 'buddy@example.com' or ['buddy1@example.com', 'buddy2@example.com']
+         * @param {Object} [attrs] - Attributes to be set on the _converse.ChatBox model.
+         * @param {Boolean} [attrs.minimized] - Should the chat be created in minimized state.
+         * @param {Boolean} [force=false] - By default, a minimized
+         *   chat won't be maximized (in `overlayed` view mode) and in
+         *   `fullscreen` view mode a newly opened chat won't replace
+         *   another chat already in the foreground.
+         *   Set `force` to `true` if you want to force the chat to be
+         *   maximized or shown.
+         * @returns {Promise} Promise which resolves with the
+         *   _converse.ChatBox representing the chat.
+         *
+         * @example
+         * // To open a single chat, provide the JID of the contact you're chatting with in that chat:
+         * converse.plugins.add('myplugin', {
+         *     initialize: function() {
+         *         const _converse = this._converse;
+         *         // Note, buddy@example.org must be in your contacts roster!
+         *         api.chats.open('buddy@example.com').then(chat => {
+         *             // Now you can do something with the chat model
+         *         });
+         *     }
+         * });
+         *
+         * @example
+         * // To open an array of chats, provide an array of JIDs:
+         * converse.plugins.add('myplugin', {
+         *     initialize: function () {
+         *         const _converse = this._converse;
+         *         // Note, these users must first be in your contacts roster!
+         *         api.chats.open(['buddy1@example.com', 'buddy2@example.com']).then(chats => {
+         *             // Now you can do something with the chat models
+         *         });
+         *     }
+         * });
+         */
+        function open(jids: string | string[], attrs?: {
+            minimized?: boolean;
+        }, force?: boolean): Promise<any>;
+        /**
+         * Retrieves a chat or all chats.
+         *
+         * @method api.chats.get
+         * @param {String|string[]} jids - e.g. 'buddy@example.com' or ['buddy1@example.com', 'buddy2@example.com']
+         * @param { Object } [attrs] - Attributes to be set on the _converse.ChatBox model.
+         * @param { Boolean } [create=false] - Whether the chat should be created if it's not found.
+         * @returns { Promise<ChatBox[]> }
+         *
+         * @example
+         * // To return a single chat, provide the JID of the contact you're chatting with in that chat:
+         * const model = await api.chats.get('buddy@example.com');
+         *
+         * @example
+         * // To return an array of chats, provide an array of JIDs:
+         * const models = await api.chats.get(['buddy1@example.com', 'buddy2@example.com']);
+         *
+         * @example
+         * // To return all open chats, call the method without any parameters::
+         * const models = await api.chats.get();
+         *
+         */
+        function get(jids: string | string[], attrs?: any, create?: boolean): Promise<import("./model.js").default[]>;
+    }
+}
+export default _default;
+export type ChatBox = import('./model.js').default;
+//# sourceMappingURL=api.d.ts.map

+ 2 - 0
src/headless/types/plugins/chat/index.d.ts

@@ -0,0 +1,2 @@
+export {};
+//# sourceMappingURL=index.d.ts.map

+ 78 - 0
src/headless/types/plugins/chat/message.d.ts

@@ -0,0 +1,78 @@
+export default Message;
+export type Model = import('@converse/skeletor').Model;
+/**
+ * Represents a (non-MUC) message.
+ * These can be either `chat`, `normal` or `headline` messages.
+ * @namespace _converse.Message
+ * @memberOf _converse
+ * @example const msg = new Message({'message': 'hello world!'});
+ */
+declare class Message extends ModelWithContact {
+    /**
+     * @param {Model[]} [models]
+     * @param {object} [options]
+     */
+    constructor(models?: Model[], options?: object);
+    defaults(): {
+        msgid: any;
+        time: string;
+        is_ephemeral: boolean;
+    };
+    file: any;
+    initialize(): Promise<void>;
+    initialized: any;
+    setContact(...args: any[]): Promise<void>;
+    /**
+     * Sets an auto-destruct timer for this message, if it's is_ephemeral.
+     * @method _converse.Message#setTimerForEphemeralMessage
+     */
+    setTimerForEphemeralMessage(): void;
+    ephemeral_timer: number;
+    checkValidity(): boolean;
+    /**
+     * Determines whether this messsage may be retracted by the current user.
+     * @method _converse.Messages#mayBeRetracted
+     * @returns { Boolean }
+     */
+    mayBeRetracted(): boolean;
+    safeDestroy(): void;
+    /**
+     * Returns a boolean indicating whether this message is ephemeral,
+     * meaning it will get automatically removed after ten seconds.
+     * @returns { boolean }
+     */
+    isEphemeral(): boolean;
+    /**
+     * Returns a boolean indicating whether this message is a XEP-0245 /me command.
+     * @returns { boolean }
+     */
+    isMeCommand(): boolean;
+    /**
+     * Returns a boolean indicating whether this message is considered a followup
+     * message from the previous one. Followup messages are shown grouped together
+     * under one author heading.
+     * A message is considered a followup of it's predecessor when it's a chat
+     * message from the same author, within 10 minutes.
+     * @returns { boolean }
+     */
+    isFollowup(): boolean;
+    getDisplayName(): any;
+    getMessageText(): any;
+    /**
+     * Send out an IQ stanza to request a file upload slot.
+     * https://xmpp.org/extensions/xep-0363.html#request
+     * @private
+     * @method _converse.Message#sendSlotRequestStanza
+     */
+    private sendSlotRequestStanza;
+    getUploadRequestMetadata(stanza: any): {
+        headers: any;
+    };
+    getRequestSlotURL(): Promise<any>;
+    upload_metadata: {
+        headers: any;
+    };
+    uploadFile(): void;
+}
+import ModelWithContact from "./model-with-contact.js";
+//# sourceMappingURL=message.d.ts.map

+ 11 - 0
src/headless/types/plugins/chat/messages.d.ts

@@ -0,0 +1,11 @@
+export default Messages;
+declare class Messages extends Collection {
+    constructor();
+    comparator: string;
+    model: typeof Message;
+    fetched: any;
+    chatbox: any;
+}
+import { Collection } from "@converse/skeletor";
+import Message from "./message.js";
+//# sourceMappingURL=messages.d.ts.map

+ 12 - 0
src/headless/types/plugins/chat/model-with-contact.d.ts

@@ -0,0 +1,12 @@
+export default ModelWithContact;
+declare class ModelWithContact extends Model {
+    rosterContactAdded: any;
+    contact: any;
+    vcard: any;
+    /**
+     * @param {string} jid
+     */
+    setRosterContact(jid: string): Promise<void>;
+}
+import { Model } from "@converse/skeletor";
+//# sourceMappingURL=model-with-contact.d.ts.map

+ 247 - 0
src/headless/types/plugins/chat/model.d.ts

@@ -0,0 +1,247 @@
+export default ChatBox;
+export type Message = import('./message.js').default;
+export type MUC = import('../muc/muc.js').default;
+export type MUCMessage = import('../muc/message.js').default;
+export type MessageAttributes = any;
+export namespace Strophe {
+    type Builder = any;
+}
+/**
+ * Represents an open/ongoing chat conversation.
+ * @namespace ChatBox
+ * @memberOf _converse
+ */
+declare class ChatBox extends ModelWithContact {
+    constructor(attrs: any, options: any);
+    defaults(): {
+        bookmarked: boolean;
+        hidden: boolean;
+        message_type: string;
+        num_unread: number;
+        time_opened: any;
+        time_sent: string;
+        type: string;
+    };
+    disable_mam: boolean;
+    initialize(): Promise<void>;
+    initialized: any;
+    presence: any;
+    getMessagesCollection(): any;
+    getMessagesCacheKey(): string;
+    initMessages(): void;
+    messages: any;
+    initUI(): void;
+    ui: Model;
+    initNotifications(): void;
+    notifications: Model;
+    getNotificationsText(): any;
+    afterMessagesFetched(): void;
+    fetchMessages(): any;
+    handleErrorMessageStanza(stanza: any): Promise<void>;
+    /**
+     * Queue an incoming `chat` message stanza for processing.
+     * @async
+     * @method ChatBox#queueMessage
+     * @param {MessageAttributes} attrs - A promise which resolves to the message attributes
+     */
+    queueMessage(attrs: any): any;
+    msg_chain: any;
+    /**
+     * @async
+     * @method ChatBox#onMessage
+     * @param {Promise<MessageAttributes>} attrs_promise - A promise which resolves to the message attributes.
+     */
+    onMessage(attrs_promise: Promise<MessageAttributes>): Promise<void>;
+    onMessageUploadChanged(message: any): Promise<void>;
+    onMessageAdded(message: any): void;
+    clearMessages(): Promise<void>;
+    close(): Promise<void>;
+    announceReconnection(): void;
+    onReconnection(): Promise<void>;
+    onPresenceChanged(item: any): void;
+    onScrolledChanged(): void;
+    pruneHistoryWhenScrolledDown(): void;
+    validate(attrs: any): string;
+    getDisplayName(): any;
+    createMessageFromError(error: any): Promise<void>;
+    editEarlierMessage(): void;
+    editLaterMessage(): any;
+    getOldestMessage(): any;
+    getMostRecentMessage(): any;
+    getUpdatedMessageAttributes(message: any, attrs: any): any;
+    updateMessage(message: any, attrs: any): void;
+    /**
+     * Mutator for setting the chat state of this chat session.
+     * Handles clearing of any chat state notification timeouts and
+     * setting new ones if necessary.
+     * Timeouts are set when the  state being set is COMPOSING or PAUSED.
+     * After the timeout, COMPOSING will become PAUSED and PAUSED will become INACTIVE.
+     * See XEP-0085 Chat State Notifications.
+     * @method ChatBox#setChatState
+     * @param { string } state - The chat state (consts ACTIVE, COMPOSING, PAUSED, INACTIVE, GONE)
+     */
+    setChatState(state: string, options: any): ChatBox;
+    chat_state_timeout: number;
+    /**
+     * Given an error `<message>` stanza's attributes, find the saved message model which is
+     * referenced by that error.
+     * @param {object} attrs
+     */
+    getMessageReferencedByError(attrs: object): any;
+    /**
+     * @method ChatBox#shouldShowErrorMessage
+     * @param {object} attrs
+     * @returns {Promise<boolean>}
+     */
+    shouldShowErrorMessage(attrs: object): Promise<boolean>;
+    /**
+     * @param {string} jid1
+     * @param {string} jid2
+     */
+    isSameUser(jid1: string, jid2: string): any;
+    /**
+     * Looks whether we already have a retraction for this
+     * incoming message. If so, it's considered "dangling" because it
+     * probably hasn't been applied to anything yet, given that the
+     * relevant message is only coming in now.
+     * @private
+     * @method ChatBox#findDanglingRetraction
+     * @param { object } attrs - Attributes representing a received
+     *  message, as returned by {@link parseMessage}
+     * @returns { Message }
+     */
+    private findDanglingRetraction;
+    /**
+     * Handles message retraction based on the passed in attributes.
+     * @method ChatBox#handleRetraction
+     * @param {object} attrs - Attributes representing a received
+     *  message, as returned by {@link parseMessage}
+     * @returns {Promise<Boolean>} Returns `true` or `false` depending on
+     *  whether a message was retracted or not.
+     */
+    handleRetraction(attrs: object): Promise<boolean>;
+    /**
+     * Returns an already cached message (if it exists) based on the
+     * passed in attributes map.
+     * @method ChatBox#getDuplicateMessage
+     * @param {object} attrs - Attributes representing a received
+     *  message, as returned by {@link parseMessage}
+     * @returns {Message}
+     */
+    getDuplicateMessage(attrs: object): Message;
+    getOriginIdQueryAttrs(attrs: any): {
+        origin_id: any;
+        from: any;
+    };
+    getStanzaIdQueryAttrs(attrs: any): {}[];
+    getMessageBodyQueryAttrs(attrs: any): {
+        from: any;
+        msgid: any;
+    };
+    /**
+     * Retract one of your messages in this chat
+     * @method ChatBoxView#retractOwnMessage
+     * @param { Message } message - The message which we're retracting.
+     */
+    retractOwnMessage(message: Message): void;
+    /**
+     * Sends a message stanza to retract a message in this chat
+     * @private
+     * @method ChatBox#sendRetractionMessage
+     * @param { Message } message - The message which we're retracting.
+     */
+    private sendRetractionMessage;
+    /**
+     * Finds the last eligible message and then sends a XEP-0333 chat marker for it.
+     * @param { ('received'|'displayed'|'acknowledged') } [type='displayed']
+     * @param { Boolean } force - Whether a marker should be sent for the
+     *  message, even if it didn't include a `markable` element.
+     */
+    sendMarkerForLastMessage(type?: ('received' | 'displayed' | 'acknowledged'), force?: boolean): void;
+    /**
+     * Given the passed in message object, send a XEP-0333 chat marker.
+     * @param { Message } msg
+     * @param { ('received'|'displayed'|'acknowledged') } [type='displayed']
+     * @param { Boolean } force - Whether a marker should be sent for the
+     *  message, even if it didn't include a `markable` element.
+     */
+    sendMarkerForMessage(msg: Message, type?: ('received' | 'displayed' | 'acknowledged'), force?: boolean): void;
+    handleChatMarker(attrs: any): boolean;
+    sendReceiptStanza(to_jid: any, id: any): void;
+    handleReceipt(attrs: any): boolean;
+    /**
+     * Given a {@link Message} return the XML stanza that represents it.
+     * @private
+     * @method ChatBox#createMessageStanza
+     * @param { Message } message - The message object
+     */
+    private createMessageStanza;
+    getOutgoingMessageAttributes(attrs: any): Promise<any>;
+    /**
+     * Responsible for setting the editable attribute of messages.
+     * If api.settings.get('allow_message_corrections') is "last", then only the last
+     * message sent from me will be editable. If set to "all" all messages
+     * will be editable. Otherwise no messages will be editable.
+     * @method ChatBox#setEditable
+     * @memberOf ChatBox
+     * @param {Object} attrs An object containing message attributes.
+     * @param {String} send_time - time when the message was sent
+     */
+    setEditable(attrs: any, send_time: string): void;
+    /**
+     * Queue the creation of a message, to make sure that we don't run
+     * into a race condition whereby we're creating a new message
+     * before the collection has been fetched.
+     * @method ChatBox#createMessage
+     * @param {Object} attrs
+     */
+    createMessage(attrs: any, options: any): Promise<any>;
+    /**
+     * Responsible for sending off a text message inside an ongoing chat conversation.
+     * @method ChatBox#sendMessage
+     * @memberOf ChatBox
+     * @param {Object} [attrs] - A map of attributes to be saved on the message
+     * @returns {Promise<Message>}
+     * @example
+     * const chat = api.chats.get('buddy1@example.org');
+     * chat.sendMessage({'body': 'hello world'});
+     */
+    sendMessage(attrs?: any): Promise<Message>;
+    /**
+     * Sends a message with the current XEP-0085 chat state of the user
+     * as taken from the `chat_state` attribute of the {@link ChatBox}.
+     * @method ChatBox#sendChatState
+     */
+    sendChatState(): void;
+    /**
+     * @param {File[]} files
+     */
+    sendFiles(files: File[]): Promise<void>;
+    /**
+     * @param {boolean} force
+     */
+    maybeShow(force: boolean): ChatBox;
+    /**
+     * Indicates whether the chat is hidden and therefore
+     * whether a newly received message will be visible
+     * to the user or not.
+     * @returns {boolean}
+     */
+    isHidden(): boolean;
+    /**
+     * Given a newly received {@link Message} instance,
+     * update the unread counter if necessary.
+     * @method ChatBox#handleUnreadMessage
+     * @param {Message} message
+     */
+    handleUnreadMessage(message: Message): void;
+    /**
+     * @param {Message} message
+     */
+    incrementUnreadMsgsCounter(message: Message): void;
+    clearUnreadMsgCounter(): void;
+    isScrolledUp(): any;
+}
+import ModelWithContact from "./model-with-contact.js";
+import { Model } from "@converse/skeletor";
+//# sourceMappingURL=model.d.ts.map

+ 9 - 0
src/headless/types/plugins/chat/parsers.d.ts

@@ -0,0 +1,9 @@
+/**
+ * Parses a passed in message stanza and returns an object of attributes.
+ * @method st#parseMessage
+ * @param { Element } stanza - The message stanza
+ * @returns { Promise<MessageAttributes|Error> }
+ */
+export function parseMessage(stanza: Element): Promise<MessageAttributes | Error>;
+export type MessageAttributes = any;
+//# sourceMappingURL=parsers.d.ts.map

+ 25 - 0
src/headless/types/plugins/chat/utils.d.ts

@@ -0,0 +1,25 @@
+export function routeToChat(event: any): void;
+export function onClearSession(): Promise<void>;
+/**
+ * Given a stanza, determine whether it's a new
+ * message, i.e. not a MAM archived one.
+ * @param {Element|Model|object} message
+ */
+export function isNewMessage(message: Element | Model | object): boolean;
+export function autoJoinChats(): void;
+export function registerMessageHandlers(): void;
+/**
+ * Handler method for all incoming single-user chat "message" stanzas.
+ * @param {Element|Builder} stanza
+ */
+export function handleMessageStanza(stanza: Element | Builder): Promise<void>;
+/**
+ * Ask the XMPP server to enable Message Carbons
+ * See [XEP-0280](https://xmpp.org/extensions/xep-0280.html#enabling)
+ */
+export function enableCarbons(): Promise<void>;
+export type ChatBox = import('./model.js').default;
+export type MessageAttributes = any;
+export type Builder = import('strophe.js').Builder;
+import { Model } from "@converse/skeletor";
+//# sourceMappingURL=utils.d.ts.map

+ 36 - 0
src/headless/types/plugins/chatboxes/api.d.ts

@@ -0,0 +1,36 @@
+declare namespace _default {
+    /**
+     * @method api.chatboxes.create
+     * @param {string|string[]} jids - A JID or array of JIDs
+     * @param {Object} attrs An object containing configuration attributes
+     * @param {new (attrs: object, options: object) => ChatBox} model - The type of chatbox that should be created
+     */
+    function create(jids: string | string[], attrs: any, model: new (attrs: any, options: any) => import("../chat/model.js").default): Promise<import("../chat/model.js").default | import("../chat/model.js").default[]>;
+    /**
+     * @method api.chatboxes.get
+     * @param {string|string[]} jids - A JID or array of JIDs
+     */
+    function get(jids: string | string[]): Promise<any>;
+    namespace registry {
+        /**
+         * @method api.chatboxes.registry.add
+         * Add another type of chatbox that can be added to this collection.
+         * This is used in the `createModel` function to determine what type of
+         * chatbox class to instantiate (e.g. ChatBox, MUC, Feed etc.) based on the
+         * passed in attributes.
+         * @param {string} type - The type name
+         * @param {Model} model - The model which will be instantiated for the given type name.
+         */
+        function add(type: string, model: import("@converse/skeletor").Model): void;
+        /**
+         * @method api.chatboxes.registry.get
+         * @param {string} type - The type name
+         * @return {Model} model - The model which will be instantiated for the given type name.
+         */
+        function get(type: string): import("@converse/skeletor").Model;
+    }
+}
+export default _default;
+export type Model = import('@converse/skeletor').Model;
+export type ChatBox = import('../chat/model.js').default;
+//# sourceMappingURL=api.d.ts.map

+ 24 - 0
src/headless/types/plugins/chatboxes/chatboxes.d.ts

@@ -0,0 +1,24 @@
+export default ChatBoxes;
+export type Model = import('@converse/skeletor').Model;
+declare class ChatBoxes extends Collection {
+    /**
+     * @param {Model[]} models
+     * @param {object} options
+     */
+    constructor(models: Model[], options: object);
+    /**
+     * @param {Collection} collection
+     */
+    onChatBoxesFetched(collection: Collection): void;
+    /**
+     * @param {boolean} reconnecting
+     */
+    onConnected(reconnecting: boolean): void;
+    /**
+     * @param {object} attrs
+     * @param {object} options
+     */
+    createModel(attrs: object, options: object): any;
+}
+import { Collection } from "@converse/skeletor";
+//# sourceMappingURL=chatboxes.d.ts.map

+ 2 - 0
src/headless/types/plugins/chatboxes/index.d.ts

@@ -0,0 +1,2 @@
+export {};
+//# sourceMappingURL=index.d.ts.map

+ 8 - 0
src/headless/types/plugins/chatboxes/utils.d.ts

@@ -0,0 +1,8 @@
+/**
+ * @param {string} jid
+ * @param {object} attrs
+ * @param {new (attrs: object, options: object) => ChatBox} Model
+ */
+export function createChatBox(jid: string, attrs: object, Model: new (attrs: object, options: object) => ChatBox): Promise<import("../chat/model.js").default>;
+export type ChatBox = import('../chat/model.js').default;
+//# sourceMappingURL=utils.d.ts.map

+ 252 - 0
src/headless/types/plugins/disco/api.d.ts

@@ -0,0 +1,252 @@
+declare namespace _default {
+    namespace disco {
+        export namespace stream {
+            /**
+             * @method api.disco.stream.getFeature
+             * @param { String } name The feature name
+             * @param { String } xmlns The XML namespace
+             * @example _converse.api.disco.stream.getFeature('ver', 'urn:xmpp:features:rosterver')
+             */
+            function getFeature(name: string, xmlns: string): Promise<any>;
+        }
+        export namespace own {
+            namespace identities {
+                /**
+                 * Lets you add new identities for this client (i.e. instance of Converse)
+                 * @method api.disco.own.identities.add
+                 *
+                 * @param { String } category - server, client, gateway, directory, etc.
+                 * @param { String } type - phone, pc, web, etc.
+                 * @param { String } name - "Converse"
+                 * @param { String } lang - en, el, de, etc.
+                 *
+                 * @example _converse.api.disco.own.identities.clear();
+                 */
+                function add(category: string, type: string, name: string, lang: string): boolean;
+                /**
+                 * Clears all previously registered identities.
+                 * @method api.disco.own.identities.clear
+                 * @example _converse.api.disco.own.identities.clear();
+                 */
+                function clear(): void;
+                /**
+                 * Returns all of the identities registered for this client
+                 * (i.e. instance of Converse).
+                 * @method api.disco.identities.get
+                 * @example const identities = api.disco.own.identities.get();
+                 */
+                function get(): any;
+            }
+            namespace features {
+                /**
+                 * Lets you register new disco features for this client (i.e. instance of Converse)
+                 * @method api.disco.own.features.add
+                 * @param { String } name - e.g. http://jabber.org/protocol/caps
+                 * @example _converse.api.disco.own.features.add("http://jabber.org/protocol/caps");
+                 */
+                function add(name: string): boolean;
+                /**
+                 * Clears all previously registered features.
+                 * @method api.disco.own.features.clear
+                 * @example _converse.api.disco.own.features.clear();
+                 */
+                function clear(): void;
+                /**
+                 * Returns all of the features registered for this client (i.e. instance of Converse).
+                 * @method api.disco.own.features.get
+                 * @example const features = api.disco.own.features.get();
+                 */
+                function get(): any;
+            }
+        }
+        /**
+         * Query for information about an XMPP entity
+         *
+         * @method api.disco.info
+         * @param { string } jid The Jabber ID of the entity to query
+         * @param { string } [node] A specific node identifier associated with the JID
+         * @returns {promise} Promise which resolves once we have a result from the server.
+         */
+        export function info(jid: string, node?: string): Promise<any>;
+        /**
+         * Query for items associated with an XMPP entity
+         *
+         * @method api.disco.items
+         * @param { string } jid The Jabber ID of the entity to query for items
+         * @param { string } [node] A specific node identifier associated with the JID
+         * @returns {promise} Promise which resolves once we have a result from the server.
+         */
+        export function items(jid: string, node?: string): Promise<any>;
+        export namespace entities {
+            /**
+             * Get the corresponding `DiscoEntity` instance.
+             *
+             * @method api.disco.entities.get
+             * @param { string } jid The Jabber ID of the entity
+             * @param { boolean } [create] Whether the entity should be created if it doesn't exist.
+             * @example _converse.api.disco.entities.get(jid);
+             */
+            function get(jid: string, create?: boolean): Promise<any>;
+            /**
+             * Return any disco items advertised on this entity
+             *
+             * @method api.disco.entities.items
+             * @param { string } jid - The Jabber ID of the entity for which we want to fetch items
+             * @example api.disco.entities.items(jid);
+             */
+            function items(jid: string): any;
+            /**
+             * Create a new  disco entity. It's identity and features
+             * will automatically be fetched from cache or from the
+             * XMPP server.
+             *
+             * Fetching from cache can be disabled by passing in
+             * `ignore_cache: true` in the options parameter.
+             *
+             * @method api.disco.entities.create
+             * @param { object } data
+             * @param { string } data.jid - The Jabber ID of the entity
+             * @param { string } data.parent_jid - The Jabber ID of the parent entity
+             * @param { string } data.name
+             * @param { object } [options] - Additional options
+             * @param { boolean } [options.ignore_cache]
+             *     If true, fetch all features from the XMPP server instead of restoring them from cache
+             * @example _converse.api.disco.entities.create({ jid }, {'ignore_cache': true});
+             */
+            function create(data: {
+                jid: string;
+                parent_jid: string;
+                name: string;
+            }, options?: {
+                ignore_cache?: boolean;
+            }): any;
+        }
+        export namespace features_1 {
+            /**
+             * Return a given feature of a disco entity
+             *
+             * @method api.disco.features.get
+             * @param { string } feature The feature that might be
+             *     supported. In the XML stanza, this is the `var`
+             *     attribute of the `<feature>` element. For
+             *     example: `http://jabber.org/protocol/muc`
+             * @param { string } jid The JID of the entity
+             *     (and its associated items) which should be queried
+             * @returns {promise} A promise which resolves with a list containing
+             *     _converse.Entity instances representing the entity
+             *     itself or those items associated with the entity if
+             *     they support the given feature.
+             * @example
+             * api.disco.features.get(Strophe.NS.MAM, _converse.bare_jid);
+             */
+            function get(feature: string, jid: string): Promise<any>;
+            /**
+             * Returns true if an entity with the given JID, or if one of its
+             * associated items, supports a given feature.
+             *
+             * @method api.disco.features.has
+             * @param { string } feature The feature that might be
+             *     supported. In the XML stanza, this is the `var`
+             *     attribute of the `<feature>` element. For
+             *     example: `http://jabber.org/protocol/muc`
+             * @param { string } jid The JID of the entity
+             *     (and its associated items) which should be queried
+             * @returns {Promise} A promise which resolves with a boolean
+             * @example
+             *      api.disco.features.has(Strophe.NS.MAM, _converse.bare_jid);
+             */
+            function has(feature: string, jid: string): Promise<any>;
+        }
+        export { features_1 as features };
+        /**
+         * Used to determine whether an entity supports a given feature.
+         *
+         * @method api.disco.supports
+         * @param { string } feature The feature that might be
+         *     supported. In the XML stanza, this is the `var`
+         *     attribute of the `<feature>` element. For
+         *     example: `http://jabber.org/protocol/muc`
+         * @param { string } jid The JID of the entity
+         *     (and its associated items) which should be queried
+         * @returns {promise} A promise which resolves with `true` or `false`.
+         * @example
+         * if (await api.disco.supports(Strophe.NS.MAM, _converse.bare_jid)) {
+         *     // The feature is supported
+         * } else {
+         *     // The feature is not supported
+         * }
+         */
+        export function supports(feature: string, jid: string): Promise<any>;
+        /**
+         * Refresh the features, fields and identities associated with a
+         * disco entity by refetching them from the server
+         * @method api.disco.refresh
+         * @param { string } jid The JID of the entity whose features are refreshed.
+         * @returns {promise} A promise which resolves once the features have been refreshed
+         * @example
+         * await api.disco.refresh('room@conference.example.org');
+         */
+        export function refresh(jid: string): Promise<any>;
+        /**
+         * @deprecated Use {@link api.disco.refresh} instead.
+         * @method api.disco.refreshFeatures
+         */
+        export function refreshFeatures(jid: any): any;
+        /**
+         * Return all the features associated with a disco entity
+         *
+         * @method api.disco.getFeatures
+         * @param { string } jid The JID of the entity whose features are returned.
+         * @returns {promise} A promise which resolves with the returned features
+         * @example
+         * const features = await api.disco.getFeatures('room@conference.example.org');
+         */
+        export function getFeatures(jid: string): Promise<any>;
+        /**
+         * Return all the service discovery extensions fields
+         * associated with an entity.
+         *
+         * See [XEP-0129: Service Discovery Extensions](https://xmpp.org/extensions/xep-0128.html)
+         *
+         * @method api.disco.getFields
+         * @param { string } jid The JID of the entity whose fields are returned.
+         * @example
+         * const fields = await api.disco.getFields('room@conference.example.org');
+         */
+        export function getFields(jid: string): Promise<any>;
+        /**
+         * Get the identity (with the given category and type) for a given disco entity.
+         *
+         * For example, when determining support for PEP (personal eventing protocol), you
+         * want to know whether the user's own JID has an identity with
+         * `category='pubsub'` and `type='pep'` as explained in this section of
+         * XEP-0163: https://xmpp.org/extensions/xep-0163.html#support
+         *
+         * @method api.disco.getIdentity
+         * @param {string} category -The identity category.
+         *     In the XML stanza, this is the `category`
+         *     attribute of the `<identity>` element.
+         *     For example: 'pubsub'
+         * @param {string} type - The identity type.
+         *     In the XML stanza, this is the `type`
+         *     attribute of the `<identity>` element.
+         *     For example: 'pep'
+         * @param {string} jid - The JID of the entity which might have the identity
+         * @returns {promise} A promise which resolves with a map indicating
+         *     whether an identity with a given type is provided by the entity.
+         * @example
+         * api.disco.getIdentity('pubsub', 'pep', _converse.bare_jid).then(
+         *     function (identity) {
+         *         if (identity) {
+         *             // The entity DOES have this identity
+         *         } else {
+         *             // The entity DOES NOT have this identity
+         *         }
+         *     }
+         * ).catch(e => log.error(e));
+         */
+        export function getIdentity(category: string, type: string, jid: string): Promise<any>;
+    }
+}
+export default _default;
+//# sourceMappingURL=api.d.ts.map

+ 9 - 0
src/headless/types/plugins/disco/entities.d.ts

@@ -0,0 +1,9 @@
+export default DiscoEntities;
+declare class DiscoEntities extends Collection {
+    constructor();
+    model: typeof DiscoEntity;
+    fetchEntities(): Promise<any>;
+}
+import { Collection } from "@converse/skeletor";
+import DiscoEntity from "./entity.js";
+//# sourceMappingURL=entities.d.ts.map

+ 49 - 0
src/headless/types/plugins/disco/entity.d.ts

@@ -0,0 +1,49 @@
+export default DiscoEntity;
+/**
+ * @class
+ * @namespace _converse.DiscoEntity
+ * @memberOf _converse
+ *
+ * A Disco Entity is a JID addressable entity that can be queried for features.
+ *
+ * See XEP-0030: https://xmpp.org/extensions/xep-0030.html
+ */
+declare class DiscoEntity extends Model {
+    initialize(_: any, options: any): void;
+    waitUntilFeaturesDiscovered: any;
+    dataforms: Collection;
+    features: Collection;
+    fields: Collection;
+    identities: Collection;
+    /**
+     * Returns a Promise which resolves with a map indicating
+     * whether a given identity is provided by this entity.
+     * @method _converse.DiscoEntity#getIdentity
+     * @param { String } category - The identity category
+     * @param { String } type - The identity type
+     */
+    getIdentity(category: string, type: string): Promise<any>;
+    /**
+     * Returns a Promise which resolves with a map indicating
+     * whether a given feature is supported.
+     * @method _converse.DiscoEntity#getFeature
+     * @param { String } feature - The feature that might be supported.
+     */
+    getFeature(feature: string): Promise<DiscoEntity>;
+    onFeatureAdded(feature: any): void;
+    onFieldAdded(field: any): void;
+    fetchFeatures(options: any): Promise<void>;
+    queryInfo(): Promise<void>;
+    /**
+     * @param {Element} stanza
+     */
+    onDiscoItems(stanza: Element): void;
+    queryForItems(): Promise<void>;
+    /**
+     * @param {Element} stanza
+     */
+    onInfo(stanza: Element): Promise<void>;
+}
+import { Model } from "@converse/skeletor";
+import { Collection } from "@converse/skeletor";
+//# sourceMappingURL=entity.d.ts.map

+ 2 - 0
src/headless/types/plugins/disco/index.d.ts

@@ -0,0 +1,2 @@
+export {};
+//# sourceMappingURL=index.d.ts.map

+ 6 - 0
src/headless/types/plugins/disco/utils.d.ts

@@ -0,0 +1,6 @@
+export function initializeDisco(): Promise<void>;
+export function initStreamFeatures(): void;
+export function notifyStreamFeaturesAdded(): void;
+export function populateStreamFeatures(): void;
+export function clearSession(): void;
+//# sourceMappingURL=utils.d.ts.map

+ 2 - 0
src/headless/types/plugins/emoji/index.d.ts

@@ -0,0 +1,2 @@
+export {};
+//# sourceMappingURL=index.d.ts.map

+ 13 - 0
src/headless/types/plugins/emoji/picker.d.ts

@@ -0,0 +1,13 @@
+export default EmojiPicker;
+/**
+ * Model for storing data related to the Emoji picker widget
+ */
+declare class EmojiPicker extends Model {
+    defaults(): {
+        current_category: string;
+        current_skintone: string;
+        scroll_position: number;
+    };
+}
+import { Model } from "@converse/skeletor";
+//# sourceMappingURL=picker.d.ts.map

+ 3 - 0
src/headless/types/plugins/emoji/regexes.d.ts

@@ -0,0 +1,3 @@
+export const ASCII_REPLACE_REGEX: RegExp;
+export const CODEPOINTS_REGEX: RegExp;
+//# sourceMappingURL=regexes.d.ts.map

+ 19 - 0
src/headless/types/plugins/emoji/utils.d.ts

@@ -0,0 +1,19 @@
+/**
+ * @param {string} str
+ */
+export function convertASCII2Emoji(str: string): string;
+/**
+ * @param {string} text
+ */
+export function getShortnameReferences(text: string): {
+    cp: any;
+    begin: number;
+    end: number;
+    shortname: string;
+    emoji: string;
+}[];
+/**
+ * @param {string} text
+ */
+export function getCodePointReferences(text: string): any[];
+//# sourceMappingURL=utils.d.ts.map

+ 17 - 0
src/headless/types/plugins/headlines/api.d.ts

@@ -0,0 +1,17 @@
+declare namespace _default {
+    namespace headlines {
+        /**
+         * Retrieves a headline-channel or all headline-channels.
+         *
+         * @method api.headlines.get
+         * @param {String|String[]} jids - e.g. 'buddy@example.com' or ['buddy1@example.com', 'buddy2@example.com']
+         * @param { Object } [attrs] - Attributes to be set on the _converse.ChatBox model.
+         * @param { Boolean } [create=false] - Whether the chat should be created if it's not found.
+         * @returns { Promise<HeadlinesFeed[]|HeadlinesFeed> }
+         */
+        function get(jids: string | string[], attrs?: any, create?: boolean): Promise<import("./feed.js").default | import("./feed.js").default[]>;
+    }
+}
+export default _default;
+export type HeadlinesFeed = import('./feed.js').default;
+//# sourceMappingURL=api.d.ts.map

+ 19 - 0
src/headless/types/plugins/headlines/feed.d.ts

@@ -0,0 +1,19 @@
+/**
+ * Shows headline messages
+ * @class
+ * @namespace _converse.HeadlinesFeed
+ * @memberOf _converse
+ */
+export default class HeadlinesFeed extends ChatBox {
+    defaults(): {
+        bookmarked: boolean;
+        hidden: boolean;
+        message_type: string;
+        num_unread: number;
+        time_opened: any;
+        time_sent: any;
+        type: string;
+    };
+}
+import ChatBox from "../../plugins/chat/model.js";
+//# sourceMappingURL=feed.d.ts.map

+ 2 - 0
src/headless/types/plugins/headlines/index.d.ts

@@ -0,0 +1,2 @@
+export {};
+//# sourceMappingURL=index.d.ts.map

+ 6 - 0
src/headless/types/plugins/headlines/utils.d.ts

@@ -0,0 +1,6 @@
+/**
+ * Handler method for all incoming messages of type "headline".
+ * @param { Element } stanza
+ */
+export function onHeadlineMessage(stanza: Element): Promise<void>;
+//# sourceMappingURL=utils.d.ts.map

+ 189 - 0
src/headless/types/plugins/mam/api.d.ts

@@ -0,0 +1,189 @@
+declare namespace _default {
+    namespace archive {
+        /**
+         * @typedef {RSMQueryParameters} MAMFilterParameters
+         * Filter parmeters which can be used to filter a MAM XEP-0313 archive
+         * @property String} [end] - A date string in ISO-8601 format, before which messages should be returned. Implies backward paging.
+         * @property {String} [start] - A date string in ISO-8601 format, after which messages should be returned. Implies forward paging.
+         * @property {String} [with] - A JID against which to match messages, according to either their `to` or `from` attributes.
+         *     An item in a MUC archive matches if the publisher of the item matches the JID.
+         *     If `with` is omitted, all messages that match the rest of the query will be returned, regardless of to/from
+         *     addresses of each message.
+         */
+        /**
+         * The options that can be passed in to the {@link _converse.api.archive.query } method
+         * @typedef {MAMFilterParameters} ArchiveQueryOptions
+         * @property {boolean} [groupchat=false] - Whether the MAM archive is for a groupchat.
+         */
+        /**
+         * Query for archived messages.
+         *
+         * The options parameter can also be an instance of
+         * RSM to enable easy querying between results pages.
+         *
+         * @method _converse.api.archive.query
+         * @param {ArchiveQueryOptions} options - An object containing query parameters
+         * @throws {Error} An error is thrown if the XMPP server responds with an error.
+         * @returns {Promise<MAMQueryResult>} A promise which resolves to a {@link MAMQueryResult} object.
+         *
+         * @example
+         * // Requesting all archived messages
+         * // ================================
+         * //
+         * // The simplest query that can be made is to simply not pass in any parameters.
+         * // Such a query will return all archived messages for the current user.
+         *
+         * let result;
+         * try {
+         *     result = await api.archive.query();
+         * } catch (e) {
+         *     // The query was not successful, perhaps inform the user?
+         *     // The IQ stanza returned by the XMPP server is passed in, so that you
+         *     // may inspect it and determine what the problem was.
+         * }
+         * // Do something with the messages, like showing them in your webpage.
+         * result.messages.forEach(m => this.showMessage(m));
+         *
+         * @example
+         * // Requesting all archived messages for a particular contact or room
+         * // =================================================================
+         * //
+         * // To query for messages sent between the current user and another user or room,
+         * // the query options need to contain the the JID (Jabber ID) of the user or
+         * // room under the  `with` key.
+         *
+         * // For a particular user
+         * let result;
+         * try {
+         *    result = await api.archive.query({'with': 'john@doe.net'});
+         * } catch (e) {
+         *     // The query was not successful
+         * }
+         *
+         * // For a particular room
+         * let result;
+         * try {
+         *    result = await api.archive.query({'with': 'discuss@conference.doglovers.net', 'groupchat': true});
+         * } catch (e) {
+         *     // The query was not successful
+         * }
+         *
+         * @example
+         * // Requesting all archived messages before or after a certain date
+         * // ===============================================================
+         * //
+         * // The `start` and `end` parameters are used to query for messages
+         * // within a certain timeframe. The passed in date values may either be ISO8601
+         * // formatted date strings, or JavaScript Date objects.
+         *
+         *  const options = {
+         *      'with': 'john@doe.net',
+         *      'start': '2010-06-07T00:00:00Z',
+         *      'end': '2010-07-07T13:23:54Z'
+         *  };
+         * let result;
+         * try {
+         *    result = await api.archive.query(options);
+         * } catch (e) {
+         *     // The query was not successful
+         * }
+         *
+         * @example
+         * // Limiting the amount of messages returned
+         * // ========================================
+         * //
+         * // The amount of returned messages may be limited with the `max` parameter.
+         * // By default, the messages are returned from oldest to newest.
+         *
+         * // Return maximum 10 archived messages
+         * let result;
+         * try {
+         *     result = await api.archive.query({'with': 'john@doe.net', 'max':10});
+         * } catch (e) {
+         *     // The query was not successful
+         * }
+         *
+         * @example
+         * // Paging forwards through a set of archived messages
+         * // ==================================================
+         * //
+         * // When limiting the amount of messages returned per query, you might want to
+         * // repeatedly make a further query to fetch the next batch of messages.
+         * //
+         * // To simplify this usecase for you, the callback method receives not only an array
+         * // with the returned archived messages, but also a special RSM (*Result Set Management*)
+         * // object which contains the query parameters you passed in, as well
+         * // as two utility methods `next`, and `previous`.
+         * //
+         * // When you call one of these utility methods on the returned RSM object, and then
+         * // pass the result into a new query, you'll receive the next or previous batch of
+         * // archived messages. Please note, when calling these methods, pass in an integer
+         * // to limit your results.
+         *
+         * const options = {'with': 'john@doe.net', 'max':10};
+         * let result;
+         * try {
+         *     result = await api.archive.query(options);
+         * } catch (e) {
+         *     // The query was not successful
+         * }
+         * // Do something with the messages, like showing them in your webpage.
+         * result.messages.forEach(m => this.showMessage(m));
+         *
+         * while (!result.complete) {
+         *     try {
+         *         result = await api.archive.query(Object.assign(options, rsm.next(10).query));
+         *     } catch (e) {
+         *         // The query was not successful
+         *     }
+         *     // Do something with the messages, like showing them in your webpage.
+         *     result.messages.forEach(m => this.showMessage(m));
+         * }
+         *
+         * @example
+         * // Paging backwards through a set of archived messages
+         * // ===================================================
+         * //
+         * // To page backwards through the archive, you need to know the UID of the message
+         * // which you'd like to page backwards from and then pass that as value for the
+         * // `before` parameter. If you simply want to page backwards from the most recent
+         * // message, pass in the `before` parameter with an empty string value `''`.
+         *
+         * let result;
+         * const options = {'before': '', 'max':5};
+         * try {
+         *     result = await api.archive.query(options);
+         * } catch (e) {
+         *     // The query was not successful
+         * }
+         * // Do something with the messages, like showing them in your webpage.
+         * result.messages.forEach(m => this.showMessage(m));
+         *
+         * // Now we query again, to get the previous batch.
+         * try {
+         *      result = await api.archive.query(Object.assign(options, rsm.previous(5).query));
+         * } catch (e) {
+         *     // The query was not successful
+         * }
+         * // Do something with the messages, like showing them in your webpage.
+         * result.messages.forEach(m => this.showMessage(m));
+         *
+         */
+        function query(options: any): Promise<{
+            messages: any[];
+            /**
+             * - An instance of {@link RSM }.
+             * You can call `next()` or `previous()` on this instance,
+             * to get the RSM query parameters for the next or previous
+             * page in the result set.
+             */
+            rsm?: RSM;
+            complete?: boolean;
+            error?: Error;
+        }>;
+    }
+}
+export default _default;
+export type RSMQueryParameters = any;
+import { RSM } from "../../shared/rsm";
+//# sourceMappingURL=api.d.ts.map

+ 2 - 0
src/headless/types/plugins/mam/index.d.ts

@@ -0,0 +1,2 @@
+export {};
+//# sourceMappingURL=index.d.ts.map

+ 8 - 0
src/headless/types/plugins/mam/placeholder.d.ts

@@ -0,0 +1,8 @@
+export default class MAMPlaceholderMessage extends Model {
+    defaults(): {
+        msgid: string;
+        is_ephemeral: boolean;
+    };
+}
+import { Model } from "@converse/skeletor";
+//# sourceMappingURL=placeholder.d.ts.map

+ 58 - 0
src/headless/types/plugins/mam/utils.d.ts

@@ -0,0 +1,58 @@
+/**
+ * @param {Element} iq
+ */
+export function onMAMError(iq: Element): void;
+/**
+ * Handle returned IQ stanza containing Message Archive
+ * Management (XEP-0313) preferences.
+ *
+ * XXX: For now we only handle the global default preference.
+ * The XEP also provides for per-JID preferences, which is
+ * currently not supported in converse.js.
+ *
+ * Per JID preferences will be set in chat boxes, so it'll
+ * probbaly be handled elsewhere in any case.
+ */
+export function onMAMPreferences(iq: any, feature: any): void;
+export function getMAMPrefsFromFeature(feature: any): void;
+export function preMUCJoinMAMFetch(muc: any): void;
+export function handleMAMResult(model: any, result: any, query: any, options: any, should_page: any): Promise<void>;
+/**
+ * @typedef {Object} MAMOptions
+ * A map of MAM related options that may be passed to fetchArchivedMessages
+ * @param {number} [options.max] - The maximum number of items to return.
+ *  Defaults to "archived_messages_page_size"
+ * @param {string} [options.after] - The XEP-0359 stanza ID of a message
+ *  after which messages should be returned. Implies forward paging.
+ * @param {string} [options.before] - The XEP-0359 stanza ID of a message
+ *  before which messages should be returned. Implies backward paging.
+ * @param {string} [options.end] - A date string in ISO-8601 format,
+ *  before which messages should be returned. Implies backward paging.
+ * @param {string} [options.start] - A date string in ISO-8601 format,
+ *  after which messages should be returned. Implies forward paging.
+ * @param {string} [options.with] - The JID of the entity with
+ *  which messages were exchanged.
+ * @param {boolean} [options.groupchat] - True if archive in groupchat.
+ */
+/**
+ * Fetch XEP-0313 archived messages based on the passed in criteria.
+ * @param {ChatBox} model
+ * @param {MAMOptions} [options]
+ * @param {('forwards'|'backwards'|null)} [should_page=null] - Determines whether
+ *  this function should recursively page through the entire result set if a limited
+ *  number of results were returned.
+ */
+export function fetchArchivedMessages(model: ChatBox, options?: MAMOptions, should_page?: ('forwards' | 'backwards' | null)): any;
+/**
+ * Fetches messages that might have been archived *after*
+ * the last archived message in our local cache.
+ * @param {ChatBox} model
+ */
+export function fetchNewestMessages(model: ChatBox): void;
+/**
+ * A map of MAM related options that may be passed to fetchArchivedMessages
+ */
+export type MAMOptions = any;
+export type MUC = import('../muc/muc.js').default;
+export type ChatBox = import('../chat/model.js').default;
+//# sourceMappingURL=utils.d.ts.map

+ 47 - 0
src/headless/types/plugins/muc/affiliations/api.d.ts

@@ -0,0 +1,47 @@
+declare namespace _default {
+    namespace affiliations {
+        /**
+         * Set the given affliation for the given JIDs in the specified MUCs
+         * @typedef {Object} User
+         * @property {string} User.jid - The JID of the user whose affiliation will change
+         * @property {Array} User.affiliation - The new affiliation for this user
+         * @property {string} [User.reason] - An optional reason for the affiliation change
+         *
+         * @param {String|Array<String>} muc_jids - The JIDs of the MUCs in
+         *  which the affiliation should be set.
+         * @param {User[]} users - An array of objects representing users
+         *  for whom the affiliation is to be set.
+         * @returns {Promise}
+         *
+         * @example
+         *  api.rooms.affiliations.set(
+         *      [
+         *          'muc1@muc.example.org',
+         *          'muc2@muc.example.org'
+         *      ], [
+         *          {
+         *              'jid': 'user@example.org',
+         *              'affiliation': 'member',
+         *              'reason': "You're one of us now!"
+         *          }
+         *      ]
+         *  )
+         */
+        function set(muc_jids: string | string[], users: {
+            /**
+             * - The JID of the user whose affiliation will change
+             */
+            jid: string;
+            /**
+             * - The new affiliation for this user
+             */
+            affiliation: any[];
+            /**
+             * - An optional reason for the affiliation change
+             */
+            reason?: string;
+        }[]): Promise<any>;
+    }
+}
+export default _default;
+//# sourceMappingURL=api.d.ts.map

+ 83 - 0
src/headless/types/plugins/muc/affiliations/utils.d.ts

@@ -0,0 +1,83 @@
+/**
+ * Sends an IQ stanza to the server, asking it for the relevant affiliation list .
+ * Returns an array of {@link MemberListItem} objects, representing occupants
+ * that have the given affiliation.
+ * See: https://xmpp.org/extensions/xep-0045.html#modifymember
+ * @typedef {("admin"|"owner"|"member")} NonOutcastAffiliation
+ * @param {NonOutcastAffiliation} affiliation
+ * @param {string} muc_jid - The JID of the MUC for which the affiliation list should be fetched
+ * @returns {Promise<MemberListItem[]|Error>}
+ */
+export function getAffiliationList(affiliation: NonOutcastAffiliation, muc_jid: string): Promise<MemberListItem[] | Error>;
+/**
+ * Given an occupant model, see which affiliations may be assigned by that user
+ * @param {Model} occupant
+ * @returns {typeof AFFILIATIONS} An array of assignable affiliations
+ */
+export function getAssignableAffiliations(occupant: Model): typeof AFFILIATIONS;
+/**
+ * Send IQ stanzas to the server to modify affiliations for users in this groupchat.
+ * See: https://xmpp.org/extensions/xep-0045.html#modifymember
+ * @param {String|Array<String>} muc_jid - The JID(s) of the MUCs in which the
+ * @param {Array<User>} users
+ * @returns {Promise}
+ */
+export function setAffiliations(muc_jid: string | Array<string>, users: Array<User>): Promise<any>;
+/**
+ * Send IQ stanzas to the server to set an affiliation for
+ * the provided JIDs.
+ * See: https://xmpp.org/extensions/xep-0045.html#modifymember
+ *
+ * Prosody doesn't accept multiple JIDs' affiliations
+ * being set in one IQ stanza, so as a workaround we send
+ * a separate stanza for each JID.
+ * Related ticket: https://issues.prosody.im/345
+ *
+ * @param {typeof AFFILIATIONS[number]} affiliation - The affiliation to be set
+ * @param {String|Array<String>} muc_jids - The JID(s) of the MUCs in which the
+ *  affiliations need to be set.
+ * @param {object} members - A map of jids, affiliations and
+ *  optionally reasons. Only those entries with the
+ *  same affiliation as being currently set will be considered.
+ * @returns {Promise} A promise which resolves and fails depending on the XMPP server response.
+ */
+export function setAffiliation(affiliation: (typeof AFFILIATIONS)[number], muc_jids: string | Array<string>, members: object): Promise<any>;
+/**
+ * Given two lists of objects with 'jid', 'affiliation' and
+ * 'reason' properties, return a new list containing
+ * those objects that are new, changed or removed
+ * (depending on the 'remove_absentees' boolean).
+ *
+ * The affiliations for new and changed members stay the
+ * same, for removed members, the affiliation is set to 'none'.
+ *
+ * The 'reason' property is not taken into account when
+ * comparing whether affiliations have been changed.
+ * @param {boolean} exclude_existing - Indicates whether JIDs from
+ *      the new list which are also in the old list
+ *      (regardless of affiliation) should be excluded
+ *      from the delta. One reason to do this
+ *      would be when you want to add a JID only if it
+ *      doesn't have *any* existing affiliation at all.
+ * @param {boolean} remove_absentees - Indicates whether JIDs
+ *      from the old list which are not in the new list
+ *      should be considered removed and therefore be
+ *      included in the delta with affiliation set
+ *      to 'none'.
+ * @param {array} new_list - Array containing the new affiliations
+ * @param {array} old_list - Array containing the old affiliations
+ * @returns {array}
+ */
+export function computeAffiliationsDelta(exclude_existing: boolean, remove_absentees: boolean, new_list: any[], old_list: any[]): any[];
+/**
+ * Sends an IQ stanza to the server, asking it for the relevant affiliation list .
+ * Returns an array of {@link MemberListItem } objects, representing occupants
+ * that have the given affiliation.
+ * See: https://xmpp.org/extensions/xep-0045.html#modifymember
+ */
+export type NonOutcastAffiliation = ("admin" | "owner" | "member");
+export type MemberListItem = any;
+export type User = any;
+export type Model = import('@converse/skeletor').Model;
+import { AFFILIATIONS } from "../constants.js";
+//# sourceMappingURL=utils.d.ts.map

+ 114 - 0
src/headless/types/plugins/muc/api.d.ts

@@ -0,0 +1,114 @@
+declare namespace _default {
+    namespace rooms {
+        /**
+         * Creates a new MUC chatroom (aka groupchat)
+         *
+         * Similar to {@link api.rooms.open}, but creates
+         * the chatroom in the background (i.e. doesn't cause a view to open).
+         *
+         * @method api.rooms.create
+         * @param {(string[]|string)} jids The JID or array of
+         *     JIDs of the chatroom(s) to create
+         * @param {object} [attrs] attrs The room attributes
+         * @returns {Promise[]} Promise which resolves with the Model representing the chat.
+         */
+        function create(jids: string | string[], attrs?: any): Promise<any>[];
+        /**
+         * Opens a MUC chatroom (aka groupchat)
+         *
+         * Similar to {@link api.chats.open}, but for groupchats.
+         *
+         * @method api.rooms.open
+         * @param {string|string[]} jids The room JID or JIDs (if not specified, all
+         *     currently open rooms will be returned).
+         * @param {object} attrs A map  containing any extra room attributes.
+         * @param {string} [attrs.nick] The current user's nickname for the MUC
+         * @param {boolean} [attrs.hidden]
+         * @param {boolean} [attrs.auto_configure] A boolean, indicating
+         *     whether the room should be configured automatically or not.
+         *     If set to `true`, then it makes sense to pass in configuration settings.
+         * @param {object} [attrs.roomconfig] A map of configuration settings to be used when the room gets
+         *     configured automatically. Currently it doesn't make sense to specify
+         *     `roomconfig` values if `auto_configure` is set to `false`.
+         *     For a list of configuration values that can be passed in, refer to these values
+         *     in the [XEP-0045 MUC specification](https://xmpp.org/extensions/xep-0045.html#registrar-formtype-owner).
+         *     The values should be named without the `muc#roomconfig_` prefix.
+         * @param {boolean} [attrs.minimized] A boolean, indicating whether the room should be opened minimized or not.
+         * @param {boolean} [attrs.bring_to_foreground] A boolean indicating whether the room should be
+         *     brought to the foreground and therefore replace the currently shown chat.
+         *     If there is no chat currently open, then this option is ineffective.
+         * @param {boolean} [force=false] - By default, a minimized
+         *   room won't be maximized (in `overlayed` view mode) and in
+         *   `fullscreen` view mode a newly opened room won't replace
+         *   another chat already in the foreground.
+         *   Set `force` to `true` if you want to force the room to be
+         *   maximized or shown.
+         * @returns {Promise<MUC[]>} Promise which resolves with the Model representing the chat.
+         *
+         * @example
+         * api.rooms.open('group@muc.example.com')
+         *
+         * @example
+         * // To return an array of rooms, provide an array of room JIDs:
+         * api.rooms.open(['group1@muc.example.com', 'group2@muc.example.com'])
+         *
+         * @example
+         * // To setup a custom nickname when joining the room, provide the optional nick argument:
+         * api.rooms.open('group@muc.example.com', {'nick': 'mycustomnick'})
+         *
+         * @example
+         * // For example, opening a room with a specific default configuration:
+         * api.rooms.open(
+         *     'myroom@conference.example.org',
+         *     { 'nick': 'coolguy69',
+         *       'auto_configure': true,
+         *       'roomconfig': {
+         *           'changesubject': false,
+         *           'membersonly': true,
+         *           'persistentroom': true,
+         *           'publicroom': true,
+         *           'roomdesc': 'Comfy room for hanging out',
+         *           'whois': 'anyone'
+         *       }
+         *     }
+         * );
+         */
+        function open(jids: string | string[], attrs?: {
+            nick?: string;
+            hidden?: boolean;
+            auto_configure?: boolean;
+            roomconfig?: any;
+            minimized?: boolean;
+            bring_to_foreground?: boolean;
+        }, force?: boolean): Promise<import("./muc.js").default[]>;
+        /**
+         * Fetches the object representing a MUC chatroom (aka groupchat)
+         *
+         * @method api.rooms.get
+         * @param {string|string[]} [jids] The room JID (if not specified, all rooms will be returned).
+         * @param {object} [attrs] A map containing any extra room attributes
+         *  to be set if `create` is set to `true`
+         * @param {string} [attrs.nick] Specify the nickname
+         * @param {string} [attrs.password ] Specify a password if needed to enter a new room
+         * @param {boolean} create A boolean indicating whether the room should be created
+         *     if not found (default: `false`)
+         * @returns {Promise<MUC[]>}
+         * @example
+         * api.waitUntil('roomsAutoJoined').then(() => {
+         *     const create_if_not_found = true;
+         *     api.rooms.get(
+         *         'group@muc.example.com',
+         *         {'nick': 'dread-pirate-roberts', 'password': 'secret'},
+         *         create_if_not_found
+         *     )
+         * });
+         */
+        function get(jids?: string | string[], attrs?: {
+            nick?: string;
+            password?: string;
+        }, create?: boolean): Promise<import("./muc.js").default[]>;
+    }
+}
+export default _default;
+export type MUC = import('./muc.js').default;
+//# sourceMappingURL=api.d.ts.map

+ 56 - 0
src/headless/types/plugins/muc/constants.d.ts

@@ -0,0 +1,56 @@
+export const ROLES: string[];
+export const AFFILIATIONS: string[];
+export namespace MUC_ROLE_WEIGHTS {
+    const moderator: number;
+    const participant: number;
+    const visitor: number;
+    const none: number;
+}
+export namespace AFFILIATION_CHANGES {
+    const OWNER: string;
+    const ADMIN: string;
+    const MEMBER: string;
+    const EXADMIN: string;
+    const EXOWNER: string;
+    const EXOUTCAST: string;
+    const EXMEMBER: string;
+}
+export const AFFILIATION_CHANGES_LIST: string[];
+export namespace MUC_TRAFFIC_STATES {
+    const ENTERED: string;
+    const EXITED: string;
+}
+export const MUC_TRAFFIC_STATES_LIST: string[];
+export namespace MUC_ROLE_CHANGES {
+    const OP: string;
+    const DEOP: string;
+    const VOICE: string;
+    const MUTE: string;
+}
+export const MUC_ROLE_CHANGES_LIST: string[];
+export namespace INFO_CODES {
+    const visibility_changes: string[];
+    const self: string[];
+    const non_privacy_changes: string[];
+    const muc_logging_changes: string[];
+    const nickname_changes: string[];
+    const disconnected: string[];
+    const affiliation_changes: string[];
+    const join_leave_events: string[];
+    const role_changes: string[];
+}
+export namespace ROOMSTATUS {
+    export const CONNECTED: number;
+    export const CONNECTING: number;
+    export const NICKNAME_REQUIRED: number;
+    export const PASSWORD_REQUIRED: number;
+    export const DISCONNECTED: number;
+    const ENTERED_1: number;
+    export { ENTERED_1 as ENTERED };
+    export const DESTROYED: number;
+    export const BANNED: number;
+    export const CLOSING: number;
+}
+export const ROOM_FEATURES: string[];
+export const MUC_NICK_CHANGED_CODE: "303";
+//# sourceMappingURL=constants.d.ts.map

+ 2 - 0
src/headless/types/plugins/muc/index.d.ts

@@ -0,0 +1,2 @@
+export {};
+//# sourceMappingURL=index.d.ts.map

+ 20 - 0
src/headless/types/plugins/muc/message.d.ts

@@ -0,0 +1,20 @@
+export default MUCMessage;
+declare class MUCMessage extends Message {
+    chatbox: any;
+    /**
+     * Determines whether this messsage may be moderated,
+     * based on configuration settings and server support.
+     * @async
+     * @method _converse.ChatRoomMessages#mayBeModerated
+     * @returns {boolean}
+     */
+    mayBeModerated(): boolean;
+    checkValidity(): any;
+    onOccupantRemoved(): void;
+    onOccupantAdded(occupant: any): void;
+    occupant: any;
+    getOccupant(): any;
+    setOccupant(): void;
+}
+import Message from "../chat/message.js";
+//# sourceMappingURL=message.d.ts.map

+ 11 - 0
src/headless/types/plugins/muc/messages.d.ts

@@ -0,0 +1,11 @@
+export default MUCMessages;
+/**
+ * Collection which stores MUC messages
+ */
+declare class MUCMessages extends Collection {
+    constructor(attrs: any, options?: {});
+    model: typeof MUCMessage;
+}
+import { Collection } from "@converse/skeletor";
+import MUCMessage from "./message";
+//# sourceMappingURL=messages.d.ts.map

+ 671 - 0
src/headless/types/plugins/muc/muc.d.ts

@@ -0,0 +1,671 @@
+export default MUC;
+export type MUCMessage = import('./message.js').default;
+export type ChatRoomOccupant = import('./occupant.js').default;
+export type NonOutcastAffiliation = import('./affiliations/utils.js').NonOutcastAffiliation;
+export type MemberListItem = any;
+export type MessageAttributes = any;
+export type MUCMessageAttributes = any;
+export namespace Strophe {
+    type Builder = any;
+}
+/**
+ * Represents an open/ongoing groupchat conversation.
+ * @namespace MUC
+ * @memberOf _converse
+ */
+declare class MUC extends ChatBox {
+    defaults(): {
+        bookmarked: boolean;
+        chat_state: any;
+        has_activity: boolean;
+        hidden: boolean;
+        hidden_occupants: boolean;
+        message_type: string;
+        name: string;
+        num_unread_general: number;
+        num_unread: number;
+        roomconfig: {};
+        time_opened: any;
+        time_sent: string;
+        type: string;
+    };
+    debouncedRejoin: any;
+    isEntered(): boolean;
+    /**
+     * Checks whether this MUC qualifies for subscribing to XEP-0437 Room Activity Indicators (RAI)
+     * @method MUC#isRAICandidate
+     * @returns { Boolean }
+     */
+    isRAICandidate(): boolean;
+    /**
+     * Checks whether we're still joined and if so, restores the MUC state from cache.
+     * @private
+     * @method MUC#restoreFromCache
+     * @returns {Promise<boolean>} Returns `true` if we're still joined, otherwise returns `false`.
+     */
+    private restoreFromCache;
+    /**
+     * Join the MUC
+     * @private
+     * @method MUC#join
+     * @param { String } [nick] - The user's nickname
+     * @param { String } [password] - Optional password, if required by the groupchat.
+     *  Will fall back to the `password` value stored in the room
+     *  model (if available).
+     */
+    private join;
+    /**
+     * Clear stale cache and re-join a MUC we've been in before.
+     * @private
+     * @method MUC#rejoin
+     */
+    private rejoin;
+    /**
+     * @param {string} password
+     */
+    constructJoinPresence(password: string): Promise<import("strophe.js/src/types/builder.js").default>;
+    clearOccupantsCache(): void;
+    /**
+     * Given the passed in MUC message, send a XEP-0333 chat marker.
+     * @param { MUCMessage } msg
+     * @param { ('received'|'displayed'|'acknowledged') } [type='displayed']
+     * @param { Boolean } force - Whether a marker should be sent for the
+     *  message, even if it didn't include a `markable` element.
+     */
+    sendMarkerForMessage(msg: MUCMessage, type?: ('received' | 'displayed' | 'acknowledged'), force?: boolean): void;
+    /**
+     * Ensures that the user is subscribed to XEP-0437 Room Activity Indicators
+     * if `muc_subscribe_to_rai` is set to `true`.
+     * Only affiliated users can subscribe to RAI, but this method doesn't
+     * check whether the current user is affiliated because it's intended to be
+     * called after the MUC has been left and we don't have that information
+     * anymore.
+     * @private
+     * @method MUC#enableRAI
+     */
+    private enableRAI;
+    /**
+     * Handler that gets called when the 'hidden' flag is toggled.
+     * @private
+     * @method MUC#onHiddenChange
+     */
+    private onHiddenChange;
+    onOccupantAdded(occupant: any): void;
+    onOccupantRemoved(occupant: any): void;
+    onOccupantShowChanged(occupant: any): void;
+    onRoomEntered(): Promise<void>;
+    onConnectionStatusChanged(): Promise<void>;
+    restoreSession(): Promise<any>;
+    session: MUCSession;
+    initDiscoModels(): void;
+    features: Model;
+    config: Model;
+    initOccupants(): void;
+    occupants: any;
+    fetchOccupants(): any;
+    handleAffiliationChangedMessage(stanza: any): void;
+    /**
+     * @param {Element} stanza
+     */
+    handleErrorMessageStanza(stanza: Element): Promise<void>;
+    /**
+     * Handles incoming message stanzas from the service that hosts this MUC
+     * @private
+     * @method MUC#handleMessageFromMUCHost
+     * @param { Element } stanza
+     */
+    private handleMessageFromMUCHost;
+    /**
+     * Handles XEP-0452 MUC Mention Notification messages
+     * @private
+     * @method MUC#handleForwardedMentions
+     * @param { Element } stanza
+     */
+    private handleForwardedMentions;
+    /**
+     * Parses an incoming message stanza and queues it for processing.
+     * @private
+     * @method MUC#handleMessageStanza
+     * @param {Strophe.Builder|Element} stanza
+     */
+    private handleMessageStanza;
+    /**
+     * Register presence and message handlers relevant to this groupchat
+     * @private
+     * @method MUC#registerHandlers
+     */
+    private registerHandlers;
+    presence_handler: any;
+    domain_presence_handler: any;
+    message_handler: any;
+    domain_message_handler: any;
+    affiliation_message_handler: any;
+    removeHandlers(): MUC;
+    invitesAllowed(): any;
+    /**
+     * Sends a message stanza to the XMPP server and expects a reflection
+     * or error message within a specific timeout period.
+     * @private
+     * @method MUC#sendTimedMessage
+     * @param {Strophe.Builder|Element } message
+     * @returns { Promise<Element>|Promise<TimeoutError> } Returns a promise
+     *  which resolves with the reflected message stanza or with an error stanza or
+     *  {@link TimeoutError}.
+     */
+    private sendTimedMessage;
+    /**
+     * Retract one of your messages in this groupchat
+     * @method MUC#retractOwnMessage
+     * @param {MUCMessage} message - The message which we're retracting.
+     */
+    retractOwnMessage(message: MUCMessage): Promise<void>;
+    /**
+     * Retract someone else's message in this groupchat.
+     * @method MUC#retractOtherMessage
+     * @param {MUCMessage} message - The message which we're retracting.
+     * @param {string} [reason] - The reason for retracting the message.
+     * @example
+     *  const room = await api.rooms.get(jid);
+     *  const message = room.messages.findWhere({'body': 'Get rich quick!'});
+     *  room.retractOtherMessage(message, 'spam');
+     */
+    retractOtherMessage(message: MUCMessage, reason?: string): Promise<any>;
+    /**
+     * Sends an IQ stanza to the XMPP server to retract a message in this groupchat.
+     * @private
+     * @method MUC#sendRetractionIQ
+     * @param {MUCMessage} message - The message which we're retracting.
+     * @param {string} [reason] - The reason for retracting the message.
+     */
+    private sendRetractionIQ;
+    /**
+     * Sends an IQ stanza to the XMPP server to destroy this groupchat. Not
+     * to be confused with the {@link MUC#destroy}
+     * method, which simply removes the room from the local browser storage cache.
+     * @private
+     * @method MUC#sendDestroyIQ
+     * @param { string } [reason] - The reason for destroying the groupchat.
+     * @param { string } [new_jid] - The JID of the new groupchat which replaces this one.
+     */
+    private sendDestroyIQ;
+    /**
+     * Leave the groupchat.
+     * @private
+     * @method MUC#leave
+     * @param { string } [exit_msg] - Message to indicate your reason for leaving
+     */
+    private leave;
+    close(ev: any): Promise<any>;
+    canModerateMessages(): any;
+    /**
+     * Return an array of unique nicknames based on all occupants and messages in this MUC.
+     * @private
+     * @method MUC#getAllKnownNicknames
+     * @returns { String[] }
+     */
+    private getAllKnownNicknames;
+    getAllKnownNicknamesRegex(): RegExp;
+    getOccupantByJID(jid: any): any;
+    getOccupantByNickname(nick: any): any;
+    getReferenceURIFromNickname(nickname: any): string;
+    /**
+     * Given a text message, look for `@` mentions and turn them into
+     * XEP-0372 references
+     * @param { String } text
+     */
+    parseTextForReferences(text: string): any[];
+    /**
+     * Utility method to construct the JID for the current user as occupant of the groupchat.
+     * @private
+     * @method MUC#getRoomJIDAndNick
+     * @returns {string} - The groupchat JID with the user's nickname added at the end.
+     * @example groupchat@conference.example.org/nickname
+     */
+    private getRoomJIDAndNick;
+    /**
+     * Send a direct invitation as per XEP-0249
+     * @private
+     * @method MUC#directInvite
+     * @param { String } recipient - JID of the person being invited
+     * @param { String } [reason] - Reason for the invitation
+     */
+    private directInvite;
+    /**
+     * Refresh the disco identity, features and fields for this {@link MUC}.
+     * *features* are stored on the features {@link Model} attribute on this {@link MUC}.
+     * *fields* are stored on the config {@link Model} attribute on this {@link MUC}.
+     * @private
+     * @returns {Promise}
+     */
+    private refreshDiscoInfo;
+    /**
+     * Fetch the *extended* MUC info from the server and cache it locally
+     * https://xmpp.org/extensions/xep-0045.html#disco-roominfo
+     * @private
+     * @method MUC#getDiscoInfo
+     * @returns {Promise}
+     */
+    private getDiscoInfo;
+    /**
+     * Fetch the *extended* MUC info fields from the server and store them locally
+     * in the `config` {@link Model} attribute.
+     * See: https://xmpp.org/extensions/xep-0045.html#disco-roominfo
+     * @private
+     * @method MUC#getDiscoInfoFields
+     * @returns {Promise}
+     */
+    private getDiscoInfoFields;
+    /**
+     * Use converse-disco to populate the features {@link Model} which
+     * is stored as an attibute on this {@link MUC}.
+     * The results may be cached. If you want to force fetching the features from the
+     * server, call {@link MUC#refreshDiscoInfo} instead.
+     * @private
+     * @returns {Promise}
+     */
+    private getDiscoInfoFeatures;
+    /**
+     * Given a <field> element, return a copy with a <value> child if
+     * we can find a value for it in this rooms config.
+     * @private
+     * @method MUC#addFieldValue
+     * @param {Element} field
+     * @returns {Element}
+     */
+    private addFieldValue;
+    /**
+     * Automatically configure the groupchat based on this model's
+     * 'roomconfig' data.
+     * @private
+     * @method MUC#autoConfigureChatRoom
+     * @returns {Promise<Element>}
+     * Returns a promise which resolves once a response IQ has
+     * been received.
+     */
+    private autoConfigureChatRoom;
+    /**
+     * Send an IQ stanza to fetch the groupchat configuration data.
+     * Returns a promise which resolves once the response IQ
+     * has been received.
+     * @private
+     * @method MUC#fetchRoomConfiguration
+     * @returns { Promise<Element> }
+     */
+    private fetchRoomConfiguration;
+    /**
+     * Sends an IQ stanza with the groupchat configuration.
+     * @private
+     * @method MUC#sendConfiguration
+     * @param { Array } config - The groupchat configuration
+     * @returns { Promise<Element> } - A promise which resolves with
+     * the `result` stanza received from the XMPP server.
+     */
+    private sendConfiguration;
+    onCommandError(err: any): void;
+    getNickOrJIDFromCommandArgs(args: any): any;
+    validateRoleOrAffiliationChangeArgs(command: any, args: any): boolean;
+    getAllowedCommands(): string[];
+    verifyAffiliations(affiliations: any, occupant: any, show_error?: boolean): boolean;
+    verifyRoles(roles: any, occupant: any, show_error?: boolean): boolean;
+    /**
+     * Returns the `role` which the current user has in this MUC
+     * @private
+     * @method MUC#getOwnRole
+     * @returns { ('none'|'visitor'|'participant'|'moderator') }
+     */
+    private getOwnRole;
+    /**
+     * Returns the `affiliation` which the current user has in this MUC
+     * @private
+     * @method MUC#getOwnAffiliation
+     * @returns { ('none'|'outcast'|'member'|'admin'|'owner') }
+     */
+    private getOwnAffiliation;
+    /**
+     * Get the {@link ChatRoomOccupant} instance which
+     * represents the current user.
+     * @method MUC#getOwnOccupant
+     * @returns {ChatRoomOccupant}
+     */
+    getOwnOccupant(): ChatRoomOccupant;
+    /**
+     * Send a presence stanza to update the user's nickname in this MUC.
+     * @param { String } nick
+     */
+    setNickname(nick: string): Promise<void>;
+    /**
+     * Send an IQ stanza to modify an occupant's role
+     * @method MUC#setRole
+     * @param {ChatRoomOccupant} occupant
+     * @param {string} role
+     * @param {string} reason
+     * @param {function} onSuccess - callback for a succesful response
+     * @param {function} onError - callback for an error response
+     */
+    setRole(occupant: ChatRoomOccupant, role: string, reason: string, onSuccess: Function, onError: Function): any;
+    /**
+     * @method MUC#getOccupant
+     * @param {string} nickname_or_jid - The nickname or JID of the occupant to be returned
+     * @returns {ChatRoomOccupant}
+     */
+    getOccupant(nickname_or_jid: string): ChatRoomOccupant;
+    /**
+     * Return an array of occupant models that have the required role
+     * @method MUC#getOccupantsWithRole
+     * @param {string} role
+     * @returns {{jid: string, nick: string, role: string}[]}
+     */
+    getOccupantsWithRole(role: string): {
+        jid: string;
+        nick: string;
+        role: string;
+    }[];
+    /**
+     * Return an array of occupant models that have the required affiliation
+     * @method MUC#getOccupantsWithAffiliation
+     * @param {string} affiliation
+     * @returns {{jid: string, nick: string, affiliation: string}[]}
+     */
+    getOccupantsWithAffiliation(affiliation: string): {
+        jid: string;
+        nick: string;
+        affiliation: string;
+    }[];
+    /**
+     * Return an array of occupant models, sorted according to the passed-in attribute.
+     * @private
+     * @method MUC#getOccupantsSortedBy
+     * @param {string} attr - The attribute to sort the returned array by
+     * @returns {ChatRoomOccupant[]}
+     */
+    private getOccupantsSortedBy;
+    /**
+     * Fetch the lists of users with the given affiliations.
+     * Then compute the delta between those users and
+     * the passed in members, and if it exists, send the delta
+     * to the XMPP server to update the member list.
+     * @private
+     * @method MUC#updateMemberLists
+     * @param {object} members - Map of member jids and affiliations.
+     * @returns {Promise}
+     *  A promise which is resolved once the list has been
+     *  updated or once it's been established there's no need
+     *  to update the list.
+     */
+    private updateMemberLists;
+    /**
+     * Given a nick name, save it to the model state, otherwise, look
+     * for a server-side reserved nickname or default configured
+     * nickname and if found, persist that to the model state.
+     * @method MUC#getAndPersistNickname
+     * @param {string} nick
+     * @returns {Promise<string>} A promise which resolves with the nickname
+     */
+    getAndPersistNickname(nick: string): Promise<string>;
+    /**
+     * Use service-discovery to ask the XMPP server whether
+     * this user has a reserved nickname for this groupchat.
+     * If so, we'll use that, otherwise we render the nickname form.
+     * @private
+     * @method MUC#getReservedNick
+     * @returns { Promise<string> } A promise which resolves with the reserved nick or null
+     */
+    private getReservedNick;
+    /**
+     * Send an IQ stanza to the MUC to register this user's nickname.
+     * This sets the user's affiliation to 'member' (if they weren't affiliated
+     * before) and reserves the nickname for this user, thereby preventing other
+     * users from using it in this MUC.
+     * See https://xmpp.org/extensions/xep-0045.html#register
+     * @private
+     * @method MUC#registerNickname
+     */
+    private registerNickname;
+    /**
+     * Check whether we should unregister the user from this MUC, and if so,
+     * call { @link MUC#sendUnregistrationIQ }
+     * @method MUC#unregisterNickname
+     */
+    unregisterNickname(): Promise<void>;
+    /**
+     * Send an IQ stanza to the MUC to unregister this user's nickname.
+     * If the user had a 'member' affiliation, it'll be removed and their
+     * nickname will no longer be reserved and can instead be used (and
+     * registered) by other users.
+     * @method MUC#sendUnregistrationIQ
+     */
+    sendUnregistrationIQ(): any;
+    /**
+     * Given a presence stanza, update the occupant model based on its contents.
+     * @private
+     * @method MUC#updateOccupantsOnPresence
+     * @param { Element } pres - The presence stanza
+     */
+    private updateOccupantsOnPresence;
+    fetchFeaturesIfConfigurationChanged(stanza: any): void;
+    /**
+     * Given two JIDs, which can be either user JIDs or MUC occupant JIDs,
+     * determine whether they belong to the same user.
+     * @method MUC#isSameUser
+     * @param { String } jid1
+     * @param { String } jid2
+     * @returns { Boolean }
+     */
+    isSameUser(jid1: string, jid2: string): boolean;
+    isSubjectHidden(): Promise<any>;
+    toggleSubjectHiddenState(): Promise<void>;
+    /**
+     * Handle a possible subject change and return `true` if so.
+     * @private
+     * @method MUC#handleSubjectChange
+     * @param { object } attrs - Attributes representing a received
+     *  message, as returned by {@link parseMUCMessage}
+     */
+    private handleSubjectChange;
+    /**
+     * Set the subject for this {@link MUC}
+     * @private
+     * @method MUC#setSubject
+     * @param { String } value
+     */
+    private setSubject;
+    /**
+     * Is this a chat state notification that can be ignored,
+     * because it's old or because it's from us.
+     * @private
+     * @method MUC#ignorableCSN
+     * @param { Object } attrs - The message attributes
+     */
+    private ignorableCSN;
+    /**
+     * Determines whether the message is from ourselves by checking
+     * the `from` attribute. Doesn't check the `type` attribute.
+     * @method MUC#isOwnMessage
+     * @param {Object|Element|MUCMessage} msg
+     * @returns {boolean}
+     */
+    isOwnMessage(msg: any | Element | MUCMessage): boolean;
+    /**
+     * Send a MUC-0410 MUC Self-Ping stanza to room to determine
+     * whether we're still joined.
+     * @async
+     * @private
+     * @method MUC#isJoined
+     * @returns {Promise<boolean>}
+     */
+    private isJoined;
+    /**
+     * Sends a status update presence (i.e. based on the `<show>` element)
+     * @method MUC#sendStatusPresence
+     * @param { String } type
+     * @param { String } [status] - An optional status message
+     * @param { Element[]|Strophe.Builder[]|Element|Strophe.Builder } [child_nodes]
+     *  Nodes(s) to be added as child nodes of the `presence` XML element.
+     */
+    sendStatusPresence(type: string, status?: string, child_nodes?: Element[] | Strophe.Builder[] | Element | Strophe.Builder): Promise<void>;
+    /**
+     * Check whether we're still joined and re-join if not
+     * @method MUC#rejoinIfNecessary
+     */
+    rejoinIfNecessary(): Promise<boolean>;
+    /**
+     * Looks whether we already have a moderation message for this
+     * incoming message. If so, it's considered "dangling" because
+     * it probably hasn't been applied to anything yet, given that
+     * the relevant message is only coming in now.
+     * @private
+     * @method MUC#findDanglingModeration
+     * @param { object } attrs - Attributes representing a received
+     *  message, as returned by {@link parseMUCMessage}
+     * @returns {MUCMessage}
+     */
+    private findDanglingModeration;
+    /**
+     * Handles message moderation based on the passed in attributes.
+     * @private
+     * @method MUC#handleModeration
+     * @param {object} attrs - Attributes representing a received
+     *  message, as returned by {@link parseMUCMessage}
+     * @returns {Promise<boolean>} Returns `true` or `false` depending on
+     *  whether a message was moderated or not.
+     */
+    private handleModeration;
+    /**
+     * @param { String } actor - The nickname of the actor that caused the notification
+     * @param {String|Array<String>} states - The state or states representing the type of notificcation
+     */
+    removeNotification(actor: string, states: string | Array<string>): void;
+    /**
+     * Update the notifications model by adding the passed in nickname
+     * to the array of nicknames that all match a particular state.
+     *
+     * Removes the nickname from any other states it might be associated with.
+     *
+     * The state can be a XEP-0085 Chat State or a XEP-0045 join/leave
+     * state.
+     * @param { String } actor - The nickname of the actor that causes the notification
+     * @param { String } state - The state representing the type of notificcation
+     */
+    updateNotifications(actor: string, state: string): void;
+    handleMetadataFastening(attrs: any): boolean;
+    /**
+     * Given {@link MessageAttributes} look for XEP-0316 Room Notifications and create info
+     * messages for them.
+     * @param {MessageAttributes} attrs
+     */
+    handleMEPNotification(attrs: any): boolean;
+    /**
+     * Returns an already cached message (if it exists) based on the
+     * passed in attributes map.
+     * @method MUC#getDuplicateMessage
+     * @param {object} attrs - Attributes representing a received
+     *  message, as returned by {@link parseMUCMessage}
+     * @returns {MUCMessage}
+     */
+    getDuplicateMessage(attrs: object): MUCMessage;
+    /**
+     * Handler for all MUC messages sent to this groupchat. This method
+     * shouldn't be called directly, instead {@link MUC#queueMessage}
+     * should be called.
+     * @method MUC#onMessage
+     * @param {MessageAttributes} attrs - A promise which resolves to the message attributes.
+     */
+    onMessage(attrs: any): Promise<void>;
+    /**
+     * @param {Element} pres
+     */
+    handleModifyError(pres: Element): void;
+    /**
+     * Handle a presence stanza that disconnects the user from the MUC
+     * @param { Element } stanza
+     */
+    handleDisconnection(stanza: Element): void;
+    getActionInfoMessage(code: any, nick: any, actor: any): any;
+    createAffiliationChangeMessage(occupant: any): void;
+    createRoleChangeMessage(occupant: any, changed: any): void;
+    /**
+     * Create an info message based on a received MUC status code
+     * @private
+     * @method MUC#createInfoMessage
+     * @param { string } code - The MUC status code
+     * @param { Element } stanza - The original stanza that contains the code
+     * @param { Boolean } is_self - Whether this stanza refers to our own presence
+     */
+    private createInfoMessage;
+    /**
+     * Create info messages based on a received presence or message stanza
+     * @private
+     * @method MUC#createInfoMessages
+     * @param { Element } stanza
+     */
+    private createInfoMessages;
+    /**
+     * Set parameters regarding disconnection from this room. This helps to
+     * communicate to the user why they were disconnected.
+     * @param {string} message - The disconnection message, as received from (or
+     *  implied by) the server.
+     * @param {string} [reason] - The reason provided for the disconnection
+     * @param {string} [actor] - The person (if any) responsible for this disconnection
+     * @param {number} [status] - The status code (see `ROOMSTATUS`)
+     */
+    setDisconnectionState(message: string, reason?: string, actor?: string, status?: number): void;
+    /**
+     * @param {Element} presence
+     */
+    onNicknameClash(presence: Element): void;
+    /**
+     * Parses a <presence> stanza with type "error" and sets the proper
+     * `connection_status` value for this {@link MUC} as
+     * well as any additional output that can be shown to the user.
+     * @private
+     * @param { Element } stanza - The presence stanza
+     */
+    private onErrorPresence;
+    /**
+     * Listens for incoming presence stanzas from the service that hosts this MUC
+     * @private
+     * @method MUC#onPresenceFromMUCHost
+     * @param { Element } stanza - The presence stanza
+     */
+    private onPresenceFromMUCHost;
+    /**
+     * Handles incoming presence stanzas coming from the MUC
+     * @private
+     * @method MUC#onPresence
+     * @param { Element } stanza
+     */
+    private onPresence;
+    /**
+     * Handles a received presence relating to the current user.
+     *
+     * For locked groupchats (which are by definition "new"), the
+     * groupchat will either be auto-configured or created instantly
+     * (with default config) or a configuration groupchat will be
+     * rendered.
+     *
+     * If the groupchat is not locked, then the groupchat will be
+     * auto-configured only if applicable and if the current
+     * user is the groupchat's owner.
+     * @private
+     * @method MUC#onOwnPresence
+     * @param {Element} stanza - The stanza
+     */
+    private onOwnPresence;
+    /**
+     * Returns a boolean to indicate whether the current user
+     * was mentioned in a message.
+     * @method MUC#isUserMentioned
+     * @param {MUCMessage} message - The text message
+     */
+    isUserMentioned(message: MUCMessage): any;
+    incrementUnreadMsgsCounter(message: any): void;
+}
+import ChatBox from "../chat/model";
+declare class MUCSession extends Model {
+    defaults(): {
+        connection_status: number;
+    };
+}
+import { Model } from "@converse/skeletor";
+import { Strophe } from "strophe.js";
+//# sourceMappingURL=muc.d.ts.map

+ 21 - 0
src/headless/types/plugins/muc/occupant.d.ts

@@ -0,0 +1,21 @@
+export default ChatRoomOccupant;
+/**
+ * Represents a participant in a MUC
+ * @class
+ * @namespace _converse.ChatRoomOccupant
+ * @memberOf _converse
+ */
+declare class ChatRoomOccupant extends Model {
+    defaults(): {
+        hats: any[];
+        show: string;
+        states: any[];
+    };
+    save(key: any, val: any, options: any): any;
+    getDisplayName(): any;
+    isMember(): boolean;
+    isModerator(): boolean;
+    isSelf(): any;
+}
+import { Model } from "@converse/skeletor";
+//# sourceMappingURL=occupant.d.ts.map

+ 60 - 0
src/headless/types/plugins/muc/occupants.d.ts

@@ -0,0 +1,60 @@
+export default ChatRoomOccupants;
+export type MemberListItem = any;
+/**
+ * A list of {@link _converse.ChatRoomOccupant} instances, representing participants in a MUC.
+ * @class
+ * @namespace _converse.ChatRoomOccupants
+ * @memberOf _converse
+ */
+declare class ChatRoomOccupants extends Collection {
+    constructor(attrs: any, options: any);
+    chatroom: any;
+    get model(): typeof ChatRoomOccupant;
+    create(attrs: any, options: any): false | Model | import("@converse/skeletor/src/types/collection.js").Attributes | (Promise<any> & {
+        isResolved: boolean;
+        isPending: boolean;
+        isRejected: boolean;
+        resolve: Function;
+        reject: Function;
+    });
+    fetchMembers(): Promise<void>;
+    /**
+     * @typedef { Object} OccupantData
+     * @property { String } [jid]
+     * @property { String } [nick]
+     * @property { String } [occupant_id] - The XEP-0421 unique occupant id
+     */
+    /**
+     * Try to find an existing occupant based on the provided
+     * @link { OccupantData } object.
+     *
+     * Fetching the user by `occupant_id` is the quickest, O(1),
+     * since it's a dictionary lookup.
+     *
+     * Fetching by jid or nick is O(n), since it requires traversing an array.
+     *
+     * Lookup by occupant_id is done first, then jid, and then nick.
+     *
+     * @method _converse.ChatRoomOccupants#findOccupant
+     * @param { OccupantData } data
+     */
+    findOccupant(data: {
+        jid?: string;
+        nick?: string;
+        /**
+         * - The XEP-0421 unique occupant id
+         */
+        occupant_id?: string;
+    }): any;
+    /**
+     * Get the {@link ChatRoomOccupant} instance which
+     * represents the current user.
+     * @method _converse.ChatRoomOccupants#getOwnOccupant
+     * @returns {ChatRoomOccupant}
+     */
+    getOwnOccupant(): ChatRoomOccupant;
+}
+import { Collection } from "@converse/skeletor";
+import ChatRoomOccupant from "./occupant.js";
+import { Model } from "@converse/skeletor";
+//# sourceMappingURL=occupants.d.ts.map

+ 79 - 0
src/headless/types/plugins/muc/parsers.d.ts

@@ -0,0 +1,79 @@
+/**
+ * Parses a message stanza for XEP-0317 MEP notification data
+ * @param { Element } stanza - The message stanza
+ * @returns { Array } Returns an array of objects representing <activity> elements.
+ */
+export function getMEPActivities(stanza: Element): any[];
+/**
+ * Parses a passed in message stanza and returns an object of attributes.
+ * @param {Element} stanza - The message stanza
+ * @param {MUC} chatbox
+ * @returns {Promise<MUCMessageAttributes|Error>}
+ */
+export function parseMUCMessage(stanza: Element, chatbox: MUC): Promise<MUCMessageAttributes | Error>;
+/**
+ * Given an IQ stanza with a member list, create an array of objects containing
+ * known member data (e.g. jid, nick, role, affiliation).
+ *
+ * @typedef {Object} MemberListItem
+ * Either the JID or the nickname (or both) will be available.
+ * @property {string} affiliation
+ * @property {string} [role]
+ * @property {string} [jid]
+ * @property {string} [nick]
+ *
+ * @method muc_utils#parseMemberListIQ
+ * @returns { MemberListItem[] }
+ */
+export function parseMemberListIQ(iq: any): MemberListItem[];
+/**
+ * Parses a passed in MUC presence stanza and returns an object of attributes.
+ * @method parseMUCPresence
+ * @param {Element} stanza - The presence stanza
+ * @param {MUC} chatbox
+ * @returns {MUCPresenceAttributes}
+ */
+export function parseMUCPresence(stanza: Element, chatbox: MUC): {
+    show: string;
+    /**
+     * - An array of XEP-0317 hats
+     */
+    hats: {
+        title: string;
+        /**
+         * The object which {@link parseMUCPresence } returns
+         */
+        uri: string;
+    }[];
+    states: Array<string>;
+    /**
+     * - The sender JID (${muc_jid}/${nick})
+     */
+    from: string;
+    /**
+     * - The nickname of the sender
+     */
+    nick: string;
+    /**
+     * - The XEP-0421 occupant ID
+     */
+    occupant_id: string;
+    /**
+     * - The type of presence
+     */
+    type: string;
+    jid?: string;
+    is_me?: boolean;
+};
+/**
+ * Either the JID or the nickname (or both) will be available.
+ */
+export type MemberListItem = {
+    affiliation: string;
+    role?: string;
+    jid?: string;
+    nick?: string;
+};
+export type MUC = import('../muc/muc.js').default;
+export type MUCMessageAttributes = any;
+//# sourceMappingURL=parsers.d.ts.map

+ 47 - 0
src/headless/types/plugins/muc/utils.d.ts

@@ -0,0 +1,47 @@
+export function isChatRoom(model: any): boolean;
+export function shouldCreateGroupchatMessage(attrs: any): any;
+export function getAutoFetchedAffiliationLists(): any[];
+export function occupantsComparator(occupant1: any, occupant2: any): 1 | 0 | -1;
+/**
+ * Given an occupant model, see which roles may be assigned to that user.
+ * @param {Model} occupant
+ * @returns {typeof ROLES} - An array of assignable roles
+ */
+export function getAssignableRoles(occupant: Model): typeof ROLES;
+export function registerDirectInvitationHandler(): void;
+export function disconnectChatRooms(): any;
+export function onWindowStateChanged(): Promise<void>;
+/**
+ * @param {Event} [event]
+ */
+export function routeToRoom(event?: Event): Promise<void>;
+export function openChatRoom(jid: any, settings: any): Promise<any>;
+/**
+ * A direct MUC invitation to join a groupchat has been received
+ * See XEP-0249: Direct MUC invitations.
+ * @private
+ * @method _converse.ChatRoom#onDirectMUCInvitation
+ * @param { Element } message - The message stanza containing the invitation.
+ */
+export function onDirectMUCInvitation(message: Element): Promise<void>;
+export function getDefaultMUCNickname(): any;
+/**
+ * Determines info message visibility based on
+ * muc_show_info_messages configuration setting
+ * @param {*} code
+ * @memberOf _converse
+ */
+export function isInfoVisible(code: any): boolean;
+/**
+ * Automatically join groupchats, based on the
+ * "auto_join_rooms" configuration setting, which is an array
+ * of strings (groupchat JIDs) or objects (with groupchat JID and other settings).
+ */
+export function autoJoinRooms(): Promise<void>;
+export function onAddClientFeatures(): void;
+export function onBeforeTearDown(): void;
+export function onStatusInitialized(): void;
+export function onBeforeResourceBinding(): void;
+export type Model = import('@converse/skeletor').Model;
+import { ROLES } from "./constants.js";
+//# sourceMappingURL=utils.d.ts.map

+ 16 - 0
src/headless/types/plugins/ping/api.d.ts

@@ -0,0 +1,16 @@
+declare namespace _default {
+    /**
+     * Pings the entity represented by the passed in JID by sending an IQ stanza to it.
+     * @method api.ping
+     * @param {string} [jid] - The JID of the service to ping
+     *  If the ping is sent out to the user's bare JID and no response is received it will attempt to reconnect.
+     * @param {number} [timeout] - The amount of time in
+     *  milliseconds to wait for a response. The default is 10000;
+     * @returns {Promise<boolean|null>}
+     *  Whether the pinged entity responded with a non-error IQ stanza.
+     *  If we already know we're not connected, no ping is sent out and `null` is returned.
+     */
+    function ping(jid?: string, timeout?: number): Promise<boolean>;
+}
+export default _default;
+//# sourceMappingURL=api.d.ts.map

+ 2 - 0
src/headless/types/plugins/ping/index.d.ts

@@ -0,0 +1,2 @@
+export {};
+//# sourceMappingURL=index.d.ts.map

+ 8 - 0
src/headless/types/plugins/ping/utils.d.ts

@@ -0,0 +1,8 @@
+export function onWindowStateChanged(): void;
+export function setLastStanzaDate(date: any): void;
+export function registerPongHandler(): any;
+export function registerPingHandler(): void;
+export function registerHandlers(): void;
+export function unregisterIntervalHandler(): void;
+export function onEverySecond(): void;
+//# sourceMappingURL=utils.d.ts.map

+ 4 - 0
src/headless/types/plugins/pubsub.d.ts

@@ -0,0 +1,4 @@
+export namespace Strophe {
+    type Builder = any;
+}
+//# sourceMappingURL=pubsub.d.ts.map

+ 51 - 0
src/headless/types/plugins/roster/api.d.ts

@@ -0,0 +1,51 @@
+declare namespace _default {
+    namespace contacts {
+        /**
+         * This method is used to retrieve roster contacts.
+         *
+         * @method _converse.api.contacts.get
+         * @params {(string[]|string)} jid|jids The JID or JIDs of
+         *      the contacts to be returned.
+         * @returns {promise} Promise which resolves with the
+         *  _converse.RosterContact (or an array of them) representing the contact.
+         *
+         * @example
+         * // Fetch a single contact
+         * _converse.api.listen.on('rosterContactsFetched', function () {
+         *     const contact = await _converse.api.contacts.get('buddy@example.com')
+         *     // ...
+         * });
+         *
+         * @example
+         * // To get multiple contacts, pass in an array of JIDs:
+         * _converse.api.listen.on('rosterContactsFetched', function () {
+         *     const contacts = await _converse.api.contacts.get(
+         *         ['buddy1@example.com', 'buddy2@example.com']
+         *     )
+         *     // ...
+         * });
+         *
+         * @example
+         * // To return all contacts, simply call ``get`` without any parameters:
+         * _converse.api.listen.on('rosterContactsFetched', function () {
+         *     const contacts = await _converse.api.contacts.get();
+         *     // ...
+         * });
+         */
+        function get(jids: any): Promise<any>;
+        /**
+         * Add a contact.
+         *
+         * @method _converse.api.contacts.add
+         * @param { string } jid The JID of the contact to be added
+         * @param { string } [name] A custom name to show the user by in the roster
+         * @example
+         *     _converse.api.contacts.add('buddy@example.com')
+         * @example
+         *     _converse.api.contacts.add('buddy@example.com', 'Buddy')
+         */
+        function add(jid: string, name?: string): Promise<any>;
+    }
+}
+export default _default;
+//# sourceMappingURL=api.d.ts.map

+ 71 - 0
src/headless/types/plugins/roster/contact.d.ts

@@ -0,0 +1,71 @@
+export default RosterContact;
+declare class RosterContact extends Model {
+    defaults(): {
+        chat_state: any;
+        groups: any[];
+        image: string;
+        image_type: string;
+        num_unread: number;
+        status: any;
+    };
+    initialize(attributes: any): Promise<void>;
+    initialized: any;
+    setPresence(): void;
+    presence: any;
+    openChat(): void;
+    /**
+     * Return a string of tab-separated values that are to be used when
+     * matching against filter text.
+     *
+     * The goal is to be able to filter against the VCard fullname,
+     * roster nickname and JID.
+     * @returns { String } Lower-cased, tab-separated values
+     */
+    getFilterCriteria(): string;
+    getDisplayName(): any;
+    getFullname(): any;
+    /**
+     * Send a presence subscription request to this roster contact
+     * @method _converse.RosterContacts#subscribe
+     * @param { String } message - An optional message to explain the
+     *      reason for the subscription request.
+     */
+    subscribe(message: string): RosterContact;
+    /**
+     * Upon receiving the presence stanza of type "subscribed",
+     * the user SHOULD acknowledge receipt of that subscription
+     * state notification by sending a presence stanza of type
+     * "subscribe" to the contact
+     * @method _converse.RosterContacts#ackSubscribe
+     */
+    ackSubscribe(): void;
+    /**
+     * Upon receiving the presence stanza of type "unsubscribed",
+     * the user SHOULD acknowledge receipt of that subscription state
+     * notification by sending a presence stanza of type "unsubscribe"
+     * this step lets the user's server know that it MUST no longer
+     * send notification of the subscription state change to the user.
+     * @method _converse.RosterContacts#ackUnsubscribe
+     */
+    ackUnsubscribe(): void;
+    /**
+     * Unauthorize this contact's presence subscription
+     * @method _converse.RosterContacts#unauthorize
+     * @param { String } message - Optional message to send to the person being unauthorized
+     */
+    unauthorize(message: string): RosterContact;
+    /**
+     * Authorize presence subscription
+     * @method _converse.RosterContacts#authorize
+     * @param { String } message - Optional message to send to the person being authorized
+     */
+    authorize(message: string): RosterContact;
+    /**
+     * Instruct the XMPP server to remove this contact from our roster
+     * @method _converse.RosterContacts#removeFromRoster
+     * @returns { Promise }
+     */
+    removeFromRoster(): Promise<any>;
+}
+import { Model } from "@converse/skeletor";
+//# sourceMappingURL=contact.d.ts.map

+ 85 - 0
src/headless/types/plugins/roster/contacts.d.ts

@@ -0,0 +1,85 @@
+export default RosterContacts;
+declare class RosterContacts extends Collection {
+    constructor();
+    model: typeof RosterContact;
+    data: any;
+    state: Model;
+    onConnected(): void;
+    /**
+     * Register a handler for roster IQ "set" stanzas, which update
+     * roster contacts.
+     */
+    registerRosterHandler(): void;
+    /**
+     * Register a handler for RosterX message stanzas, which are
+     * used to suggest roster contacts to a user.
+     */
+    registerRosterXHandler(): void;
+    /**
+     * Fetches the roster contacts, first by trying the browser cache,
+     * and if that's empty, then by querying the XMPP server.
+     * @returns {promise} Promise which resolves once the contacts have been fetched.
+     */
+    fetchRosterContacts(): Promise<any>;
+    subscribeToSuggestedItems(msg: any): boolean;
+    isSelf(jid: any): any;
+    /**
+     * Add a roster contact and then once we have confirmation from
+     * the XMPP server we subscribe to that contact's presence updates.
+     * @method _converse.RosterContacts#addAndSubscribe
+     * @param { String } jid - The Jabber ID of the user being added and subscribed to.
+     * @param { String } name - The name of that user
+     * @param { Array<String> } groups - Any roster groups the user might belong to
+     * @param { String } message - An optional message to explain the reason for the subscription request.
+     * @param { Object } attributes - Any additional attributes to be stored on the user's model.
+     */
+    addAndSubscribe(jid: string, name: string, groups: Array<string>, message: string, attributes: any): Promise<void>;
+    /**
+     * Send an IQ stanza to the XMPP server to add a new roster contact.
+     * @method _converse.RosterContacts#sendContactAddIQ
+     * @param { String } jid - The Jabber ID of the user being added
+     * @param { String } name - The name of that user
+     * @param { Array<String> } groups - Any roster groups the user might belong to
+     */
+    sendContactAddIQ(jid: string, name: string, groups: Array<string>): any;
+    /**
+     * Adds a RosterContact instance to _converse.roster and
+     * registers the contact on the XMPP server.
+     * Returns a promise which is resolved once the XMPP server has responded.
+     * @method _converse.RosterContacts#addContactToRoster
+     * @param { String } jid - The Jabber ID of the user being added and subscribed to.
+     * @param { String } name - The name of that user
+     * @param { Array<String> } groups - Any roster groups the user might belong to
+     * @param { Object } attributes - Any additional attributes to be stored on the user's model.
+     */
+    addContactToRoster(jid: string, name: string, groups: Array<string>, attributes: any): Promise<any>;
+    subscribeBack(bare_jid: any, presence: any): Promise<void>;
+    /**
+     * Handle roster updates from the XMPP server.
+     * See: https://xmpp.org/rfcs/rfc6121.html#roster-syntax-actions-push
+     * @method _converse.RosterContacts#onRosterPush
+     * @param { Element } iq - The IQ stanza received from the XMPP server.
+     */
+    onRosterPush(iq: Element): void;
+    rosterVersioningSupported(): any;
+    /**
+     * Fetch the roster from the XMPP server
+     * @emits _converse#roster
+     * @returns {promise}
+     */
+    fetchFromServer(): Promise<any>;
+    /**
+     * Update or create RosterContact models based on the given `item` XML
+     * node received in the resulting IQ stanza from the server.
+     * @param { Element } item
+     */
+    updateContact(item: Element): any;
+    createRequestingContact(presence: any): void;
+    handleIncomingSubscription(presence: any): void;
+    handleOwnPresence(presence: any): void;
+    presenceHandler(presence: any): true | void;
+}
+import { Collection } from "@converse/skeletor";
+import RosterContact from "./contact.js";
+import { Model } from "@converse/skeletor";
+//# sourceMappingURL=contacts.d.ts.map

+ 4 - 0
src/headless/types/plugins/roster/filter.d.ts

@@ -0,0 +1,4 @@
+export class RosterFilter extends Model {
+}
+import { Model } from "@converse/skeletor";
+//# sourceMappingURL=filter.d.ts.map

+ 2 - 0
src/headless/types/plugins/roster/index.d.ts

@@ -0,0 +1,2 @@
+export {};
+//# sourceMappingURL=index.d.ts.map

+ 31 - 0
src/headless/types/plugins/roster/presence.d.ts

@@ -0,0 +1,31 @@
+export default Presence;
+declare class Presence extends Model {
+    defaults(): {
+        show: string;
+    };
+    resources: Resources;
+    onResourcesChanged(): void;
+    /**
+     * Return the resource with the highest priority.
+     * If multiple resources have the same priority, take the latest one.
+     * @private
+     */
+    private getHighestPriorityResource;
+    /**
+     * Adds a new resource and it's associated attributes as taken
+     * from the passed in presence stanza.
+     * Also updates the presence if the resource has higher priority (and is newer).
+     * @param { Element } presence: The presence stanza
+     */
+    addResource(presence: Element): void;
+    /**
+     * Remove the passed in resource from the resources map.
+     * Also redetermines the presence given that there's one less
+     * resource.
+     * @param { string } name: The resource name
+     */
+    removeResource(name: string): void;
+}
+import { Model } from "@converse/skeletor";
+import Resources from "./resources.js";
+//# sourceMappingURL=presence.d.ts.map

+ 8 - 0
src/headless/types/plugins/roster/presences.d.ts

@@ -0,0 +1,8 @@
+export default Presences;
+declare class Presences extends Collection {
+    constructor();
+    model: typeof Presence;
+}
+import { Collection } from "@converse/skeletor";
+import Presence from "./presence.js";
+//# sourceMappingURL=presences.d.ts.map

+ 5 - 0
src/headless/types/plugins/roster/resource.d.ts

@@ -0,0 +1,5 @@
+export default Resource;
+declare class Resource extends Model {
+}
+import { Model } from "@converse/skeletor";
+//# sourceMappingURL=resource.d.ts.map

+ 6 - 0
src/headless/types/plugins/roster/resources.d.ts

@@ -0,0 +1,6 @@
+export default Resources;
+declare class Resources extends Collection {
+    constructor();
+}
+import { Collection } from "@converse/skeletor";
+//# sourceMappingURL=resources.d.ts.map

+ 42 - 0
src/headless/types/plugins/roster/utils.d.ts

@@ -0,0 +1,42 @@
+export function unregisterPresenceHandler(): void;
+/**
+ * Roster specific event handler for the clearSession event
+ */
+export function onClearSession(): Promise<void>;
+/**
+ * Roster specific event handler for the presencesInitialized event
+ * @param { Boolean } reconnecting
+ */
+export function onPresencesInitialized(reconnecting: boolean): void;
+/**
+ * Roster specific event handler for the statusInitialized event
+ * @param { Boolean } reconnecting
+ */
+export function onStatusInitialized(reconnecting: boolean): Promise<void>;
+/**
+ * Roster specific event handler for the chatBoxesInitialized event
+ */
+export function onChatBoxesInitialized(): void;
+/**
+ * Roster specific handler for the rosterContactsFetched promise
+ */
+export function onRosterContactsFetched(): void;
+/**
+ * Reject or cancel another user's subscription to our presence updates.
+ * @function rejectPresenceSubscription
+ * @param { String } jid - The Jabber ID of the user whose subscription is being canceled
+ * @param { String } message - An optional message to the user
+ */
+export function rejectPresenceSubscription(jid: string, message: string): void;
+export function contactsComparator(contact1: any, contact2: any): 1 | 0 | -1;
+export function groupsComparator(a: any, b: any): 1 | 0 | -1;
+export function getGroupsAutoCompleteList(): any[];
+export function getJIDsAutoCompleteList(): any[];
+/**
+ * @param {string} query
+ */
+export function getNamesAutoCompleteList(query: string): Promise<{
+    label: any;
+    value: any;
+}[]>;
+//# sourceMappingURL=utils.d.ts.map

+ 2 - 0
src/headless/types/plugins/smacks/index.d.ts

@@ -0,0 +1,2 @@
+export {};
+//# sourceMappingURL=index.d.ts.map

+ 5 - 0
src/headless/types/plugins/smacks/utils.d.ts

@@ -0,0 +1,5 @@
+export function initSessionData(): void;
+export function sendEnableStanza(): Promise<void>;
+export function enableStreamManagement(): Promise<void>;
+export function onStanzaSent(stanza: any): void;
+//# sourceMappingURL=utils.d.ts.map

+ 41 - 0
src/headless/types/plugins/status/api.d.ts

@@ -0,0 +1,41 @@
+declare namespace _default {
+    namespace status {
+        /**
+         * Return the current user's availability status.
+         * @async
+         * @method _converse.api.user.status.get
+         * @example _converse.api.user.status.get();
+         */
+        function get(): Promise<any>;
+        /**
+         * The user's status can be set to one of the following values:
+         *
+         * @async
+         * @method _converse.api.user.status.set
+         * @param { string } value The user's chat status (e.g. 'away', 'dnd', 'offline', 'online', 'unavailable' or 'xa')
+         * @param { string } [message] A custom status message
+         *
+         * @example _converse.api.user.status.set('dnd');
+         * @example _converse.api.user.status.set('dnd', 'In a meeting');
+         */
+        function set(value: string, message?: string): Promise<void>;
+        namespace message {
+            /**
+             * @async
+             * @method _converse.api.user.status.message.get
+             * @returns { Promise<string> } The status message
+             * @example const message = _converse.api.user.status.message.get()
+             */
+            function get(): Promise<string>;
+            /**
+             * @async
+             * @method _converse.api.user.status.message.set
+             * @param { string } status The status message
+             * @example _converse.api.user.status.message.set('In a meeting');
+             */
+            function set(status: string): Promise<void>;
+        }
+    }
+}
+export default _default;
+//# sourceMappingURL=api.d.ts.map

+ 2 - 0
src/headless/types/plugins/status/index.d.ts

@@ -0,0 +1,2 @@
+export {};
+//# sourceMappingURL=index.d.ts.map

+ 16 - 0
src/headless/types/plugins/status/status.d.ts

@@ -0,0 +1,16 @@
+export default class XMPPStatus extends Model {
+    defaults(): {
+        status: any;
+    };
+    getDisplayName(): any;
+    getNickname(): any;
+    getFullname(): string;
+    /** Constructs a presence stanza
+     * @param { string } [type]
+     * @param { string } [to] - The JID to which this presence should be sent
+     * @param { string } [status_message]
+     */
+    constructPresence(type?: string, to?: string, status_message?: string): Promise<any>;
+}
+import { Model } from "@converse/skeletor";
+//# sourceMappingURL=status.d.ts.map

+ 22 - 0
src/headless/types/plugins/status/utils.d.ts

@@ -0,0 +1,22 @@
+export function initStatus(reconnecting: any): void;
+export function isIdle(): boolean;
+export function getIdleSeconds(): number;
+/**
+ * Resets counters and flags relating to CSI and auto_away/auto_xa
+ */
+export function onUserActivity(): void;
+export function onEverySecond(): void;
+/**
+ * Send out a Client State Indication (XEP-0352)
+ * @function sendCSI
+ * @param { String } stat - The user's chat status
+ */
+export function sendCSI(stat: string): void;
+/**
+ * Set an interval of one second and register a handler for it.
+ * Required for the auto_away, auto_xa and csi_waiting_time features.
+ */
+export function registerIntervalHandler(): void;
+export function tearDown(): void;
+export function addStatusToMUCJoinPresence(_: any, stanza: any): any;
+//# sourceMappingURL=utils.d.ts.map

+ 69 - 0
src/headless/types/plugins/vcard/api.d.ts

@@ -0,0 +1,69 @@
+declare namespace _default {
+    namespace vcard {
+        /**
+         * Enables setting new values for a VCard.
+         *
+         * Sends out an IQ stanza to set the user's VCard and if
+         * successful, it updates the {@link _converse.VCard}
+         * for the passed in JID.
+         *
+         * @method _converse.api.vcard.set
+         * @param {string} jid The JID for which the VCard should be set
+         * @param {object} data A map of VCard keys and values
+         * @example
+         * let jid = _converse.bare_jid;
+         * _converse.api.vcard.set( jid, {
+         *     'fn': 'John Doe',
+         *     'nickname': 'jdoe'
+         * }).then(() => {
+         *     // Succes
+         * }).catch((e) => {
+         *     // Failure, e is your error object
+         * }).
+         */
+        function set(jid: string, data: any): Promise<any>;
+        /**
+         * @method _converse.api.vcard.get
+         * @param {Model|string} model Either a `Model` instance, or a string JID.
+         *     If a `Model` instance is passed in, then it must have either a `jid`
+         *     attribute or a `muc_jid` attribute.
+         * @param {boolean} [force] A boolean indicating whether the vcard should be
+         *     fetched from the server even if it's been fetched before.
+         * @returns {promise} A Promise which resolves with the VCard data for a particular JID or for
+         *     a `Model` instance which represents an entity with a JID (such as a roster contact,
+         *     chat or chatroom occupant).
+         *
+         * @example
+         * const { api } = _converse;
+         * api.waitUntil('rosterContactsFetched').then(() => {
+         *     api.vcard.get('someone@example.org').then(
+         *         (vcard) => {
+         *             // Do something with the vcard...
+         *         }
+         *     );
+         * });
+         */
+        function get(model: string | import("@converse/skeletor").Model, force?: boolean): Promise<any>;
+        /**
+         * Fetches the VCard associated with a particular `Model` instance
+         * (by using its `jid` or `muc_jid` attribute) and then updates the model with the
+         * returned VCard data.
+         *
+         * @method _converse.api.vcard.update
+         * @param {Model} model A `Model` instance
+         * @param {boolean} [force] A boolean indicating whether the vcard should be
+         *     fetched again even if it's been fetched before.
+         * @returns {promise} A promise which resolves once the update has completed.
+         * @example
+         * const { api } = _converse;
+         * api.waitUntil('rosterContactsFetched').then(async () => {
+         *     const chatbox = await api.chats.get('someone@example.org');
+         *     api.vcard.update(chatbox);
+         * });
+         */
+        function update(model: import("@converse/skeletor").Model, force?: boolean): Promise<any>;
+    }
+}
+export default _default;
+export type Model = import('@converse/skeletor').Model;
+//# sourceMappingURL=api.d.ts.map

+ 2 - 0
src/headless/types/plugins/vcard/index.d.ts

@@ -0,0 +1,2 @@
+export {};
+//# sourceMappingURL=index.d.ts.map

+ 23 - 0
src/headless/types/plugins/vcard/utils.d.ts

@@ -0,0 +1,23 @@
+export function createStanza(type: any, jid: any, vcard_el: any): any;
+/**
+ * @param {ChatRoomOccupant} occupant
+ */
+export function onOccupantAvatarChanged(occupant: ChatRoomOccupant): void;
+/**
+ * @param {ModelWithContact} model
+ */
+export function setVCardOnModel(model: ModelWithContact): Promise<void>;
+export function setVCardOnOccupant(occupant: any): Promise<void>;
+export function setVCardOnMUCMessage(message: any): Promise<void>;
+export function initVCardCollection(): Promise<void>;
+export function clearVCardsSession(): void;
+export function getVCard(jid: any): Promise<{
+    image_hash: any;
+} | {
+    jid: any;
+    stanza: any;
+    vcard_error: string;
+}>;
+export type ChatRoomOccupant = import('../muc/occupant.js').default;
+export type ModelWithContact = import('../chat/model-with-contact.js').default;
+//# sourceMappingURL=utils.d.ts.map

+ 16 - 0
src/headless/types/plugins/vcard/vcard.d.ts

@@ -0,0 +1,16 @@
+export default VCard;
+/**
+ * Represents a VCard
+ * @namespace _converse.VCard
+ * @memberOf _converse
+ */
+declare class VCard extends Model {
+    defaults(): {
+        image: string;
+        image_type: string;
+    };
+    set(key: any, val: any, options: any, ...args: any[]): any;
+    getDisplayName(): any;
+}
+import { Model } from "@converse/skeletor";
+//# sourceMappingURL=vcard.d.ts.map

+ 8 - 0
src/headless/types/plugins/vcard/vcards.d.ts

@@ -0,0 +1,8 @@
+export default VCards;
+declare class VCards extends Collection {
+    constructor();
+    model: typeof VCard;
+}
+import { Collection } from "@converse/skeletor";
+import VCard from "./vcard";
+//# sourceMappingURL=vcards.d.ts.map

+ 85 - 0
src/headless/types/shared/_converse.d.ts

@@ -0,0 +1,85 @@
+export default _converse;
+export type Storage = any;
+declare const _converse: ConversePrivateGlobal;
+declare const ConversePrivateGlobal_base: (new (...args: any[]) => {
+    on(name: string, callback: (event: any, model: Model, collection: import("@converse/skeletor").Collection, options?: Record<string, any>) => any, context: any): any;
+    _events: any;
+    _listeners: {};
+    listenTo(obj: any, name: string, callback?: (event: any, model: Model, collection: import("@converse/skeletor").Collection, options?: Record<string, any>) => any): any;
+    _listeningTo: {};
+    _listenId: any;
+    off(name: string, callback: (event: any, model: Model, collection: import("@converse/skeletor").Collection, options?: Record<string, any>) => any, context?: any): any;
+    stopListening(obj?: any, name?: string, callback?: (event: any, model: Model, collection: import("@converse/skeletor").Collection, options?: Record<string, any>) => any): any;
+    once(name: string, callback: (event: any, model: Model, collection: import("@converse/skeletor").Collection, options?: Record<string, any>) => any, context: any): any;
+    listenToOnce(obj: any, name: string, callback?: (event: any, model: Model, collection: import("@converse/skeletor").Collection, options?: Record<string, any>) => any): any;
+    trigger(name: string, ...args: any[]): any;
+}) & ObjectConstructor;
+/**
+ * A private, closured namespace containing the private api (via {@link _converse.api})
+ * as well as private methods and internal data-structures.
+ * @global
+ * @namespace _converse
+ */
+declare class ConversePrivateGlobal extends ConversePrivateGlobal_base {
+    constructor();
+    initialize(): void;
+    VERSION_NAME: string;
+    strict_plugin_dependencies: boolean;
+    pluggable: any;
+    templates: {};
+    storage: {};
+    promises: {
+        initialized: any;
+    };
+    DEFAULT_IMAGE_TYPE: string;
+    DEFAULT_IMAGE: string;
+    NUM_PREKEYS: number;
+    TIMEOUTS: {
+        PAUSED: number;
+        INACTIVE: number;
+    };
+    api: any;
+    /**
+     * Namespace for storing translated strings.
+     */
+    labels: {};
+    /**
+     * Namespace for storing code that might be useful to 3rd party
+     * plugins. We want to make it possible for 3rd party plugins to have
+     * access to code (e.g. classes) from converse.js without having to add
+     * converse.js as a dependency.
+     */
+    exports: {};
+    /**
+     * Namespace for storing the state, as represented by instances of
+     * Models and Collections.
+     */
+    state: {};
+    initSession(): void;
+    session: Model;
+    /**
+     * Translate the given string based on the current locale.
+     * @method __
+     * @memberOf _converse
+     * @param {...String} args
+     */
+    __(...args: string[]): any;
+    /**
+     * A no-op method which is used to signal to gettext that the passed in string
+     * should be included in the pot translation file.
+     *
+     * In contrast to the double-underscore method, the triple underscore method
+     * doesn't actually translate the strings.
+     *
+     * One reason for this method might be because we're using strings we cannot
+     * send to the translation function because they require variable interpolation
+     * and we don't yet have the variables at scan time.
+     *
+     * @method ___
+     * @memberOf _converse
+     * @param {String} str
+     */
+    ___(str: string): string;
+}
+import { Model } from "@converse/skeletor";
+//# sourceMappingURL=_converse.d.ts.map

+ 10 - 0
src/headless/types/shared/actions.d.ts

@@ -0,0 +1,10 @@
+export function rejectMessage(stanza: any, text: any): void;
+/**
+ * Send out a XEP-0333 chat marker
+ * @param { String } to_jid
+ * @param { String } id - The id of the message being marked
+ * @param { String } type - The marker type
+ * @param { String } [msg_type]
+ */
+export function sendMarker(to_jid: string, id: string, type: string, msg_type?: string): void;
+//# sourceMappingURL=actions.d.ts.map

+ 49 - 0
src/headless/types/shared/api/events.d.ts

@@ -0,0 +1,49 @@
+declare namespace _default {
+    /**
+     * Lets you trigger events, which can be listened to via
+     * {@link _converse.api.listen.on} or {@link _converse.api.listen.once}
+     * (see [_converse.api.listen](http://localhost:8000/docs/html/api/-_converse.api.listen.html)).
+     *
+     * Some events also double as promises and can be waited on via {@link _converse.api.waitUntil}.
+     *
+     * @typedef {object} Options
+     * @property {boolean} [Options.synchronous] - Whether the event is synchronous or not.
+     *  When a synchronous event is fired, a promise will be returned
+     *  by {@link _converse.api.trigger} which resolves once all the
+     *  event handlers' promises have been resolved.
+     *
+     * @method _converse.api.trigger
+     * @param { string } name - The event name
+     */
+    function trigger(name: string, ...args: any[]): Promise<void>;
+    /**
+     * Triggers a hook which can be intercepted by registered listeners via
+     * {@link _converse.api.listen.on} or {@link _converse.api.listen.once}.
+     * (see [_converse.api.listen](http://localhost:8000/docs/html/api/-_converse.api.listen.html)).
+     * A hook is a special kind of event which allows you to intercept a data
+     * structure in order to modify it, before passing it back.
+     * @async
+     * @param { string } name - The hook name
+     * @param {...any} context - The context to which the hook applies (could be for example, a {@link _converse.ChatBox})).
+     * @param {...any} data - The data structure to be intercepted and modified by the hook listeners.
+     * @returns {Promise<any>} - A promise that resolves with the modified data structure.
+     */
+    function hook(name: string, context: any, data: any): Promise<any>;
+    namespace listen {
+        const once: any;
+        const on: any;
+        const not: any;
+        /**
+         * Subscribe to an incoming stanza
+         * Every a matched stanza is received, the callback method specified by
+         * `callback` will be called.
+         * @method _converse.api.listen.stanza
+         * @param { string } name The stanza's name
+         * @param { object } options Matching options (e.g. 'ns' for namespace, 'type' for stanza type, also 'id' and 'from');
+         * @param { function } handler The callback method to be called when the stanza appears
+         */
+        function stanza(name: string, options: any, handler: Function): void;
+    }
+}
+export default _default;
+//# sourceMappingURL=events.d.ts.map

+ 92 - 0
src/headless/types/shared/api/index.d.ts

@@ -0,0 +1,92 @@
+export default api;
+export { converse } from "./public.js";
+export type _converse = {
+    initialize(): void;
+    VERSION_NAME: string;
+    strict_plugin_dependencies: boolean;
+    pluggable: any;
+    templates: {};
+    storage: {};
+    promises: {
+        initialized: any;
+    };
+    DEFAULT_IMAGE_TYPE: string;
+    DEFAULT_IMAGE: string;
+    NUM_PREKEYS: number;
+    TIMEOUTS: {
+        PAUSED: number;
+        INACTIVE: number;
+    };
+    api: any;
+    labels: {};
+    exports: {};
+    state: {};
+    initSession(): void;
+    session: import("@converse/skeletor").Model;
+    __(...args: string[]): any;
+    ___(str: string): string;
+    on(name: string, callback: (event: any, model: import("@converse/skeletor").Model, collection: import("@converse/skeletor").Collection, options?: Record<string, any>) => any, context: any): any;
+    _events: any;
+    _listeners: {};
+    listenTo(obj: any, name: string, callback?: (event: any, model: import("@converse/skeletor").Model, collection: import("@converse/skeletor").Collection, options?: Record<string, any>) => any): any;
+    _listeningTo: {};
+    _listenId: any;
+    off(name: string, callback: (event: any, model: import("@converse/skeletor").Model, collection: import("@converse/skeletor").Collection, options?: Record<string, any>) => any, context?: any): any;
+    stopListening(obj?: any, name?: string, callback?: (event: any, model: import("@converse/skeletor").Model, collection: import("@converse/skeletor").Collection, options?: Record<string, any>) => any): any;
+    once(name: string, callback: (event: any, model: import("@converse/skeletor").Model, collection: import("@converse/skeletor").Collection, options?: Record<string, any>) => any, context: any): any;
+    listenToOnce(obj: any, name: string, callback?: (event: any, model: import("@converse/skeletor").Model, collection: import("@converse/skeletor").Collection, options?: Record<string, any>) => any): any;
+    trigger(name: string, ...args: any[]): any;
+    constructor: Function;
+    toString(): string;
+    toLocaleString(): string;
+    valueOf(): Object;
+    hasOwnProperty(v: PropertyKey): boolean;
+    isPrototypeOf(v: Object): boolean;
+    propertyIsEnumerable(v: PropertyKey): boolean;
+};
+export type APIEndpoint = any;
+/**
+ * :shared-api.APIEndpoint
+ */
+export type module = Record<string, Function>;
+/**
+ * ### The private API
+ *
+ * The private API methods are only accessible via the closured {@link _converse }
+ * object, which is only available to plugins.
+ *
+ * These methods are kept private (i.e. not global) because they may return
+ * sensitive data which should be kept off-limits to other 3rd-party scripts
+ * that might be running in the page.
+ */
+export type APINamespace = Record<string, APIEndpoint | Function>;
+/**
+ * ### The private API
+ *
+ * The private API methods are only accessible via the closured {@link _converse }
+ * object, which is only available to plugins.
+ *
+ * These methods are kept private (i.e. not global) because they may return
+ * sensitive data which should be kept off-limits to other 3rd-party scripts
+ * that might be running in the page.
+ */
+export type API = Record<string, APINamespace | APIEndpoint | Function>;
+/**
+ * ### The private API
+ *
+ * The private API methods are only accessible via the closured {@link _converse}
+ * object, which is only available to plugins.
+ *
+ * These methods are kept private (i.e. not global) because they may return
+ * sensitive data which should be kept off-limits to other 3rd-party scripts
+ * that might be running in the page.
+ *
+ * @memberOf _converse
+ * @namespace api
+ * @typedef {Record<string, Function>} module:shared-api.APIEndpoint
+ * @typedef {Record<string, APIEndpoint|Function>} APINamespace
+ * @typedef {Record<string, APINamespace|APIEndpoint|Function>} API
+ * @type {API}
+ */
+declare const api: API;
+//# sourceMappingURL=index.d.ts.map

+ 19 - 0
src/headless/types/shared/api/presence.d.ts

@@ -0,0 +1,19 @@
+declare namespace _default {
+    namespace presence {
+        /**
+         * Send out a presence stanza
+         * @method _converse.api.user.presence.send
+         * @param { String } [type]
+         * @param { String } [to]
+         * @param { String } [status] - An optional status message
+         * @param { Array<Element>|Array<Strophe.Builder>|Element|Strophe.Builder } [child_nodes]
+         *  Nodes(s) to be added as child nodes of the `presence` XML element.
+         */
+        function send(type?: string, to?: string, status?: string, child_nodes?: any): Promise<void>;
+    }
+}
+export default _default;
+export namespace Strophe {
+    type Builder = any;
+}
+//# sourceMappingURL=presence.d.ts.map

+ 33 - 0
src/headless/types/shared/api/promise.d.ts

@@ -0,0 +1,33 @@
+declare namespace _default {
+    namespace promises {
+        /**
+         * By calling `promises.add`, a new [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
+         * is made available for other code or plugins to depend on via the
+         * {@link _converse.api.waitUntil} method.
+         *
+         * Generally, it's the responsibility of the plugin which adds the promise to
+         * also resolve it.
+         *
+         * This is done by calling {@link _converse.api.trigger}, which not only resolves the
+         * promise, but also emits an event with the same name (which can be listened to
+         * via {@link _converse.api.listen}).
+         *
+         * @method _converse.api.promises.add
+         * @param {string|array} [promises] The name or an array of names for the promise(s) to be added
+         * @param {boolean} [replace=true] Whether this promise should be replaced with a new one when the user logs out.
+         * @example _converse.api.promises.add('foo-completed');
+         */
+        function add(promises?: string | any[], replace?: boolean): void;
+    }
+    /**
+     * Wait until a promise is resolved or until the passed in function returns
+     * a truthy value.
+     * @method _converse.api.waitUntil
+     * @param {string|function} condition - The name of the promise to wait for,
+     * or a function which should eventually return a truthy value.
+     * @returns {Promise}
+     */
+    function waitUntil(condition: string | Function): Promise<any>;
+}
+export default _default;
+//# sourceMappingURL=promise.d.ts.map

+ 31 - 0
src/headless/types/shared/api/public.d.ts

@@ -0,0 +1,31 @@
+/**
+ * @typedef {Window & {converse: ConversePrivateGlobal} } window
+ *
+ * ### The Public API
+ *
+ * This namespace contains public API methods which are are
+ * accessible on the global `converse` object.
+ * They are public, because any JavaScript in the
+ * page can call them. Public methods therefore don’t expose any sensitive
+ * or closured data. To do that, you’ll need to create a plugin, which has
+ * access to the private API method.
+ *
+ * @global
+ * @namespace converse
+ */
+export const converse: any;
+export type ConversePrivateGlobal = any;
+/**
+ * ### The Public API
+ *
+ * This namespace contains public API methods which are are
+ * accessible on the global `converse` object.
+ * They are public, because any JavaScript in the
+ * page can call them. Public methods therefore don’t expose any sensitive
+ * or closured data. To do that, you’ll need to create a plugin, which has
+ * access to the private API method.
+ */
+export type window = Window & {
+    converse: ConversePrivateGlobal;
+};
+//# sourceMappingURL=public.d.ts.map

+ 35 - 0
src/headless/types/shared/api/send.d.ts

@@ -0,0 +1,35 @@
+declare namespace _default {
+    /**
+     * Allows you to send XML stanzas.
+     * @method _converse.api.send
+     * @param {Element|Strophe.Builder} stanza
+     * @return {void}
+     * @example
+     * const msg = converse.env.$msg({
+     *     'from': 'juliet@example.com/balcony',
+     *     'to': 'romeo@example.net',
+     *     'type':'chat'
+     * });
+     * _converse.api.send(msg);
+     */
+    function send(stanza: any): void;
+    /**
+     * Send an IQ stanza
+     * @method _converse.api.sendIQ
+     * @param {Element|Strophe.Builder} stanza
+     * @param {number} [timeout] - The default timeout value is taken from
+     *  the `stanza_timeout` configuration setting.
+     * @param {boolean} [reject=true] - Whether an error IQ should cause the promise
+     *  to be rejected. If `false`, the promise will resolve instead of being rejected.
+     * @returns {Promise} A promise which resolves (or potentially rejected) once we
+     *  receive a `result` or `error` stanza or once a timeout is reached.
+     *  If the IQ stanza being sent is of type `result` or `error`, there's
+     *  nothing to wait for, so an already resolved promise is returned.
+     */
+    function sendIQ(stanza: any, timeout?: number, reject?: boolean): Promise<any>;
+}
+export default _default;
+export namespace Strophe {
+    type Builder = any;
+}
+//# sourceMappingURL=send.d.ts.map

+ 45 - 0
src/headless/types/shared/api/user.d.ts

@@ -0,0 +1,45 @@
+export default api;
+declare namespace api {
+    const user: {
+        /**
+         * @method _converse.api.user.jid
+         * @returns {string} The current user's full JID (Jabber ID)
+         * @example _converse.api.user.jid())
+         */
+        jid(): string;
+        /**
+         * Logs the user in.
+         *
+         * If called without any parameters, Converse will try
+         * to log the user in by calling the `prebind_url` or `credentials_url` depending
+         * on whether prebinding is used or not.
+         *
+         * @method _converse.api.user.login
+         * @param { string } [jid]
+         * @param { string } [password]
+         * @param { boolean } [automatic=false] - An internally used flag that indicates whether
+         *  this method was called automatically once the connection has been
+         *  initialized. It's used together with the `auto_login` configuration flag
+         *  to determine whether Converse should try to log the user in if it
+         *  fails to restore a previous auth'd session.
+         *  @returns  { Promise<void> }
+         */
+        login(jid?: string, password?: string, automatic?: boolean): Promise<void>;
+        /**
+         * Logs the user out of the current XMPP session.
+         * @method _converse.api.user.logout
+         * @example _converse.api.user.logout();
+         */
+        logout(): Promise<any>;
+        presence: {
+            send(type?: string, to?: string, status?: string, child_nodes?: any): Promise<void>;
+        };
+        settings: {
+            getModel(): Promise<import("@converse/skeletor").Model>;
+            get(key: string, fallback?: any): Promise<any>;
+            set(key: any, val?: string): Promise<any>;
+            clear(): Promise<any>;
+        };
+    };
+}
+//# sourceMappingURL=user.d.ts.map

+ 31 - 0
src/headless/types/shared/chat/utils.d.ts

@@ -0,0 +1,31 @@
+/**
+ * @param {ChatBox|MUC} model
+ */
+export function pruneHistory(model: ChatBox | MUC): void;
+/**
+ * Given an array of {@link MediaURLMetadata} objects and text, return an
+ * array of {@link MediaURL} objects.
+ * @param {Array<MediaURLMetadata>} arr
+ * @param {String} text
+ * @returns{Array<MediaURLData>}
+ */
+export function getMediaURLs(arr: Array<MediaURLMetadata>, text: string, offset?: number): Array<MediaURLData>;
+/**
+ * Determines whether the given attributes of an incoming message
+ * represent a XEP-0308 correction and, if so, handles it appropriately.
+ * @private
+ * @method ChatBox#handleCorrection
+ * @param {ChatBox|MUC} model
+ * @param {object} attrs - Attributes representing a received
+ *  message, as returned by {@link parseMessage}
+ * @returns {Promise<Message|void>} Returns the corrected
+ *  message or `undefined` if not applicable.
+ */
+export function handleCorrection(model: ChatBox | MUC, attrs: object): Promise<Message | void>;
+export const debouncedPruneHistory: any;
+export type MUC = import('../../plugins/muc/muc.js').default;
+export type ChatBox = import('../../plugins/chat/model.js').default;
+export type Message = import('../../plugins/chat/message.js').default;
+export type MediaURLMetadata = any;
+export type MediaURLData = any;
+//# sourceMappingURL=utils.d.ts.map

+ 51 - 0
src/headless/types/shared/connection/api.d.ts

@@ -0,0 +1,51 @@
+declare namespace _default {
+    /**
+     * @method api.connection.init
+     * @memberOf api.connection
+     * @param {string} [jid]
+     * @return {Connection|MockConnection}
+     */
+    function init(jid?: string): Connection | MockConnection;
+    function get(): any;
+    function destroy(): void;
+    /**
+     * @method api.connection.authenticated
+     * @memberOf api.connection
+     * @returns {boolean} Whether we're authenticated to the XMPP server or not
+     */
+    function authenticated(): boolean;
+    /**
+     * @method api.connection.connected
+     * @memberOf api.connection
+     * @returns {boolean} Whether there is an established connection or not.
+     */
+    function connected(): boolean;
+    /**
+     * Terminates the connection.
+     *
+     * @method api.connection.disconnect
+     * @memberOf api.connection
+     */
+    function disconnect(): void;
+    /**
+     * Can be called once the XMPP connection has dropped and we want
+     * to attempt reconnection.
+     * Only needs to be called once, if reconnect fails Converse will
+     * attempt to reconnect every two seconds, alternating between BOSH and
+     * Websocket if URLs for both were provided.
+     * @method reconnect
+     * @memberOf api.connection
+     */
+    function reconnect(): any;
+    /**
+     * Utility method to determine the type of connection we have
+     * @method isType
+     * @memberOf api.connection
+     * @returns {boolean}
+     */
+    function isType(type: any): boolean;
+}
+export default _default;
+import { Connection } from "./index.js";
+import { MockConnection } from "./index.js";
+//# sourceMappingURL=api.d.ts.map

+ 9 - 0
src/headless/types/shared/connection/feedback.d.ts

@@ -0,0 +1,9 @@
+export default Feedback;
+declare class Feedback extends Model {
+    defaults(): {
+        connection_status: number;
+        message: string;
+    };
+}
+import { Model } from "@converse/skeletor";
+//# sourceMappingURL=feedback.d.ts.map

+ 114 - 0
src/headless/types/shared/connection/index.d.ts

@@ -0,0 +1,114 @@
+declare const Connection_base: typeof import("strophe.js/src/types/connection.js").default;
+/**
+ * The Connection class manages the connection to the XMPP server. It's
+ * agnostic concerning the underlying protocol (i.e. websocket, long-polling
+ * via BOSH or websocket inside a shared worker).
+ */
+export class Connection extends Connection_base {
+    static generateResource(): string;
+    constructor(service: any, options: any);
+    send_initial_presence: boolean;
+    debouncedReconnect: any;
+    bind(): Promise<void>;
+    onDomainDiscovered(response: any): Promise<void>;
+    /**
+     * Adds support for XEP-0156 by quering the XMPP server for alternate
+     * connection methods. This allows users to use the websocket or BOSH
+     * connection of their own XMPP server instead of a proxy provided by the
+     * host of Converse.js.
+     * @method Connnection.discoverConnectionMethods
+     * @param {string} domain
+     */
+    discoverConnectionMethods(domain: string): Promise<void>;
+    /**
+     * Establish a new XMPP session by logging in with the supplied JID and
+     * password.
+     * @method Connnection.connect
+     * @param {String} jid
+     * @param {String} password
+     * @param {Function} callback
+     */
+    connect(jid: string, password: string, callback: Function): Promise<void>;
+    /**
+     * @param {string} reason
+     */
+    disconnect(reason: string): void;
+    /**
+     * Switch to a different transport if a service URL is available for it.
+     *
+     * When reconnecting with a new transport, we call setUserJID
+     * so that a new resource is generated, to avoid multiple
+     * server-side sessions with the same resource.
+     *
+     * We also call `_proto._doDisconnect` so that connection event handlers
+     * for the old transport are removed.
+     */
+    switchTransport(): Promise<void>;
+    _proto: any;
+    reconnect(): Promise<any>;
+    reconnecting: boolean;
+    /**
+     * Called as soon as a new connection has been established, either
+     * by logging in or by attaching to an existing BOSH session.
+     * @method Connection.onConnected
+     * @param {Boolean} [reconnecting] - Whether Converse.js reconnected from an earlier dropped session.
+     */
+    onConnected(reconnecting?: boolean): Promise<void>;
+    /**
+     * Used to keep track of why we got disconnected, so that we can
+     * decide on what the next appropriate action is (in onDisconnected)
+     * @method Connection.setDisconnectionCause
+     * @param {Number|'logout'} [cause] - The status number as received from Strophe.
+     * @param {String} [reason] - An optional user-facing message as to why
+     *  there was a disconnection.
+     * @param {Boolean} [override] - An optional flag to replace any previous
+     *  disconnection cause and reason.
+     */
+    setDisconnectionCause(cause?: number | 'logout', reason?: string, override?: boolean): void;
+    disconnection_cause: number | "logout";
+    disconnection_reason: string;
+    /**
+     * @param {Number} [status] - The status number as received from Strophe.
+     * @param {String} [message] - An optional user-facing message
+     */
+    setConnectionStatus(status?: number, message?: string): void;
+    status: number;
+    finishDisconnection(): Promise<void>;
+    /**
+     * Gets called once strophe's status reaches Strophe.Status.DISCONNECTED.
+     * Will either start a teardown process for converse.js or attempt
+     * to reconnect.
+     * @method onDisconnected
+     */
+    onDisconnected(): any;
+    /**
+     * Callback method called by Strophe as the Connection goes
+     * through various states while establishing or tearing down a
+     * connection.
+     * @param {Number} status
+     * @param {String} message
+     */
+    onConnectStatusChanged(status: number, message: string): void;
+    /**
+     * @param {string} type
+     */
+    isType(type: string): boolean;
+    hasResumed(): boolean;
+    restoreWorkerSession(): any;
+    worker_attach_promise: any;
+}
+/**
+ * The MockConnection class is used during testing, to mock an XMPP connection.
+ * @class
+ */
+export class MockConnection extends Connection {
+    sent_stanzas: any[];
+    IQ_stanzas: any[];
+    IQ_ids: any[];
+    mock: boolean;
+    _processRequest(): void;
+    sendIQ(iq: any, callback: any, errback: any): string;
+    send(stanza: any): void;
+}
+export {};
+//# sourceMappingURL=index.d.ts.map

+ 3 - 0
src/headless/types/shared/connection/utils.d.ts

@@ -0,0 +1,3 @@
+export function setUpXMLLogging(connection: any): void;
+export function getConnectionServiceURL(): any;
+//# sourceMappingURL=utils.d.ts.map

+ 54 - 0
src/headless/types/shared/constants.d.ts

@@ -0,0 +1,54 @@
+export const BOSH_WAIT: 59;
+export const VERSION_NAME: "v10.1.5";
+export namespace STATUS_WEIGHTS {
+    const offline: number;
+    const unavailable: number;
+    const xa: number;
+    const away: number;
+    const dnd: number;
+    const chat: number;
+    const online: number;
+}
+export const ANONYMOUS: "anonymous";
+export const CLOSED: "closed";
+export const EXTERNAL: "external";
+export const LOGIN: "login";
+export const LOGOUT: "logout";
+export const OPENED: "opened";
+export const PREBIND: "prebind";
+export const SUCCESS: "success";
+export const FAILURE: "failure";
+export const DEFAULT_IMAGE_TYPE: "image/svg+xml";
+export const DEFAULT_IMAGE: "PD94bWwgdmVyc2lvbj0iMS4wIj8+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCI+CiA8cmVjdCB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgZmlsbD0iIzU1NSIvPgogPGNpcmNsZSBjeD0iNjQiIGN5PSI0MSIgcj0iMjQiIGZpbGw9IiNmZmYiLz4KIDxwYXRoIGQ9Im0yOC41IDExMiB2LTEyIGMwLTEyIDEwLTI0IDI0LTI0IGgyMyBjMTQgMCAyNCAxMiAyNCAyNCB2MTIiIGZpbGw9IiNmZmYiLz4KPC9zdmc+Cg==";
+export const INACTIVE: "inactive";
+export const ACTIVE: "active";
+export const COMPOSING: "composing";
+export const PAUSED: "paused";
+export const GONE: "gone";
+export const PRIVATE_CHAT_TYPE: "chatbox";
+export const CHATROOMS_TYPE: "chatroom";
+export const HEADLINES_TYPE: "headline";
+export const CONTROLBOX_TYPE: "controlbox";
+export const CONNECTION_STATUS: typeof CONNECTION_STATUS;
+export const CORE_PLUGINS: string[];
+export namespace URL_PARSE_OPTIONS {
+    const start: RegExp;
+}
+export const CHAT_STATES: string[];
+export namespace KEYCODES {
+    const TAB: number;
+    const ENTER: number;
+    const SHIFT: number;
+    const CTRL: number;
+    const ALT: number;
+    const ESCAPE: number;
+    const LEFT_ARROW: number;
+    const UP_ARROW: number;
+    const RIGHT_ARROW: number;
+    const DOWN_ARROW: number;
+    const FORWARD_SLASH: number;
+    const AT: number;
+    const META: number;
+    const META_RIGHT: number;
+}
+//# sourceMappingURL=constants.d.ts.map

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff