@atlaskit/share 3.1.7 → 3.2.0

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 (31) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/components/ErrorBoundary.js +1 -1
  3. package/dist/cjs/components/LazyShareForm/LazyShareForm.js +1 -1
  4. package/dist/cjs/components/ShareDialogContainer.js +32 -9
  5. package/dist/cjs/components/ShareDialogWithTrigger.js +27 -2
  6. package/dist/cjs/components/ShareForm.js +1 -1
  7. package/dist/cjs/components/SplitButton.js +1 -1
  8. package/dist/cjs/components/{analytics.js → analytics/analytics.js} +1 -1
  9. package/dist/cjs/components/analytics/ufoExperiences.js +25 -0
  10. package/dist/cjs/version.json +1 -1
  11. package/dist/es2019/components/ErrorBoundary.js +1 -1
  12. package/dist/es2019/components/LazyShareForm/LazyShareForm.js +1 -1
  13. package/dist/es2019/components/ShareDialogContainer.js +20 -1
  14. package/dist/es2019/components/ShareDialogWithTrigger.js +21 -2
  15. package/dist/es2019/components/ShareForm.js +1 -1
  16. package/dist/es2019/components/SplitButton.js +1 -1
  17. package/dist/es2019/components/{analytics.js → analytics/analytics.js} +1 -1
  18. package/dist/es2019/components/analytics/ufoExperiences.js +15 -0
  19. package/dist/es2019/version.json +1 -1
  20. package/dist/esm/components/ErrorBoundary.js +1 -1
  21. package/dist/esm/components/LazyShareForm/LazyShareForm.js +1 -1
  22. package/dist/esm/components/ShareDialogContainer.js +27 -9
  23. package/dist/esm/components/ShareDialogWithTrigger.js +25 -2
  24. package/dist/esm/components/ShareForm.js +1 -1
  25. package/dist/esm/components/SplitButton.js +1 -1
  26. package/dist/esm/components/{analytics.js → analytics/analytics.js} +1 -1
  27. package/dist/esm/components/analytics/ufoExperiences.js +15 -0
  28. package/dist/esm/version.json +1 -1
  29. package/dist/types/components/{analytics.d.ts → analytics/analytics.d.ts} +1 -1
  30. package/dist/types/components/analytics/ufoExperiences.d.ts +3 -0
  31. package/package.json +6 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/share
2
2
 
3
+ ## 3.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`bbadcbc3c29`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bbadcbc3c29) - Add analytics through @atlassian/ufo
8
+
3
9
  ## 3.1.7
4
10
 
5
11
  ### Patch Changes
@@ -25,7 +25,7 @@ var _react = _interopRequireDefault(require("react"));
25
25
 
26
26
  var _analyticsNext = require("@atlaskit/analytics-next");
27
27
 
28
- var _analytics = require("./analytics");
28
+ var _analytics = require("./analytics/analytics");
29
29
 
30
30
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
31
31
 
@@ -11,7 +11,7 @@ var _react = _interopRequireDefault(require("react"));
11
11
 
12
12
  var _analyticsNext = require("@atlaskit/analytics-next");
13
13
 
14
- var _analytics = require("../analytics");
14
+ var _analytics = require("../analytics/analytics");
15
15
 
16
16
  var _IntegrationForm = require("../IntegrationForm");
17
17
 
@@ -9,6 +9,8 @@ exports.defaultConfig = exports.ShareDialogContainerInternal = exports.ShareDial
9
9
 
10
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
11
 
12
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
+
12
14
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
15
 
14
16
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
@@ -43,7 +45,9 @@ var _ShareServiceClient = require("../clients/ShareServiceClient");
43
45
 
44
46
  var _i18n = require("../i18n");
45
47
 
46
- var _analytics = require("./analytics");
48
+ var _analytics = require("./analytics/analytics");
49
+
50
+ var _ufoExperiences = require("./analytics/ufoExperiences");
47
51
 
48
52
  var _ErrorBoundary = _interopRequireDefault(require("./ErrorBoundary"));
49
53
 
