@atlaskit/share 3.7.0 → 3.7.2
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/CHANGELOG.md +12 -0
- package/dist/cjs/clients/AtlassianUrlShortenerClient.js +0 -22
- package/dist/cjs/clients/ShareServiceClient.js +1 -12
- package/dist/cjs/clients/index.js +0 -1
- package/dist/cjs/components/CommentField.js +0 -9
- package/dist/cjs/components/CopyLinkButton.js +8 -48
- package/dist/cjs/components/ErrorBoundary.js +0 -26
- package/dist/cjs/components/IntegrationButton.js +3 -15
- package/dist/cjs/components/IntegrationForm.js +8 -17
- package/dist/cjs/components/LazyShareForm/LazyShareForm.js +38 -61
- package/dist/cjs/components/LazyShareForm/index.js +0 -2
- package/dist/cjs/components/LazyShareForm/lazy.js +4 -18
- package/dist/cjs/components/MessagesIntlProvider.js +1 -14
- package/dist/cjs/components/ShareButton.js +1 -9
- package/dist/cjs/components/ShareDialogContainer.js +56 -123
- package/dist/cjs/components/ShareDialogWithTrigger.js +85 -161
- package/dist/cjs/components/ShareForm.js +41 -100
- package/dist/cjs/components/ShareFormWrapper/ShareFormWrapper.js +5 -11
- package/dist/cjs/components/ShareFormWrapper/index.js +0 -2
- package/dist/cjs/components/ShareFormWrapper/styled.js +2 -9
- package/dist/cjs/components/ShareHeader.js +0 -14
- package/dist/cjs/components/SlackIcon.js +0 -4
- package/dist/cjs/components/SplitButton.js +18 -43
- package/dist/cjs/components/UserPickerField.js +20 -70
- package/dist/cjs/components/analytics/analytics.js +6 -39
- package/dist/cjs/components/analytics/ufoExperienceHelper.js +0 -4
- package/dist/cjs/components/analytics/ufoExperiences.js +0 -2
- package/dist/cjs/components/colorSlackIcon.js +0 -4
- package/dist/cjs/components/localStorageUtils.js +0 -11
- package/dist/cjs/components/monochromeSlackIcon.js +2 -4
- package/dist/cjs/components/styles.js +2 -16
- package/dist/cjs/components/utils.js +4 -19
- package/dist/cjs/i18n/cs.js +0 -1
- package/dist/cjs/i18n/da.js +1 -2
- package/dist/cjs/i18n/de.js +0 -1
- package/dist/cjs/i18n/en.js +29 -22
- package/dist/cjs/i18n/en_GB.js +29 -22
- package/dist/cjs/i18n/en_ZZ.js +0 -1
- package/dist/cjs/i18n/es.js +0 -1
- package/dist/cjs/i18n/et.js +0 -1
- package/dist/cjs/i18n/fi.js +0 -1
- package/dist/cjs/i18n/fr.js +0 -1
- package/dist/cjs/i18n/hu.js +0 -1
- package/dist/cjs/i18n/index.js +0 -31
- package/dist/cjs/i18n/is.js +0 -1
- package/dist/cjs/i18n/it.js +0 -1
- package/dist/cjs/i18n/ja.js +0 -1
- package/dist/cjs/i18n/ko.js +0 -1
- package/dist/cjs/i18n/languages.js +0 -1
- package/dist/cjs/i18n/nb.js +0 -1
- package/dist/cjs/i18n/nl.js +0 -1
- package/dist/cjs/i18n/pl.js +0 -1
- package/dist/cjs/i18n/pt_BR.js +0 -1
- package/dist/cjs/i18n/pt_PT.js +0 -1
- package/dist/cjs/i18n/ro.js +0 -1
- package/dist/cjs/i18n/ru.js +0 -1
- package/dist/cjs/i18n/sk.js +0 -1
- package/dist/cjs/i18n/sv.js +0 -1
- package/dist/cjs/i18n/th.js +0 -1
- package/dist/cjs/i18n/tr.js +0 -1
- package/dist/cjs/i18n/uk.js +0 -1
- package/dist/cjs/i18n/vi.js +0 -1
- package/dist/cjs/i18n/zh.js +0 -1
- package/dist/cjs/i18n/zh_TW.js +0 -1
- package/dist/cjs/i18n.js +2 -3
- package/dist/cjs/index.js +0 -3
- package/dist/cjs/types/ShareEntities.js +0 -1
- package/dist/cjs/types/index.js +0 -2
- package/dist/cjs/util/i18n-util.js +2 -8
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/clients/AtlassianUrlShortenerClient.js +0 -6
- package/dist/es2019/clients/ShareServiceClient.js +1 -4
- package/dist/es2019/components/CopyLinkButton.js +2 -13
- package/dist/es2019/components/ErrorBoundary.js +0 -10
- package/dist/es2019/components/IntegrationButton.js +0 -2
- package/dist/es2019/components/LazyShareForm/LazyShareForm.js +5 -14
- package/dist/es2019/components/LazyShareForm/lazy.js +3 -5
- package/dist/es2019/components/MessagesIntlProvider.js +2 -3
- package/dist/es2019/components/ShareDialogContainer.js +21 -59
- package/dist/es2019/components/ShareDialogWithTrigger.js +29 -68
- package/dist/es2019/components/ShareForm.js +4 -24
- package/dist/es2019/components/ShareFormWrapper/ShareFormWrapper.js +0 -2
- package/dist/es2019/components/ShareFormWrapper/styled.js +2 -1
- package/dist/es2019/components/SlackIcon.js +0 -2
- package/dist/es2019/components/SplitButton.js +2 -5
- package/dist/es2019/components/UserPickerField.js +2 -23
- package/dist/es2019/components/analytics/analytics.js +9 -13
- package/dist/es2019/components/analytics/ufoExperienceHelper.js +0 -2
- package/dist/es2019/components/colorSlackIcon.js +0 -2
- package/dist/es2019/components/localStorageUtils.js +0 -3
- package/dist/es2019/components/monochromeSlackIcon.js +2 -2
- package/dist/es2019/components/styles.js +3 -2
- package/dist/es2019/components/utils.js +7 -8
- package/dist/es2019/i18n/da.js +1 -1
- package/dist/es2019/i18n/en.js +29 -21
- package/dist/es2019/i18n/en_GB.js +29 -21
- package/dist/es2019/i18n.js +2 -1
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/types/ShareEntities.js +1 -1
- package/dist/es2019/util/i18n-util.js +1 -5
- package/dist/es2019/version.json +1 -1
- package/dist/esm/clients/AtlassianUrlShortenerClient.js +0 -16
- package/dist/esm/clients/ShareServiceClient.js +1 -7
- package/dist/esm/components/CopyLinkButton.js +8 -31
- package/dist/esm/components/ErrorBoundary.js +0 -18
- package/dist/esm/components/IntegrationButton.js +3 -8
- package/dist/esm/components/IntegrationForm.js +8 -10
- package/dist/esm/components/LazyShareForm/LazyShareForm.js +38 -47
- package/dist/esm/components/LazyShareForm/lazy.js +5 -7
- package/dist/esm/components/MessagesIntlProvider.js +1 -6
- package/dist/esm/components/ShareButton.js +1 -2
- package/dist/esm/components/ShareDialogContainer.js +56 -108
- package/dist/esm/components/ShareDialogWithTrigger.js +89 -157
- package/dist/esm/components/ShareForm.js +41 -74
- package/dist/esm/components/ShareFormWrapper/ShareFormWrapper.js +5 -7
- package/dist/esm/components/ShareFormWrapper/styled.js +2 -1
- package/dist/esm/components/ShareHeader.js +0 -2
- package/dist/esm/components/SlackIcon.js +0 -2
- package/dist/esm/components/SplitButton.js +18 -24
- package/dist/esm/components/UserPickerField.js +20 -54
- package/dist/esm/components/analytics/analytics.js +6 -15
- package/dist/esm/components/analytics/ufoExperienceHelper.js +0 -2
- package/dist/esm/components/colorSlackIcon.js +0 -2
- package/dist/esm/components/localStorageUtils.js +0 -3
- package/dist/esm/components/monochromeSlackIcon.js +2 -2
- package/dist/esm/components/styles.js +2 -7
- package/dist/esm/components/utils.js +7 -8
- package/dist/esm/i18n/da.js +1 -1
- package/dist/esm/i18n/en.js +29 -21
- package/dist/esm/i18n/en_GB.js +29 -21
- package/dist/esm/i18n.js +2 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/types/ShareEntities.js +1 -1
- package/dist/esm/util/i18n-util.js +1 -5
- package/dist/esm/version.json +1 -1
- package/dist/types/components/LazyShareForm/LazyShareForm.d.ts +1 -1
- package/dist/types/i18n/en.d.ts +27 -19
- package/dist/types/i18n/en_GB.d.ts +27 -19
- package/dist/types/types/ShareForm.d.ts +0 -1
- package/package.json +2 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
|
|
4
3
|
/** @jsx jsx */
|
|
5
4
|
import React from 'react';
|
|
6
5
|
import { css, jsx } from '@emotion/react';
|
|
@@ -24,7 +23,8 @@ const messageTextStyle = css`
|
|
|
24
23
|
text-indent: 6px;
|
|
25
24
|
`;
|
|
26
25
|
const isSafari = navigator.userAgent.indexOf('Safari');
|
|
27
|
-
export const HiddenInput = /*#__PURE__*/React.forwardRef(
|
|
26
|
+
export const HiddenInput = /*#__PURE__*/React.forwardRef(
|
|
27
|
+
// we need a hidden input to reliably copy to clipboard across all browsers.
|
|
28
28
|
(props, ref) => jsx("input", {
|
|
29
29
|
style: {
|
|
30
30
|
position: 'absolute',
|
|
@@ -40,28 +40,22 @@ export const HiddenInput = /*#__PURE__*/React.forwardRef( // we need a hidden in
|
|
|
40
40
|
export class CopyLinkButton extends React.Component {
|
|
41
41
|
constructor(...args) {
|
|
42
42
|
super(...args);
|
|
43
|
-
|
|
44
43
|
_defineProperty(this, "inputRef", /*#__PURE__*/React.createRef());
|
|
45
|
-
|
|
46
44
|
_defineProperty(this, "state", {
|
|
47
45
|
shouldShowCopiedMessage: false
|
|
48
46
|
});
|
|
49
|
-
|
|
50
47
|
_defineProperty(this, "clearAutoDismiss", () => {
|
|
51
48
|
if (this.autoDismiss) {
|
|
52
49
|
clearTimeout(this.autoDismiss);
|
|
53
50
|
this.autoDismiss = undefined;
|
|
54
51
|
}
|
|
55
52
|
});
|
|
56
|
-
|
|
57
53
|
_defineProperty(this, "handleClick", () => {
|
|
58
54
|
this.inputRef.current.select();
|
|
59
55
|
document.execCommand('copy');
|
|
60
|
-
|
|
61
56
|
if (this.props.onLinkCopy) {
|
|
62
57
|
this.props.onLinkCopy(this.props.link);
|
|
63
58
|
}
|
|
64
|
-
|
|
65
59
|
this.setState({
|
|
66
60
|
shouldShowCopiedMessage: true
|
|
67
61
|
}, () => {
|
|
@@ -73,14 +67,12 @@ export class CopyLinkButton extends React.Component {
|
|
|
73
67
|
}, AUTO_DISMISS_MS);
|
|
74
68
|
});
|
|
75
69
|
});
|
|
76
|
-
|
|
77
70
|
_defineProperty(this, "handleDismissCopiedMessage", () => {
|
|
78
71
|
this.clearAutoDismiss();
|
|
79
72
|
this.setState({
|
|
80
73
|
shouldShowCopiedMessage: false
|
|
81
74
|
});
|
|
82
75
|
});
|
|
83
|
-
|
|
84
76
|
_defineProperty(this, "renderTriggerButton", triggerProps => {
|
|
85
77
|
const {
|
|
86
78
|
isDisabled,
|
|
@@ -100,11 +92,9 @@ export class CopyLinkButton extends React.Component {
|
|
|
100
92
|
}, triggerProps), children || copyLinkButtonText);
|
|
101
93
|
});
|
|
102
94
|
}
|
|
103
|
-
|
|
104
95
|
componentWillUnmount() {
|
|
105
96
|
this.clearAutoDismiss();
|
|
106
97
|
}
|
|
107
|
-
|
|
108
98
|
render() {
|
|
109
99
|
const {
|
|
110
100
|
shouldShowCopiedMessage
|
|
@@ -139,6 +129,5 @@ export class CopyLinkButton extends React.Component {
|
|
|
139
129
|
}, this.renderTriggerButton(triggerProps)) : this.renderTriggerButton(triggerProps)
|
|
140
130
|
}));
|
|
141
131
|
}
|
|
142
|
-
|
|
143
132
|
}
|
|
144
133
|
export default CopyLinkButton;
|
|
@@ -2,48 +2,38 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
4
4
|
import { CHANNEL_ID, errorEncountered } from './analytics/analytics';
|
|
5
|
-
|
|
6
5
|
// ErrorBoundary does not support in functional component
|
|
7
6
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
8
7
|
class ErrorBoundary extends React.Component {
|
|
9
8
|
constructor(...args) {
|
|
10
9
|
super(...args);
|
|
11
|
-
|
|
12
10
|
_defineProperty(this, "state", {
|
|
13
11
|
hasError: false
|
|
14
12
|
});
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
componentDidCatch(error) {
|
|
18
15
|
const {
|
|
19
16
|
createAnalyticsEvent
|
|
20
17
|
} = this.props;
|
|
21
|
-
|
|
22
18
|
if (createAnalyticsEvent) {
|
|
23
19
|
createAnalyticsEvent(errorEncountered(undefined, {
|
|
24
20
|
message: error.message,
|
|
25
21
|
errorClass: error.name
|
|
26
22
|
})).fire(CHANNEL_ID);
|
|
27
23
|
}
|
|
28
|
-
|
|
29
24
|
this.setState({
|
|
30
25
|
hasError: true
|
|
31
26
|
});
|
|
32
27
|
}
|
|
33
|
-
|
|
34
28
|
render() {
|
|
35
29
|
const {
|
|
36
30
|
hasError
|
|
37
31
|
} = this.state;
|
|
38
|
-
|
|
39
32
|
if (hasError) {
|
|
40
33
|
// Silently fail.
|
|
41
34
|
return null;
|
|
42
35
|
}
|
|
43
|
-
|
|
44
36
|
return this.props.children;
|
|
45
37
|
}
|
|
46
|
-
|
|
47
38
|
}
|
|
48
|
-
|
|
49
39
|
export default withAnalyticsEvents()(ErrorBoundary);
|
|
@@ -10,7 +10,6 @@ const integrationButtonCopyWrapperStyle = css`
|
|
|
10
10
|
const integrationIconWrapperStyle = css`
|
|
11
11
|
margin: 1px 8px 0 0;
|
|
12
12
|
`;
|
|
13
|
-
|
|
14
13
|
const IntegrationButton = props => {
|
|
15
14
|
const {
|
|
16
15
|
text,
|
|
@@ -27,6 +26,5 @@ const IntegrationButton = props => {
|
|
|
27
26
|
css: integrationIconWrapperStyle
|
|
28
27
|
}, jsx(IntegrationIcon, null)), jsx("span", null, text)));
|
|
29
28
|
};
|
|
30
|
-
|
|
31
29
|
IntegrationButton.displayName = 'IntegrationButton';
|
|
32
30
|
export default IntegrationButton;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
|
|
3
1
|
/** @jsx jsx */
|
|
4
|
-
|
|
5
2
|
/** @jsxFrag */
|
|
6
3
|
import React from 'react';
|
|
7
4
|
import { jsx } from '@emotion/react';
|
|
@@ -14,7 +11,6 @@ import { IntegrationForm } from '../IntegrationForm';
|
|
|
14
11
|
import { ShareForm } from '../ShareForm';
|
|
15
12
|
import { ShareFormWrapper } from '../ShareFormWrapper';
|
|
16
13
|
import { allowEmails } from '../utils';
|
|
17
|
-
|
|
18
14
|
/**
|
|
19
15
|
* A Share form content which is lazy-loaded.
|
|
20
16
|
* Make sure this component is not exported inside main entry points `src/index.ts`
|
|
@@ -57,8 +53,6 @@ function LazyShareForm(props) {
|
|
|
57
53
|
defaultValue,
|
|
58
54
|
showTitle,
|
|
59
55
|
orgId,
|
|
60
|
-
shareContentType,
|
|
61
|
-
isJwmShareToSlackFFEnabled,
|
|
62
56
|
isBrowseUsersDisabled
|
|
63
57
|
} = props;
|
|
64
58
|
const footer = jsx("div", null, bottomMessage ? jsx("div", {
|
|
@@ -75,7 +69,8 @@ function LazyShareForm(props) {
|
|
|
75
69
|
});
|
|
76
70
|
const allowEmail = allowEmails(config);
|
|
77
71
|
return jsx(ShareFormWrapper, {
|
|
78
|
-
footer: footer
|
|
72
|
+
footer: footer
|
|
73
|
+
// form title will be determined by `title` and `showTitle` prop passed to `ShareForm`,
|
|
79
74
|
// so we don't need to show title via ShareFormWrapper
|
|
80
75
|
,
|
|
81
76
|
shouldShowTitle: false
|
|
@@ -86,7 +81,7 @@ function LazyShareForm(props) {
|
|
|
86
81
|
}, jsx(IntegrationForm, {
|
|
87
82
|
Content: selectedIntegration.Content,
|
|
88
83
|
onIntegrationClose: onDialogClose
|
|
89
|
-
})) : jsx(React.Fragment, null, allowEmail || !isBrowseUsersDisabled ? jsx(ShareForm,
|
|
84
|
+
})) : jsx(React.Fragment, null, allowEmail || !isBrowseUsersDisabled ? jsx(ShareForm, {
|
|
90
85
|
copyLink: copyLink,
|
|
91
86
|
loadOptions: loadOptions,
|
|
92
87
|
title: shareFormTitle,
|
|
@@ -101,10 +96,7 @@ function LazyShareForm(props) {
|
|
|
101
96
|
loggedInAccountId: loggedInAccountId,
|
|
102
97
|
cloudId: cloudId,
|
|
103
98
|
fieldsFooter: shareFieldsFooter,
|
|
104
|
-
selectPortalRef: selectPortalRef
|
|
105
|
-
}, isJwmShareToSlackFFEnabled && {
|
|
106
|
-
shareContentType
|
|
107
|
-
}, {
|
|
99
|
+
selectPortalRef: selectPortalRef,
|
|
108
100
|
copyTooltipText: copyTooltipText,
|
|
109
101
|
integrationMode: integrationMode,
|
|
110
102
|
shareIntegrations: shareIntegrations,
|
|
@@ -119,7 +111,6 @@ function LazyShareForm(props) {
|
|
|
119
111
|
handleCloseDialog: onDialogClose,
|
|
120
112
|
onTabChange: onTabChange,
|
|
121
113
|
isBrowseUsersDisabled: isBrowseUsersDisabled
|
|
122
|
-
})
|
|
114
|
+
}) : jsx("p", null, jsx(FormattedMessage, messages.formNoPermissions))));
|
|
123
115
|
}
|
|
124
|
-
|
|
125
116
|
export default LazyShareForm;
|
|
@@ -4,12 +4,10 @@ import { jsx } from '@emotion/react';
|
|
|
4
4
|
import { lazyForPaint, LazySuspense } from 'react-loosely-lazy';
|
|
5
5
|
import Spinner from '@atlaskit/spinner';
|
|
6
6
|
import { ShareFormWrapper } from '../ShareFormWrapper';
|
|
7
|
-
const LazyShareFormLazy = lazyForPaint(() => import(
|
|
8
|
-
/* webpackChunkName: "@atlaskit-internal_share-form" */
|
|
7
|
+
const LazyShareFormLazy = lazyForPaint(() => import( /* webpackChunkName: "@atlaskit-internal_share-form" */
|
|
9
8
|
'./LazyShareForm'), {
|
|
10
9
|
ssr: false
|
|
11
10
|
});
|
|
12
|
-
|
|
13
11
|
const LoadingDialog = ({
|
|
14
12
|
shareFormTitle,
|
|
15
13
|
showTitle,
|
|
@@ -19,7 +17,8 @@ const LoadingDialog = ({
|
|
|
19
17
|
setIsLoading(true);
|
|
20
18
|
});
|
|
21
19
|
return jsx(ShareFormWrapper, {
|
|
22
|
-
shareFormTitle: shareFormTitle
|
|
20
|
+
shareFormTitle: shareFormTitle
|
|
21
|
+
// if `showTitle` is passed, we use it. Otherwise, we will show title for loading dialog.
|
|
23
22
|
,
|
|
24
23
|
shouldShowTitle: typeof showTitle === 'boolean' ? showTitle : true
|
|
25
24
|
}, jsx("div", {
|
|
@@ -32,7 +31,6 @@ const LoadingDialog = ({
|
|
|
32
31
|
}
|
|
33
32
|
}, jsx(Spinner, null)));
|
|
34
33
|
};
|
|
35
|
-
|
|
36
34
|
export default (props => jsx(LazySuspense, {
|
|
37
35
|
fallback: jsx(LoadingDialog, {
|
|
38
36
|
shareFormTitle: props.shareFormTitle,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { injectIntl, IntlProvider } from 'react-intl-next';
|
|
3
3
|
import { getMessagesForLocale } from '../util/i18n-util';
|
|
4
|
-
|
|
5
4
|
const MessagesIntlProvider = ({
|
|
6
5
|
intl,
|
|
7
6
|
children
|
|
8
7
|
}) => {
|
|
9
8
|
const mergedMessages = useMemo(() => {
|
|
10
|
-
return {
|
|
9
|
+
return {
|
|
10
|
+
...intl.messages,
|
|
11
11
|
...getMessagesForLocale(intl.locale)
|
|
12
12
|
};
|
|
13
13
|
}, [intl.messages, intl.locale]);
|
|
@@ -16,5 +16,4 @@ const MessagesIntlProvider = ({
|
|
|
16
16
|
messages: mergedMessages
|
|
17
17
|
}, children);
|
|
18
18
|
};
|
|
19
|
-
|
|
20
19
|
export default injectIntl(MessagesIntlProvider);
|
|
@@ -20,37 +20,31 @@ export const defaultConfig = {
|
|
|
20
20
|
disableSharingToEmails: false
|
|
21
21
|
};
|
|
22
22
|
const memoizedFormatCopyLink = memoizeOne((origin, link) => origin.addToUrl(link));
|
|
23
|
-
|
|
24
23
|
function getCurrentPageUrl() {
|
|
25
24
|
return window.location.href;
|
|
26
25
|
}
|
|
26
|
+
|
|
27
27
|
/**
|
|
28
28
|
* This component serves as a Provider to provide customizable implementations
|
|
29
29
|
* to ShareDialogTrigger component
|
|
30
30
|
*/
|
|
31
31
|
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
32
|
-
|
|
33
|
-
|
|
34
32
|
export class ShareDialogContainerInternal extends React.Component {
|
|
35
33
|
constructor(props) {
|
|
36
|
-
super(props);
|
|
34
|
+
super(props);
|
|
37
35
|
|
|
36
|
+
// v0.4 -> v0.5 .client -> .shareClient
|
|
38
37
|
_defineProperty(this, "_isMounted", false);
|
|
39
|
-
|
|
40
38
|
_defineProperty(this, "_urlShorteningRequestCounter", 0);
|
|
41
|
-
|
|
42
39
|
_defineProperty(this, "_lastUrlShorteningWasTooSlow", false);
|
|
43
|
-
|
|
44
40
|
_defineProperty(this, "createAndFireEvent", payload => {
|
|
45
41
|
const {
|
|
46
42
|
createAnalyticsEvent
|
|
47
43
|
} = this.props;
|
|
48
|
-
|
|
49
44
|
if (createAnalyticsEvent) {
|
|
50
45
|
createAnalyticsEvent(payload).fire(CHANNEL_ID);
|
|
51
46
|
}
|
|
52
47
|
});
|
|
53
|
-
|
|
54
48
|
_defineProperty(this, "fetchConfig", () => {
|
|
55
49
|
this.setState({
|
|
56
50
|
isFetchingConfig: true
|
|
@@ -58,14 +52,12 @@ export class ShareDialogContainerInternal extends React.Component {
|
|
|
58
52
|
try {
|
|
59
53
|
renderShareDialogExp.start();
|
|
60
54
|
const config = await this.shareClient.getConfig(this.props.cloudId);
|
|
61
|
-
|
|
62
55
|
if (this._isMounted) {
|
|
63
56
|
this.setState({
|
|
64
57
|
config,
|
|
65
58
|
isFetchingConfig: false
|
|
66
59
|
});
|
|
67
60
|
}
|
|
68
|
-
|
|
69
61
|
renderShareDialogExp.success();
|
|
70
62
|
} catch (error) {
|
|
71
63
|
if (this._isMounted) {
|
|
@@ -74,21 +66,19 @@ export class ShareDialogContainerInternal extends React.Component {
|
|
|
74
66
|
isFetchingConfig: false
|
|
75
67
|
});
|
|
76
68
|
}
|
|
77
|
-
|
|
78
|
-
|
|
69
|
+
let {
|
|
70
|
+
...errObj
|
|
79
71
|
} = error;
|
|
80
|
-
|
|
81
72
|
if (error instanceof Error) {
|
|
82
|
-
errObj = {
|
|
73
|
+
errObj = {
|
|
74
|
+
...errObj,
|
|
83
75
|
className: error.constructor.name
|
|
84
76
|
};
|
|
85
77
|
}
|
|
86
|
-
|
|
87
78
|
isValidFailedExperience(renderShareDialogExp, errObj);
|
|
88
79
|
}
|
|
89
80
|
});
|
|
90
81
|
});
|
|
91
|
-
|
|
92
82
|
_defineProperty(this, "handleSubmitShare", ({
|
|
93
83
|
users,
|
|
94
84
|
comment
|
|
@@ -115,54 +105,49 @@ export class ShareDialogContainerInternal extends React.Component {
|
|
|
115
105
|
return this.shareClient.share(content, optionDataToUsers(users), metaData, comment).then(() => {
|
|
116
106
|
if (!this._isMounted) {
|
|
117
107
|
return;
|
|
118
|
-
}
|
|
119
|
-
|
|
108
|
+
}
|
|
120
109
|
|
|
110
|
+
// renew Origin Tracing Id per share action succeeded
|
|
121
111
|
this.setState(state => ({
|
|
122
112
|
shareActionCount: state.shareActionCount + 1
|
|
123
113
|
}));
|
|
124
114
|
});
|
|
125
115
|
});
|
|
126
|
-
|
|
127
116
|
_defineProperty(this, "handleDialogOpen", async () => {
|
|
128
117
|
if (this.props.onDialogOpen) {
|
|
129
118
|
this.props.onDialogOpen();
|
|
130
119
|
}
|
|
131
|
-
|
|
132
120
|
this.setState({
|
|
133
121
|
currentPageUrl: getCurrentPageUrl()
|
|
134
122
|
}, () => {
|
|
135
123
|
this.updateShortCopyLink();
|
|
136
|
-
});
|
|
124
|
+
});
|
|
137
125
|
|
|
126
|
+
// always refetch the config when modal is re-opened
|
|
138
127
|
this.fetchConfig();
|
|
139
128
|
});
|
|
140
|
-
|
|
141
129
|
_defineProperty(this, "decorateAnalytics", payload => {
|
|
142
130
|
if (payload.type === COPY_LINK_EVENT.type && payload.action === COPY_LINK_EVENT.action && payload.actionSubjectId === COPY_LINK_EVENT.actionSubjectId) {
|
|
143
131
|
const isCopyLinkShortened = !!this.getShortenedCopyLink();
|
|
144
|
-
payload = {
|
|
145
|
-
|
|
132
|
+
payload = {
|
|
133
|
+
...payload,
|
|
134
|
+
attributes: {
|
|
135
|
+
...payload.attributes,
|
|
146
136
|
shortUrl: isCopyLinkShortened
|
|
147
137
|
}
|
|
148
138
|
};
|
|
149
|
-
|
|
150
139
|
if (this.shouldShortenCopyLink() && !isCopyLinkShortened) {
|
|
151
140
|
this._lastUrlShorteningWasTooSlow = true;
|
|
152
141
|
}
|
|
153
142
|
}
|
|
154
|
-
|
|
155
143
|
return payload;
|
|
156
144
|
});
|
|
157
|
-
|
|
158
145
|
_defineProperty(this, "getUniqueCopyLinkOriginTracing", memoizeOne((link, originTracingFactory) => {
|
|
159
146
|
return originTracingFactory();
|
|
160
147
|
}));
|
|
161
|
-
|
|
162
148
|
_defineProperty(this, "getUniqueFormShareOriginTracing", memoizeOne((link, originTracingFactory, shareCount) => {
|
|
163
149
|
return originTracingFactory();
|
|
164
150
|
}));
|
|
165
|
-
|
|
166
151
|
_defineProperty(this, "getUpToDateShortenedCopyLink", memoizeOne(data => {
|
|
167
152
|
this._lastUrlShorteningWasTooSlow = false;
|
|
168
153
|
this._urlShorteningRequestCounter++;
|
|
@@ -176,12 +161,10 @@ export class ShareDialogContainerInternal extends React.Component {
|
|
|
176
161
|
return null;
|
|
177
162
|
});
|
|
178
163
|
}, deepEqual));
|
|
179
|
-
|
|
180
164
|
_defineProperty(this, "getFormShareLink", () => {
|
|
181
165
|
// original share link is used here
|
|
182
166
|
return this.getRawLink();
|
|
183
167
|
});
|
|
184
|
-
|
|
185
168
|
assert(!props.client, 'elements/share: Breaking change, please update your props!');
|
|
186
169
|
this.shareClient = props.shareClient || new ShareServiceClient();
|
|
187
170
|
this.urlShortenerClient = props.urlShortenerClient || new AtlassianUrlShortenerClient();
|
|
@@ -193,21 +176,17 @@ export class ShareDialogContainerInternal extends React.Component {
|
|
|
193
176
|
shortenedCopyLink: null
|
|
194
177
|
};
|
|
195
178
|
}
|
|
196
|
-
|
|
197
179
|
componentDidMount() {
|
|
198
180
|
this._isMounted = true;
|
|
199
181
|
}
|
|
200
|
-
|
|
201
182
|
componentWillUnmount() {
|
|
202
183
|
this._isMounted = false;
|
|
203
184
|
}
|
|
204
|
-
|
|
205
185
|
componentDidUpdate(prevProps) {
|
|
206
186
|
if (!deepEqual(this.getShortLinkData(prevProps), this.getShortLinkData(this.props))) {
|
|
207
187
|
this.updateShortCopyLink();
|
|
208
188
|
}
|
|
209
189
|
}
|
|
210
|
-
|
|
211
190
|
getRawLink() {
|
|
212
191
|
const {
|
|
213
192
|
shareLink
|
|
@@ -217,7 +196,6 @@ export class ShareDialogContainerInternal extends React.Component {
|
|
|
217
196
|
} = this.state;
|
|
218
197
|
return shareLink || currentPageUrl;
|
|
219
198
|
}
|
|
220
|
-
|
|
221
199
|
getCopyLinkOriginTracing() {
|
|
222
200
|
const {
|
|
223
201
|
originTracingFactory
|
|
@@ -225,7 +203,6 @@ export class ShareDialogContainerInternal extends React.Component {
|
|
|
225
203
|
const shareLink = this.getRawLink();
|
|
226
204
|
return this.getUniqueCopyLinkOriginTracing(shareLink, originTracingFactory);
|
|
227
205
|
}
|
|
228
|
-
|
|
229
206
|
getFormShareOriginTracing() {
|
|
230
207
|
const {
|
|
231
208
|
originTracingFactory
|
|
@@ -236,7 +213,6 @@ export class ShareDialogContainerInternal extends React.Component {
|
|
|
236
213
|
const shareLink = this.getRawLink();
|
|
237
214
|
return this.getUniqueFormShareOriginTracing(shareLink, originTracingFactory, shareActionCount);
|
|
238
215
|
}
|
|
239
|
-
|
|
240
216
|
getFullCopyLink() {
|
|
241
217
|
const {
|
|
242
218
|
formatCopyLink
|
|
@@ -245,24 +221,19 @@ export class ShareDialogContainerInternal extends React.Component {
|
|
|
245
221
|
const copyLinkOrigin = this.getCopyLinkOriginTracing();
|
|
246
222
|
return (formatCopyLink || memoizedFormatCopyLink)(copyLinkOrigin, shareLink);
|
|
247
223
|
}
|
|
248
|
-
|
|
249
224
|
shouldShortenCopyLink() {
|
|
250
225
|
return !!this.props.shortLinkData || !!this.props.useUrlShortener;
|
|
251
226
|
}
|
|
252
|
-
|
|
253
227
|
getShortenedCopyLink() {
|
|
254
228
|
return this.shouldShortenCopyLink() && this.state.shortenedCopyLink || undefined;
|
|
255
229
|
}
|
|
256
|
-
|
|
257
230
|
getCopyLink() {
|
|
258
231
|
return this.getShortenedCopyLink() || this.getFullCopyLink();
|
|
259
232
|
}
|
|
260
|
-
|
|
261
233
|
addOriginToShortQuery(query = '') {
|
|
262
234
|
const copyLinkOrigin = this.getCopyLinkOriginTracing();
|
|
263
235
|
return copyLinkOrigin.addToUrl(query);
|
|
264
236
|
}
|
|
265
|
-
|
|
266
237
|
getShortLinkData(props) {
|
|
267
238
|
let {
|
|
268
239
|
shortLinkData,
|
|
@@ -270,14 +241,14 @@ export class ShareDialogContainerInternal extends React.Component {
|
|
|
270
241
|
cloudId,
|
|
271
242
|
product
|
|
272
243
|
} = props;
|
|
273
|
-
|
|
274
244
|
if (shortLinkData) {
|
|
275
|
-
return {
|
|
245
|
+
return {
|
|
246
|
+
...shortLinkData,
|
|
276
247
|
query: this.addOriginToShortQuery(shortLinkData.query)
|
|
277
248
|
};
|
|
278
|
-
}
|
|
279
|
-
|
|
249
|
+
}
|
|
280
250
|
|
|
251
|
+
// Use the legacy link type if old API is being used
|
|
281
252
|
if (useUrlShortener && product === 'confluence') {
|
|
282
253
|
return {
|
|
283
254
|
cloudId,
|
|
@@ -288,39 +259,31 @@ export class ShareDialogContainerInternal extends React.Component {
|
|
|
288
259
|
}
|
|
289
260
|
};
|
|
290
261
|
}
|
|
291
|
-
|
|
292
262
|
return undefined;
|
|
293
263
|
}
|
|
294
|
-
|
|
295
264
|
updateShortCopyLink() {
|
|
296
265
|
this.setState({
|
|
297
266
|
shortenedCopyLink: null
|
|
298
267
|
});
|
|
299
268
|
const shortLinkData = this.getShortLinkData(this.props);
|
|
300
|
-
|
|
301
269
|
if (!shortLinkData) {
|
|
302
270
|
return;
|
|
303
271
|
}
|
|
304
|
-
|
|
305
272
|
const shortLink = this.getUpToDateShortenedCopyLink(shortLinkData);
|
|
306
273
|
const requestCounter = this._urlShorteningRequestCounter;
|
|
307
274
|
shortLink.then(shortenedCopyLink => {
|
|
308
275
|
if (!this._isMounted) {
|
|
309
276
|
return;
|
|
310
277
|
}
|
|
311
|
-
|
|
312
278
|
const isRequestOutdated = requestCounter !== this._urlShorteningRequestCounter;
|
|
313
|
-
|
|
314
279
|
if (isRequestOutdated) {
|
|
315
280
|
return;
|
|
316
281
|
}
|
|
317
|
-
|
|
318
282
|
this.setState({
|
|
319
283
|
shortenedCopyLink
|
|
320
284
|
});
|
|
321
285
|
});
|
|
322
286
|
}
|
|
323
|
-
|
|
324
287
|
render() {
|
|
325
288
|
const {
|
|
326
289
|
cloudId,
|
|
@@ -330,6 +293,7 @@ export class ShareDialogContainerInternal extends React.Component {
|
|
|
330
293
|
loadUserOptions,
|
|
331
294
|
renderCustomTriggerButton,
|
|
332
295
|
shareContentType,
|
|
296
|
+
isJwmShareToSlackFFEnabled,
|
|
333
297
|
shareFormTitle,
|
|
334
298
|
shareFormHelperMessage,
|
|
335
299
|
shouldCloseOnEscapePress,
|
|
@@ -375,6 +339,7 @@ export class ShareDialogContainerInternal extends React.Component {
|
|
|
375
339
|
onShareSubmit: this.handleSubmitShare,
|
|
376
340
|
renderCustomTriggerButton: renderCustomTriggerButton,
|
|
377
341
|
shareContentType: shareContentType,
|
|
342
|
+
isJwmShareToSlackFFEnabled: isJwmShareToSlackFFEnabled,
|
|
378
343
|
shareFormTitle: shareFormTitle,
|
|
379
344
|
shareFormHelperMessage: shareFormHelperMessage,
|
|
380
345
|
copyLinkOrigin: this.getCopyLinkOriginTracing(),
|
|
@@ -407,13 +372,10 @@ export class ShareDialogContainerInternal extends React.Component {
|
|
|
407
372
|
isBrowseUsersDisabled: isBrowseUsersDisabled
|
|
408
373
|
})));
|
|
409
374
|
}
|
|
410
|
-
|
|
411
375
|
}
|
|
412
|
-
|
|
413
376
|
_defineProperty(ShareDialogContainerInternal, "defaultProps", {
|
|
414
377
|
enableSmartUserPicker: false,
|
|
415
378
|
shareeAction: 'view',
|
|
416
379
|
product: 'confluence'
|
|
417
380
|
});
|
|
418
|
-
|
|
419
381
|
export const ShareDialogContainer = withAnalyticsEvents()(ShareDialogContainerInternal);
|