@atlaskit/share 1.0.3 → 3.0.1

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.
Files changed (115) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/clients/package.json +7 -0
  3. package/dist/cjs/clients/ShareServiceClient.js +1 -7
  4. package/dist/cjs/clients/index.js +13 -0
  5. package/dist/cjs/components/CommentField.js +5 -4
  6. package/dist/cjs/components/CopyLinkButton.js +22 -17
  7. package/dist/cjs/components/ErrorBoundary.js +2 -0
  8. package/dist/cjs/components/IntegrationForm.js +11 -3
  9. package/dist/cjs/components/LazyShareForm/LazyShareForm.js +105 -0
  10. package/dist/cjs/components/LazyShareForm/index.js +15 -0
  11. package/dist/cjs/components/LazyShareForm/lazy.js +53 -0
  12. package/dist/cjs/components/LazyShareForm/styled.js +28 -0
  13. package/dist/cjs/components/ShareButton.js +2 -2
  14. package/dist/cjs/components/ShareDialogContainer.js +9 -8
  15. package/dist/cjs/components/ShareDialogWithTrigger.js +34 -45
  16. package/dist/cjs/components/ShareForm.js +31 -12
  17. package/dist/cjs/components/ShareFormWrapper/ShareFormWrapper.js +29 -0
  18. package/dist/cjs/components/ShareFormWrapper/index.js +15 -0
  19. package/dist/cjs/components/ShareFormWrapper/styled.js +31 -0
  20. package/dist/cjs/components/UserPickerField.js +8 -7
  21. package/dist/cjs/components/styles.js +1 -20
  22. package/dist/cjs/components/utils.js +2 -5
  23. package/dist/cjs/i18n.js +0 -10
  24. package/dist/cjs/index.js +0 -8
  25. package/dist/cjs/types/ShareDialogContainer.js +5 -0
  26. package/dist/cjs/types/ShareEntities.js +10 -1
  27. package/dist/cjs/types/ShareForm.js +5 -0
  28. package/dist/cjs/types/index.js +9 -1
  29. package/dist/cjs/util/i18n-util.js +3 -0
  30. package/dist/cjs/version.json +1 -1
  31. package/dist/es2019/clients/ShareServiceClient.js +1 -7
  32. package/dist/es2019/clients/index.js +1 -0
  33. package/dist/es2019/components/CommentField.js +3 -2
  34. package/dist/es2019/components/CopyLinkButton.js +16 -7
  35. package/dist/es2019/components/ErrorBoundary.js +2 -0
  36. package/dist/es2019/components/IntegrationForm.js +5 -3
  37. package/dist/es2019/components/LazyShareForm/LazyShareForm.js +92 -0
  38. package/dist/es2019/components/LazyShareForm/index.js +1 -0
  39. package/dist/es2019/components/LazyShareForm/lazy.js +26 -0
  40. package/dist/es2019/components/LazyShareForm/styled.js +16 -0
  41. package/dist/es2019/components/MessagesIntlProvider.js +1 -1
  42. package/dist/es2019/components/ShareButton.js +1 -1
  43. package/dist/es2019/components/ShareDialogContainer.js +6 -5
  44. package/dist/es2019/components/ShareDialogWithTrigger.js +33 -42
  45. package/dist/es2019/components/ShareForm.js +25 -8
  46. package/dist/es2019/components/ShareFormWrapper/ShareFormWrapper.js +14 -0
  47. package/dist/es2019/components/ShareFormWrapper/index.js +1 -0
  48. package/dist/es2019/components/ShareFormWrapper/styled.js +15 -0
  49. package/dist/es2019/components/UserPickerField.js +5 -4
  50. package/dist/es2019/components/styles.js +1 -15
  51. package/dist/es2019/components/utils.js +1 -3
  52. package/dist/es2019/i18n.js +0 -10
  53. package/dist/es2019/index.js +0 -1
  54. package/dist/es2019/types/ShareDialogContainer.js +1 -0
  55. package/dist/es2019/types/ShareEntities.js +7 -1
  56. package/dist/es2019/types/ShareForm.js +1 -0
  57. package/dist/es2019/types/index.js +2 -1
  58. package/dist/es2019/util/i18n-util.js +3 -0
  59. package/dist/es2019/version.json +1 -1
  60. package/dist/esm/clients/ShareServiceClient.js +1 -7
  61. package/dist/esm/clients/index.js +1 -0
  62. package/dist/esm/components/CommentField.js +3 -2
  63. package/dist/esm/components/CopyLinkButton.js +16 -7
  64. package/dist/esm/components/ErrorBoundary.js +2 -0
  65. package/dist/esm/components/IntegrationForm.js +11 -3
  66. package/dist/esm/components/LazyShareForm/LazyShareForm.js +87 -0
  67. package/dist/esm/components/LazyShareForm/index.js +1 -0
  68. package/dist/esm/components/LazyShareForm/lazy.js +31 -0
  69. package/dist/esm/components/LazyShareForm/styled.js +9 -0
  70. package/dist/esm/components/MessagesIntlProvider.js +1 -1
  71. package/dist/esm/components/ShareButton.js +1 -1
  72. package/dist/esm/components/ShareDialogContainer.js +6 -5
  73. package/dist/esm/components/ShareDialogWithTrigger.js +34 -38
  74. package/dist/esm/components/ShareForm.js +27 -7
  75. package/dist/esm/components/ShareFormWrapper/ShareFormWrapper.js +17 -0
  76. package/dist/esm/components/ShareFormWrapper/index.js +1 -0
  77. package/dist/esm/components/ShareFormWrapper/styled.js +15 -0
  78. package/dist/esm/components/UserPickerField.js +5 -4
  79. package/dist/esm/components/styles.js +1 -16
  80. package/dist/esm/components/utils.js +1 -3
  81. package/dist/esm/i18n.js +0 -10
  82. package/dist/esm/index.js +0 -1
  83. package/dist/esm/types/ShareDialogContainer.js +1 -0
  84. package/dist/esm/types/ShareEntities.js +7 -1
  85. package/dist/esm/types/ShareForm.js +1 -0
  86. package/dist/esm/types/index.js +2 -1
  87. package/dist/esm/util/i18n-util.js +3 -0
  88. package/dist/esm/version.json +1 -1
  89. package/dist/types/clients/ShareServiceClient.d.ts +2 -2
  90. package/dist/types/clients/index.d.ts +2 -0
  91. package/dist/types/components/CopyLinkButton.d.ts +1 -1
  92. package/dist/types/components/IntegrationForm.d.ts +5 -5
  93. package/dist/types/components/LazyShareForm/LazyShareForm.d.ts +19 -0
  94. package/dist/types/components/LazyShareForm/index.d.ts +1 -0
  95. package/dist/types/components/LazyShareForm/lazy.d.ts +4 -0
  96. package/dist/types/components/LazyShareForm/styled.d.ts +4 -0
  97. package/dist/types/components/ShareButton.d.ts +1 -1
  98. package/dist/types/components/ShareDialogContainer.d.ts +10 -149
  99. package/dist/types/components/ShareDialogWithTrigger.d.ts +10 -71
  100. package/dist/types/components/ShareForm.d.ts +5 -43
  101. package/dist/types/components/ShareFormWrapper/ShareFormWrapper.d.ts +9 -0
  102. package/dist/types/components/ShareFormWrapper/index.d.ts +1 -0
  103. package/dist/types/components/ShareFormWrapper/styled.d.ts +9 -0
  104. package/dist/types/components/UserPickerField.d.ts +1 -1
  105. package/dist/types/components/styles.d.ts +0 -7
  106. package/dist/types/i18n.d.ts +0 -10
  107. package/dist/types/index.d.ts +1 -4
  108. package/dist/types/types/ShareContentState.d.ts +2 -2
  109. package/dist/types/types/ShareDialogContainer.d.ts +142 -0
  110. package/dist/types/types/ShareDialogWithTrigger.d.ts +30 -3
  111. package/dist/types/types/ShareEntities.d.ts +5 -0
  112. package/dist/types/types/ShareForm.d.ts +31 -0
  113. package/dist/types/types/index.d.ts +5 -2
  114. package/docs/0-intro.tsx +4 -4
  115. package/package.json +28 -3
