@messenger-box/platform-client 10.0.3-alpha.17 → 10.0.3-alpha.171
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/graphql/fragments/post-message.gql +36 -0
- package/lib/graphql/id-generation.js.map +1 -1
- package/lib/graphql/index.js.map +1 -1
- package/lib/graphql/mutations/channel-mutation.gql +5 -0
- package/lib/graphql/mutations/messages-mutation.gql +3 -0
- package/lib/graphql/policies/channel-policies.d.ts.map +1 -1
- package/lib/graphql/policies/channel-policies.js +150 -2
- package/lib/graphql/policies/channel-policies.js.map +1 -1
- package/lib/graphql/policies/messages-policies.d.ts.map +1 -1
- package/lib/graphql/policies/messages-policies.js +229 -37
- package/lib/graphql/policies/messages-policies.js.map +1 -1
- package/lib/graphql/policies/post-thread-policies.d.ts.map +1 -1
- package/lib/graphql/policies/post-thread-policies.js +136 -31
- package/lib/graphql/policies/post-thread-policies.js.map +1 -1
- package/lib/graphql/policies/posts-policies.js.map +1 -1
- package/lib/graphql/policies/teams-policies.d.ts.map +1 -1
- package/lib/graphql/policies/teams-policies.js +13 -1
- package/lib/graphql/policies/teams-policies.js.map +1 -1
- package/lib/graphql/policies/user-account-policies.js.map +1 -1
- package/lib/graphql/policies/user-policies.js.map +1 -1
- package/lib/graphql/queries/channels-by-user.gql +26 -0
- package/lib/graphql/queries/messages.gql +2 -2
- package/lib/graphql/queries/organization-query.gql +70 -35
- package/lib/graphql/queries/post-thread-message.gql +4 -0
- package/lib/graphql/queries/teams-query.gql +29 -29
- package/lib/graphql/queries/user-account.gql +1 -1
- package/lib/graphql/queries/users.gql +1 -1
- package/lib/graphql/schema/index.js.map +1 -1
- package/lib/graphql/subscription/fileUpdated.gql +11 -0
- package/lib/hooks/use-base-file-upload.hook.d.ts.map +1 -1
- package/lib/hooks/use-upload-file.hook.d.ts +1 -1
- package/lib/hooks/use-upload-file.hook.d.ts.map +1 -1
- package/lib/hooks/use-upload-file.hook.js +1 -1
- package/lib/hooks/use-upload-file.hook.js.map +1 -1
- package/lib/hooks/use-upload-file.hook.native.d.ts +1 -1
- package/lib/hooks/use-upload-file.hook.native.d.ts.map +1 -1
- package/lib/hooks/use-upload-file.hook.native.js +1 -1
- package/lib/hooks/use-upload-file.hook.native.js.map +1 -1
- package/lib/hooks/use-upload-files.hook.d.ts +1 -1
- package/lib/hooks/use-upload-files.hook.d.ts.map +1 -1
- package/lib/hooks/use-upload-files.hook.js +1 -1
- package/lib/hooks/use-upload-files.hook.js.map +1 -1
- package/lib/hooks/use-upload-files.hook.native.d.ts +1 -1
- package/lib/hooks/use-upload-files.hook.native.d.ts.map +1 -1
- package/lib/hooks/use-upload-files.hook.native.js +1 -1
- package/lib/hooks/use-upload-files.hook.native.js.map +1 -1
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/package.json +4 -4
- package/CHANGELOG.md +0 -141
- package/jest.config.js +0 -25
- package/rollup.config.mjs +0 -36
- package/src/graphql/fragments/configuration.gql +0 -12
- package/src/graphql/fragments/extended-user-account.gql +0 -10
- package/src/graphql/fragments/file-info.gql +0 -12
- package/src/graphql/fragments/messenger-user.gql +0 -15
- package/src/graphql/fragments/minimal-user.gql +0 -9
- package/src/graphql/fragments/post-message.gql +0 -116
- package/src/graphql/fragments/post-thread-message.gql +0 -77
- package/src/graphql/fragments/user.gql +0 -11
- package/src/graphql/id-generation.ts +0 -8
- package/src/graphql/index.ts +0 -24
- package/src/graphql/mutations/channel-mutation.gql +0 -72
- package/src/graphql/mutations/expo-notification-token.gql +0 -13
- package/src/graphql/mutations/message-threads-mutation.gql +0 -44
- package/src/graphql/mutations/messages-mutation.gql +0 -110
- package/src/graphql/mutations/messages-mutation.gql.bk +0 -66
- package/src/graphql/mutations/organization-mutation.gql.bk +0 -14
- package/src/graphql/mutations/teams-mutation.gql.bk +0 -8
- package/src/graphql/policies/channel-policies.ts +0 -7
- package/src/graphql/policies/index.ts +0 -7
- package/src/graphql/policies/messages-policies.ts +0 -109
- package/src/graphql/policies/post-thread-policies.ts +0 -59
- package/src/graphql/policies/posts-policies.ts +0 -110
- package/src/graphql/policies/teams-policies.ts +0 -7
- package/src/graphql/policies/user-account-policies.ts +0 -15
- package/src/graphql/policies/user-policies.ts +0 -32
- package/src/graphql/queries/channel.gql +0 -57
- package/src/graphql/queries/channels-by-user.gql +0 -60
- package/src/graphql/queries/check-for-new-messages.gql +0 -5
- package/src/graphql/queries/file-url.gql +0 -5
- package/src/graphql/queries/get-device-token.gql +0 -8
- package/src/graphql/queries/messages.gql +0 -28
- package/src/graphql/queries/organization-query.gql +0 -90
- package/src/graphql/queries/post-message.gql +0 -8
- package/src/graphql/queries/post-thread-message.gql +0 -20
- package/src/graphql/queries/support-service-channels.gql +0 -18
- package/src/graphql/queries/teams-query.gql +0 -32
- package/src/graphql/queries/user-account.gql +0 -5
- package/src/graphql/queries/users.gql +0 -48
- package/src/graphql/schema/index.ts +0 -6
- package/src/graphql/schema/messages.graphql +0 -5
- package/src/graphql/schema/post.graphql +0 -44
- package/src/graphql/schema/services.graphql +0 -6
- package/src/graphql/schema/user-account.graphql +0 -3
- package/src/graphql/subscription/chat-message-added.gql +0 -6
- package/src/graphql/subscription/public-post-added.gql +0 -5
- package/src/graphql/subscription/thread-chat-message-added.gql +0 -5
- package/src/graphql/subscription/thread-created-updated.gql +0 -12
- package/src/hooks/index.ts +0 -4
- package/src/hooks/use-base-file-upload.hook.ts +0 -148
- package/src/hooks/use-upload-file.hook.native.ts +0 -22
- package/src/hooks/use-upload-file.hook.ts +0 -22
- package/src/hooks/use-upload-files.hook.native.ts +0 -22
- package/src/hooks/use-upload-files.hook.ts +0 -22
- package/src/index.ts +0 -3
- package/src/inversify-containers/index.ts +0 -1
- package/src/inversify-containers/module.ts +0 -4
- package/src/packages/constants/constants.ts +0 -1831
- package/src/packages/types/channels.ts +0 -194
- package/src/packages/types/emojis.ts +0 -41
- package/src/packages/types/files.ts +0 -43
- package/src/packages/types/posts.ts +0 -155
- package/src/packages/types/reactions.ts +0 -8
- package/src/packages/types/teams.ts +0 -109
- package/src/packages/types/utilities.ts +0 -30
- package/src/services/index.ts +0 -0
- package/src/tests/mutation/__snapshots__/set-device-token.test.ts.snap +0 -18
- package/src/tests/mutation/set-device-token.test.ts +0 -85
- package/src/utils/constants.tsx +0 -1120
- package/src/utils/i18n.tsx +0 -15
- package/src/utils/index.ts +0 -34
- package/src/utils/post_list.ts +0 -54
- package/src/utils/post_utils.ts +0 -33
- package/src/utils/user_agent.tsx +0 -153
- package/src/utils/utils.tsx +0 -54
- package/tsconfig.json +0 -14
- package/webpack.config.js +0 -58
package/src/utils/i18n.tsx
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
2
|
-
// See LICENSE.txt for license information.
|
|
3
|
-
|
|
4
|
-
export function getMonthLong(locale) {
|
|
5
|
-
if (locale === 'ko') {
|
|
6
|
-
// Long and short are equivalent in Korean except long has a bug on IE11/Windows 7
|
|
7
|
-
return 'short';
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
return 'long';
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function t(v) {
|
|
14
|
-
return v;
|
|
15
|
-
}
|
package/src/utils/index.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export const getFilteredMenus = (accountPageStore, selectedMenu) =>
|
|
2
|
-
accountPageStore
|
|
3
|
-
.map((item) => {
|
|
4
|
-
if (selectedMenu.indexOf(item.key) !== -1) {
|
|
5
|
-
const { path, component, ...rest } = item;
|
|
6
|
-
return {
|
|
7
|
-
[path]: { name: rest.tab, ...rest },
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
})
|
|
11
|
-
.filter((valid) => valid);
|
|
12
|
-
|
|
13
|
-
export const getFilteredRoutes = (accountPageStore, selectedRoutes) =>
|
|
14
|
-
accountPageStore
|
|
15
|
-
.map((item) => {
|
|
16
|
-
if (selectedRoutes.indexOf(item.key) !== -1) {
|
|
17
|
-
const { path } = item;
|
|
18
|
-
return {
|
|
19
|
-
[path]: item,
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
return null;
|
|
23
|
-
})
|
|
24
|
-
.filter((valid) => valid);
|
|
25
|
-
|
|
26
|
-
export const getFilteredTabs = (accountPageStore, selectedTabs) =>
|
|
27
|
-
accountPageStore
|
|
28
|
-
.map((item) => {
|
|
29
|
-
if (selectedTabs.indexOf(item.key) !== -1) {
|
|
30
|
-
const { component, ...rest } = item;
|
|
31
|
-
return rest;
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
.filter((valid) => valid);
|
package/src/utils/post_list.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
export const COMBINED_USER_ACTIVITY = 'user-activity-';
|
|
2
|
-
export const CREATE_COMMENT = 'create-comment';
|
|
3
|
-
export const DATE_LINE = 'date-';
|
|
4
|
-
export const START_OF_NEW_MESSAGES = 'start-of-new-messages';
|
|
5
|
-
export const MAX_COMBINED_SYSTEM_POSTS = 100;
|
|
6
|
-
|
|
7
|
-
export function isDateLine(item: string) {
|
|
8
|
-
return item.startsWith(DATE_LINE);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function getDateForDateLine(item: string) {
|
|
12
|
-
return parseInt(item.substring(DATE_LINE.length), 10);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function isStartOfNewMessages(item: string) {
|
|
16
|
-
return item === START_OF_NEW_MESSAGES;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function isCreateComment(item: string) {
|
|
20
|
-
return item === CREATE_COMMENT;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function isCombinedUserActivityPost(item: string) {
|
|
24
|
-
return /^user-activity-(?:[^_]+_)*[^_]+$/.test(item);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function getPostIdsForCombinedUserActivityPost(item: string) {
|
|
28
|
-
return item.substring(COMBINED_USER_ACTIVITY.length).split('_');
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function getFirstPostId(items: string[]) {
|
|
32
|
-
// eslint-disable-next-line no-plusplus
|
|
33
|
-
for (let i = 0; i < items.length; i++) {
|
|
34
|
-
const item = items[i];
|
|
35
|
-
|
|
36
|
-
if (isStartOfNewMessages(item) || isDateLine(item) || isCreateComment(item)) {
|
|
37
|
-
// This is not a post at all
|
|
38
|
-
// eslint-disable-next-line no-continue
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (isCombinedUserActivityPost(item)) {
|
|
43
|
-
// This is a combined post, so find the first post ID from it
|
|
44
|
-
const combinedIds = getPostIdsForCombinedUserActivityPost(item);
|
|
45
|
-
|
|
46
|
-
return combinedIds[0];
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// This is a post ID
|
|
50
|
-
return item;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return '';
|
|
54
|
-
}
|
package/src/utils/post_utils.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Post } from '../packages/types/posts';
|
|
2
|
-
import { Constants } from '../packages/constants/constants';
|
|
3
|
-
|
|
4
|
-
export function isSystemMessage(post: Post): boolean {
|
|
5
|
-
return Boolean(post.type && post.type.lastIndexOf(Constants.SYSTEM_MESSAGE_PREFIX) === 0);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function fromAutoResponder(post: Post): boolean {
|
|
9
|
-
return Boolean(post.type && post.type === Constants.AUTO_RESPONDER);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function isMeMessage(post: Post): boolean {
|
|
13
|
-
return null;
|
|
14
|
-
// return Boolean(post.type && post.type === Posts.POST_TYPES.ME);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function isFromWebhook(post: Post): boolean {
|
|
18
|
-
return post.props && post.props.from_webhook === 'true';
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function getImageSrc(src: string, hasImageProxy = false): string {
|
|
22
|
-
if (!src) {
|
|
23
|
-
return src;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// const imageAPI = Client4.getBaseRoute() + '/image?url=';
|
|
27
|
-
|
|
28
|
-
// if (hasImageProxy && !src.startsWith(imageAPI)) {
|
|
29
|
-
// return imageAPI + encodeURIComponent(src);
|
|
30
|
-
// }
|
|
31
|
-
|
|
32
|
-
return src;
|
|
33
|
-
}
|
package/src/utils/user_agent.tsx
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
// // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
2
|
-
// // See LICENSE.txt for license information.
|
|
3
|
-
|
|
4
|
-
// /*
|
|
5
|
-
// Example User Agents
|
|
6
|
-
// --------------------
|
|
7
|
-
|
|
8
|
-
// Chrome:
|
|
9
|
-
// Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36
|
|
10
|
-
|
|
11
|
-
// Firefox:
|
|
12
|
-
// Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0
|
|
13
|
-
|
|
14
|
-
// IE11:
|
|
15
|
-
// Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko
|
|
16
|
-
|
|
17
|
-
// Edge:
|
|
18
|
-
// Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586
|
|
19
|
-
|
|
20
|
-
// Desktop App:
|
|
21
|
-
// Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Mattermost/1.2.1 Chrome/49.0.2623.75 Electron/0.37.8 Safari/537.36
|
|
22
|
-
// Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586
|
|
23
|
-
// Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Mattermost/3.4.1 Chrome/53.0.2785.113 Electron/1.4.2 Safari/537.36
|
|
24
|
-
// Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Mattermost/3.4.1 Chrome/51.0.2704.106 Electron/1.2.8 Safari/537.36
|
|
25
|
-
|
|
26
|
-
// Android Chrome:
|
|
27
|
-
// Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19
|
|
28
|
-
|
|
29
|
-
// Android Firefox:
|
|
30
|
-
// Mozilla/5.0 (Android; U; Android; pl; rv:1.9.2.8) Gecko/20100202 Firefox/3.5.8
|
|
31
|
-
// Mozilla/5.0 (Android 7.0; Mobile; rv:54.0) Gecko/54.0 Firefox/54.0
|
|
32
|
-
// Mozilla/5.0 (Android 7.0; Mobile; rv:57.0) Gecko/57.0 Firefox/57.0
|
|
33
|
-
|
|
34
|
-
// Android App:
|
|
35
|
-
// Mozilla/5.0 (Linux; U; Android 4.1.1; en-gb; Build/KLP) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30
|
|
36
|
-
// Mozilla/5.0 (Linux; Android 4.4; Nexus 5 Build/_BuildID_) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.0.0 Mobile Safari/537.36
|
|
37
|
-
// Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5 Build/LMY48B; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/43.0.2357.65 Mobile Safari/537.36
|
|
38
|
-
|
|
39
|
-
// iOS Safari:
|
|
40
|
-
// Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543 Safari/419.3
|
|
41
|
-
|
|
42
|
-
// iOS Android:
|
|
43
|
-
// Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3
|
|
44
|
-
|
|
45
|
-
// iOS App:
|
|
46
|
-
// Mozilla/5.0 (iPhone; CPU iPhone OS 9_3_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Mobile/13F69
|
|
47
|
-
// */
|
|
48
|
-
|
|
49
|
-
// const userAgent = () => window.navigator.userAgent;
|
|
50
|
-
|
|
51
|
-
// export function isChrome(): boolean {
|
|
52
|
-
// return userAgent().indexOf('Chrome') > -1 && userAgent().indexOf('Edge') === -1;
|
|
53
|
-
// }
|
|
54
|
-
|
|
55
|
-
// export function isSafari(): boolean {
|
|
56
|
-
// return userAgent().indexOf('Safari') !== -1 && userAgent().indexOf('Chrome') === -1;
|
|
57
|
-
// }
|
|
58
|
-
|
|
59
|
-
// export function isIosSafari(): boolean {
|
|
60
|
-
// return (userAgent().indexOf('iPhone') !== -1 || userAgent().indexOf('iPad') !== -1) && userAgent().indexOf('Safari') !== -1 && userAgent().indexOf('CriOS') === -1;
|
|
61
|
-
// }
|
|
62
|
-
|
|
63
|
-
// export function isIosChrome(): boolean {
|
|
64
|
-
// return userAgent().indexOf('CriOS') !== -1;
|
|
65
|
-
// }
|
|
66
|
-
|
|
67
|
-
// export function isIosWeb(): boolean {
|
|
68
|
-
// return isIosSafari() || isIosChrome();
|
|
69
|
-
// }
|
|
70
|
-
|
|
71
|
-
// export function isIos(): boolean {
|
|
72
|
-
// return userAgent().indexOf('iPhone') !== -1 || userAgent().indexOf('iPad') !== -1;
|
|
73
|
-
// }
|
|
74
|
-
|
|
75
|
-
// export function isAndroid(): boolean {
|
|
76
|
-
// return userAgent().indexOf('Android') !== -1;
|
|
77
|
-
// }
|
|
78
|
-
|
|
79
|
-
// export function isAndroidChrome(): boolean {
|
|
80
|
-
// return userAgent().indexOf('Android') !== -1 && userAgent().indexOf('Chrome') !== -1 && userAgent().indexOf('Version') === -1;
|
|
81
|
-
// }
|
|
82
|
-
|
|
83
|
-
// export function isAndroidFirefox(): boolean {
|
|
84
|
-
// return userAgent().indexOf('Android') !== -1 && userAgent().indexOf('Firefox') !== -1;
|
|
85
|
-
// }
|
|
86
|
-
|
|
87
|
-
// export function isAndroidWeb(): boolean {
|
|
88
|
-
// return isAndroidChrome() || isAndroidFirefox();
|
|
89
|
-
// }
|
|
90
|
-
|
|
91
|
-
// export function isIosClassic(): boolean {
|
|
92
|
-
// return isMobileApp() && isIos();
|
|
93
|
-
// }
|
|
94
|
-
|
|
95
|
-
// // Returns true if and only if the user is using a Mattermost mobile app. This will return false if the user is using the
|
|
96
|
-
// // web browser on a mobile device.
|
|
97
|
-
// export function isMobileApp(): boolean {
|
|
98
|
-
// return isMobile() && !isIosWeb() && !isAndroidWeb();
|
|
99
|
-
// }
|
|
100
|
-
|
|
101
|
-
// // Returns true if and only if the user is using Mattermost from either the mobile app or the web browser on a mobile device.
|
|
102
|
-
// export function isMobile(): boolean {
|
|
103
|
-
// return isIos() || isAndroid();
|
|
104
|
-
// }
|
|
105
|
-
|
|
106
|
-
// export function isFirefox(): boolean {
|
|
107
|
-
// return userAgent().indexOf('Firefox') !== -1;
|
|
108
|
-
// }
|
|
109
|
-
|
|
110
|
-
// export function isInternetExplorer(): boolean {
|
|
111
|
-
// return userAgent().indexOf('Trident') !== -1;
|
|
112
|
-
// }
|
|
113
|
-
|
|
114
|
-
// export function isEdge(): boolean {
|
|
115
|
-
// return userAgent().indexOf('Edge') !== -1;
|
|
116
|
-
// }
|
|
117
|
-
|
|
118
|
-
// export function isDesktopApp(): boolean {
|
|
119
|
-
// return userAgent().indexOf('Mattermost') !== -1 && userAgent().indexOf('Electron') !== -1;
|
|
120
|
-
// }
|
|
121
|
-
|
|
122
|
-
// export function isWindowsApp(): boolean {
|
|
123
|
-
// return isDesktopApp() && isWindows();
|
|
124
|
-
// }
|
|
125
|
-
|
|
126
|
-
// export function isMacApp(): boolean {
|
|
127
|
-
// return isDesktopApp() && isMac();
|
|
128
|
-
// }
|
|
129
|
-
|
|
130
|
-
// export function isWindows(): boolean {
|
|
131
|
-
// return userAgent().indexOf('Windows') !== -1;
|
|
132
|
-
// }
|
|
133
|
-
|
|
134
|
-
// export function isMac(): boolean {
|
|
135
|
-
// return userAgent().indexOf('Macintosh') !== -1;
|
|
136
|
-
// }
|
|
137
|
-
|
|
138
|
-
// export function isWindows7(): boolean {
|
|
139
|
-
// const appVersion = navigator.appVersion;
|
|
140
|
-
|
|
141
|
-
// if (!appVersion) {
|
|
142
|
-
// return false;
|
|
143
|
-
// }
|
|
144
|
-
|
|
145
|
-
// return (/\bWindows NT 6\.1\b/).test(appVersion);
|
|
146
|
-
// }
|
|
147
|
-
|
|
148
|
-
// export function getDesktopVersion(): string {
|
|
149
|
-
// // use if the value window.desktop.version is not set yet
|
|
150
|
-
// const regex = /Mattermost\/(\d+\.\d+\.\d+)/gm;
|
|
151
|
-
// const match = regex.exec(window.navigator.appVersion)?.[1] || '';
|
|
152
|
-
// return match;
|
|
153
|
-
// }
|
package/src/utils/utils.tsx
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { FormattedMessage } from 'react-intl';
|
|
3
|
-
|
|
4
|
-
import cssVars from 'css-vars-ponyfill';
|
|
5
|
-
|
|
6
|
-
import { Constants } from '../packages/constants/constants';
|
|
7
|
-
import { Post } from '../packages/types/posts';
|
|
8
|
-
|
|
9
|
-
export function isPostEphemeral(post) {
|
|
10
|
-
return null;
|
|
11
|
-
// return post.type === Constants.PostTypes.EPHEMERAL || post.state === Posts.POST_DELETED;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function isMobile() {
|
|
15
|
-
return window.innerWidth > 0 && window.innerWidth <= Constants.MOBILE_SCREEN_WIDTH;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function imageURLForUser(userId, lastPictureUpdate = 0) {
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function isInRole(roles, inRole) {
|
|
23
|
-
if (roles) {
|
|
24
|
-
var parts = roles.split(' ');
|
|
25
|
-
for (var i = 0; i < parts.length; i++) {
|
|
26
|
-
if (parts[i] === inRole) {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function isGuest(user) {
|
|
36
|
-
if (user && user.roles && isInRole(user.roles, 'system_guest')) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export function localizeMessage(id, defaultMessage) {
|
|
44
|
-
// const state = store.getState();
|
|
45
|
-
|
|
46
|
-
// const locale = getCurrentLocale(state);
|
|
47
|
-
// const translations = getTranslations(state, locale);
|
|
48
|
-
|
|
49
|
-
// if (!translations || !(id in translations)) {
|
|
50
|
-
// return defaultMessage || id;
|
|
51
|
-
// }
|
|
52
|
-
|
|
53
|
-
return true
|
|
54
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../tsconfig.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"rootDir": "./src",
|
|
5
|
-
"outDir": "lib",
|
|
6
|
-
"declarationDir": "lib",
|
|
7
|
-
"declaration": true,
|
|
8
|
-
"declarationMap": true,
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"types": ["@types/node", "@types/jest", "../../../typings"]
|
|
11
|
-
},
|
|
12
|
-
"exclude": ["../../../node_modules", "node_modules", "lib", "dist", "webpack.config.js", "rollup.config.mjs"],
|
|
13
|
-
"include": ["src", "./typings/*.d.ts", "type.d.ts"]
|
|
14
|
-
}
|
package/webpack.config.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
const nodeExternals = require('webpack-node-externals');
|
|
2
|
-
const webpack = require('webpack');
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const fs = require('fs');
|
|
5
|
-
|
|
6
|
-
const webpackOpts = {
|
|
7
|
-
mode: 'development',
|
|
8
|
-
entry: './src/index.tsx',
|
|
9
|
-
target: 'node',
|
|
10
|
-
output: {
|
|
11
|
-
path: path.join(__dirname, 'lib'),
|
|
12
|
-
filename: 'index.js',
|
|
13
|
-
libraryTarget: 'commonjs2',
|
|
14
|
-
},
|
|
15
|
-
node: {
|
|
16
|
-
__dirname: false,
|
|
17
|
-
},
|
|
18
|
-
resolve: {
|
|
19
|
-
extensions: ['.ts', '.tsx', '.graphql', '.gql'],
|
|
20
|
-
},
|
|
21
|
-
plugins: [
|
|
22
|
-
new webpack.LoaderOptionsPlugin({
|
|
23
|
-
options: {
|
|
24
|
-
test: /\.tsx?$/,
|
|
25
|
-
ts: {
|
|
26
|
-
compiler: 'typescript',
|
|
27
|
-
configFile: 'tsconfig.json',
|
|
28
|
-
},
|
|
29
|
-
tslint: {
|
|
30
|
-
emitErrors: true,
|
|
31
|
-
failOnHint: true,
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
}),
|
|
35
|
-
],
|
|
36
|
-
devtool: 'source-map',
|
|
37
|
-
module: {
|
|
38
|
-
rules: [
|
|
39
|
-
{
|
|
40
|
-
test: /\.tsx?$/,
|
|
41
|
-
use: 'ts-loader',
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
test: /\.graphql?/,
|
|
45
|
-
exclude: /node_modules/,
|
|
46
|
-
use: 'raw-loader',
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
test: /\.(gql)$/,
|
|
50
|
-
exclude: /node_modules/,
|
|
51
|
-
use: ['graphql-tag/loader'],
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
externals: [nodeExternals({ modulesDir: '../../../node_modules' }), nodeExternals()],
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
module.exports = webpackOpts;
|