@@ -105,16 +109,19 @@ var ShareDialogContainerInternal = /*#__PURE__*/function (_React$Component) {
105
109
  _this.setState({
106
110
  isFetchingConfig: true
107
111
  }, /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
108
- var config;
112
+ var config, errObj;
109
113
  return _regenerator.default.wrap(function _callee$(_context) {
110
114
  while (1) {
111
115
  switch (_context.prev = _context.next) {
112
116
  case 0:
113
117
  _context.prev = 0;
114
- _context.next = 3;
118
+
119
+ _ufoExperiences.renderShareDialogExp.start();
120
+
121
+ _context.next = 4;
115
122
  return _this.shareClient.getConfig(_this.props.cloudId);
116
123
 
117
- case 3:
124
+ case 4:
118
125
  config = _context.sent;
119
126
 
120
127
  if (_this._isMounted) {
@@ -124,11 +131,13 @@ var ShareDialogContainerInternal = /*#__PURE__*/function (_React$Component) {
124
131
  });
125
132
  }
126
133
 
127
- _context.next = 10;
134
+ _ufoExperiences.renderShareDialogExp.success();
135
+
136
+ _context.next = 15;
128
137
  break;
129
138
 
130
- case 7:
131
- _context.prev = 7;
139
+ case 9:
140
+ _context.prev = 9;
132
141
  _context.t0 = _context["catch"](0);
133
142
 
134
143
  if (_this._isMounted) {
@@ -138,12 +147,26 @@ var ShareDialogContainerInternal = /*#__PURE__*/function (_React$Component) {
138
147
  });
139
148
  }
140
149
 
141
- case 10:
150
+ errObj = (0, _extends2.default)({}, _context.t0);
151
+
152
+ if (_context.t0 instanceof Error) {
153
+ errObj = _objectSpread(_objectSpread({}, errObj), {}, {
154
+ className: _context.t0.constructor.name
155
+ });
156
+ }
157
+
158
+ _ufoExperiences.renderShareDialogExp.failure({
159
+ metadata: {
160
+ error: errObj
161
+ }
162
+ });
163
+
164
+ case 15:
142
165
  case "end":
143
166
  return _context.stop();
144
167
  }
145
168
  }
146
- }, _callee, null, [[0, 7]]);
169
+ }, _callee, null, [[0, 9]]);
147
170
  })));
148
171
  });
149
172
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleSubmitShare", function (_ref2) {
@@ -47,7 +47,9 @@ var _i18n = require("../i18n");
47
47
 
48
48
  var _types = require("../types");
49
49
 
50
- var _analytics = require("./analytics");
50
+ var _analytics = require("./analytics/analytics");
51
+
52
+ var _ufoExperiences = require("./analytics/ufoExperiences");
51
53
 
52
54
  var _lazy = _interopRequireDefault(require("./LazyShareForm/lazy"));
53
55
 
@@ -197,6 +199,11 @@ var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureComponent
197
199
 
198
200
 
199
201
  if (shouldCloseOnEscapePress) {
202
+ // This experience should be aborted in a scenario when a user closes the dialog before the shareClient.getConfig() call is finished
203
+ // It is a race condition between the `SUCCEEDED` case and the `ABORTED` case of this experience
204
+ // UFO experiences can only have one FINAL state so it doesn't matter if we call .abort() after the experience has succeeded and vice versa
205
+ _ufoExperiences.renderShareDialogExp.abort();
206
+
200
207
  _this.createAndFireEvent((0, _analytics.cancelShare)(_this.start));
201
208
 
202
209
  _this.closeAndResetDialog();
@@ -250,7 +257,12 @@ var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureComponent
250
257
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleCloseDialog", function () {
251
258
  if (_this.props.onDialogClose) {
252
259
  _this.props.onDialogClose();
253
- }
260
+ } // This experience should be aborted in a scenario when a user closes the dialog before the shareClient.getConfig() call is finished
261
+ // It is a race condition between the `SUCCEEDED` case and the `ABORTED` case of this experience
262
+ // UFO experiences can only have one FINAL state so it doesn't matter if we call .abort() after the experience has succeeded and vice versa
263
+
264
+
265
+ _ufoExperiences.renderShareDialogExp.abort();
254
266
 