@@ -0,0 +1,87 @@
1
+ import React from 'react';
2
+ import { AnalyticsContext } from '@atlaskit/analytics-next';
3
+ import { ANALYTICS_SOURCE } from '../analytics';
4
+ import { IntegrationForm } from '../IntegrationForm';
5
+ import { ShareForm } from '../ShareForm';
6
+ import { ShareFormWrapper } from '../ShareFormWrapper';
7
+ import { BottomMessageWrapper, CustomFooterWrapper } from './styled';
8
+
9
+ /**
10
+ * A Share form content which is lazy-loaded.
11
+ * Make sure this component is not exported inside main entry points `src/index.ts`
12
+ */
13
+ function LazyShareForm(props) {
14
+ var copyLink = props.copyLink,
15
+ config = props.config,
16
+ isFetchingConfig = props.isFetchingConfig,
17
+ loadOptions = props.loadOptions,
18
+ shareFormTitle = props.shareFormTitle,
19
+ shareFormHelperMessage = props.shareFormHelperMessage,
20
+ bottomMessage = props.bottomMessage,
21
+ submitButtonLabel = props.submitButtonLabel,
22
+ product = props.product,
23
+ customFooter = props.customFooter,
24
+ enableSmartUserPicker = props.enableSmartUserPicker,
25
+ loggedInAccountId = props.loggedInAccountId,
26
+ cloudId = props.cloudId,
27
+ shareFieldsFooter = props.shareFieldsFooter,
28
+ onUserSelectionChange = props.onUserSelectionChange,
29
+ isPublicLink = props.isPublicLink,
30
+ copyTooltipText = props.copyTooltipText,
31
+ shareIntegrations = props.shareIntegrations,
32
+ integrationMode = props.integrationMode,
33
+ onLinkCopy = props.onLinkCopy,
34
+ onDismiss = props.onDismiss,
35
+ onSubmit = props.onSubmit,
36
+ onDialogClose = props.onDialogClose,
37
+ selectPortalRef = props.selectPortalRef,
38
+ showIntegrationForm = props.showIntegrationForm,
39
+ selectedIntegration = props.selectedIntegration,
40
+ isSharing = props.isSharing,
41
+ shareError = props.shareError,
42
+ defaultValue = props.defaultValue,
43
+ showTitle = props.showTitle;
44
+ var footer = /*#__PURE__*/React.createElement("div", null, bottomMessage ? /*#__PURE__*/React.createElement(BottomMessageWrapper, null, bottomMessage) : null, customFooter && /*#__PURE__*/React.createElement(CustomFooterWrapper, null, customFooter));
45
+ return /*#__PURE__*/React.createElement(AnalyticsContext, {
46
+ data: {
47
+ source: ANALYTICS_SOURCE
48
+ }
49
+ }, /*#__PURE__*/React.createElement(ShareFormWrapper, {
50
+ footer: footer // form title will be determined by `title` and `showTitle` prop passed to `ShareForm`,
51
+ // so we don't need to show title via ShareFormWrapper
52
+ ,
53
+ shouldShowTitle: false
54
+ }, showIntegrationForm && selectedIntegration !== null ? /*#__PURE__*/React.createElement(IntegrationForm, {
55
+ Content: selectedIntegration.Content,
56
+ onIntegrationClose: onDialogClose
57
+ }) : /*#__PURE__*/React.createElement(ShareForm, {
58
+ copyLink: copyLink,
59
+ loadOptions: loadOptions,
60
+ title: shareFormTitle,
61
+ showTitle: showTitle,
62
+ helperMessage: shareFormHelperMessage,
63
+ shareError: shareError,
64
+ defaultValue: defaultValue,
65
+ config: config,
66
+ submitButtonLabel: submitButtonLabel,
67
+ product: product,
68
+ enableSmartUserPicker: enableSmartUserPicker,
69
+ loggedInAccountId: loggedInAccountId,
70
+ cloudId: cloudId,
71
+ fieldsFooter: shareFieldsFooter,
72
+ selectPortalRef: selectPortalRef,
73
+ copyTooltipText: copyTooltipText,
74
+ integrationMode: integrationMode,
75
+ shareIntegrations: shareIntegrations,
76
+ isSharing: isSharing,
77
+ isFetchingConfig: isFetchingConfig,
78
+ isPublicLink: isPublicLink,
79
+ onSubmit: onSubmit,
80
+ onDismiss: onDismiss,
81
+ onLinkCopy: onLinkCopy,
82
+ onUserSelectionChange: onUserSelectionChange,
83
+ handleCloseDialog: onDialogClose
84
+ })));
85
+ }
86
+
87
+ export default LazyShareForm;
@@ -0,0 +1 @@
1
+ export { default } from './LazyShareForm';
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { lazyForPaint, LazySuspense } from 'react-loosely-lazy';
3
+ import Spinner from '@atlaskit/spinner';
4
+ import { ShareFormWrapper } from '../ShareFormWrapper';
5
+ import { SpinnerWrapper } from './styled';
6
+ var LazyShareFormLazy = lazyForPaint(function () {
7
+ return import(
8
+ /* webpackChunkName: "@atlaskit-internal_share-form" */
9
+ './LazyShareForm');
10
+ }, {
11
+ ssr: false
12
+ });
13
+
14
+ var LoadingDialog = function LoadingDialog(_ref) {
15
+ var shareFormTitle = _ref.shareFormTitle,
16
+ showTitle = _ref.showTitle;
17
+ return /*#__PURE__*/React.createElement(ShareFormWrapper, {
18
+ shareFormTitle: shareFormTitle // if `showTitle` is passed, we use it. Otherwise, we will show title for loading dialog.
19
+ ,
20
+ shouldShowTitle: typeof showTitle === 'boolean' ? showTitle : true
21
+ }, /*#__PURE__*/React.createElement(SpinnerWrapper, null, /*#__PURE__*/React.createElement(Spinner, null)));
22
+ };
23
+
24
+ export default (function (props) {
25
+ return /*#__PURE__*/React.createElement(LazySuspense, {
26
+ fallback: /*#__PURE__*/React.createElement(LoadingDialog, {
27
+ shareFormTitle: props.shareFormTitle,
28
+ showTitle: props.showTitle
29
+ })
30
+ }, /*#__PURE__*/React.createElement(LazyShareFormLazy, props));
31
+ });
@@ -0,0 +1,9 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+
3
+ var _templateObject, _templateObject2, _templateObject3;
4
+
5
+ import styled from 'styled-components';
6
+ import { gridSize } from '@atlaskit/theme/constants';
7
+ export var BottomMessageWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: ", "px;\n"])), gridSize() * 44);
8
+ export var CustomFooterWrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n /* Must match inline dialog padding. */\n margin: 0 ", "px ", "px ", "px;\n"])), -gridSize() * 3, -gridSize() * 2, -gridSize() * 3);
9
+ export var SpinnerWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n widht: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n align-content: center;\n"])));
@@ -5,7 +5,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6
6
 
