@atlaskit/media-client 14.2.0 → 14.3.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 (32) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/client/file-fetcher/index.js +1 -1
  3. package/dist/cjs/client/mobile-upload.js +1 -2
  4. package/dist/cjs/index.js +8 -0
  5. package/dist/cjs/utils/imageResizeModeToFileImageMode.js +12 -0
  6. package/dist/cjs/utils/mobileUpload/helpers.js +2 -2
  7. package/dist/cjs/utils/mobileUpload/stateMachine/index.js +2 -2
  8. package/dist/cjs/utils/polling/index.js +8 -15
  9. package/dist/cjs/version.json +1 -1
  10. package/dist/es2019/client/file-fetcher/index.js +2 -2
  11. package/dist/es2019/client/mobile-upload.js +1 -2
  12. package/dist/es2019/index.js +1 -0
  13. package/dist/es2019/utils/imageResizeModeToFileImageMode.js +1 -0
  14. package/dist/es2019/utils/mobileUpload/helpers.js +3 -3
  15. package/dist/es2019/utils/mobileUpload/stateMachine/index.js +2 -2
  16. package/dist/es2019/utils/polling/index.js +7 -9
  17. package/dist/es2019/version.json +1 -1
  18. package/dist/esm/client/file-fetcher/index.js +2 -2
  19. package/dist/esm/client/mobile-upload.js +1 -2
  20. package/dist/esm/index.js +1 -0
  21. package/dist/esm/utils/imageResizeModeToFileImageMode.js +3 -0
  22. package/dist/esm/utils/mobileUpload/helpers.js +3 -3
  23. package/dist/esm/utils/mobileUpload/stateMachine/index.js +2 -2
  24. package/dist/esm/utils/polling/index.js +7 -11
  25. package/dist/esm/version.json +1 -1
  26. package/dist/types/client/mobile-upload.d.ts +0 -1
  27. package/dist/types/index.d.ts +2 -1
  28. package/dist/types/utils/imageResizeModeToFileImageMode.d.ts +3 -0
  29. package/dist/types/utils/mobileUpload/helpers.d.ts +1 -2
  30. package/dist/types/utils/mobileUpload/stateMachine/index.d.ts +1 -2
  31. package/dist/types/utils/polling/index.d.ts +8 -4
  32. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/media-client
2
2
 