255
267
  _this.setState({
256
268
  isDialogOpen: false,
@@ -271,6 +283,8 @@ var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureComponent
271
283
  return;
272
284
  }
273
285
 
286
+ _ufoExperiences.shareSubmitExp.start();
287
+
274
288
  _this.setState({
275
289
  isSharing: true
276
290
  });
@@ -285,6 +299,8 @@ var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureComponent
285
299
  });
286
300
 
287
301
  showFlags(_this.getFlags());
302
+
303
+ _ufoExperiences.shareSubmitExp.success();
288
304
  }).catch(function (err) {
289
305
  _this.setState({
290
306
  isSharing: false,
@@ -292,6 +308,15 @@ var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureComponent
292
308
  message: err.message
293
309
  }
294
310
  });
311
+
312
+ _ufoExperiences.shareSubmitExp.failure({
313
+ metadata: {
314
+ error: {
315
+ message: err.message,
316
+ name: err.name
317
+ }
318
+ }
319
+ });
295
320
  });
296
321
  });
297
322
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleFormDismiss", function (data) {
@@ -55,7 +55,7 @@ var _i18n = require("../i18n");
55
55
 
56
56
  var _types = require("../types");
57
57
 
58
- var _analytics = require("./analytics");
58
+ var _analytics = require("./analytics/analytics");
59
59
 
60
60
  var _CommentField = require("./CommentField");
61
61
 
@@ -35,7 +35,7 @@ var _tokens = require("@atlaskit/tokens");
35
35
 
36
36
  var _i18n = require("../i18n");
37
37
 
38
- var _analytics = require("./analytics");
38
+ var _analytics = require("./analytics/analytics");
39
39
 
40
40
  var _IntegrationButton = _interopRequireDefault(require("./IntegrationButton"));
41
41
 
@@ -11,7 +11,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
11
11
 
12
12
  var _smartUserPicker = require("@atlaskit/smart-user-picker");
13
13
 
14
- var _version = require("../version.json");
14
+ var _version = require("../../version.json");
15
15
 
16
16
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
17
17
 
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.shareSubmitExp = exports.renderShareDialogExp = void 0;
7
+
8
+ var _ufo = require("@atlaskit/ufo");
9
+
10
+ var renderShareDialogExp = new _ufo.UFOExperience('render-share-dialog', {
11
+ type: _ufo.ExperienceTypes.Experience,
12
+ performanceType: _ufo.ExperiencePerformanceTypes.InlineResult,
13
+ platform: {
14
+ component: 'people'
15
+ }
16
+ });
17
+ exports.renderShareDialogExp = renderShareDialogExp;
18
+ var shareSubmitExp = new _ufo.UFOExperience('share-submit-action', {
19
+ type: _ufo.ExperienceTypes.Experience,
20
+ performanceType: _ufo.ExperiencePerformanceTypes.InlineResult,
21
+ platform: {
22
+ component: 'people'
23
+ }
24
+ });
25
+ exports.shareSubmitExp = shareSubmitExp;
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/share",
3
- "version": "3.1.7"
3
+ "version": "3.2.0"
4
4
  }
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import React from 'react';
3
3
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
4
- import { CHANNEL_ID, errorEncountered } from './analytics';
4
+ import { CHANNEL_ID, errorEncountered } from './analytics/analytics';
5
5
 
6
6
  // ErrorBoundary does not support in functional component
7
7
  // eslint-disable-next-line @repo/internal/react/no-class-components
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { AnalyticsContext } from '@atlaskit/analytics-next';
3
- import { INTEGRATION_MODAL_SOURCE } from '../analytics';
3
+ import { INTEGRATION_MODAL_SOURCE } from '../analytics/analytics';
4
4
  import { IntegrationForm } from '../IntegrationForm';
5
5
  import { ShareForm } from '../ShareForm';
6
6
  import { ShareFormWrapper } from '../ShareFormWrapper';
