@atlaskit/media-client 33.4.1 → 34.0.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,26 @@
1
1
  # @atlaskit/media-client
2
2
 
3
+ ## 34.0.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#169011](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/169011)
8
+ [`93d6ca5689e75`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/93d6ca5689e75) -
9
+ Sending collection as query parameter during captions upload
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 33.5.0
16
+
17
+ ### Minor Changes
18
+
19
+ - [#172332](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/172332)
20
+ [`d257b57972216`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d257b57972216) -
21
+ Updating the response type of document content endpoint to add the new annotation and links from
22
+ documents
23
+
3
24
  ## 33.4.1
4
25
 
5
26
  ### Patch Changes
@@ -95,7 +95,8 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
95
95
  'Content-Type': file.type
96
96
  };
97
97
  extendedParams = _objectSpread(_objectSpread({}, params), {}, {
98
- name: file.name
98
+ name: file.name,
99
+ collection: collectionName
99
100
  });
100
101
  authContext = {
101
102
  collectionName: collectionName,
@@ -665,26 +666,28 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
665
666
  key: "getDocumentContent",
666
667
  value: function () {
667
668
  var _getDocumentContent = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(id, options) {
668
- var metadata, requestOptions;
669
+ var endpoint, metadata, requestOptions;
669
670
  return _regenerator.default.wrap(function _callee12$(_context12) {
670
671
  while (1) switch (_context12.prev = _context12.next) {
671
672
  case 0:
673
+ endpoint = cdnFeatureFlag('contents');
672
674
  metadata = {
673
675
  method: 'GET',
674
- endpoint: '/file/{fileId}/document/contents'
676
+ endpoint: "/file/{fileId}/document/".concat(endpoint)
675
677
  };
676
678
  requestOptions = _objectSpread(_objectSpread({}, metadata), {}, {
677
679
  authContext: {
678
680
  collectionName: options.collectionName
679
681
  },
680
682
  params: {
683
+ collection: options.collectionName,
681
684
  pageStart: options.pageStart,
682
685
  pageEnd: options.pageEnd,
683
686
  'max-age': _constants.FILE_CACHE_MAX_AGE
684
687
  }
685
688
  });
686
- return _context12.abrupt("return", this.request("/file/".concat(id, "/document/contents"), requestOptions).then((0, _helpers.createMapResponseToJson)(metadata)));
687
- case 3:
689
+ return _context12.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then((0, _helpers.createMapResponseToJson)(metadata)));
690
+ case 4:
688
691
  case "end":
689
692
  return _context12.stop();
690
693
  }
@@ -703,6 +706,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
703
706
  return _regenerator.default.wrap(function _callee13$(_context13) {
704
707
  while (1) switch (_context13.prev = _context13.next) {
705
708
  case 0:
709
+ // Temporarily disabling CDN for document due to bug of CDN not forwarding query params
706
710
  endpoint = cdnFeatureFlag('page');
707
711
  metadata = {
708
712
  method: 'GET',
@@ -713,6 +717,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
713
717
  collectionName: options.collectionName
714
718
  },
715
719
  params: {
720
+ collection: options.collectionName,
716
721
  page: options.page,
717
722
  zoom: options.zoom,
718
723
  'max-age': _constants.FILE_CACHE_MAX_AGE
@@ -66,7 +66,8 @@ export class MediaStore {
66
66
  };
67
67
  const extendedParams = {
68
68
  ...params,
69
- name: file.name
69
+ name: file.name,
70
+ collection: collectionName
70
71
  };
71
72
  const authContext = {
72
73
  collectionName,
@@ -395,9 +396,10 @@ export class MediaStore {
395
396
  return this.request(`/file/${id}/image/metadata`, options).then(createMapResponseToJson(metadata));
396
397
  }
397
398
  async getDocumentContent(id, options) {
399
+ const endpoint = cdnFeatureFlag('contents');
398
400
  const metadata = {
399
401
  method: 'GET',
400
- endpoint: '/file/{fileId}/document/contents'
402
+ endpoint: `/file/{fileId}/document/${endpoint}`
401
403
  };
402
404
  const requestOptions = {
403
405
  ...metadata,
@@ -405,14 +407,16 @@ export class MediaStore {
405
407
  collectionName: options.collectionName
406
408
  },
407
409
  params: {
410
+ collection: options.collectionName,
408
411
  pageStart: options.pageStart,
409
412
  pageEnd: options.pageEnd,
410
413
  'max-age': FILE_CACHE_MAX_AGE
411
414
  }
412
415
  };
413
- return this.request(`/file/${id}/document/contents`, requestOptions).then(createMapResponseToJson(metadata));
416
+ return this.request(`/file/${id}/document/${endpoint}`, requestOptions).then(createMapResponseToJson(metadata));
414
417
  }
415
418
  async getDocumentPageImage(id, options) {
419
+ // Temporarily disabling CDN for document due to bug of CDN not forwarding query params
416
420
  const endpoint = cdnFeatureFlag('page');
417
421
  const metadata = {
418
422
  method: 'GET',
@@ -424,6 +428,7 @@ export class MediaStore {
424
428
  collectionName: options.collectionName
425
429
  },
426
430
  params: {
431
+ collection: options.collectionName,
427
432
  page: options.page,
428
433
  zoom: options.zoom,
429
434
  'max-age': FILE_CACHE_MAX_AGE
@@ -89,7 +89,8 @@ export var MediaStore = /*#__PURE__*/function () {
89
89
  'Content-Type': file.type
90
90
  };
91
91
  extendedParams = _objectSpread(_objectSpread({}, params), {}, {
92
- name: file.name
92
+ name: file.name,
93
+ collection: collectionName
93
94
  });
94
95
  authContext = {
95
96
  collectionName: collectionName,
@@ -659,26 +660,28 @@ export var MediaStore = /*#__PURE__*/function () {
659
660
  key: "getDocumentContent",
660
661
  value: function () {
661
662
  var _getDocumentContent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(id, options) {
662
- var metadata, requestOptions;
663
+ var endpoint, metadata, requestOptions;
663
664
  return _regeneratorRuntime.wrap(function _callee12$(_context12) {
664
665
  while (1) switch (_context12.prev = _context12.next) {
665
666
  case 0:
667
+ endpoint = cdnFeatureFlag('contents');
666
668
  metadata = {
667
669
  method: 'GET',
668
- endpoint: '/file/{fileId}/document/contents'
670
+ endpoint: "/file/{fileId}/document/".concat(endpoint)
669
671
  };
670
672
  requestOptions = _objectSpread(_objectSpread({}, metadata), {}, {
671
673
  authContext: {
672
674
  collectionName: options.collectionName
673
675
  },
674
676
  params: {
677
+ collection: options.collectionName,
675
678
  pageStart: options.pageStart,
676
679
  pageEnd: options.pageEnd,
677
680
  'max-age': FILE_CACHE_MAX_AGE
678
681
  }
679
682
  });
680
- return _context12.abrupt("return", this.request("/file/".concat(id, "/document/contents"), requestOptions).then(createMapResponseToJson(metadata)));
681
- case 3:
683
+ return _context12.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then(createMapResponseToJson(metadata)));
684
+ case 4:
682
685
  case "end":
683
686
  return _context12.stop();
684
687
  }
@@ -697,6 +700,7 @@ export var MediaStore = /*#__PURE__*/function () {
697
700
  return _regeneratorRuntime.wrap(function _callee13$(_context13) {
698
701
  while (1) switch (_context13.prev = _context13.next) {
699
702
  case 0:
703
+ // Temporarily disabling CDN for document due to bug of CDN not forwarding query params
700
704
  endpoint = cdnFeatureFlag('page');
701
705
  metadata = {
702
706
  method: 'GET',
@@ -707,6 +711,7 @@ export var MediaStore = /*#__PURE__*/function () {
707
711
  collectionName: options.collectionName
708
712
  },
709
713
  params: {
714
+ collection: options.collectionName,
710
715
  page: options.page,
711
716
  zoom: options.zoom,
712
717
  'max-age': FILE_CACHE_MAX_AGE
@@ -27,11 +27,48 @@ export type Line = {
27
27
  r: number;
28
28
  spans: readonly Span[];
29
29
  };
30
+ export type DocumentAnnotations = {
31
+ text_form_fields: readonly TextField[];
32
+ combobox_form_fields: readonly ComboBoxField[];
33
+ };
34
+ export type TextField = {
35
+ x: number;
36
+ y: number;
37
+ w: number;
38
+ h: number;
39
+ f: number;
40
+ text: string;
41
+ };
42
+ export type ComboBoxField = {
43
+ x: number;
44
+ y: number;
45
+ w: number;
46
+ h: number;
47
+ f: number;
48
+ text: string;
49
+ };
50
+ export type DocumentLink = {
51
+ type: 'uri';
52
+ dest: string;
53
+ x: number;
54
+ y: number;
55
+ w: number;
56
+ h: number;
57
+ } | {
58
+ type: 'local';
59
+ p_num: number;
60
+ x: number;
61
+ y: number;
62
+ w: number;
63
+ h: number;
64
+ };
30
65
  export type DocumentPageContent = {
31
66
  rotation: number;
32
67
  width: number;
33
68
  height: number;
34
69
  lines: readonly Line[];
70
+ annotations: DocumentAnnotations;
71
+ links: readonly DocumentLink[];
35
72
  };
36
73
  export type DocumentPageRangeContent = {
37
74
  total_pages: number;
@@ -27,11 +27,48 @@ export type Line = {
27
27
  r: number;
28
28
  spans: readonly Span[];
29
29
  };
30
+ export type DocumentAnnotations = {
31
+ text_form_fields: readonly TextField[];
32
+ combobox_form_fields: readonly ComboBoxField[];
33
+ };
34
+ export type TextField = {
35
+ x: number;
36
+ y: number;
37
+ w: number;
38
+ h: number;
39
+ f: number;
40
+ text: string;
41
+ };
42
+ export type ComboBoxField = {
43
+ x: number;
44
+ y: number;
45
+ w: number;
46
+ h: number;
47
+ f: number;
48
+ text: string;
49
+ };
50
+ export type DocumentLink = {
51
+ type: 'uri';
52
+ dest: string;
53
+ x: number;
54
+ y: number;
55
+ w: number;
56
+ h: number;
57
+ } | {
58
+ type: 'local';
59
+ p_num: number;
60
+ x: number;
61
+ y: number;
62
+ w: number;
63
+ h: number;
64
+ };
30
65
  export type DocumentPageContent = {
31
66
  rotation: number;
32
67
  width: number;
33
68
  height: number;
34
69
  lines: readonly Line[];
70
+ annotations: DocumentAnnotations;
71
+ links: readonly DocumentLink[];
35
72
  };
36
73
  export type DocumentPageRangeContent = {
37
74
  total_pages: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "33.4.1",
3
+ "version": "34.0.0",
4
4
  "description": "Media API Web Client Library",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -50,11 +50,11 @@
50
50
  "xstate": "4.20.0"
51
51
  },
52
52
  "peerDependencies": {
53
- "@atlaskit/media-core": "^36.1.0",
53
+ "@atlaskit/media-core": "^37.0.0",
54
54
  "@atlaskit/media-state": "^1.6.0"
55
55
  },
56
56
  "devDependencies": {
57
- "@atlaskit/media-core": "^36.1.0",
57
+ "@atlaskit/media-core": "^37.0.0",
58
58
  "@atlaskit/media-state": "^1.6.0",
59
59
  "@atlaskit/ssr": "workspace:^",
60
60
  "@atlaskit/tokens": "^5.2.0",