3
+ ## 14.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`b51fc0a9062`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b51fc0a9062) - New helper to convert ImageResizeMode into FileImageMode
8
+ - [`269ee940b87`](https://bitbucket.org/atlassian/atlassian-frontend/commits/269ee940b87) - redesign error UI on new media card experience
9
+
10
+ ### Patch Changes
11
+
12
+ - [`fe9ced0cd70`](https://bitbucket.org/atlassian/atlassian-frontend/commits/fe9ced0cd70) - Removed feature flags for polling settings
13
+ - Updated dependencies
14
+
3
15
  ## 14.2.0
4
16
 
5
17
  ### Minor Changes
@@ -94,7 +94,7 @@ var FileFetcherImpl = /*#__PURE__*/function () {
94
94
  (0, _classCallCheck2.default)(this, FileFetcherImpl);
95
95
  (0, _defineProperty2.default)(this, "createDownloadFileStream", function (id, collectionName, occurrenceKey) {
96
96
  var subject = (0, _createFileStateSubject.createFileStateSubject)();
97
- var poll = new _polling.PollingFunction((0, _polling.getPollingOptions)(_this.mediaStore.featureFlags)); // ensure subject errors if polling exceeds max iterations or uncaught exception in executor
97
+ var poll = new _polling.PollingFunction(); // ensure subject errors if polling exceeds max iterations or uncaught exception in executor
98
98
 
99
99
  poll.onError = function (error) {
100
100
  return subject.error(error);
@@ -22,7 +22,6 @@ var _mobileUpload = require("../utils/mobileUpload");
22
22
  var MobileUploadImpl = /*#__PURE__*/function () {
23
23
  function MobileUploadImpl(mediaStore) {
24
24
  (0, _classCallCheck2.default)(this, MobileUploadImpl);
25
- this.mediaStore = mediaStore;
26
25
  this.dataloader = (0, _createFileDataLoader.createFileDataloader)(mediaStore);
27
26
  this.servicesCache = (0, _mobileUpload.createServicesCache)();
28
27
  }
@@ -51,7 +50,7 @@ var MobileUploadImpl = /*#__PURE__*/function () {
51
50
  preview: preview,
52
51
  createdAt: createdAt
53
52
  };
54
- var service = (0, _mobileUpload.createMobileUploadService)((0, _mobileUpload.createMobileUploadStateMachine)(this.dataloader, initialState, collectionName, this.mediaStore.featureFlags));
53
+ var service = (0, _mobileUpload.createMobileUploadService)((0, _mobileUpload.createMobileUploadStateMachine)(this.dataloader, initialState, collectionName));
55
54
  var subject = (0, _mobileUpload.createMobileFileStateSubject)(service);
56
55
  this.servicesCache.put(fileId, service);
57
56
  (0, _fileStreamsCache.getFileStreamsCache)().set(fileId, subject);
package/dist/cjs/index.js CHANGED
@@ -201,6 +201,12 @@ Object.defineProperty(exports, "PollingError", {
201
201
  return _errors2.PollingError;
202
202
  }
203
203
  });
204
+ Object.defineProperty(exports, "imageResizeModeToFileImageMode", {
205
+ enumerable: true,
206
+ get: function get() {
207
+ return _imageResizeModeToFileImageMode.imageResizeModeToFileImageMode;
208
+ }
209
+ });
204
210
  Object.defineProperty(exports, "FileFetcherImpl", {
205
211
  enumerable: true,
206
212
  get: function get() {
@@ -371,6 +377,8 @@ var _polling = require("./utils/polling");
371
377
 
372
378
  var _errors2 = require("./utils/polling/errors");
373
379
 
380
+ var _imageResizeModeToFileImageMode = require("./utils/imageResizeModeToFileImageMode");
381
+
374
382
  var _fileFetcher = require("./client/file-fetcher");
375
383
 
376
384
  var _collectionFetcher = require("./client/collection-fetcher");
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.imageResizeModeToFileImageMode = void 0;
7
+
8
+ var imageResizeModeToFileImageMode = function imageResizeModeToFileImageMode(resizeMode) {
9
+ return resizeMode === 'stretchy-fit' ? 'full-fit' : resizeMode;
10
+ };
11
+
12
+ exports.imageResizeModeToFileImageMode = imageResizeModeToFileImageMode;
@@ -37,9 +37,9 @@ var createMobileFileStateSubject = function createMobileFileStateSubject(service
37
37
 
38
38
  exports.createMobileFileStateSubject = createMobileFileStateSubject;
39
39
 
40
- var createMobileDownloadFileStream = function createMobileDownloadFileStream(dataloader, id, collectionName, occurrenceKey, featureFlags) {
40
+ var createMobileDownloadFileStream = function createMobileDownloadFileStream(dataloader, id, collectionName, occurrenceKey) {
41
41
  var subject = (0, _createFileStateSubject.createFileStateSubject)();
42
- var poll = new _polling.PollingFunction((0, _polling.getPollingOptions)(featureFlags)); // ensure subject errors if polling exceeds max iterations or uncaught exception in executor
42
+ var poll = new _polling.PollingFunction(); // ensure subject errors if polling exceeds max iterations or uncaught exception in executor
43
43
 
44
44
  poll.onError = function (error) {
45
45
  return subject.error(error);
@@ -32,7 +32,7 @@ var _processingFailed = require("./states/processingFailed");
32
32
 
33
33
  var _error = require("./states/error");
34
34
 
35
- var createMobileUploadStateMachine = function createMobileUploadStateMachine(dataloader, initialState, collectionName, featureFlags) {
35
+ var createMobileUploadStateMachine = function createMobileUploadStateMachine(dataloader, initialState, collectionName) {
36
36
  return (0, _xstate.createMachine)({
37
37
  // Initial state
38
38
  initial: initialState.status,
@@ -85,7 +85,7 @@ var createMobileUploadStateMachine = function createMobileUploadStateMachine(dat
85
85
  return shouldFetchRemoteFileStates;
86
86
  }(),
87
87
  fetchRemoteFileStates: function fetchRemoteFileStates(ctx) {
88
- return (0, _helpers.createMobileDownloadFileStream)(dataloader, ctx.currentFileState.id, collectionName, ctx.currentFileState.occurrenceKey, featureFlags).pipe((0, _map.map)(function (fileState) {
88
+ return (0, _helpers.createMobileDownloadFileStream)(dataloader, ctx.currentFileState.id, collectionName, ctx.currentFileState.occurrenceKey).pipe((0, _map.map)(function (fileState) {
89
89
  return {
90
90
  type: 'REMOTE_FILESTATE_RESULT',
91
91
  fileState: fileState
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.PollingFunction = exports.defaultPollingOptions = exports.getPollingOptions = void 0;
8
+ exports.PollingFunction = exports.defaultPollingOptions = void 0;
9
9
 
10
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
11
 
@@ -17,26 +17,19 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
17
17
 
18
18
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
19
19
 
20
- var _mediaFeatureFlags = require("@atlaskit/media-common/mediaFeatureFlags");
21
-
22
20
  var _errors = require("./errors");
23
21
 
24
22
  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; }
25
23
 
26
24
  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) { (0, _defineProperty2.default)(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; }
27
25
 
28
- var getPollingOptions = function getPollingOptions(featureFlags) {
29
- return {
30
- poll_intervalMs: (0, _mediaFeatureFlags.getMediaFeatureFlag)('poll_intervalMs', featureFlags),
31
- poll_maxAttempts: (0, _mediaFeatureFlags.getMediaFeatureFlag)('poll_maxAttempts', featureFlags),
32
- poll_backoffFactor: (0, _mediaFeatureFlags.getMediaFeatureFlag)('poll_backoffFactor', featureFlags),
33
- poll_maxIntervalMs: (0, _mediaFeatureFlags.getMediaFeatureFlag)('poll_maxIntervalMs', featureFlags)
34
- };
35
- }; // default polling options without using feature flags
36
-
37
-
38
- exports.getPollingOptions = getPollingOptions;
39
- var defaultPollingOptions = getPollingOptions(undefined);
26
+ // default polling options without using feature flags
27
+ var defaultPollingOptions = {
28
+ poll_intervalMs: 3000,
29
+ poll_maxAttempts: 30,
30
+ poll_backoffFactor: 1.25,
31
+ poll_maxIntervalMs: 200000
32
+ };
40
33
  /**
41
34
  * This class encapsulates polling functionality with the following features:
42
35
  *
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "14.2.0",
3
+ "version": "14.3.0",
4
4
  "sideEffects": false
5
5
  }
@@ -26,14 +26,14 @@ import { getDimensionsFromBlob } from '../../utils/getDimensionsFromBlob';
26
26
  import { createFileStateSubject } from '../../utils/createFileStateSubject';
27
27
  import { isMimeTypeSupportedByBrowser, getMediaTypeFromMimeType } from '@atlaskit/media-common/mediaTypeUtils';
28
28
  import { shouldFetchRemoteFileStates, shouldFetchRemoteFileStatesObservable } from '../../utils/shouldFetchRemoteFileStates';
29
- import { getPollingOptions, PollingFunction } from '../../utils/polling';
29
+ import { PollingFunction } from '../../utils/polling';
30
30
  import { isEmptyFile } from '../../utils/detectEmptyFile';
31
31
  export { isFileFetcherError, FileFetcherError } from './error';
32
32
  export class FileFetcherImpl {
33
33
  constructor(mediaStore) {
34
34
  _defineProperty(this, "createDownloadFileStream", (id, collectionName, occurrenceKey) => {
35
35
  const subject = createFileStateSubject();
36
- const poll = new PollingFunction(getPollingOptions(this.mediaStore.featureFlags)); // ensure subject errors if polling exceeds max iterations or uncaught exception in executor
36
+ const poll = new PollingFunction(); // ensure subject errors if polling exceeds max iterations or uncaught exception in executor
37
37
 
38
38
  poll.onError = error => subject.error(error);
39
39
 
@@ -4,7 +4,6 @@ import { createFileDataloader } from '../utils/createFileDataLoader';
4
4
  import { createServicesCache, createMobileUploadStateMachine, createMobileUploadService, createMobileFileStateSubject } from '../utils/mobileUpload';
5
5
  export class MobileUploadImpl {
6
6
  constructor(mediaStore) {
7
- this.mediaStore = mediaStore;
8
7
  this.dataloader = createFileDataloader(mediaStore);
9
8
  this.servicesCache = createServicesCache();
10
9
  }
@@ -33,7 +32,7 @@ export class MobileUploadImpl {
33
32
  preview,
34
33
  createdAt
35
34
  };
36
- const service = createMobileUploadService(createMobileUploadStateMachine(this.dataloader, initialState, collectionName, this.mediaStore.featureFlags));
35
+ const service = createMobileUploadService(createMobileUploadStateMachine(this.dataloader, initialState, collectionName));
37
36
  const subject = createMobileFileStateSubject(service);
38
37
  this.servicesCache.put(fileId, service);
39
38
  getFileStreamsCache().set(fileId, subject);
@@ -10,6 +10,7 @@ export { request, RequestError, isRequestError, isRateLimitedError } from './uti
10
10
  export { isAbortedRequestError, mapResponseToJson, mapResponseToBlob, mapResponseToVoid, createUrl } from './utils/request/helpers';
11
11
  export { PollingFunction } from './utils/polling';
12
12
  export { isPollingError, PollingError } from './utils/polling/errors';
13
+ export { imageResizeModeToFileImageMode } from './utils/imageResizeModeToFileImageMode';
13
14
  export { FileFetcherImpl, FileFetcherError, isFileFetcherError } from './client/file-fetcher';
14
15
  export { CollectionFetcher } from './client/collection-fetcher';
15
16
  export { MediaClient } from './client/media-client';
@@ -0,0 +1 @@
1
+ export const imageResizeModeToFileImageMode = resizeMode => resizeMode === 'stretchy-fit' ? 'full-fit' : resizeMode;
@@ -4,16 +4,16 @@ import { map } from 'rxjs/operators/map';
4
4
  import { mapMediaItemToFileState } from '../../models/file-state';
5
5
  import { createFileStateSubject } from '../createFileStateSubject';
6
6
  import { isEmptyFile } from '../detectEmptyFile';
7
- import { getPollingOptions, PollingFunction } from '../polling';
7
+ import { PollingFunction } from '../polling';
8
8
  import { MobileUploadError } from './error';
9
9
  export const createMobileFileStateSubject = service => {
10
10
  const subject = new ReplaySubject(1);
11
11
  from(service.start()).pipe(map(state => state.context.currentFileState)).subscribe(subject);
12
12
  return subject;
13
13
  };
14
- export const createMobileDownloadFileStream = (dataloader, id, collectionName, occurrenceKey, featureFlags) => {
14
+ export const createMobileDownloadFileStream = (dataloader, id, collectionName, occurrenceKey) => {
15
15
  const subject = createFileStateSubject();
16
- const poll = new PollingFunction(getPollingOptions(featureFlags)); // ensure subject errors if polling exceeds max iterations or uncaught exception in executor
16
+ const poll = new PollingFunction(); // ensure subject errors if polling exceeds max iterations or uncaught exception in executor
17
17
 
18
18
  poll.onError = error => subject.error(error);
19
19
 
@@ -8,7 +8,7 @@ import { machineProcessingState } from './states/processing';
8
8
  import { machineProcessedState } from './states/processed';
9
9
  import { machineProcessingFailedState } from './states/processingFailed';
10
10
  import { machineErrorState } from './states/error';
11
- export const createMobileUploadStateMachine = (dataloader, initialState, collectionName, featureFlags) => createMachine({
11
+ export const createMobileUploadStateMachine = (dataloader, initialState, collectionName) => createMachine({
12
12
  // Initial state
13
13
  initial: initialState.status,
14
14
  // Context
@@ -41,7 +41,7 @@ export const createMobileUploadStateMachine = (dataloader, initialState, collect
41
41
 
42
42
  return false;
43
43
  },
44
- fetchRemoteFileStates: ctx => createMobileDownloadFileStream(dataloader, ctx.currentFileState.id, collectionName, ctx.currentFileState.occurrenceKey, featureFlags).pipe(map(fileState => ({
44
+ fetchRemoteFileStates: ctx => createMobileDownloadFileStream(dataloader, ctx.currentFileState.id, collectionName, ctx.currentFileState.occurrenceKey).pipe(map(fileState => ({
45
45
  type: 'REMOTE_FILESTATE_RESULT',
46
46
  fileState
47
47
  })))
@@ -1,14 +1,12 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import { getMediaFeatureFlag } from '@atlaskit/media-common/mediaFeatureFlags';
3
2
  import { PollingError } from './errors';
4
- export const getPollingOptions = featureFlags => ({
5
- poll_intervalMs: getMediaFeatureFlag('poll_intervalMs', featureFlags),
6
- poll_maxAttempts: getMediaFeatureFlag('poll_maxAttempts', featureFlags),
7
- poll_backoffFactor: getMediaFeatureFlag('poll_backoffFactor', featureFlags),
8
- poll_maxIntervalMs: getMediaFeatureFlag('poll_maxIntervalMs', featureFlags)
9
- }); // default polling options without using feature flags
10
-
11
- export const defaultPollingOptions = getPollingOptions(undefined);
3
+ // default polling options without using feature flags
4
+ export const defaultPollingOptions = {
5
+ poll_intervalMs: 3000,
6
+ poll_maxAttempts: 30,
7
+ poll_backoffFactor: 1.25,
8
+ poll_maxIntervalMs: 200000
9
+ };
12
10
  /**
13
11
  * This class encapsulates polling functionality with the following features:
14
12
  *
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "14.2.0",
3
+ "version": "14.3.0",
4
4
  "sideEffects": false
5
5
  }
@@ -35,7 +35,7 @@ import { getDimensionsFromBlob } from '../../utils/getDimensionsFromBlob';
35
35
  import { createFileStateSubject } from '../../utils/createFileStateSubject';
36
36
  import { isMimeTypeSupportedByBrowser, getMediaTypeFromMimeType } from '@atlaskit/media-common/mediaTypeUtils';
37
37
  import { shouldFetchRemoteFileStates, shouldFetchRemoteFileStatesObservable } from '../../utils/shouldFetchRemoteFileStates';
38
- import { getPollingOptions, PollingFunction } from '../../utils/polling';
38
+ import { PollingFunction } from '../../utils/polling';
39
39
  import { isEmptyFile } from '../../utils/detectEmptyFile';
40
40
  export { isFileFetcherError, FileFetcherError } from './error';
41
41
  export var FileFetcherImpl = /*#__PURE__*/function () {
@@ -46,7 +46,7 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
46
46
 
47
47
  _defineProperty(this, "createDownloadFileStream", function (id, collectionName, occurrenceKey) {
48
48
  var subject = createFileStateSubject();
49
- var poll = new PollingFunction(getPollingOptions(_this.mediaStore.featureFlags)); // ensure subject errors if polling exceeds max iterations or uncaught exception in executor
49
+ var poll = new PollingFunction(); // ensure subject errors if polling exceeds max iterations or uncaught exception in executor
50
50
 
51
51
  poll.onError = function (error) {
52
52
  return subject.error(error);
@@ -8,7 +8,6 @@ export var MobileUploadImpl = /*#__PURE__*/function () {
8
8
  function MobileUploadImpl(mediaStore) {
9
9
  _classCallCheck(this, MobileUploadImpl);
10
10
 
11
- this.mediaStore = mediaStore;
12
11
  this.dataloader = createFileDataloader(mediaStore);
13
12
  this.servicesCache = createServicesCache();
14
13
  }
@@ -37,7 +36,7 @@ export var MobileUploadImpl = /*#__PURE__*/function () {
37
36
  preview: preview,
38
37
  createdAt: createdAt
39
38
  };
40
- var service = createMobileUploadService(createMobileUploadStateMachine(this.dataloader, initialState, collectionName, this.mediaStore.featureFlags));
39
+ var service = createMobileUploadService(createMobileUploadStateMachine(this.dataloader, initialState, collectionName));
41
40
  var subject = createMobileFileStateSubject(service);
42
41
  this.servicesCache.put(fileId, service);
43
42
  getFileStreamsCache().set(fileId, subject);
package/dist/esm/index.js CHANGED
@@ -10,6 +10,7 @@ export { request, RequestError, isRequestError, isRateLimitedError } from './uti
10
10
  export { isAbortedRequestError, mapResponseToJson, mapResponseToBlob, mapResponseToVoid, createUrl } from './utils/request/helpers';
11
11
  export { PollingFunction } from './utils/polling';
12
12
  export { isPollingError, PollingError } from './utils/polling/errors';
13
+ export { imageResizeModeToFileImageMode } from './utils/imageResizeModeToFileImageMode';
13
14
  export { FileFetcherImpl, FileFetcherError, isFileFetcherError } from './client/file-fetcher';
14
15
  export { CollectionFetcher } from './client/collection-fetcher';
15
16
  export { MediaClient } from './client/media-client';
@@ -0,0 +1,3 @@
1
+ export var imageResizeModeToFileImageMode = function imageResizeModeToFileImageMode(resizeMode) {
2
+ return resizeMode === 'stretchy-fit' ? 'full-fit' : resizeMode;
3
+ };
@@ -6,7 +6,7 @@ import { map } from 'rxjs/operators/map';
6
6
  import { mapMediaItemToFileState } from '../../models/file-state';
7
7
  import { createFileStateSubject } from '../createFileStateSubject';
8
8
  import { isEmptyFile } from '../detectEmptyFile';
9
- import { getPollingOptions, PollingFunction } from '../polling';
9
+ import { PollingFunction } from '../polling';
10
10
  import { MobileUploadError } from './error';
11
11
  export var createMobileFileStateSubject = function createMobileFileStateSubject(service) {
12
12
  var subject = new ReplaySubject(1);
@@ -15,9 +15,9 @@ export var createMobileFileStateSubject = function createMobileFileStateSubject(
15
15
  })).subscribe(subject);
16
16
  return subject;
17
17
  };
18
- export var createMobileDownloadFileStream = function createMobileDownloadFileStream(dataloader, id, collectionName, occurrenceKey, featureFlags) {
18
+ export var createMobileDownloadFileStream = function createMobileDownloadFileStream(dataloader, id, collectionName, occurrenceKey) {
19
19
  var subject = createFileStateSubject();
20
- var poll = new PollingFunction(getPollingOptions(featureFlags)); // ensure subject errors if polling exceeds max iterations or uncaught exception in executor
20
+ var poll = new PollingFunction(); // ensure subject errors if polling exceeds max iterations or uncaught exception in executor
21
21
 
22
22
  poll.onError = function (error) {
23
23
  return subject.error(error);
@@ -10,7 +10,7 @@ import { machineProcessingState } from './states/processing';
10
10
  import { machineProcessedState } from './states/processed';
11
11
  import { machineProcessingFailedState } from './states/processingFailed';
12
12
  import { machineErrorState } from './states/error';
13
- export var createMobileUploadStateMachine = function createMobileUploadStateMachine(dataloader, initialState, collectionName, featureFlags) {
13
+ export var createMobileUploadStateMachine = function createMobileUploadStateMachine(dataloader, initialState, collectionName) {
14
14
  return createMachine({
15
15
  // Initial state
16
16
  initial: initialState.status,
@@ -63,7 +63,7 @@ export var createMobileUploadStateMachine = function createMobileUploadStateMach
63
63
  return shouldFetchRemoteFileStates;
64
64
  }(),
65
65
  fetchRemoteFileStates: function fetchRemoteFileStates(ctx) {
66
- return createMobileDownloadFileStream(dataloader, ctx.currentFileState.id, collectionName, ctx.currentFileState.occurrenceKey, featureFlags).pipe(map(function (fileState) {
66
+ return createMobileDownloadFileStream(dataloader, ctx.currentFileState.id, collectionName, ctx.currentFileState.occurrenceKey).pipe(map(function (fileState) {
67
67
  return {
68
68
  type: 'REMOTE_FILESTATE_RESULT',
69
69
  fileState: fileState
@@ -8,18 +8,14 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
8
8
 
9
9
  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; }
10
10
 
11
- import { getMediaFeatureFlag } from '@atlaskit/media-common/mediaFeatureFlags';
12
11
  import { PollingError } from './errors';
13
- export var getPollingOptions = function getPollingOptions(featureFlags) {
14
- return {
15
- poll_intervalMs: getMediaFeatureFlag('poll_intervalMs', featureFlags),
16
- poll_maxAttempts: getMediaFeatureFlag('poll_maxAttempts', featureFlags),
17
- poll_backoffFactor: getMediaFeatureFlag('poll_backoffFactor', featureFlags),
18
- poll_maxIntervalMs: getMediaFeatureFlag('poll_maxIntervalMs', featureFlags)
19
- };
20
- }; // default polling options without using feature flags
21
-
22
- export var defaultPollingOptions = getPollingOptions(undefined);
12
+ // default polling options without using feature flags
13
+ export var defaultPollingOptions = {
14
+ poll_intervalMs: 3000,
15
+ poll_maxAttempts: 30,
16
+ poll_backoffFactor: 1.25,
17
+ poll_maxIntervalMs: 200000
18
+ };
23
19
  /**
24
20
  * This class encapsulates polling functionality with the following features:
25
21
  *
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "14.2.0",
3
+ "version": "14.3.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,7 +1,6 @@
1
1
  import { MobileUpload, MobileUploadStartEvent, MobileUploadProgressEvent, MobileUploadEndEvent, MobileUploadErrorEvent } from '../models/mobile-upload';
2
2
  import { MediaStore } from './media-store';
3
3
  export declare class MobileUploadImpl implements MobileUpload {
4
- private readonly mediaStore;
5
4
  private readonly dataloader;
6
5
  private readonly servicesCache;
7
6
  constructor(mediaStore: MediaStore);
@@ -22,7 +22,8 @@ export { PollingFunction } from './utils/polling';
22
22
  export { isPollingError, PollingError } from './utils/polling/errors';
23
23
  export type { Executor, PollingErrorAttributes, PollingErrorReason, } from './utils/polling/types';
24
24
  export type { RequestMethod, RequestParams, RequestHeaders, RetryOptions, ClientOptions, RequestMetadata, RequestOptions, CreateUrlOptions, } from './utils/request/types';
25
- export declare type ImageResizeMode = 'crop' | 'fit' | 'full-fit' | 'stretchy-fit';
25
+ export type { ImageResizeMode } from './utils/imageResizeModeToFileImageMode';
26
+ export { imageResizeModeToFileImageMode } from './utils/imageResizeModeToFileImageMode';
26
27
  export { FileFetcherImpl, FileFetcherError, isFileFetcherError, } from './client/file-fetcher';
27
28
  export type { CopySourceFile, CopyDestination, CopyFileOptions, FileFetcher, FileFetcherErrorAttributes, FileFetcherErrorReason, } from './client/file-fetcher';
28
29
  export { CollectionFetcher } from './client/collection-fetcher';
@@ -0,0 +1,3 @@
1
+ import { MediaStoreGetFileImageParams } from '../client/media-store';
2
+ export declare type ImageResizeMode = 'crop' | 'fit' | 'full-fit' | 'stretchy-fit';
3
+ export declare const imageResizeModeToFileImageMode: (resizeMode?: "crop" | "fit" | "full-fit" | "stretchy-fit" | undefined) => MediaStoreGetFileImageParams['mode'];
@@ -1,4 +1,3 @@
1
- import { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
2
1
  import Dataloader from 'dataloader';
3
2
  import { ReplaySubject } from 'rxjs/ReplaySubject';
4
3
  import { Interpreter } from 'xstate';
@@ -6,4 +5,4 @@ import { FileState } from '../../models/file-state';
6
5
  import { DataloaderKey, DataloaderResult } from '../createFileDataLoader';
7
6
  import { StateMachineContext, StateMachineEvent, StateMachineTypestate } from './stateMachine/types';
8
7
  export declare const createMobileFileStateSubject: (service: Interpreter<StateMachineContext, any, StateMachineEvent, StateMachineTypestate>) => ReplaySubject<FileState>;
9
- export declare const createMobileDownloadFileStream: (dataloader: Dataloader<DataloaderKey, DataloaderResult>, id: string, collectionName?: string | undefined, occurrenceKey?: string | undefined, featureFlags?: MediaFeatureFlags | undefined) => ReplaySubject<FileState>;
8
+ export declare const createMobileDownloadFileStream: (dataloader: Dataloader<DataloaderKey, DataloaderResult>, id: string, collectionName?: string | undefined, occurrenceKey?: string | undefined) => ReplaySubject<FileState>;
@@ -1,8 +1,7 @@
1
- import { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
2
1
  import DataLoader from 'dataloader';
3
2
  import { Interpreter, StateMachine } from 'xstate';
4
3
  import { UploadingFileState } from '../../../models/file-state';
5
4
  import { DataloaderKey, DataloaderResult } from '../../createFileDataLoader';
6
5
  import { StateMachineContext, StateMachineEvent, StateMachineSchema, StateMachineTypestate } from './types';
7
- export declare const createMobileUploadStateMachine: (dataloader: DataLoader<DataloaderKey, DataloaderResult>, initialState: UploadingFileState, collectionName?: string | undefined, featureFlags?: MediaFeatureFlags | undefined) => StateMachine<StateMachineContext, any, StateMachineEvent, StateMachineTypestate>;
6
+ export declare const createMobileUploadStateMachine: (dataloader: DataLoader<DataloaderKey, DataloaderResult>, initialState: UploadingFileState, collectionName?: string | undefined) => StateMachine<StateMachineContext, any, StateMachineEvent, StateMachineTypestate>;
8
7
  export declare function createMobileUploadService(machine: StateMachine<StateMachineContext, StateMachineSchema, StateMachineEvent, StateMachineTypestate>): Interpreter<StateMachineContext, StateMachineSchema, StateMachineEvent, StateMachineTypestate>;
@@ -1,7 +1,11 @@
1
- import { MediaFeatureFlags, PollingOptions } from '@atlaskit/media-common/mediaFeatureFlags';
2
1
  import { Executor } from './types';
3
- export declare const getPollingOptions: (featureFlags?: MediaFeatureFlags | undefined) => Required<PollingOptions>;
4
- export declare const defaultPollingOptions: Required<PollingOptions>;
2
+ export interface PollingOptions {
3
+ poll_intervalMs: number;
4
+ poll_maxAttempts: number;
5
+ poll_backoffFactor: number;
6
+ poll_maxIntervalMs: number;
7
+ }
8
+ export declare const defaultPollingOptions: PollingOptions;
5
9
  /**
6
10
  * This class encapsulates polling functionality with the following features:
7
11
  *
@@ -14,7 +18,7 @@ export declare const defaultPollingOptions: Required<PollingOptions>;
14
18
  * IMPORTANT! the executor function must explicitly call ".next()" for the next iteration to run
15
19
  */
16
20
  export declare class PollingFunction {
17
- options: Required<PollingOptions>;
21
+ options: PollingOptions;
18
22
  poll_intervalMs: number;
19
23
  attempt: number;
20
24
  shouldIterate: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "14.2.0",
3
+ "version": "14.3.0",
4
4
  "description": "Media API Web Client Library",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -51,9 +51,9 @@
51
51
  "@atlaskit/build-utils": "*",
52
52
  "@atlaskit/button": "^16.1.0",
53
53
  "@atlaskit/docs": "*",
54
- "@atlaskit/media-card": "^70.11.0",
54
+ "@atlaskit/media-card": "^72.0.0",
55
55
  "@atlaskit/media-core": "^32.2.0",
56
- "@atlaskit/media-test-helpers": "^28.7.0",
56
+ "@atlaskit/media-test-helpers": "^28.8.0",
57
57
  "@atlaskit/ssr": "*",
58
58
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
59
59
  "@types/deep-equal": "^1.0.1",