@@ -8,7 +8,8 @@ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
8
8
  import { AtlassianUrlShortenerClient } from '../clients/AtlassianUrlShortenerClient';
9
9
  import { ShareServiceClient } from '../clients/ShareServiceClient';
10
10
  import { messages } from '../i18n';
11
- import { CHANNEL_ID, copyLinkButtonClicked, errorEncountered, shortUrlGenerated, shortUrlRequested } from './analytics';
11
+ import { CHANNEL_ID, copyLinkButtonClicked, errorEncountered, shortUrlGenerated, shortUrlRequested } from './analytics/analytics';
12
+ import { renderShareDialogExp } from './analytics/ufoExperiences';
12
13
  import ErrorBoundary from './ErrorBoundary';
13
14
  import MessagesIntlProvider from './MessagesIntlProvider';
14
15
  import { ShareDialogWithTrigger } from './ShareDialogWithTrigger';
@@ -54,6 +55,7 @@ export class ShareDialogContainerInternal extends React.Component {
54
55
  isFetchingConfig: true
55
56
  }, async () => {
56
57
  try {
58
+ renderShareDialogExp.start();
57
59
  const config = await this.shareClient.getConfig(this.props.cloudId);
58
60
 
59
61
  if (this._isMounted) {
@@ -62,6 +64,8 @@ export class ShareDialogContainerInternal extends React.Component {
62
64
  isFetchingConfig: false
63
65
  });
64
66
  }
67
+
68
+ renderShareDialogExp.success();
65
69
  } catch (error) {
66
70
  if (this._isMounted) {
67
71
  this.setState({
@@ -69,6 +73,21 @@ export class ShareDialogContainerInternal extends React.Component {
69
73
  isFetchingConfig: false
70
74
  });
71
75
  }
76
+
77
+ let { ...errObj
78
+ } = error;
79
+
80
+ if (error instanceof Error) {
81
+ errObj = { ...errObj,
82
+ className: error.constructor.name
83
+ };
84
+ }
85
+
86
+ renderShareDialogExp.failure({
87
+ metadata: {
88
+ error: errObj
89
+ }
90
+ });
72
91
  }
73
92
  });
74
93
  });
@@ -12,8 +12,9 @@ import Aktooltip from '@atlaskit/tooltip';
12
12
  import { messages } from '../i18n';
13
13
  import { OBJECT_SHARED } from '../types';
14
14
  import { cancelShare, CHANNEL_ID, copyLinkButtonClicked, formShareSubmitted, screenEvent, shareSplitButtonEvent, shareTabClicked, shareTriggerButtonClicked // type TabSubjectIdType,
15
- } from './analytics'; // eslint-disable-next-line no-duplicate-imports
15
+ } from './analytics/analytics'; // eslint-disable-next-line no-duplicate-imports
16
16
 
17
+ import { renderShareDialogExp, shareSubmitExp } from './analytics/ufoExperiences';
17
18
  import LazyShareFormLazy from './LazyShareForm/lazy';
18
19
  import ShareButton from './ShareButton';
19
20
  import SplitButton from './SplitButton';
@@ -153,6 +154,10 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
153
154
 
154
155
 
155
156
  if (shouldCloseOnEscapePress) {
157
+ // This experience should be aborted in a scenario when a user closes the dialog before the shareClient.getConfig() call is finished
158
+ // It is a race condition between the `SUCCEEDED` case and the `ABORTED` case of this experience
159
+ // UFO experiences can only have one FINAL state so it doesn't matter if we call .abort() after the experience has succeeded and vice versa
160
+ renderShareDialogExp.abort();
156
161
  this.createAndFireEvent(cancelShare(this.start));
157
162
  this.closeAndResetDialog();
158
163
  }