7
7
  import React, { useMemo } from 'react';
8
- import { IntlProvider, injectIntl } from 'react-intl-next';
8
+ import { injectIntl, IntlProvider } from 'react-intl-next';
9
9
  import { getMessagesForLocale } from '../util/i18n-util';
10
10
 
11
11
  var MessagesIntlProvider = function MessagesIntlProvider(_ref) {
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- import Button from '@atlaskit/button/custom-theme-button';
4
3
  import React from 'react';
4
+ import Button from '@atlaskit/button/custom-theme-button';
5
5
  export var ShareButton = /*#__PURE__*/React.forwardRef(function ShareButton(_ref, ref) {
6
6
  var text = _ref.text,
7
7
  props = _objectWithoutProperties(_ref, ["text"]);
@@ -16,20 +16,20 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
16
16
 
17
17
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
18
18
 
19
- import { withAnalyticsEvents } from '@atlaskit/analytics-next';
20
- import memoizeOne from 'memoize-one';
21
19
  import React from 'react';
20
+ import deepEqual from 'fast-deep-equal';
21
+ import memoizeOne from 'memoize-one';
22
22
  import { FormattedMessage } from 'react-intl-next';
23
23
  import assert from 'tiny-invariant';
24
+ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
24
25
  import { AtlassianUrlShortenerClient } from '../clients/AtlassianUrlShortenerClient';
25
26
  import { ShareServiceClient } from '../clients/ShareServiceClient';
26
27
  import { messages } from '../i18n';
27
28
  import { CHANNEL_ID, copyLinkButtonClicked, errorEncountered, shortUrlGenerated, shortUrlRequested } from './analytics';
29
+ import ErrorBoundary from './ErrorBoundary';
28
30
  import MessagesIntlProvider from './MessagesIntlProvider';
29
31
  import { ShareDialogWithTrigger } from './ShareDialogWithTrigger';
30
32
  import { optionDataToUsers } from './utils';
31
- import ErrorBoundary from './ErrorBoundary';
32
- import deepEqual from 'fast-deep-equal';
33
33
  var COPY_LINK_EVENT = copyLinkButtonClicked(0);
34
34
  export var defaultConfig = {
35
35
  disableSharingToEmails: false
@@ -45,6 +45,7 @@ function getCurrentPageUrl() {
45
45
  * This component serves as a Provider to provide customizable implementations
46
46
  * to ShareDialogTrigger component
47
47
  */
48
+ // eslint-disable-next-line @repo/internal/react/no-class-components
48
49
 
49
50
 
50
51
  export var ShareDialogContainerInternal = /*#__PURE__*/function (_React$Component) {
@@ -84,7 +85,7 @@ export var ShareDialogContainerInternal = /*#__PURE__*/function (_React$Componen
84
85
  case 0:
85
86
  _context.prev = 0;
86
87
  _context.next = 3;
87
- return _this.shareClient.getConfig(_this.props.cloudId, _this.props.enableEmailPermissionCheck);
88
+ return _this.shareClient.getConfig(_this.props.cloudId);
88
89
 
89
90
  case 3:
90
91
  config = _context.sent;
@@ -8,7 +8,7 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
8
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
9
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
10
10
 
11
- var _templateObject, _templateObject2, _templateObject3, _templateObject4;
11
+ var _templateObject;
12
12
 
13
13
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
14
14
 
@@ -18,28 +18,25 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
18
18
 
19
19
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
20
20
 
21
- import { AnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
22
- import SplitButton from './SplitButton';
21
+ import React from 'react';
22
+ import { FormattedMessage, injectIntl } from 'react-intl-next';
23
+ import styled from 'styled-components';
24
+ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
23
25
  import ShareIcon from '@atlaskit/icon/glyph/share';
24
26
  import Popup from '@atlaskit/popup';
25
27
  import Portal from '@atlaskit/portal';
28
+ import { layers } from '@atlaskit/theme/constants';
26
29
  import Aktooltip from '@atlaskit/tooltip';
27
- import { gridSize, layers } from '@atlaskit/theme/constants';
28
- import React from 'react';
29
- import { FormattedMessage, injectIntl } from 'react-intl-next';
30
- import styled from 'styled-components';
31
30
  import { messages } from '../i18n';
32
31
  import { OBJECT_SHARED } from '../types';
33
- import { cancelShare, CHANNEL_ID, copyLinkButtonClicked, formShareSubmitted, screenEvent, shareTriggerButtonClicked, shareSplitButtonEvent, ANALYTICS_SOURCE, shareTabClicked } from './analytics';
32
+ import { cancelShare, CHANNEL_ID, copyLinkButtonClicked, formShareSubmitted, screenEvent, shareSplitButtonEvent, shareTabClicked, shareTriggerButtonClicked // type TabSubjectIdType,
33
+ } from './analytics'; // eslint-disable-next-line no-duplicate-imports
34
+
35
+ import LazyShareFormLazy from './LazyShareForm/lazy';
34
36
  import ShareButton from './ShareButton';
35
- import { ShareForm } from './ShareForm';
37
+ import SplitButton from './SplitButton';
36
38
  import { generateSelectZIndex } from './utils';
37
- import { InlineDialogContentWrapper } from './styles';
38
- import { IntegrationForm } from './IntegrationForm';
39
39
  var ShareButtonWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n outline: none;\n"])));
40
- var InlineDialogFormWrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: 352px;\n"])));
41
- var BottomMessageWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 352px;\n"])));
42
- var CustomFooterWrapper = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n /* Must match inline dialog padding. */\n margin: 0 ", "px ", "px ", "px;\n"])), -gridSize() * 3, -gridSize() * 2, -gridSize() * 3);
43
40
  export var defaultShareContentState = {
44
41
  users: [],
45
42
  comment: {
@@ -47,6 +44,7 @@ export var defaultShareContentState = {
47
44
  value: ''
48
45
  }
49
46
  };
47
+ // eslint-disable-next-line @repo/internal/react/no-class-components
50
48
  export var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureComponent) {
51
49
  _inherits(ShareDialogWithTriggerInternal, _React$PureComponent);
52
50
 
@@ -445,51 +443,49 @@ export var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureCo
445
443
  style: style
446
444
  }, /*#__PURE__*/React.createElement(Popup, {
447
445
  content: function content() {
448
- return /*#__PURE__*/React.createElement(AnalyticsContext, {
449
- data: {
450
- source: ANALYTICS_SOURCE
451
- }
452
- }, /*#__PURE__*/React.createElement(InlineDialogContentWrapper, {
453
- innerRef: _this2.containerRef
454
- }, showIntegrationForm && selectedIntegration !== null ? /*#__PURE__*/React.createElement(InlineDialogFormWrapper, null, /*#__PURE__*/React.createElement(IntegrationForm, {
455
- Content: selectedIntegration.Content,
456
- onIntegrationClose: _this2.handleCloseDialog
457
- })) : /*#__PURE__*/React.createElement(InlineDialogFormWrapper, null, /*#__PURE__*/React.createElement(ShareForm, {
446
+ return /*#__PURE__*/React.createElement("div", {
447
+ ref: _this2.containerRef
448
+ }, /*#__PURE__*/React.createElement(LazyShareFormLazy, {
449
+ Content: selectedIntegration && selectedIntegration.Content,
450
+ selectedIntegration: selectedIntegration,
458
451
  copyLink: copyLink,
452
+ showIntegrationForm: showIntegrationForm,
453
+ bottomMessage: bottomMessage,
454
+ customFooter: customFooter,
459
455
  loadOptions: loadUserOptions,
460
456
  isSharing: isSharing,
461
- onSubmit: _this2.handleShareSubmit,
462
- title: shareFormTitle,
457
+ shareFormTitle: shareFormTitle,
463
458
  showTitle: integrationMode !== 'tabs' || !shareIntegrations || !shareIntegrations.length,
464
- onTabChange: _this2.onTabChange,
465
- helperMessage: shareFormHelperMessage,
459
+ shareFormHelperMessage: shareFormHelperMessage,
466
460
  shareError: shareError,
467
- onDismiss: _this2.handleFormDismiss,
468
461
  defaultValue: defaultValue,
469
462
  config: config,
470
463
  isFetchingConfig: isFetchingConfig,
471
- onLinkCopy: _this2.handleCopyLink,
472
464
  submitButtonLabel: submitButtonLabel,
473
465
  product: product,
474
466
  enableSmartUserPicker: enableSmartUserPicker,
475
467
  loggedInAccountId: loggedInAccountId,
476
468
  cloudId: cloudId,
477
469
  onUserSelectionChange: onUserSelectionChange,
478
- fieldsFooter: shareFieldsFooter,
479
- selectPortalRef: _this2.selectPortalRef,
470
+ shareFieldsFooter: shareFieldsFooter,
480
471
  isPublicLink: isPublicLink,
481
472
  copyTooltipText: copyTooltipText,
482
473
  integrationMode: integrationMode,
483
- handleCloseDialog: _this2.handleCloseDialog,
484
- shareIntegrations: shareIntegrations
485
- })), bottomMessage ? /*#__PURE__*/React.createElement(BottomMessageWrapper, null, bottomMessage) : null, customFooter && /*#__PURE__*/React.createElement(CustomFooterWrapper, null, customFooter)));
474
+ shareIntegrations: shareIntegrations // actions
475
+ ,
476
+ onLinkCopy: _this2.handleCopyLink,
477
+ onSubmit: _this2.handleShareSubmit,
478
+ onDismiss: _this2.handleFormDismiss,
479
+ onDialogClose: _this2.handleCloseDialog,
480
+ onTabChange: _this2.onTabChange //ref
481
+ ,
482
+ selectPortalRef: _this2.selectPortalRef
483
+ }));
486
484
  },
487
485
  isOpen: isDialogOpen,
488
486
  onClose: this.handleCloseDialog,
489
487
  placement: dialogPlacement,
490
- trigger: function trigger(triggerProps) {
491
- return _this2.renderShareTriggerButton(triggerProps);
492
- },
488
+ trigger: this.renderShareTriggerButton,
493
489
  zIndex: dialogZIndex
494
490
  }), /*#__PURE__*/React.createElement(Portal, {
495
491
  zIndex: generateSelectZIndex(dialogZIndex)
@@ -18,22 +18,23 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
18
18
 
19
19
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
20
20
 
21
+ import React from 'react';
22
+ import { FormattedMessage, injectIntl } from 'react-intl-next';
23
+ import styled from 'styled-components';
21
24
  import Button from '@atlaskit/button/custom-theme-button';
22
25
  import Form from '@atlaskit/form';
23
26
  import ErrorIcon from '@atlaskit/icon/glyph/error';
27
+ import Tabs, { Tab, TabList, TabPanel } from '@atlaskit/tabs';
24
28
  import { R400 } from '@atlaskit/theme/colors';
25
29
  import { gridSize } from '@atlaskit/theme/constants';
26
30
  import Tooltip from '@atlaskit/tooltip';
27
- import Tabs, { Tab, TabList, TabPanel } from '@atlaskit/tabs';
28
- import React from 'react';
29
- import { FormattedMessage, injectIntl } from 'react-intl-next';
30
- import styled from 'styled-components';
31
31
  import { messages } from '../i18n';
32
+ import { TabType } from '../types';
32
33
  import { CommentField } from './CommentField';
33
34
  import CopyLinkButton from './CopyLinkButton';
35
+ import { IntegrationForm } from './IntegrationForm';
34
36
  import { ShareHeader } from './ShareHeader';
35
37
  import { UserPickerField } from './UserPickerField';
36
- import { IntegrationForm } from './IntegrationForm';
37
38
  var SubmitButtonWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n margin-left: auto;\n"])));
38
39
  var CenterAlignedIconWrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n align-self: center;\n padding: 0 10px;\n\n > div {\n line-height: 1;\n }\n"])));
39
40
  export var FormWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-top: ", "px;\n width: 100%;\n\n /* jira has a class override font settings on h1 in gh-custom-field-pickers.css */\n #ghx-modes-tools #ghx-share & h1:first-child {\n margin-top: 0;\n }\n"])), function (props) {
@@ -52,6 +53,7 @@ var integrationTabText = function integrationTabText(integrationName) {
52
53
  }));
53
54
  };
54
55
 
56
+ // eslint-disable-next-line @repo/internal/react/no-class-components
55
57
  var InternalForm = /*#__PURE__*/function (_React$PureComponent) {
56
58
  _inherits(InternalForm, _React$PureComponent);
57
59
 
@@ -68,6 +70,10 @@ var InternalForm = /*#__PURE__*/function (_React$PureComponent) {
68
70
 
69
71
  _this = _super.call.apply(_super, [this].concat(args));
70
72
 
73
+ _defineProperty(_assertThisInitialized(_this), "state", {
74
+ selectedTab: TabType.default
75
+ });
76
+
71
77
  _defineProperty(_assertThisInitialized(_this), "renderShareForm", function () {
72
78
  var _this$props = _this.props,
73
79
  formProps = _this$props.formProps,
@@ -101,7 +107,7 @@ var InternalForm = /*#__PURE__*/function (_React$PureComponent) {
101
107
  defaultValue: defaultValue && defaultValue.users,
102
108
  config: config,
103
109
  isLoading: isFetchingConfig,
104
- product: product,
110
+ product: product || 'confluence',
105
111
  enableSmartUserPicker: enableSmartUserPicker,
106
112
  loggedInAccountId: loggedInAccountId,
107
113
  cloudId: cloudId,
@@ -163,6 +169,12 @@ var InternalForm = /*#__PURE__*/function (_React$PureComponent) {
163
169
  return /*#__PURE__*/React.createElement(FormattedMessage, productShareType);
164
170
  });
165
171
 
172
+ _defineProperty(_assertThisInitialized(_this), "changeTab", function (tab) {
173
+ _this.setState({
174
+ selectedTab: tab
175
+ });
176
+ });
177
+
166
178
  return _this;
167
179
  }
168
180
 
@@ -180,6 +192,8 @@ var InternalForm = /*#__PURE__*/function (_React$PureComponent) {
180
192
  }, {
181
193
  key: "render",
182
194
  value: function render() {
195
+ var _this2 = this;
196
+
183
197
  var _this$props5 = this.props,
184
198
  _this$props5$integrat = _this$props5.integrationMode,
185
199
  integrationMode = _this$props5$integrat === void 0 ? 'off' : _this$props5$integrat,
@@ -197,8 +211,11 @@ var InternalForm = /*#__PURE__*/function (_React$PureComponent) {
197
211
  return /*#__PURE__*/React.createElement(Tabs, {
198
212
  id: "ShareForm-Tabs-Integrations",
199
213
  onChange: function onChange(index) {
214
+ _this2.changeTab(index);
215
+
200
216
  onTabChange === null || onTabChange === void 0 ? void 0 : onTabChange(index);
201
- }
217
+ },
218
+ selected: this.state.selectedTab
202
219
  }, /*#__PURE__*/React.createElement(TabList, null, /*#__PURE__*/React.createElement(Tab, {
203
220
  key: "share-tab-default"
204
221
  }, this.renderMainTabTitle()), /*#__PURE__*/React.createElement(Tab, {
@@ -215,6 +232,9 @@ var InternalForm = /*#__PURE__*/function (_React$PureComponent) {
215
232
  Content: firstIntegration.Content,
216
233
  onIntegrationClose: function onIntegrationClose() {
217
234
  return handleCloseDialog === null || handleCloseDialog === void 0 ? void 0 : handleCloseDialog();
235
+ },
236
+ changeTab: function changeTab(index) {
237
+ _this2.changeTab(index);
218
238
  }
219
239
  }))));
220
240
  }
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { ShareHeader } from '../ShareHeader';
3
+ import { InlineDialogContentWrapper, InlineDialogFormWrapper } from './styled';
4
+
5
+ var ShareFormWrapper = function ShareFormWrapper(_ref) {
6
+ var shareFormTitle = _ref.shareFormTitle,
7
+ shouldShowTitle = _ref.shouldShowTitle,
8
+ _ref$children = _ref.children,
9
+ children = _ref$children === void 0 ? null : _ref$children,
10
+ _ref$footer = _ref.footer,
11
+ footer = _ref$footer === void 0 ? null : _ref$footer;
12
+ return /*#__PURE__*/React.createElement(InlineDialogContentWrapper, null, /*#__PURE__*/React.createElement(InlineDialogFormWrapper, null, shouldShowTitle && /*#__PURE__*/React.createElement(ShareHeader, {
13
+ title: shareFormTitle
14
+ }), children), footer);
15
+ };
16
+
17
+ export default ShareFormWrapper;
@@ -0,0 +1 @@
1
+ export { default as ShareFormWrapper } from './ShareFormWrapper';
@@ -0,0 +1,15 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+
3
+ var _templateObject, _templateObject2;
4
+
5
+ import styled from 'styled-components';
6
+ import { gridSize } from '@atlaskit/theme/constants';
7
+ export var InlineDialogFormWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: ", "px;\n"])), gridSize() * 44);
8
+ /**
9
+ * Apply the same styling, as previous @atlaskit/inline-dialog had,
10
+ * compared to the @atlaskit/popup we are now using.
11
+ *
12
+ * packages/design-system/inline-dialog/src/InlineDialog/styled.ts:20:3
13
+ */
14
+
15
+ export var InlineDialogContentWrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: ", "px ", "px;\n"])), gridSize() * 2, gridSize() * 3);
@@ -11,13 +11,13 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
11
11
 
12
12
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
13
 
14
+ import React from 'react';
15
+ import { FormattedMessage, injectIntl } from 'react-intl-next';
14
16
  import { ErrorMessage, Field, HelperMessage } from '@atlaskit/form';
15
17
  import UserPicker, { isValidEmail, SmartUserPicker } from '@atlaskit/user-picker';
16
- import React from 'react';
17
- import { injectIntl, FormattedMessage } from 'react-intl-next';
18
18
  import { messages } from '../i18n';
19
- import { allowEmails, getMenuPortalTargetCurrentHTML } from './utils';
20
19
  import { MAX_PICKER_HEIGHT } from './styles';
20
+ import { allowEmails, getMenuPortalTargetCurrentHTML } from './utils';
21
21
  export var REQUIRED = 'REQUIRED';
22
22
  var DEBOUNCE_MS = 150;
23
23
 
@@ -75,7 +75,8 @@ var requiredMessagesWithoutEmail = {
75
75
  var getRequiredMessage = function getRequiredMessage(product, allowEmail) {
76
76
  var messages = allowEmail ? requiredMessagesWithEmail : requiredMessagesWithoutEmail;
77
77
  return messages[product];
78
- };
78
+ }; // eslint-disable-next-line @repo/internal/react/no-class-components
79
+
79
80
 
80
81
  export var UserPickerFieldComponent = /*#__PURE__*/function (_React$Component) {
81
82
  _inherits(UserPickerFieldComponent, _React$Component);
@@ -1,29 +1,14 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
5
-
6
- var _templateObject;
7
4
 
8
5
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
9
6
 
10
7
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
11
8
 
12
- import React from 'react'; // AFP-2532 TODO: Fix automatic suppressions below
13
- // eslint-disable-next-line @atlassian/tangerine/import/entry-points
14
-
15
- import { gridSize } from '@atlaskit/theme/constants';
9
+ import React from 'react';
16
10
  import Button from '@atlaskit/button/custom-theme-button';
17
- import styled from 'styled-components';
18
11
  export var MAX_PICKER_HEIGHT = 102;
19
- /**
20
- * Apply the same styling, as previous @atlaskit/inline-dialog had,
21
- * compared to the @atlaskit/popup we are now using.
22
- *
23
- * packages/design-system/inline-dialog/src/InlineDialog/styled.ts:20:3
24
- */
25
-
26
- export var InlineDialogContentWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: ", "px ", "px;\n"])), gridSize() * 2, gridSize() * 3);
27
12
  var StyledButton = /*#__PURE__*/React.forwardRef(function (props, ref) {
28
13
  return /*#__PURE__*/React.createElement(Button, _extends({
29
14
  ref: ref
@@ -1,6 +1,4 @@
1
- // AFP-2532 TODO: Fix automatic suppressions below
2
- // eslint-disable-next-line @atlassian/tangerine/import/entry-points
3
- import { layers } from '@atlaskit/theme';
1
+ import { layers } from '@atlaskit/theme/constants';
4
2
 
5
3
  /**
6
4
  * We need to generate correct zIndex, for the PopUp and for the Select inside it.
package/dist/esm/i18n.js CHANGED
@@ -100,11 +100,6 @@ export var messages = defineMessages({
100
100
  defaultMessage: 'Invite',
101
101
  description: 'Button label for when the sharee action is set to "edit".'
102
102
  },
103
- copyLinkButtonIconLabel: {
104
- id: 'fabric.elements.share.copylink.button.icon.label',
105
- defaultMessage: 'Copy link icon',
106
- description: 'Default text for the aria-label of the copy Link icon'
107
- },
108
103
  copyLinkButtonText: {
109
104
  id: 'fabric.elements.share.copylink.button.text',
110
105
  defaultMessage: 'Copy link',
@@ -115,11 +110,6 @@ export var messages = defineMessages({
115
110
  defaultMessage: 'Copy public link',
116
111
  description: 'Default text for the Copy Link button when the link is public'
117
112
  },
118
- copiedToClipboardIconLabel: {
119
- id: 'fabric.elements.share.copied.to.clipboard.icon.label',
120
- defaultMessage: 'Copy link success icon',
121
- description: 'Default text for the aria-label of the copied link icon'
122
- },
123
113
  copiedToClipboardMessage: {
124
114
  id: 'fabric.elements.share.copied.to.clipboard.message',
125
115
  defaultMessage: 'Link copied to clipboard',
package/dist/esm/index.js CHANGED
@@ -1,4 +1,3 @@
1
- export { ShareServiceClient } from './clients/ShareServiceClient';
2
1
  export { ShareDialogContainer } from './components/ShareDialogContainer';
3
2
  export { // Constants
4
3
  ADMIN_NOTIFIED, OBJECT_SHARED } from './types';
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1,7 @@
1
- export {};
1
+ // Third party integrations
2
+ export var TabType;
3
+
4
+ (function (TabType) {
5
+ TabType[TabType["default"] = 0] = "default";
6
+ TabType[TabType["Slack"] = 1] = "Slack";
7
+ })(TabType || (TabType = {}));
@@ -0,0 +1 @@
1
+ export {};
@@ -1 +1,2 @@
1
- export { ADMIN_NOTIFIED, OBJECT_SHARED } from './Flag';
1
+ export { ADMIN_NOTIFIED, OBJECT_SHARED } from './Flag';
2
+ export { TabType } from './ShareEntities';
@@ -1,3 +1,6 @@
1
+ // Cannot import from `../i18n` because there is `../i18n.tsx` file there.
2
+
3
+ /* eslint-disable @atlassian/tangerine/import/no-dangling-index */
1
4
  import { cs, da, de, en, en_GB, es, et, fi, fr, hu, is, it, ja, ko, nb, nl, pl, pt_BR, pt_PT, ro, ru, sk, sv, zh } from '../i18n/index';
2
5
  var localesMessagesMap = {
3
6
  cs: cs,
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/share",
3
- "version": "1.0.3"
3
+ "version": "3.0.1"
4
4
  }
@@ -2,7 +2,7 @@ import { ServiceConfig } from '@atlaskit/util-service-support';
2
2
  import { Comment, Content, MetaData, User } from '../types';
3
3
  export interface ShareClient {
4
4
  share(content: Content, recipients: User[], metadata: MetaData, comment?: Comment): Promise<ShareResponse>;
5
- getConfig(cloudId: string, enableEmailPermissionCheck?: boolean): Promise<ConfigResponse>;
5
+ getConfig(cloudId: string): Promise<ConfigResponse>;
6
6
  }
7
7
  export declare type ShareRequest = (content: Content, recipients: User[], metadata: MetaData, comment?: Comment) => Promise<ShareResponse>;
8
8
  export declare type ShareResponse = {
@@ -17,7 +17,7 @@ export declare const DEFAULT_SHARE_SERVICE_URL = "/gateway/api";
17
17
  export declare class ShareServiceClient implements ShareClient {
18
18
  private serviceConfig;
19
19
  constructor(serviceConfig?: Partial<ServiceConfig>);
20
- getConfig(cloudId: string, enableEmailPermissionCheck?: boolean): Promise<ConfigResponse>;
20
+ getConfig(cloudId: string): Promise<ConfigResponse>;
21
21
  /**
22
22
  * To send a POST request to the share endpoint in Share service
23
23
  */
@@ -0,0 +1,2 @@
1
+ export { ShareServiceClient } from './ShareServiceClient';
2
+ export type { ShareClient } from './ShareServiceClient';
@@ -1,6 +1,6 @@
1
- import { TriggerProps } from '@atlaskit/popup';
2
1
  import React from 'react';
3
2
  import { WrappedComponentProps } from 'react-intl-next';
3
+ import { TriggerProps } from '@atlaskit/popup';
4
4
  export declare const AUTO_DISMISS_MS: number;
5
5
  export declare const MessageContainer: import("styled-components").StyledComponentClass<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, any, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
6
6
  declare type InputProps = {