2019-07-11 10:48:52 +02:00
|
|
|
/**
|
2020-01-26 16:21:20 +01:00
|
|
|
* @copyright The Converse.js contributors
|
2019-09-19 16:54:55 +02:00
|
|
|
* @license Mozilla Public License (MPLv2)
|
2019-07-11 10:48:52 +02:00
|
|
|
*/
|
2023-02-26 16:46:31 +01:00
|
|
|
import './shared/constants.js';
|
2022-12-28 21:36:40 +01:00
|
|
|
import _converse from './shared/_converse';
|
2019-05-21 16:18:14 +02:00
|
|
|
import advancedFormat from 'dayjs/plugin/advancedFormat';
|
2022-12-28 21:36:40 +01:00
|
|
|
import connection_api from './shared/connection/api.js';
|
2019-06-05 06:57:20 +02:00
|
|
|
import dayjs from 'dayjs';
|
2022-12-28 21:36:40 +01:00
|
|
|
import i18n from './shared/i18n';
|
2023-02-26 10:39:57 +01:00
|
|
|
import { settings_api } from './shared/settings/api.js';
|
|
|
|
import send_api from './shared/api/send.js';
|
|
|
|
import user_api from './shared/api/user.js';
|
|
|
|
import events_api from './shared/api/events.js';
|
|
|
|
import promise_api from './shared/api/promise.js';
|
2018-10-23 03:41:38 +02:00
|
|
|
|
2023-02-26 16:23:42 +01:00
|
|
|
export { converse } from './shared/api/public.js';
|
2021-03-09 12:55:44 +01:00
|
|
|
export { _converse };
|
|
|
|
export { i18n };
|
2019-05-29 17:40:16 +02:00
|
|
|
|
2019-05-21 16:18:14 +02:00
|
|
|
dayjs.extend(advancedFormat);
|
2019-05-06 11:16:56 +02:00
|
|
|
|
2020-03-31 12:51:30 +02:00
|
|
|
/**
|
|
|
|
* ### 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.
|
|
|
|
*
|
|
|
|
* @namespace _converse.api
|
|
|
|
* @memberOf _converse
|
|
|
|
*/
|
2020-04-15 13:59:55 +02:00
|
|
|
export const api = _converse.api = {
|
2022-04-25 09:47:11 +02:00
|
|
|
connection: connection_api,
|
|
|
|
settings: settings_api,
|
2023-02-26 10:39:57 +01:00
|
|
|
...send_api,
|
|
|
|
...user_api,
|
|
|
|
...events_api,
|
|
|
|
...promise_api,
|
2020-03-31 12:51:30 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2020-10-20 06:45:35 +02:00
|
|
|
_converse.shouldClearCache = () => (
|
|
|
|
!_converse.config.get('trusted') ||
|
|
|
|
api.settings.get('clear_cache_on_logout') ||
|
|
|
|
_converse.isTestEnv()
|
|
|
|
);
|