@@ -208,8 +213,12 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
208
213
  _defineProperty(this, "handleCloseDialog", () => {
209
214
  if (this.props.onDialogClose) {
210
215
  this.props.onDialogClose();
211
- }
216
+ } // This experience should be aborted in a scenario when a user closes the dialog before the shareClient.getConfig() call is finished
217
+ // It is a race condition between the `SUCCEEDED` case and the `ABORTED` case of this experience
218
+ // UFO experiences can only have one FINAL state so it doesn't matter if we call .abort() after the experience has succeeded and vice versa
219
+
212
220
 
221
+ renderShareDialogExp.abort();
213
222
  this.setState({
214
223
  isDialogOpen: false,
215
224
  showIntegrationForm: false,
@@ -231,6 +240,7 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
231
240
  return;
232
241
  }
233
242
 
243
+ shareSubmitExp.start();
234
244
  this.setState({
235
245
  isSharing: true
236
246
  });
@@ -241,6 +251,7 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
241
251
  isSharing: false
242
252
  });
243
253
  showFlags(this.getFlags());
254
+ shareSubmitExp.success();
244
255
  }).catch(err => {
245
256
  this.setState({
246
257
  isSharing: false,
@@ -248,6 +259,14 @@ export class ShareDialogWithTriggerInternal extends React.PureComponent {
248
259
  message: err.message
249
260
  }
250
261
  });
262
+ shareSubmitExp.failure({
263
+ metadata: {
264
+ error: {
265
+ message: err.message,
266
+ name: err.name
267
+ }
268
+ }
269
+ });
251
270
  });
252
271
  });
253
272
 
@@ -14,7 +14,7 @@ import { token } from '@atlaskit/tokens';
14
14
  import Tooltip from '@atlaskit/tooltip';
15
15
  import { messages } from '../i18n';
16
16
  import { TabType } from '../types';
17
- import { ANALYTICS_SOURCE, INTEGRATION_MODAL_SOURCE } from './analytics';
17
+ import { ANALYTICS_SOURCE, INTEGRATION_MODAL_SOURCE } from './analytics/analytics';
18
18
  import { CommentField } from './CommentField';
19
19
  import CopyLinkButton from './CopyLinkButton';
20
20
  import { IntegrationForm } from './IntegrationForm';
@@ -9,7 +9,7 @@ import { N800 } from '@atlaskit/theme/colors';
9
9
  import { borderRadius } from '@atlaskit/theme/constants';
10
10
  import { token } from '@atlaskit/tokens';
11
11
  import { messages } from '../i18n';
12
- import { shareIntegrationButtonEvent } from './analytics';
12
+ import { shareIntegrationButtonEvent } from './analytics/analytics';
13
13
  import IntegrationButton from './IntegrationButton';
