@atlaskit/media-picker 70.0.8 → 70.1.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/media-picker
2
2
 
3
+ ## 70.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`96051ddbcd485`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/96051ddbcd485) -
8
+ Error detail added in failure event to better track errors.
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
14
+ ## 70.0.9
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies
19
+
3
20
  ## 70.0.8
4
21
 
5
22
  ### Patch Changes
@@ -18,6 +18,7 @@ var _react = require("react");
18
18
  var _perfMarks = require("perf-marks");
19
19
  var _mediaClient = require("@atlaskit/media-client");
20
20
  var _mediaCommon = require("@atlaskit/media-common");
21
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
21
22
  var _component = require("./component");
22
23
  var _uploadServiceImpl = require("../service/uploadServiceImpl");
23
24
  var _analytics = require("../util/analytics");
@@ -105,12 +106,16 @@ var LocalUploadComponentReact = exports.LocalUploadComponentReact = /*#__PURE__*
105
106
  });
106
107
  (0, _defineProperty2.default)(_this, "fireUploadFailed", /*#__PURE__*/function () {
107
108
  var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(payload) {
108
- var fileId, _payload$error, errorName, rawError, traceContext, _end2, _end2$duration, uploadDurationMsec;
109
+ var fileId, _payload$error, errorName, rawError, traceContext, _end2, _end2$duration, uploadDurationMsec, errorDetail, _rawError$innerError, _rawError$innerError2;
109
110
  return _regenerator.default.wrap(function _callee$(_context) {
110
111
  while (1) switch (_context.prev = _context.next) {
111
112
  case 0:
112
113
  fileId = payload.fileId, _payload$error = payload.error, errorName = _payload$error.name, rawError = _payload$error.rawError, traceContext = payload.traceContext;
113
114
  _end2 = (0, _perfMarks.end)("MediaPicker.fireUpload.".concat(fileId)), _end2$duration = _end2.duration, uploadDurationMsec = _end2$duration === void 0 ? -1 : _end2$duration;
115
+ errorDetail = 'unknown';
116
+ if ((0, _platformFeatureFlags.fg)('add_media_picker_error_detail')) {
117
+ errorDetail = rawError && (0, _mediaClient.isCommonMediaClientError)(rawError) && (_rawError$innerError = rawError.innerError) !== null && _rawError$innerError !== void 0 && _rawError$innerError.message ? (_rawError$innerError2 = rawError.innerError) === null || _rawError$innerError2 === void 0 ? void 0 : _rawError$innerError2.message : rawError instanceof Error ? rawError.message : 'unknown';
118
+ }
114
119
  _this.createAndFireAnalyticsEvent({
115
120
  eventType: 'operational',
116
121
  action: 'failed',
@@ -127,19 +132,21 @@ var LocalUploadComponentReact = exports.LocalUploadComponentReact = /*#__PURE__*
127
132
  fileId: fileId
128
133
  },
129
134
  uploadDurationMsec: uploadDurationMsec,
130
- traceContext: traceContext
135
+ traceContext: traceContext,
136
+ errorDetail: errorDetail
131
137
  }
132
138
  });
133
139
  (0, _ufoExperiences.failMediaUploadUfoExperience)(fileId, {
134
140
  failReason: errorName,
135
141
  error: !!rawError ? (0, _mediaClient.getMediaClientErrorReason)(rawError) : 'unknown',
142
+ errorDetail: errorDetail,
136
143
  request: !!rawError ? (0, _analytics.getRequestMetadata)(rawError) : undefined,
137
144
  fileAttributes: {
138
145
  fileId: fileId
139
146
  },
140
147
  uploadDurationMsec: uploadDurationMsec
141
148
  });
142
- case 4:
149
+ case 6:
143
150
  case "end":
144
151
  return _context.stop();
145
152
  }
@@ -9,7 +9,7 @@ var _mediaClient = require("@atlaskit/media-client");
9
9
  // Component name will be prefixed with "media-picker-" in logs. Check ufoExperiences in utils files
10
10
 
11
11
  var packageName = "@atlaskit/media-picker";
12
- var packageVersion = "0.0.0-development";
12
+ var packageVersion = "70.0.9";
13
13
  function getPackageAttributes(componentName) {
14
14
  return {
15
15
  packageName: packageName,
@@ -12,7 +12,7 @@ var _mediaClient = require("@atlaskit/media-client");
12
12
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
13
13
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
14
14
  var packageName = "@atlaskit/media-picker";
15
- var packageVersion = "0.0.0-development";
15
+ var packageVersion = "70.0.9";
16
16
  var ufoExperience;
17
17
  var initExperience = function initExperience(id, componentName) {
18
18
  if (!ufoExperience) {
@@ -1,8 +1,9 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { Component } from 'react';
3
3
  import { start, end } from 'perf-marks';
4
- import { getMediaClientErrorReason } from '@atlaskit/media-client';
4
+ import { getMediaClientErrorReason, isCommonMediaClientError } from '@atlaskit/media-client';
5
5
  import { ANALYTICS_MEDIA_CHANNEL } from '@atlaskit/media-common';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { UploadComponent } from './component';
7
8
  import { UploadServiceImpl } from '../service/uploadServiceImpl';
8
9
  import { getRequestMetadata } from '../util/analytics';
@@ -102,6 +103,11 @@ export class LocalUploadComponentReact extends Component {
102
103
  const {
103
104
  duration: uploadDurationMsec = -1
104
105
  } = end(`MediaPicker.fireUpload.${fileId}`);
106
+ let errorDetail = 'unknown';
107
+ if (fg('add_media_picker_error_detail')) {
108
+ var _rawError$innerError, _rawError$innerError2;
109
+ errorDetail = rawError && isCommonMediaClientError(rawError) && (_rawError$innerError = rawError.innerError) !== null && _rawError$innerError !== void 0 && _rawError$innerError.message ? (_rawError$innerError2 = rawError.innerError) === null || _rawError$innerError2 === void 0 ? void 0 : _rawError$innerError2.message : rawError instanceof Error ? rawError.message : 'unknown';
110
+ }
105
111
  this.createAndFireAnalyticsEvent({
106
112
  eventType: 'operational',
107
113
  action: 'failed',
@@ -118,12 +124,14 @@ export class LocalUploadComponentReact extends Component {
118
124
  fileId
119
125
  },
120
126
  uploadDurationMsec,
121
- traceContext
127
+ traceContext,
128
+ errorDetail
122
129
  }
123
130
  });
124
131
  failMediaUploadUfoExperience(fileId, {
125
132
  failReason: errorName,
126
133
  error: !!rawError ? getMediaClientErrorReason(rawError) : 'unknown',
134
+ errorDetail,
127
135
  request: !!rawError ? getRequestMetadata(rawError) : undefined,
128
136
  fileAttributes: {
129
137
  fileId
@@ -3,7 +3,7 @@ import { isRequestError } from '@atlaskit/media-client';
3
3
  // Component name will be prefixed with "media-picker-" in logs. Check ufoExperiences in utils files
4
4
 
5
5
  const packageName = "@atlaskit/media-picker";
6
- const packageVersion = "0.0.0-development";
6
+ const packageVersion = "70.0.9";
7
7
  export function getPackageAttributes(componentName) {
8
8
  return {
9
9
  packageName,
@@ -2,7 +2,7 @@ import { ConcurrentExperience, ExperiencePerformanceTypes, ExperienceTypes } fro
2
2
  import { getFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
3
3
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
4
4
  const packageName = "@atlaskit/media-picker";
5
- const packageVersion = "0.0.0-development";
5
+ const packageVersion = "70.0.9";
6
6
  let ufoExperience;
7
7
  const initExperience = (id, componentName) => {
8
8
  if (!ufoExperience) {
@@ -11,8 +11,9 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
11
11
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
12
12
  import { Component } from 'react';
13
13
  import { start, end } from 'perf-marks';
14
- import { getMediaClientErrorReason } from '@atlaskit/media-client';
14
+ import { getMediaClientErrorReason, isCommonMediaClientError } from '@atlaskit/media-client';
15
15
  import { ANALYTICS_MEDIA_CHANNEL } from '@atlaskit/media-common';
16
+ import { fg } from '@atlaskit/platform-feature-flags';
16
17
  import { UploadComponent } from './component';
17
18
  import { UploadServiceImpl } from '../service/uploadServiceImpl';
18
19
  import { getRequestMetadata } from '../util/analytics';
@@ -98,12 +99,16 @@ export var LocalUploadComponentReact = /*#__PURE__*/function (_Component) {
98
99
  });
99
100
  _defineProperty(_this, "fireUploadFailed", /*#__PURE__*/function () {
100
101
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(payload) {
101
- var fileId, _payload$error, errorName, rawError, traceContext, _end2, _end2$duration, uploadDurationMsec;
102
+ var fileId, _payload$error, errorName, rawError, traceContext, _end2, _end2$duration, uploadDurationMsec, errorDetail, _rawError$innerError, _rawError$innerError2;
102
103
  return _regeneratorRuntime.wrap(function _callee$(_context) {
103
104
  while (1) switch (_context.prev = _context.next) {
104
105
  case 0:
105
106
  fileId = payload.fileId, _payload$error = payload.error, errorName = _payload$error.name, rawError = _payload$error.rawError, traceContext = payload.traceContext;
106
107
  _end2 = end("MediaPicker.fireUpload.".concat(fileId)), _end2$duration = _end2.duration, uploadDurationMsec = _end2$duration === void 0 ? -1 : _end2$duration;
108
+ errorDetail = 'unknown';
109
+ if (fg('add_media_picker_error_detail')) {
110
+ errorDetail = rawError && isCommonMediaClientError(rawError) && (_rawError$innerError = rawError.innerError) !== null && _rawError$innerError !== void 0 && _rawError$innerError.message ? (_rawError$innerError2 = rawError.innerError) === null || _rawError$innerError2 === void 0 ? void 0 : _rawError$innerError2.message : rawError instanceof Error ? rawError.message : 'unknown';
111
+ }
107
112
  _this.createAndFireAnalyticsEvent({
108
113
  eventType: 'operational',
109
114
  action: 'failed',
@@ -120,19 +125,21 @@ export var LocalUploadComponentReact = /*#__PURE__*/function (_Component) {
120
125
  fileId: fileId
121
126
  },
122
127
  uploadDurationMsec: uploadDurationMsec,
123
- traceContext: traceContext
128
+ traceContext: traceContext,
129
+ errorDetail: errorDetail
124
130
  }
125
131
  });
126
132
  failMediaUploadUfoExperience(fileId, {
127
133
  failReason: errorName,
128
134
  error: !!rawError ? getMediaClientErrorReason(rawError) : 'unknown',
135
+ errorDetail: errorDetail,
129
136
  request: !!rawError ? getRequestMetadata(rawError) : undefined,
130
137
  fileAttributes: {
131
138
  fileId: fileId
132
139
  },
133
140
  uploadDurationMsec: uploadDurationMsec
134
141
  });
135
- case 4:
142
+ case 6:
136
143
  case "end":
137
144
  return _context.stop();
138
145
  }
@@ -3,7 +3,7 @@ import { isRequestError } from '@atlaskit/media-client';
3
3
  // Component name will be prefixed with "media-picker-" in logs. Check ufoExperiences in utils files
4
4
 
5
5
  var packageName = "@atlaskit/media-picker";
6
- var packageVersion = "0.0.0-development";
6
+ var packageVersion = "70.0.9";
7
7
  export function getPackageAttributes(componentName) {
8
8
  return {
9
9
  packageName: packageName,
@@ -5,7 +5,7 @@ import { ConcurrentExperience, ExperiencePerformanceTypes, ExperienceTypes } fro
5
5
  import { getFeatureFlagKeysAllProducts } from '@atlaskit/media-common';
6
6
  import { getMediaEnvironment, getMediaRegion } from '@atlaskit/media-client';
7
7
  var packageName = "@atlaskit/media-picker";
8
- var packageVersion = "0.0.0-development";
8
+ var packageVersion = "70.0.9";
9
9
  var ufoExperience;
10
10
  var initExperience = function initExperience(id, componentName) {
11
11
  if (!ufoExperience) {
@@ -34,7 +34,10 @@ const getArtifactUrl = (
34
34
  .then((blob) => blob.slice(0, blob.size, getMimeTypeFromArtifact(artifact)))
35
35
  .then((blob) => URL.createObjectURL(blob));
36
36
 
37
- export const NativeMediaViewer = ({ id, mediaClient }: NativeMediaViewerProps) => {
37
+ export const NativeMediaViewer = ({
38
+ id,
39
+ mediaClient,
40
+ }: NativeMediaViewerProps): React.JSX.Element => {
38
41
  const [url, setUrl] = useState('');
39
42
  const [mediaType, setMediaType] = useState<MediaType | null>(null);
40
43
 
@@ -4,7 +4,7 @@ import { FeatureFlagsWrapper } from '@atlaskit/media-test-helpers';
4
4
  import { UfoLoggerWrapper } from './UfoWrapper';
5
5
  import { IntlProvider } from 'react-intl-next';
6
6
 
7
- export const MainWrapper = ({ children }: { children: ReactNode }) => (
7
+ export const MainWrapper = ({ children }: { children: ReactNode }): React.JSX.Element => (
8
8
  <UfoLoggerWrapper>
9
9
  <FeatureFlagsWrapper>
10
10
  <IntlProvider locale={'en'}>{children}</IntlProvider>
@@ -19,7 +19,7 @@ export class UploadPreview extends React.Component<PreviewData> {
19
19
  }
20
20
  }
21
21
 
22
- render() {
22
+ render(): React.JSX.Element {
23
23
  const { fileId } = this.props;
24
24
 
25
25
  const identifier: FileIdentifier = {
@@ -57,7 +57,7 @@ export class UploadPreviews extends React.Component<PreviewsDataProps, PreviewsD
57
57
  console.log('upload error:', data);
58
58
  };
59
59
 
60
- render() {
60
+ render(): React.JSX.Element {
61
61
  const { previewsData } = this.state;
62
62
 
63
63
  return (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-picker",
3
- "version": "70.0.8",
3
+ "version": "70.1.0",
4
4
  "description": "Library for handling file uploads",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -31,14 +31,14 @@
31
31
  "dependencies": {
32
32
  "@atlaskit/analytics-next": "^11.1.0",
33
33
  "@atlaskit/flag": "^17.5.0",
34
- "@atlaskit/icon": "^28.5.0",
35
- "@atlaskit/media-client": "^35.5.0",
34
+ "@atlaskit/icon": "^29.0.0",
35
+ "@atlaskit/media-client": "^35.6.0",
36
36
  "@atlaskit/media-client-react": "^4.1.0",
37
37
  "@atlaskit/media-common": "^12.3.0",
38
38
  "@atlaskit/media-ui": "^28.7.0",
39
39
  "@atlaskit/platform-feature-flags": "^1.1.0",
40
40
  "@atlaskit/theme": "^21.0.0",
41
- "@atlaskit/tokens": "^8.0.0",
41
+ "@atlaskit/tokens": "^8.2.0",
42
42
  "@atlaskit/ufo": "^0.4.0",
43
43
  "@babel/runtime": "^7.0.0",
44
44
  "eventemitter2": "^4.1.0",
@@ -55,7 +55,7 @@
55
55
  },
56
56
  "devDependencies": {
57
57
  "@atlaskit/analytics-listeners": "^9.1.0",
58
- "@atlaskit/analytics-namespaced-context": "^7.1.0",
58
+ "@atlaskit/analytics-namespaced-context": "^7.2.0",
59
59
  "@atlaskit/button": "^23.6.0",
60
60
  "@atlaskit/media-core": "^37.0.0",
61
61
  "@atlaskit/media-test-helpers": "^39.0.0",
@@ -89,6 +89,9 @@
89
89
  "platform-feature-flags": {
90
90
  "should-render-to-parent-should-be-true-media-exif": {
91
91
  "type": "boolean"
92
+ },
93
+ "add_media_picker_error_detail": {
94
+ "type": "boolean"
92
95
  }
93
96
  }
94
97
  }