14
14
  const SplitButtonWrapper = styled.div`
15
15
  display: flex;
@@ -1,5 +1,5 @@
1
1
  import { isEmail, isTeam, isUser } from '@atlaskit/smart-user-picker';
2
- import { name as packageName, version as packageVersion } from '../version.json';
2
+ import { name as packageName, version as packageVersion } from '../../version.json';
3
3
 
4
4
  const buildAttributes = (attributes = {}) => ({
5
5
  packageName,
@@ -0,0 +1,15 @@
1
+ import { ExperiencePerformanceTypes, ExperienceTypes, UFOExperience } from '@atlaskit/ufo';
2
+ export const renderShareDialogExp = new UFOExperience('render-share-dialog', {
3
+ type: ExperienceTypes.Experience,
4
+ performanceType: ExperiencePerformanceTypes.InlineResult,
5
+ platform: {
6
+ component: 'people'
7
+ }
8
+ });
9
+ export const shareSubmitExp = new UFOExperience('share-submit-action', {
10
+ type: ExperienceTypes.Experience,
11
+ performanceType: ExperiencePerformanceTypes.InlineResult,
12
+ platform: {
13
+ component: 'people'
14
+ }
15
+ });
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/share",
3
- "version": "3.1.7"
3
+ "version": "3.2.0"
4
4
  }
@@ -12,7 +12,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
12
12
 
13
13
  import React from 'react';
14
14
  import { withAnalyticsEvents } from '@atlaskit/analytics-next';
15
- import { CHANNEL_ID, errorEncountered } from './analytics';
15
+ import { CHANNEL_ID, errorEncountered } from './analytics/analytics';
16
16
 
17
17
  // ErrorBoundary does not support in functional component
18
18
  // eslint-disable-next-line @repo/internal/react/no-class-components
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { AnalyticsContext } from '@atlaskit/analytics-next';
3
- import { INTEGRATION_MODAL_SOURCE } from '../analytics';
3
+ import { INTEGRATION_MODAL_SOURCE } from '../analytics/analytics';
4
4
  import { IntegrationForm } from '../IntegrationForm';
5
5
  import { ShareForm } from '../ShareForm';
6
6
  import { ShareFormWrapper } from '../ShareFormWrapper';
@@ -1,4 +1,5 @@
1
1
  import _regeneratorRuntime from "@babel/runtime/regenerator";
2
+ import _extends from "@babel/runtime/helpers/extends";
2
3
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
3
4
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
4
5
  import _createClass from "@babel/runtime/helpers/createClass";
@@ -25,7 +26,8 @@ import { withAnalyticsEvents } from '@atlaskit/analytics-next';
25
26
  import { AtlassianUrlShortenerClient } from '../clients/AtlassianUrlShortenerClient';
26
27
  import { ShareServiceClient } from '../clients/ShareServiceClient';
27
28
  import { messages } from '../i18n';
28
- import { CHANNEL_ID, copyLinkButtonClicked, errorEncountered, shortUrlGenerated, shortUrlRequested } from './analytics';
29
+ import { CHANNEL_ID, copyLinkButtonClicked, errorEncountered, shortUrlGenerated, shortUrlRequested } from './analytics/analytics';
30
+ import { renderShareDialogExp } from './analytics/ufoExperiences';
29
31
  import ErrorBoundary from './ErrorBoundary';
30
32
  import MessagesIntlProvider from './MessagesIntlProvider';
31
33
  import { ShareDialogWithTrigger } from './ShareDialogWithTrigger';
@@ -78,16 +80,17 @@ export var ShareDialogContainerInternal = /*#__PURE__*/function (_React$Componen
78
80
  _this.setState({
79
81
  isFetchingConfig: true
80
82
  }, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
81
- var config;
83
+ var config, errObj;
82
84
  return _regeneratorRuntime.wrap(function _callee$(_context) {
83
85
  while (1) {
84
86
  switch (_context.prev = _context.next) {
85
87
  case 0:
86
88
  _context.prev = 0;
87
- _context.next = 3;
89
+ renderShareDialogExp.start();
90
+ _context.next = 4;
88
91
  return _this.shareClient.getConfig(_this.props.cloudId);
89
92
 
90
- case 3:
93
+ case 4:
91
94
  config = _context.sent;
92
95
 
93
96
  if (_this._isMounted) {
@@ -97,11 +100,12 @@ export var ShareDialogContainerInternal = /*#__PURE__*/function (_React$Componen
97
100
  });
98
101
  }
99
102
 
100
- _context.next = 10;
103
+ renderShareDialogExp.success();
104
+ _context.next = 15;
101
105
  break;
102
106
 
103
- case 7:
104
- _context.prev = 7;
107
+ case 9:
108
+ _context.prev = 9;
105
109
  _context.t0 = _context["catch"](0);
106
110
 
107
111
  if (_this._isMounted) {
@@ -111,12 +115,26 @@ export var ShareDialogContainerInternal = /*#__PURE__*/function (_React$Componen
111
115
  });
112
116
  }
113
117
 
114
- case 10:
118
+ errObj = _extends({}, _context.t0);
119
+
120
+ if (_context.t0 instanceof Error) {
121
+ errObj = _objectSpread(_objectSpread({}, errObj), {}, {
122
+ className: _context.t0.constructor.name
123
+ });
124
+ }
125
+
126
+ renderShareDialogExp.failure({
127
+ metadata: {
128
+ error: errObj
129
+ }
130
+ });
131
+
132
+ case 15:
115
133
  case "end":
116
134
  return _context.stop();
117
135
  }
118
136
  }
119
- }, _callee, null, [[0, 7]]);
137
+ }, _callee, null, [[0, 9]]);
120
138
  })));
121
139
  });
122
140
 
@@ -30,8 +30,9 @@ import Aktooltip from '@atlaskit/tooltip';
30
30
  import { messages } from '../i18n';
31
31
  import { OBJECT_SHARED } from '../types';
32
32
  import { cancelShare, CHANNEL_ID, copyLinkButtonClicked, formShareSubmitted, screenEvent, shareSplitButtonEvent, shareTabClicked, shareTriggerButtonClicked // type TabSubjectIdType,
33
- } from './analytics'; // eslint-disable-next-line no-duplicate-imports
33
+ } from './analytics/analytics'; // eslint-disable-next-line no-duplicate-imports
34
34
 
35
+ import { renderShareDialogExp, shareSubmitExp } from './analytics/ufoExperiences';
35
36
  import LazyShareFormLazy from './LazyShareForm/lazy';
36
37
  import ShareButton from './ShareButton';
37
38
  import SplitButton from './SplitButton';
@@ -172,6 +173,11 @@ export var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureCo
172
173
 
173
174
 
174
175
  if (shouldCloseOnEscapePress) {
176
+ // This experience should be aborted in a scenario when a user closes the dialog before the shareClient.getConfig() call is finished
177
+ // It is a race condition between the `SUCCEEDED` case and the `ABORTED` case of this experience
178
+ // UFO experiences can only have one FINAL state so it doesn't matter if we call .abort() after the experience has succeeded and vice versa
179
+ renderShareDialogExp.abort();
180
+
175
181
  _this.createAndFireEvent(cancelShare(_this.start));
176
182
 
177
183
  _this.closeAndResetDialog();
@@ -228,7 +234,12 @@ export var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureCo
228
234
  _defineProperty(_assertThisInitialized(_this), "handleCloseDialog", function () {
229
235
  if (_this.props.onDialogClose) {
230
236
  _this.props.onDialogClose();
231
- }
237
+ } // This experience should be aborted in a scenario when a user closes the dialog before the shareClient.getConfig() call is finished
238
+ // It is a race condition between the `SUCCEEDED` case and the `ABORTED` case of this experience
239
+ // UFO experiences can only have one FINAL state so it doesn't matter if we call .abort() after the experience has succeeded and vice versa
240
+
241
+
242
+ renderShareDialogExp.abort();
232
243
 
233
244
  _this.setState({
234
245
  isDialogOpen: false,
@@ -250,6 +261,8 @@ export var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureCo
250
261
  return;
251
262
  }
252
263
 
264
+ shareSubmitExp.start();
265
+
253
266
  _this.setState({
254
267
  isSharing: true
255
268
  });
@@ -264,6 +277,7 @@ export var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureCo
264
277
  });
265
278
 
266
279
  showFlags(_this.getFlags());
280
+ shareSubmitExp.success();
267
281
  }).catch(function (err) {
268
282
  _this.setState({
269
283
  isSharing: false,
@@ -271,6 +285,15 @@ export var ShareDialogWithTriggerInternal = /*#__PURE__*/function (_React$PureCo
271
285
  message: err.message
272
286
  }
273
287
  });
288
+
289
+ shareSubmitExp.failure({
290
+ metadata: {
291
+ error: {
292
+ message: err.message,
293
+ name: err.name
294
+ }
295
+ }
296
+ });
274
297
  });
275
298
  });
276
299
 
@@ -32,7 +32,7 @@ import { token } from '@atlaskit/tokens';
32
32
  import Tooltip from '@atlaskit/tooltip';
33
33
  import { messages } from '../i18n';
34
34
  import { TabType } from '../types';
35
- import { ANALYTICS_SOURCE, INTEGRATION_MODAL_SOURCE } from './analytics';
35
+ import { ANALYTICS_SOURCE, INTEGRATION_MODAL_SOURCE } from './analytics/analytics';
36
36
  import { CommentField } from './CommentField';
37
37
  import CopyLinkButton from './CopyLinkButton';
38
38
  import { IntegrationForm } from './IntegrationForm';
@@ -15,7 +15,7 @@ import { N800 } from '@atlaskit/theme/colors';
15
15
  import { borderRadius } from '@atlaskit/theme/constants';
16
16
  import { token } from '@atlaskit/tokens';
17
17
  import { messages } from '../i18n';
18
- import { shareIntegrationButtonEvent } from './analytics';
18
+ import { shareIntegrationButtonEvent } from './analytics/analytics';
19
19
  import IntegrationButton from './IntegrationButton';
20
20
  var SplitButtonWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n button {\n border-radius: ", "px 0 0 ", "px;\n }\n button:hover {\n border-radius: ", "px 0 0 ", "px;\n }\n"])), borderRadius(), borderRadius(), borderRadius(), borderRadius());
21
21
  var DropdownMenuWrapper = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin-left: 1px;\n button {\n border-radius: 0 ", "px ", "px 0;\n }\n button:hover {\n border-radius: 0 ", "px ", "px 0;\n }\n"])), borderRadius(), borderRadius(), borderRadius(), borderRadius());
@@ -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 = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
6
 
7
7
  import { isEmail, isTeam, isUser } from '@atlaskit/smart-user-picker';
8
- import { name as packageName, version as packageVersion } from '../version.json';
8
+ import { name as packageName, version as packageVersion } from '../../version.json';
9
9
 
10
10
  var buildAttributes = function buildAttributes() {
11
11
  var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -0,0 +1,15 @@
1
+ import { ExperiencePerformanceTypes, ExperienceTypes, UFOExperience } from '@atlaskit/ufo';
2
+ export var renderShareDialogExp = new UFOExperience('render-share-dialog', {
3
+ type: ExperienceTypes.Experience,
4
+ performanceType: ExperiencePerformanceTypes.InlineResult,
5
+ platform: {
6
+ component: 'people'
7
+ }
8
+ });
9
+ export var shareSubmitExp = new UFOExperience('share-submit-action', {
10
+ type: ExperienceTypes.Experience,
11
+ performanceType: ExperiencePerformanceTypes.InlineResult,
12
+ platform: {
13
+ component: 'people'
14
+ }
15
+ });
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "@atlaskit/share",
3
- "version": "3.1.7"
3
+ "version": "3.2.0"
4
4
  }
@@ -1,5 +1,5 @@
1
1
  import { AnalyticsEventPayload } from '@atlaskit/analytics-next';
2
- import { DialogContentState, OriginTracing } from '../types';
2
+ import { DialogContentState, OriginTracing } from '../../types';
3
3
  export declare const CHANNEL_ID = "fabric-elements";
4
4
  export declare const ANALYTICS_SOURCE = "shareModal";
5
5
  export declare const INTEGRATION_MODAL_SOURCE = "integrationShareDialog";
@@ -0,0 +1,3 @@
1
+ import { UFOExperience } from '@atlaskit/ufo';
2
+ export declare const renderShareDialogExp: UFOExperience;
3
+ export declare const shareSubmitExp: UFOExperience;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/share",
3
- "version": "3.1.7",
3
+ "version": "3.2.0",
4
4
  "description": "Fabric Share Element",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -44,6 +44,7 @@
44
44
  "@atlaskit/theme": "^12.1.0",
45
45
  "@atlaskit/tokens": "^0.9.0",
46
46
  "@atlaskit/tooltip": "^17.5.0",
47
+ "@atlaskit/ufo": "^0.1.0",
47
48
  "@atlaskit/user-picker": "^9.0.0",
48
49
  "@atlaskit/util-service-support": "^6.1.0",
49
50
  "@babel/runtime": "^7.0.0",
@@ -78,10 +79,6 @@
78
79
  "fabric",
79
80
  "teams"
80
81
  ],
81
- "af:exports": {
82
- ".": "./src/index.ts",
83
- "./clients": "./src/clients/index.ts"
84
- },
85
82
  "techstack": {
86
83
  "@atlassian/frontend": {
87
84
  "package-boundaries": [
@@ -104,5 +101,9 @@
104
101
  "theming": "tokens"
105
102
  }
106
103
  },
104
+ "af:exports": {
105
+ ".": "./src/index.ts",
106
+ "./clients": "./src/clients/index.ts"
107
+ },
107
108
  "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.1"
108
109
  }