@atlaskit/media-client 39.2.7 → 39.3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @atlaskit/media-client
2
2
 
3
+ ## 39.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 39.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`c570c6f9b75f7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c570c6f9b75f7) -
14
+ `getImage` takes an optional `clientOptions` argument after `traceContext`, so a caller can set
15
+ retry options for one request. `preloadMediaViewer` uses it to make a single attempt.
16
+ - [`c570c6f9b75f7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c570c6f9b75f7) -
17
+ Add `getImageWatermarkVersion(collectionName)` to `MediaClient`. It resolves the watermark version
18
+ `getImage` sends as `wmv`, or `undefined` when it sends none, so a caller that reuses an image
19
+ fetched earlier can tell whether the watermark config has changed since. `preloadMediaViewer` uses
20
+ it to key its warm-ups.
21
+ - [`c570c6f9b75f7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c570c6f9b75f7) -
22
+ Add `is-file-identifier`, `is-error-file-state` and `is-image-representation-ready` subpath
23
+ exports for `isFileIdentifier`, `isErrorFileState` and `isImageRepresentationReady`, so consumers
24
+ can import them without the package barrel.
25
+
3
26
  ## 39.2.7
4
27
 
5
28
  ### Patch Changes
@@ -50,8 +50,8 @@ var MediaClient = exports.MediaClient = /*#__PURE__*/function () {
50
50
  }
51
51
  }, {
52
52
  key: "getImage",
53
- value: function getImage(id, params, controller, fetchMaxRes, traceContext) {
54
- return this.mediaStore.getImage(id, params, controller, fetchMaxRes, traceContext);
53
+ value: function getImage(id, params, controller, fetchMaxRes, traceContext, clientOptions) {
54
+ return this.mediaStore.getImage(id, params, controller, fetchMaxRes, traceContext, clientOptions);
55
55
  }
56
56
  }, {
57
57
  key: "getImageUrl",
@@ -88,23 +88,42 @@ var MediaClient = exports.MediaClient = /*#__PURE__*/function () {
88
88
  return this.mediaStore.getClientIdSync();
89
89
  }
90
90
  }, {
91
- key: "getImageMetadata",
91
+ key: "getImageWatermarkVersion",
92
92
  value: function () {
93
- var _getImageMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(id, params) {
93
+ var _getImageWatermarkVersion = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(collectionName) {
94
94
  return _regenerator.default.wrap(function (_context2) {
95
95
  while (1) switch (_context2.prev = _context2.next) {
96
96
  case 0:
97
- _context2.next = 1;
98
- return this.mediaStore.getImageMetadata(id, params);
97
+ return _context2.abrupt("return", this.mediaStore.getImageWatermarkVersion(collectionName));
99
98
  case 1:
100
- return _context2.abrupt("return", _context2.sent.metadata);
101
- case 2:
102
99
  case "end":
103
100
  return _context2.stop();
104
101
  }
105
102
  }, _callee2, this);
106
103
  }));
107
- function getImageMetadata(_x2, _x3) {
104
+ function getImageWatermarkVersion(_x2) {
105
+ return _getImageWatermarkVersion.apply(this, arguments);
106
+ }
107
+ return getImageWatermarkVersion;
108
+ }()
109
+ }, {
110
+ key: "getImageMetadata",
111
+ value: function () {
112
+ var _getImageMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(id, params) {
113
+ return _regenerator.default.wrap(function (_context3) {
114
+ while (1) switch (_context3.prev = _context3.next) {
115
+ case 0:
116
+ _context3.next = 1;
117
+ return this.mediaStore.getImageMetadata(id, params);
118
+ case 1:
119
+ return _context3.abrupt("return", _context3.sent.metadata);
120
+ case 2:
121
+ case "end":
122
+ return _context3.stop();
123
+ }
124
+ }, _callee3, this);
125
+ }));
126
+ function getImageMetadata(_x3, _x4) {
108
127
  return _getImageMetadata.apply(this, arguments);
109
128
  }
110
129
  return getImageMetadata;
@@ -112,30 +131,30 @@ var MediaClient = exports.MediaClient = /*#__PURE__*/function () {
112
131
  }, {
113
132
  key: "mobileUploadPromise",
114
133
  value: function () {
115
- var _mobileUploadPromise = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
134
+ var _mobileUploadPromise = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
116
135
  var module;
117
- return _regenerator.default.wrap(function (_context3) {
118
- while (1) switch (_context3.prev = _context3.next) {
136
+ return _regenerator.default.wrap(function (_context4) {
137
+ while (1) switch (_context4.prev = _context4.next) {
119
138
  case 0:
120
139
  if (!this.mobileUpload) {
121
- _context3.next = 1;
140
+ _context4.next = 1;
122
141
  break;
123
142
  }
124
- return _context3.abrupt("return", this.mobileUpload);
143
+ return _context4.abrupt("return", this.mobileUpload);
125
144
  case 1:
126
- _context3.next = 2;
145
+ _context4.next = 2;
127
146
  return Promise.resolve().then(function () {
128
147
  return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_media-client-mobile-upload" */'./mobile-upload'));
129
148
  });
130
149
  case 2:
131
- module = _context3.sent;
150
+ module = _context4.sent;
132
151
  this.mobileUpload = new module.MobileUploadImpl(this.mediaStore, this.store);
133
- return _context3.abrupt("return", this.mobileUpload);
152
+ return _context4.abrupt("return", this.mobileUpload);
134
153
  case 3:
135
154
  case "end":
136
- return _context3.stop();
155
+ return _context4.stop();
137
156
  }
138
- }, _callee3, this);
157
+ }, _callee4, this);
139
158
  }));
140
159
  function mobileUploadPromise() {
141
160
  return _mobileUploadPromise.apply(this, arguments);
@@ -145,19 +164,19 @@ var MediaClient = exports.MediaClient = /*#__PURE__*/function () {
145
164
  }, {
146
165
  key: "removeFileFromCollection",
147
166
  value: function () {
148
- var _removeFileFromCollection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(id, collectionName, occurrenceKey, traceContext) {
149
- return _regenerator.default.wrap(function (_context4) {
150
- while (1) switch (_context4.prev = _context4.next) {
167
+ var _removeFileFromCollection = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(id, collectionName, occurrenceKey, traceContext) {
168
+ return _regenerator.default.wrap(function (_context5) {
169
+ while (1) switch (_context5.prev = _context5.next) {
151
170
  case 0:
152
- _context4.next = 1;
171
+ _context5.next = 1;
153
172
  return this.mediaStore.removeCollectionFile(id, collectionName, occurrenceKey, traceContext);
154
173
  case 1:
155
174
  case "end":
156
- return _context4.stop();
175
+ return _context5.stop();
157
176
  }
158
- }, _callee4, this);
177
+ }, _callee5, this);
159
178
  }));
160
- function removeFileFromCollection(_x4, _x5, _x6, _x7) {
179
+ function removeFileFromCollection(_x5, _x6, _x7, _x8) {
161
180
  return _removeFileFromCollection.apply(this, arguments);
162
181
  }
163
182
  return removeFileFromCollection;
@@ -641,13 +641,51 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
641
641
  }
642
642
  return getArtifactURL;
643
643
  }()
644
+ }, {
645
+ key: "getImageWatermarkVersion",
646
+ value: (
647
+ /**
648
+ * The watermark version `getImage` sends as `wmv` for `collectionName`, or
649
+ * `undefined` when it sends none. A caller that reuses an image fetched earlier can
650
+ * compare it to tell whether the watermark config has changed since.
651
+ */
652
+ function () {
653
+ var _getImageWatermarkVersion = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(collectionName) {
654
+ var auth;
655
+ return _regenerator.default.wrap(function (_context10) {
656
+ while (1) switch (_context10.prev = _context10.next) {
657
+ case 0:
658
+ if ((0, _fg.fg)('confluence_watermark_admin_ui')) {
659
+ _context10.next = 1;
660
+ break;
661
+ }
662
+ return _context10.abrupt("return", undefined);
663
+ case 1:
664
+ _context10.next = 2;
665
+ return this.resolveAuth({
666
+ collectionName: collectionName
667
+ });
668
+ case 2:
669
+ auth = _context10.sent;
670
+ return _context10.abrupt("return", (0, _watermarkVersion.getWatermarkVersionFromToken)(auth.token));
671
+ case 3:
672
+ case "end":
673
+ return _context10.stop();
674
+ }
675
+ }, _callee10, this);
676
+ }));
677
+ function getImageWatermarkVersion(_x33) {
678
+ return _getImageWatermarkVersion.apply(this, arguments);
679
+ }
680
+ return getImageWatermarkVersion;
681
+ }())
644
682
  }, {
645
683
  key: "getImage",
646
684
  value: function () {
647
- var _getImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(id, params, controller, fetchMaxRes, traceContext) {
685
+ var _getImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(id, params, controller, fetchMaxRes, traceContext, clientOptions) {
648
686
  var isWebpSupported, headers, imageEndpoint, metadata, wmvParams, authOptions, auth, wmv, options;
649
- return _regenerator.default.wrap(function (_context10) {
650
- while (1) switch (_context10.prev = _context10.next) {
687
+ return _regenerator.default.wrap(function (_context11) {
688
+ while (1) switch (_context11.prev = _context11.next) {
651
689
  case 0:
652
690
  // TODO add checkWebpSupport() back https://product-fabric.atlassian.net/browse/MPT-584
653
691
  isWebpSupported = false;
@@ -667,13 +705,13 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
667
705
  }
668
706
  };
669
707
  if (!(0, _fg.fg)('confluence_watermark_admin_ui')) {
670
- _context10.next = 2;
708
+ _context11.next = 2;
671
709
  break;
672
710
  }
673
- _context10.next = 1;
711
+ _context11.next = 1;
674
712
  return this.resolveAuth(authOptions.authContext);
675
713
  case 1:
676
- auth = _context10.sent;
714
+ auth = _context11.sent;
677
715
  wmv = (0, _watermarkVersion.getWatermarkVersionFromToken)(auth.token);
678
716
  if (wmv) {
679
717
  wmvParams = {
@@ -688,16 +726,17 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
688
726
  params: _objectSpread(_objectSpread({}, (0, _extendImageParams.extendImageParams)(params, fetchMaxRes)), wmvParams),
689
727
  headers: headers,
690
728
  traceContext: traceContext,
729
+ clientOptions: clientOptions,
691
730
  addMediaClientParam: true
692
731
  });
693
- return _context10.abrupt("return", this.request("/file/".concat(id, "/").concat(imageEndpoint), options, controller, true).then((0, _createMapResponseToBlob.createMapResponseToBlob)(metadata)));
732
+ return _context11.abrupt("return", this.request("/file/".concat(id, "/").concat(imageEndpoint), options, controller, true).then((0, _createMapResponseToBlob.createMapResponseToBlob)(metadata)));
694
733
  case 3:
695
734
  case "end":
696
- return _context10.stop();
735
+ return _context11.stop();
697
736
  }
698
- }, _callee10, this);
737
+ }, _callee11, this);
699
738
  }));
700
- function getImage(_x33, _x34, _x35, _x36, _x37) {
739
+ function getImage(_x34, _x35, _x36, _x37, _x38, _x39) {
701
740
  return _getImage.apply(this, arguments);
702
741
  }
703
742
  return getImage;
@@ -705,10 +744,10 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
705
744
  }, {
706
745
  key: "getItems",
707
746
  value: function () {
708
- var _getItems = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(ids, collectionName, traceContext, includeHashForDuplicateFiles) {
747
+ var _getItems = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(ids, collectionName, traceContext, includeHashForDuplicateFiles) {
709
748
  var descriptors, metadata, options;
710
- return _regenerator.default.wrap(function (_context11) {
711
- while (1) switch (_context11.prev = _context11.next) {
749
+ return _regenerator.default.wrap(function (_context12) {
750
+ while (1) switch (_context12.prev = _context12.next) {
712
751
  case 0:
713
752
  descriptors = ids.map(function (id) {
714
753
  return {
@@ -732,14 +771,14 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
732
771
  }),
733
772
  traceContext: traceContext
734
773
  });
735
- return _context11.abrupt("return", this.request('/items', options).then((0, _createMapResponseToJson.createMapResponseToJson)(metadata)));
774
+ return _context12.abrupt("return", this.request('/items', options).then((0, _createMapResponseToJson.createMapResponseToJson)(metadata)));
736
775
  case 1:
737
776
  case "end":
738
- return _context11.stop();
777
+ return _context12.stop();
739
778
  }
740
- }, _callee11, this);
779
+ }, _callee12, this);
741
780
  }));
742
- function getItems(_x38, _x39, _x40, _x41) {
781
+ function getItems(_x40, _x41, _x42, _x43) {
743
782
  return _getItems.apply(this, arguments);
744
783
  }
745
784
  return getItems;
@@ -747,10 +786,10 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
747
786
  }, {
748
787
  key: "getImageMetadata",
749
788
  value: function () {
750
- var _getImageMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(id, params, traceContext) {
789
+ var _getImageMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(id, params, traceContext) {
751
790
  var metadata, options;
752
- return _regenerator.default.wrap(function (_context12) {
753
- while (1) switch (_context12.prev = _context12.next) {
791
+ return _regenerator.default.wrap(function (_context13) {
792
+ while (1) switch (_context13.prev = _context13.next) {
754
793
  case 0:
755
794
  metadata = {
756
795
  method: 'GET',
@@ -763,14 +802,14 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
763
802
  params: params,
764
803
  traceContext: traceContext
765
804
  });
766
- return _context12.abrupt("return", this.request("/file/".concat(id, "/image/metadata"), options).then((0, _createMapResponseToJson.createMapResponseToJson)(metadata)));
805
+ return _context13.abrupt("return", this.request("/file/".concat(id, "/image/metadata"), options).then((0, _createMapResponseToJson.createMapResponseToJson)(metadata)));
767
806
  case 1:
768
807
  case "end":
769
- return _context12.stop();
808
+ return _context13.stop();
770
809
  }
771
- }, _callee12, this);
810
+ }, _callee13, this);
772
811
  }));
773
- function getImageMetadata(_x42, _x43, _x44) {
812
+ function getImageMetadata(_x44, _x45, _x46) {
774
813
  return _getImageMetadata.apply(this, arguments);
775
814
  }
776
815
  return getImageMetadata;
@@ -778,10 +817,10 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
778
817
  }, {
779
818
  key: "getDocumentContent",
780
819
  value: function () {
781
- var _getDocumentContent = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(id, options, traceContext) {
820
+ var _getDocumentContent = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(id, options, traceContext) {
782
821
  var shouldCache, endpoint, metadata, headers, requestOptions;
783
- return _regenerator.default.wrap(function (_context13) {
784
- while (1) switch (_context13.prev = _context13.next) {
822
+ return _regenerator.default.wrap(function (_context14) {
823
+ while (1) switch (_context14.prev = _context14.next) {
785
824
  case 0:
786
825
  // when requesting for password protected document don't use CDN as it won't forward headers
787
826
  // this is deliberate to avoid caching Password protected files
@@ -808,14 +847,14 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
808
847
  },
809
848
  traceContext: traceContext
810
849
  });
811
- return _context13.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then((0, _createMapResponseToJson.createMapResponseToJson)(metadata)));
850
+ return _context14.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then((0, _createMapResponseToJson.createMapResponseToJson)(metadata)));
812
851
  case 1:
813
852
  case "end":
814
- return _context13.stop();
853
+ return _context14.stop();
815
854
  }
816
- }, _callee13, this);
855
+ }, _callee14, this);
817
856
  }));
818
- function getDocumentContent(_x45, _x46, _x47) {
857
+ function getDocumentContent(_x47, _x48, _x49) {
819
858
  return _getDocumentContent.apply(this, arguments);
820
859
  }
821
860
  return getDocumentContent;
@@ -823,10 +862,10 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
823
862
  }, {
824
863
  key: "getDocumentPageImage",
825
864
  value: function () {
826
- var _getDocumentPageImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(id, options, traceContext) {
865
+ var _getDocumentPageImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(id, options, traceContext) {
827
866
  var shouldCache, endpoint, metadata, headers, requestOptions;
828
- return _regenerator.default.wrap(function (_context14) {
829
- while (1) switch (_context14.prev = _context14.next) {
867
+ return _regenerator.default.wrap(function (_context15) {
868
+ while (1) switch (_context15.prev = _context15.next) {
830
869
  case 0:
831
870
  // when requesting for password protected document don't use CDN as it won't forward headers
832
871
  // this is deliberate to avoid caching Password protected files
@@ -853,14 +892,14 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
853
892
  },
854
893
  traceContext: traceContext
855
894
  });
856
- return _context14.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then((0, _createMapResponseToBlob.createMapResponseToBlob)(metadata)));
895
+ return _context15.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then((0, _createMapResponseToBlob.createMapResponseToBlob)(metadata)));
857
896
  case 1:
858
897
  case "end":
859
- return _context14.stop();
898
+ return _context15.stop();
860
899
  }
861
- }, _callee14, this);
900
+ }, _callee15, this);
862
901
  }));
863
- function getDocumentPageImage(_x48, _x49, _x50) {
902
+ function getDocumentPageImage(_x50, _x51, _x52) {
864
903
  return _getDocumentPageImage.apply(this, arguments);
865
904
  }
866
905
  return getDocumentPageImage;
@@ -868,10 +907,10 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
868
907
  }, {
869
908
  key: "appendChunksToUpload",
870
909
  value: function () {
871
- var _appendChunksToUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(uploadId, body, collectionName, traceContext, options) {
910
+ var _appendChunksToUpload = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(uploadId, body, collectionName, traceContext, options) {
872
911
  var metadata, headers, requestOptions;
873
- return _regenerator.default.wrap(function (_context15) {
874
- while (1) switch (_context15.prev = _context15.next) {
912
+ return _regenerator.default.wrap(function (_context16) {
913
+ while (1) switch (_context16.prev = _context16.next) {
875
914
  case 0:
876
915
  metadata = {
877
916
  method: 'PUT',
@@ -889,15 +928,15 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
889
928
  body: JSON.stringify(body),
890
929
  traceContext: traceContext
891
930
  });
892
- _context15.next = 1;
931
+ _context16.next = 1;
893
932
  return this.request("/upload/".concat(uploadId, "/chunks"), requestOptions);
894
933
  case 1:
895
934
  case "end":
896
- return _context15.stop();
935
+ return _context16.stop();
897
936
  }
898
- }, _callee15, this);
937
+ }, _callee16, this);
899
938
  }));
900
- function appendChunksToUpload(_x51, _x52, _x53, _x54, _x55) {
939
+ function appendChunksToUpload(_x53, _x54, _x55, _x56, _x57) {
901
940
  return _appendChunksToUpload.apply(this, arguments);
902
941
  }
903
942
  return appendChunksToUpload;
@@ -955,10 +994,10 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
955
994
  }, {
956
995
  key: "registerCopyIntents",
957
996
  value: function () {
958
- var _registerCopyIntents = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(files, traceContext, resolvedAuth) {
997
+ var _registerCopyIntents = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(files, traceContext, resolvedAuth) {
959
998
  var metadata, options;
960
- return _regenerator.default.wrap(function (_context16) {
961
- while (1) switch (_context16.prev = _context16.next) {
999
+ return _regenerator.default.wrap(function (_context17) {
1000
+ while (1) switch (_context17.prev = _context17.next) {
962
1001
  case 0:
963
1002
  metadata = {
964
1003
  method: 'POST',
@@ -972,15 +1011,15 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
972
1011
  traceContext: traceContext,
973
1012
  resolvedAuth: resolvedAuth
974
1013
  });
975
- _context16.next = 1;
1014
+ _context17.next = 1;
976
1015
  return this.request('/file/copy/intents', options);
977
1016
  case 1:
978
1017
  case "end":
979
- return _context16.stop();
1018
+ return _context17.stop();
980
1019
  }
981
- }, _callee16, this);
1020
+ }, _callee17, this);
982
1021
  }));
983
- function registerCopyIntents(_x56, _x57, _x58) {
1022
+ function registerCopyIntents(_x58, _x59, _x60) {
984
1023
  return _registerCopyIntents.apply(this, arguments);
985
1024
  }
986
1025
  return registerCopyIntents;
@@ -988,7 +1027,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
988
1027
  }, {
989
1028
  key: "request",
990
1029
  value: function () {
991
- var _request2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(path) {
1030
+ var _request2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(path) {
992
1031
  var options,
993
1032
  controller,
994
1033
  useMediaCdn,
@@ -1008,31 +1047,31 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
1008
1047
  extendedParams,
1009
1048
  url,
1010
1049
  response,
1011
- _args17 = arguments,
1050
+ _args18 = arguments,
1012
1051
  _t;
1013
- return _regenerator.default.wrap(function (_context17) {
1014
- while (1) switch (_context17.prev = _context17.next) {
1052
+ return _regenerator.default.wrap(function (_context18) {
1053
+ while (1) switch (_context18.prev = _context18.next) {
1015
1054
  case 0:
1016
- options = _args17.length > 1 && _args17[1] !== undefined ? _args17[1] : {
1055
+ options = _args18.length > 1 && _args18[1] !== undefined ? _args18[1] : {
1017
1056
  method: 'GET',
1018
1057
  endpoint: undefined,
1019
1058
  authContext: {}
1020
1059
  };
1021
- controller = _args17.length > 2 ? _args17[2] : undefined;
1022
- useMediaCdn = _args17.length > 3 ? _args17[3] : undefined;
1060
+ controller = _args18.length > 2 ? _args18[2] : undefined;
1061
+ useMediaCdn = _args18.length > 3 ? _args18[3] : undefined;
1023
1062
  method = options.method, endpoint = options.endpoint, authContext = options.authContext, params = options.params, headers = options.headers, body = options.body, clientOptions = options.clientOptions, traceContext = options.traceContext, addMediaClientParam = options.addMediaClientParam, resolvedAuth = options.resolvedAuth;
1024
1063
  if (!(resolvedAuth !== null && resolvedAuth !== void 0)) {
1025
- _context17.next = 1;
1064
+ _context18.next = 1;
1026
1065
  break;
1027
1066
  }
1028
1067
  _t = resolvedAuth;
1029
- _context17.next = 3;
1068
+ _context18.next = 3;
1030
1069
  break;
1031
1070
  case 1:
1032
- _context17.next = 2;
1071
+ _context18.next = 2;
1033
1072
  return this.resolveAuth(authContext);
1034
1073
  case 2:
1035
- _t = _context17.sent;
1074
+ _t = _context18.sent;
1036
1075
  case 3:
1037
1076
  auth = _t;
1038
1077
  clientId = (0, _isClientBasedAuth.isClientBasedAuth)(auth) ? auth.clientId : undefined;
@@ -1047,7 +1086,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
1047
1086
  if ((0, _isPathBasedEnabled.isPathBasedEnabled)()) {
1048
1087
  url = (0, _mapToPathBasedUrl.mapToPathBasedUrl)(url);
1049
1088
  }
1050
- _context17.next = 4;
1089
+ _context18.next = 4;
1051
1090
  return (0, _request3.request)(url, {
1052
1091
  method: method,
1053
1092
  endpoint: endpoint,
@@ -1059,17 +1098,17 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
1059
1098
  traceContext: extendedTraceContext
1060
1099
  }, controller);
1061
1100
  case 4:
1062
- response = _context17.sent;
1101
+ response = _context18.sent;
1063
1102
  (0, _setKeyValueInSessionStorage.setKeyValueInSessionStorage)(MEDIA_API_REGION, response.headers.get('x-media-region'));
1064
1103
  (0, _setKeyValueInSessionStorage.setKeyValueInSessionStorage)(MEDIA_API_ENVIRONMENT, response.headers.get('x-media-env'));
1065
- return _context17.abrupt("return", response);
1104
+ return _context18.abrupt("return", response);
1066
1105
  case 5:
1067
1106
  case "end":
1068
- return _context17.stop();
1107
+ return _context18.stop();
1069
1108
  }
1070
- }, _callee17, this);
1109
+ }, _callee18, this);
1071
1110
  }));
1072
- function request(_x59) {
1111
+ function request(_x61) {
1073
1112
  return _request2.apply(this, arguments);
1074
1113
  }
1075
1114
  return request;
@@ -1077,16 +1116,16 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
1077
1116
  }, {
1078
1117
  key: "testUrl",
1079
1118
  value: function () {
1080
- var _testUrl = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(url) {
1119
+ var _testUrl = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19(url) {
1081
1120
  var options,
1082
1121
  traceContext,
1083
- _args18 = arguments;
1084
- return _regenerator.default.wrap(function (_context18) {
1085
- while (1) switch (_context18.prev = _context18.next) {
1122
+ _args19 = arguments;
1123
+ return _regenerator.default.wrap(function (_context19) {
1124
+ while (1) switch (_context19.prev = _context19.next) {
1086
1125
  case 0:
1087
- options = _args18.length > 1 && _args18[1] !== undefined ? _args18[1] : {};
1126
+ options = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : {};
1088
1127
  traceContext = options.traceContext;
1089
- _context18.next = 1;
1128
+ _context19.next = 1;
1090
1129
  return (0, _request3.request)(url, {
1091
1130
  method: 'HEAD',
1092
1131
  traceContext: (0, _extendTraceContext.extendTraceContext)(traceContext),
@@ -1098,11 +1137,11 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
1098
1137
  });
1099
1138
  case 1:
1100
1139
  case "end":
1101
- return _context18.stop();
1140
+ return _context19.stop();
1102
1141
  }
1103
- }, _callee18);
1142
+ }, _callee19);
1104
1143
  }));
1105
- function testUrl(_x60) {
1144
+ function testUrl(_x62) {
1106
1145
  return _testUrl.apply(this, arguments);
1107
1146
  }
1108
1147
  return testUrl;
@@ -30,8 +30,8 @@ export class MediaClient {
30
30
  __DO_NOT_USE__getMediaStore() {
31
31
  return this.store;
32
32
  }
33
- getImage(id, params, controller, fetchMaxRes, traceContext) {
34
- return this.mediaStore.getImage(id, params, controller, fetchMaxRes, traceContext);
33
+ getImage(id, params, controller, fetchMaxRes, traceContext, clientOptions) {
34
+ return this.mediaStore.getImage(id, params, controller, fetchMaxRes, traceContext, clientOptions);
35
35
  }
36
36
  getImageUrl(id, params) {
37
37
  return this.mediaStore.getFileImageURL(id, params);
@@ -45,6 +45,9 @@ export class MediaClient {
45
45
  getClientIdSync() {
46
46
  return this.mediaStore.getClientIdSync();
47
47
  }
48
+ async getImageWatermarkVersion(collectionName) {
49
+ return this.mediaStore.getImageWatermarkVersion(collectionName);
50
+ }
48
51
  async getImageMetadata(id, params) {
49
52
  return (await this.mediaStore.getImageMetadata(id, params)).metadata;
50
53
  }
@@ -389,7 +389,21 @@ export class MediaStore {
389
389
  }
390
390
  return url;
391
391
  }
392
- async getImage(id, params, controller, fetchMaxRes, traceContext) {
392
+ /**
393
+ * The watermark version `getImage` sends as `wmv` for `collectionName`, or
394
+ * `undefined` when it sends none. A caller that reuses an image fetched earlier can
395
+ * compare it to tell whether the watermark config has changed since.
396
+ */
397
+ async getImageWatermarkVersion(collectionName) {
398
+ if (!fg('confluence_watermark_admin_ui')) {
399
+ return undefined;
400
+ }
401
+ const auth = await this.resolveAuth({
402
+ collectionName
403
+ });
404
+ return getWatermarkVersionFromToken(auth.token);
405
+ }
406
+ async getImage(id, params, controller, fetchMaxRes, traceContext, clientOptions) {
393
407
  // TODO add checkWebpSupport() back https://product-fabric.atlassian.net/browse/MPT-584
394
408
  const isWebpSupported = false;
395
409
  const headers = {};
@@ -428,6 +442,7 @@ export class MediaStore {
428
442
  },
429
443
  headers,
430
444
  traceContext,
445
+ clientOptions,
431
446
  addMediaClientParam: true
432
447
  };
433
448
  return this.request(`/file/${id}/${imageEndpoint}`, options, controller, true).then(createMapResponseToBlob(metadata));
@@ -41,8 +41,8 @@ export var MediaClient = /*#__PURE__*/function () {
41
41
  }
42
42
  }, {
43
43
  key: "getImage",
44
- value: function getImage(id, params, controller, fetchMaxRes, traceContext) {
45
- return this.mediaStore.getImage(id, params, controller, fetchMaxRes, traceContext);
44
+ value: function getImage(id, params, controller, fetchMaxRes, traceContext, clientOptions) {
45
+ return this.mediaStore.getImage(id, params, controller, fetchMaxRes, traceContext, clientOptions);
46
46
  }
47
47
  }, {
48
48
  key: "getImageUrl",
@@ -79,23 +79,42 @@ export var MediaClient = /*#__PURE__*/function () {
79
79
  return this.mediaStore.getClientIdSync();
80
80
  }
81
81
  }, {
82
- key: "getImageMetadata",
82
+ key: "getImageWatermarkVersion",
83
83
  value: function () {
84
- var _getImageMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(id, params) {
84
+ var _getImageWatermarkVersion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(collectionName) {
85
85
  return _regeneratorRuntime.wrap(function (_context2) {
86
86
  while (1) switch (_context2.prev = _context2.next) {
87
87
  case 0:
88
- _context2.next = 1;
89
- return this.mediaStore.getImageMetadata(id, params);
88
+ return _context2.abrupt("return", this.mediaStore.getImageWatermarkVersion(collectionName));
90
89
  case 1:
91
- return _context2.abrupt("return", _context2.sent.metadata);
92
- case 2:
93
90
  case "end":
94
91
  return _context2.stop();
95
92
  }
96
93
  }, _callee2, this);
97
94
  }));
98
- function getImageMetadata(_x2, _x3) {
95
+ function getImageWatermarkVersion(_x2) {
96
+ return _getImageWatermarkVersion.apply(this, arguments);
97
+ }
98
+ return getImageWatermarkVersion;
99
+ }()
100
+ }, {
101
+ key: "getImageMetadata",
102
+ value: function () {
103
+ var _getImageMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(id, params) {
104
+ return _regeneratorRuntime.wrap(function (_context3) {
105
+ while (1) switch (_context3.prev = _context3.next) {
106
+ case 0:
107
+ _context3.next = 1;
108
+ return this.mediaStore.getImageMetadata(id, params);
109
+ case 1:
110
+ return _context3.abrupt("return", _context3.sent.metadata);
111
+ case 2:
112
+ case "end":
113
+ return _context3.stop();
114
+ }
115
+ }, _callee3, this);
116
+ }));
117
+ function getImageMetadata(_x3, _x4) {
99
118
  return _getImageMetadata.apply(this, arguments);
100
119
  }
101
120
  return getImageMetadata;
@@ -103,28 +122,28 @@ export var MediaClient = /*#__PURE__*/function () {
103
122
  }, {
104
123
  key: "mobileUploadPromise",
105
124
  value: function () {
106
- var _mobileUploadPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
125
+ var _mobileUploadPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
107
126
  var module;
108
- return _regeneratorRuntime.wrap(function (_context3) {
109
- while (1) switch (_context3.prev = _context3.next) {
127
+ return _regeneratorRuntime.wrap(function (_context4) {
128
+ while (1) switch (_context4.prev = _context4.next) {
110
129
  case 0:
111
130
  if (!this.mobileUpload) {
112
- _context3.next = 1;
131
+ _context4.next = 1;
113
132
  break;
114
133
  }
115
- return _context3.abrupt("return", this.mobileUpload);
134
+ return _context4.abrupt("return", this.mobileUpload);
116
135
  case 1:
117
- _context3.next = 2;
136
+ _context4.next = 2;
118
137
  return import( /* webpackChunkName: "@atlaskit-internal_media-client-mobile-upload" */'./mobile-upload');
119
138
  case 2:
120
- module = _context3.sent;
139
+ module = _context4.sent;
121
140
  this.mobileUpload = new module.MobileUploadImpl(this.mediaStore, this.store);
122
- return _context3.abrupt("return", this.mobileUpload);
141
+ return _context4.abrupt("return", this.mobileUpload);
123
142
  case 3:
124
143
  case "end":
125
- return _context3.stop();
144
+ return _context4.stop();
126
145
  }
127
- }, _callee3, this);
146
+ }, _callee4, this);
128
147
  }));
129
148
  function mobileUploadPromise() {
130
149
  return _mobileUploadPromise.apply(this, arguments);
@@ -134,19 +153,19 @@ export var MediaClient = /*#__PURE__*/function () {
134
153
  }, {
135
154
  key: "removeFileFromCollection",
136
155
  value: function () {
137
- var _removeFileFromCollection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(id, collectionName, occurrenceKey, traceContext) {
138
- return _regeneratorRuntime.wrap(function (_context4) {
139
- while (1) switch (_context4.prev = _context4.next) {
156
+ var _removeFileFromCollection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(id, collectionName, occurrenceKey, traceContext) {
157
+ return _regeneratorRuntime.wrap(function (_context5) {
158
+ while (1) switch (_context5.prev = _context5.next) {
140
159
  case 0:
141
- _context4.next = 1;
160
+ _context5.next = 1;
142
161
  return this.mediaStore.removeCollectionFile(id, collectionName, occurrenceKey, traceContext);
143
162
  case 1:
144
163
  case "end":
145
- return _context4.stop();
164
+ return _context5.stop();
146
165
  }
147
- }, _callee4, this);
166
+ }, _callee5, this);
148
167
  }));
149
- function removeFileFromCollection(_x4, _x5, _x6, _x7) {
168
+ function removeFileFromCollection(_x5, _x6, _x7, _x8) {
150
169
  return _removeFileFromCollection.apply(this, arguments);
151
170
  }
152
171
  return removeFileFromCollection;
@@ -615,13 +615,51 @@ export var MediaStore = /*#__PURE__*/function () {
615
615
  }
616
616
  return getArtifactURL;
617
617
  }()
618
+ }, {
619
+ key: "getImageWatermarkVersion",
620
+ value: (
621
+ /**
622
+ * The watermark version `getImage` sends as `wmv` for `collectionName`, or
623
+ * `undefined` when it sends none. A caller that reuses an image fetched earlier can
624
+ * compare it to tell whether the watermark config has changed since.
625
+ */
626
+ function () {
627
+ var _getImageWatermarkVersion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(collectionName) {
628
+ var auth;
629
+ return _regeneratorRuntime.wrap(function (_context10) {
630
+ while (1) switch (_context10.prev = _context10.next) {
631
+ case 0:
632
+ if (fg('confluence_watermark_admin_ui')) {
633
+ _context10.next = 1;
634
+ break;
635
+ }
636
+ return _context10.abrupt("return", undefined);
637
+ case 1:
638
+ _context10.next = 2;
639
+ return this.resolveAuth({
640
+ collectionName: collectionName
641
+ });
642
+ case 2:
643
+ auth = _context10.sent;
644
+ return _context10.abrupt("return", getWatermarkVersionFromToken(auth.token));
645
+ case 3:
646
+ case "end":
647
+ return _context10.stop();
648
+ }
649
+ }, _callee10, this);
650
+ }));
651
+ function getImageWatermarkVersion(_x33) {
652
+ return _getImageWatermarkVersion.apply(this, arguments);
653
+ }
654
+ return getImageWatermarkVersion;
655
+ }())
618
656
  }, {
619
657
  key: "getImage",
620
658
  value: function () {
621
- var _getImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(id, params, controller, fetchMaxRes, traceContext) {
659
+ var _getImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(id, params, controller, fetchMaxRes, traceContext, clientOptions) {
622
660
  var isWebpSupported, headers, imageEndpoint, metadata, wmvParams, authOptions, auth, wmv, options;
623
- return _regeneratorRuntime.wrap(function (_context10) {
624
- while (1) switch (_context10.prev = _context10.next) {
661
+ return _regeneratorRuntime.wrap(function (_context11) {
662
+ while (1) switch (_context11.prev = _context11.next) {
625
663
  case 0:
626
664
  // TODO add checkWebpSupport() back https://product-fabric.atlassian.net/browse/MPT-584
627
665
  isWebpSupported = false;
@@ -641,13 +679,13 @@ export var MediaStore = /*#__PURE__*/function () {
641
679
  }
642
680
  };
643
681
  if (!fg('confluence_watermark_admin_ui')) {
644
- _context10.next = 2;
682
+ _context11.next = 2;
645
683
  break;
646
684
  }
647
- _context10.next = 1;
685
+ _context11.next = 1;
648
686
  return this.resolveAuth(authOptions.authContext);
649
687
  case 1:
650
- auth = _context10.sent;
688
+ auth = _context11.sent;
651
689
  wmv = getWatermarkVersionFromToken(auth.token);
652
690
  if (wmv) {
653
691
  wmvParams = {
@@ -662,16 +700,17 @@ export var MediaStore = /*#__PURE__*/function () {
662
700
  params: _objectSpread(_objectSpread({}, extendImageParams(params, fetchMaxRes)), wmvParams),
663
701
  headers: headers,
664
702
  traceContext: traceContext,
703
+ clientOptions: clientOptions,
665
704
  addMediaClientParam: true
666
705
  });
667
- return _context10.abrupt("return", this.request("/file/".concat(id, "/").concat(imageEndpoint), options, controller, true).then(createMapResponseToBlob(metadata)));
706
+ return _context11.abrupt("return", this.request("/file/".concat(id, "/").concat(imageEndpoint), options, controller, true).then(createMapResponseToBlob(metadata)));
668
707
  case 3:
669
708
  case "end":
670
- return _context10.stop();
709
+ return _context11.stop();
671
710
  }
672
- }, _callee10, this);
711
+ }, _callee11, this);
673
712
  }));
674
- function getImage(_x33, _x34, _x35, _x36, _x37) {
713
+ function getImage(_x34, _x35, _x36, _x37, _x38, _x39) {
675
714
  return _getImage.apply(this, arguments);
676
715
  }
677
716
  return getImage;
@@ -679,10 +718,10 @@ export var MediaStore = /*#__PURE__*/function () {
679
718
  }, {
680
719
  key: "getItems",
681
720
  value: function () {
682
- var _getItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11(ids, collectionName, traceContext, includeHashForDuplicateFiles) {
721
+ var _getItems = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(ids, collectionName, traceContext, includeHashForDuplicateFiles) {
683
722
  var descriptors, metadata, options;
684
- return _regeneratorRuntime.wrap(function (_context11) {
685
- while (1) switch (_context11.prev = _context11.next) {
723
+ return _regeneratorRuntime.wrap(function (_context12) {
724
+ while (1) switch (_context12.prev = _context12.next) {
686
725
  case 0:
687
726
  descriptors = ids.map(function (id) {
688
727
  return {
@@ -706,14 +745,14 @@ export var MediaStore = /*#__PURE__*/function () {
706
745
  }),
707
746
  traceContext: traceContext
708
747
  });
709
- return _context11.abrupt("return", this.request('/items', options).then(createMapResponseToJson(metadata)));
748
+ return _context12.abrupt("return", this.request('/items', options).then(createMapResponseToJson(metadata)));
710
749
  case 1:
711
750
  case "end":
712
- return _context11.stop();
751
+ return _context12.stop();
713
752
  }
714
- }, _callee11, this);
753
+ }, _callee12, this);
715
754
  }));
716
- function getItems(_x38, _x39, _x40, _x41) {
755
+ function getItems(_x40, _x41, _x42, _x43) {
717
756
  return _getItems.apply(this, arguments);
718
757
  }
719
758
  return getItems;
@@ -721,10 +760,10 @@ export var MediaStore = /*#__PURE__*/function () {
721
760
  }, {
722
761
  key: "getImageMetadata",
723
762
  value: function () {
724
- var _getImageMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12(id, params, traceContext) {
763
+ var _getImageMetadata = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(id, params, traceContext) {
725
764
  var metadata, options;
726
- return _regeneratorRuntime.wrap(function (_context12) {
727
- while (1) switch (_context12.prev = _context12.next) {
765
+ return _regeneratorRuntime.wrap(function (_context13) {
766
+ while (1) switch (_context13.prev = _context13.next) {
728
767
  case 0:
729
768
  metadata = {
730
769
  method: 'GET',
@@ -737,14 +776,14 @@ export var MediaStore = /*#__PURE__*/function () {
737
776
  params: params,
738
777
  traceContext: traceContext
739
778
  });
740
- return _context12.abrupt("return", this.request("/file/".concat(id, "/image/metadata"), options).then(createMapResponseToJson(metadata)));
779
+ return _context13.abrupt("return", this.request("/file/".concat(id, "/image/metadata"), options).then(createMapResponseToJson(metadata)));
741
780
  case 1:
742
781
  case "end":
743
- return _context12.stop();
782
+ return _context13.stop();
744
783
  }
745
- }, _callee12, this);
784
+ }, _callee13, this);
746
785
  }));
747
- function getImageMetadata(_x42, _x43, _x44) {
786
+ function getImageMetadata(_x44, _x45, _x46) {
748
787
  return _getImageMetadata.apply(this, arguments);
749
788
  }
750
789
  return getImageMetadata;
@@ -752,10 +791,10 @@ export var MediaStore = /*#__PURE__*/function () {
752
791
  }, {
753
792
  key: "getDocumentContent",
754
793
  value: function () {
755
- var _getDocumentContent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(id, options, traceContext) {
794
+ var _getDocumentContent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(id, options, traceContext) {
756
795
  var shouldCache, endpoint, metadata, headers, requestOptions;
757
- return _regeneratorRuntime.wrap(function (_context13) {
758
- while (1) switch (_context13.prev = _context13.next) {
796
+ return _regeneratorRuntime.wrap(function (_context14) {
797
+ while (1) switch (_context14.prev = _context14.next) {
759
798
  case 0:
760
799
  // when requesting for password protected document don't use CDN as it won't forward headers
761
800
  // this is deliberate to avoid caching Password protected files
@@ -782,14 +821,14 @@ export var MediaStore = /*#__PURE__*/function () {
782
821
  },
783
822
  traceContext: traceContext
784
823
  });
785
- return _context13.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then(createMapResponseToJson(metadata)));
824
+ return _context14.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then(createMapResponseToJson(metadata)));
786
825
  case 1:
787
826
  case "end":
788
- return _context13.stop();
827
+ return _context14.stop();
789
828
  }
790
- }, _callee13, this);
829
+ }, _callee14, this);
791
830
  }));
792
- function getDocumentContent(_x45, _x46, _x47) {
831
+ function getDocumentContent(_x47, _x48, _x49) {
793
832
  return _getDocumentContent.apply(this, arguments);
794
833
  }
795
834
  return getDocumentContent;
@@ -797,10 +836,10 @@ export var MediaStore = /*#__PURE__*/function () {
797
836
  }, {
798
837
  key: "getDocumentPageImage",
799
838
  value: function () {
800
- var _getDocumentPageImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(id, options, traceContext) {
839
+ var _getDocumentPageImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(id, options, traceContext) {
801
840
  var shouldCache, endpoint, metadata, headers, requestOptions;
802
- return _regeneratorRuntime.wrap(function (_context14) {
803
- while (1) switch (_context14.prev = _context14.next) {
841
+ return _regeneratorRuntime.wrap(function (_context15) {
842
+ while (1) switch (_context15.prev = _context15.next) {
804
843
  case 0:
805
844
  // when requesting for password protected document don't use CDN as it won't forward headers
806
845
  // this is deliberate to avoid caching Password protected files
@@ -827,14 +866,14 @@ export var MediaStore = /*#__PURE__*/function () {
827
866
  },
828
867
  traceContext: traceContext
829
868
  });
830
- return _context14.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then(createMapResponseToBlob(metadata)));
869
+ return _context15.abrupt("return", this.request("/file/".concat(id, "/document/").concat(endpoint), requestOptions).then(createMapResponseToBlob(metadata)));
831
870
  case 1:
832
871
  case "end":
833
- return _context14.stop();
872
+ return _context15.stop();
834
873
  }
835
- }, _callee14, this);
874
+ }, _callee15, this);
836
875
  }));
837
- function getDocumentPageImage(_x48, _x49, _x50) {
876
+ function getDocumentPageImage(_x50, _x51, _x52) {
838
877
  return _getDocumentPageImage.apply(this, arguments);
839
878
  }
840
879
  return getDocumentPageImage;
@@ -842,10 +881,10 @@ export var MediaStore = /*#__PURE__*/function () {
842
881
  }, {
843
882
  key: "appendChunksToUpload",
844
883
  value: function () {
845
- var _appendChunksToUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(uploadId, body, collectionName, traceContext, options) {
884
+ var _appendChunksToUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(uploadId, body, collectionName, traceContext, options) {
846
885
  var metadata, headers, requestOptions;
847
- return _regeneratorRuntime.wrap(function (_context15) {
848
- while (1) switch (_context15.prev = _context15.next) {
886
+ return _regeneratorRuntime.wrap(function (_context16) {
887
+ while (1) switch (_context16.prev = _context16.next) {
849
888
  case 0:
850
889
  metadata = {
851
890
  method: 'PUT',
@@ -863,15 +902,15 @@ export var MediaStore = /*#__PURE__*/function () {
863
902
  body: JSON.stringify(body),
864
903
  traceContext: traceContext
865
904
  });
866
- _context15.next = 1;
905
+ _context16.next = 1;
867
906
  return this.request("/upload/".concat(uploadId, "/chunks"), requestOptions);
868
907
  case 1:
869
908
  case "end":
870
- return _context15.stop();
909
+ return _context16.stop();
871
910
  }
872
- }, _callee15, this);
911
+ }, _callee16, this);
873
912
  }));
874
- function appendChunksToUpload(_x51, _x52, _x53, _x54, _x55) {
913
+ function appendChunksToUpload(_x53, _x54, _x55, _x56, _x57) {
875
914
  return _appendChunksToUpload.apply(this, arguments);
876
915
  }
877
916
  return appendChunksToUpload;
@@ -929,10 +968,10 @@ export var MediaStore = /*#__PURE__*/function () {
929
968
  }, {
930
969
  key: "registerCopyIntents",
931
970
  value: function () {
932
- var _registerCopyIntents = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(files, traceContext, resolvedAuth) {
971
+ var _registerCopyIntents = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(files, traceContext, resolvedAuth) {
933
972
  var metadata, options;
934
- return _regeneratorRuntime.wrap(function (_context16) {
935
- while (1) switch (_context16.prev = _context16.next) {
973
+ return _regeneratorRuntime.wrap(function (_context17) {
974
+ while (1) switch (_context17.prev = _context17.next) {
936
975
  case 0:
937
976
  metadata = {
938
977
  method: 'POST',
@@ -946,15 +985,15 @@ export var MediaStore = /*#__PURE__*/function () {
946
985
  traceContext: traceContext,
947
986
  resolvedAuth: resolvedAuth
948
987
  });
949
- _context16.next = 1;
988
+ _context17.next = 1;
950
989
  return this.request('/file/copy/intents', options);
951
990
  case 1:
952
991
  case "end":
953
- return _context16.stop();
992
+ return _context17.stop();
954
993
  }
955
- }, _callee16, this);
994
+ }, _callee17, this);
956
995
  }));
957
- function registerCopyIntents(_x56, _x57, _x58) {
996
+ function registerCopyIntents(_x58, _x59, _x60) {
958
997
  return _registerCopyIntents.apply(this, arguments);
959
998
  }
960
999
  return registerCopyIntents;
@@ -962,7 +1001,7 @@ export var MediaStore = /*#__PURE__*/function () {
962
1001
  }, {
963
1002
  key: "request",
964
1003
  value: function () {
965
- var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(path) {
1004
+ var _request2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(path) {
966
1005
  var options,
967
1006
  controller,
968
1007
  useMediaCdn,
@@ -982,31 +1021,31 @@ export var MediaStore = /*#__PURE__*/function () {
982
1021
  extendedParams,
983
1022
  url,
984
1023
  response,
985
- _args17 = arguments,
1024
+ _args18 = arguments,
986
1025
  _t;
987
- return _regeneratorRuntime.wrap(function (_context17) {
988
- while (1) switch (_context17.prev = _context17.next) {
1026
+ return _regeneratorRuntime.wrap(function (_context18) {
1027
+ while (1) switch (_context18.prev = _context18.next) {
989
1028
  case 0:
990
- options = _args17.length > 1 && _args17[1] !== undefined ? _args17[1] : {
1029
+ options = _args18.length > 1 && _args18[1] !== undefined ? _args18[1] : {
991
1030
  method: 'GET',
992
1031
  endpoint: undefined,
993
1032
  authContext: {}
994
1033
  };
995
- controller = _args17.length > 2 ? _args17[2] : undefined;
996
- useMediaCdn = _args17.length > 3 ? _args17[3] : undefined;
1034
+ controller = _args18.length > 2 ? _args18[2] : undefined;
1035
+ useMediaCdn = _args18.length > 3 ? _args18[3] : undefined;
997
1036
  method = options.method, endpoint = options.endpoint, authContext = options.authContext, params = options.params, headers = options.headers, body = options.body, clientOptions = options.clientOptions, traceContext = options.traceContext, addMediaClientParam = options.addMediaClientParam, resolvedAuth = options.resolvedAuth;
998
1037
  if (!(resolvedAuth !== null && resolvedAuth !== void 0)) {
999
- _context17.next = 1;
1038
+ _context18.next = 1;
1000
1039
  break;
1001
1040
  }
1002
1041
  _t = resolvedAuth;
1003
- _context17.next = 3;
1042
+ _context18.next = 3;
1004
1043
  break;
1005
1044
  case 1:
1006
- _context17.next = 2;
1045
+ _context18.next = 2;
1007
1046
  return this.resolveAuth(authContext);
1008
1047
  case 2:
1009
- _t = _context17.sent;
1048
+ _t = _context18.sent;
1010
1049
  case 3:
1011
1050
  auth = _t;
1012
1051
  clientId = isClientBasedAuth(auth) ? auth.clientId : undefined;
@@ -1021,7 +1060,7 @@ export var MediaStore = /*#__PURE__*/function () {
1021
1060
  if (isPathBasedEnabled()) {
1022
1061
  url = mapToPathBasedUrl(url);
1023
1062
  }
1024
- _context17.next = 4;
1063
+ _context18.next = 4;
1025
1064
  return _request(url, {
1026
1065
  method: method,
1027
1066
  endpoint: endpoint,
@@ -1033,17 +1072,17 @@ export var MediaStore = /*#__PURE__*/function () {
1033
1072
  traceContext: extendedTraceContext
1034
1073
  }, controller);
1035
1074
  case 4:
1036
- response = _context17.sent;
1075
+ response = _context18.sent;
1037
1076
  setKeyValueInSessionStorage(MEDIA_API_REGION, response.headers.get('x-media-region'));
1038
1077
  setKeyValueInSessionStorage(MEDIA_API_ENVIRONMENT, response.headers.get('x-media-env'));
1039
- return _context17.abrupt("return", response);
1078
+ return _context18.abrupt("return", response);
1040
1079
  case 5:
1041
1080
  case "end":
1042
- return _context17.stop();
1081
+ return _context18.stop();
1043
1082
  }
1044
- }, _callee17, this);
1083
+ }, _callee18, this);
1045
1084
  }));
1046
- function request(_x59) {
1085
+ function request(_x61) {
1047
1086
  return _request2.apply(this, arguments);
1048
1087
  }
1049
1088
  return request;
@@ -1051,16 +1090,16 @@ export var MediaStore = /*#__PURE__*/function () {
1051
1090
  }, {
1052
1091
  key: "testUrl",
1053
1092
  value: function () {
1054
- var _testUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(url) {
1093
+ var _testUrl = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(url) {
1055
1094
  var options,
1056
1095
  traceContext,
1057
- _args18 = arguments;
1058
- return _regeneratorRuntime.wrap(function (_context18) {
1059
- while (1) switch (_context18.prev = _context18.next) {
1096
+ _args19 = arguments;
1097
+ return _regeneratorRuntime.wrap(function (_context19) {
1098
+ while (1) switch (_context19.prev = _context19.next) {
1060
1099
  case 0:
1061
- options = _args18.length > 1 && _args18[1] !== undefined ? _args18[1] : {};
1100
+ options = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : {};
1062
1101
  traceContext = options.traceContext;
1063
- _context18.next = 1;
1102
+ _context19.next = 1;
1064
1103
  return _request(url, {
1065
1104
  method: 'HEAD',
1066
1105
  traceContext: extendTraceContext(traceContext),
@@ -1072,11 +1111,11 @@ export var MediaStore = /*#__PURE__*/function () {
1072
1111
  });
1073
1112
  case 1:
1074
1113
  case "end":
1075
- return _context18.stop();
1114
+ return _context19.stop();
1076
1115
  }
1077
- }, _callee18);
1116
+ }, _callee19);
1078
1117
  }));
1079
- function testUrl(_x60) {
1118
+ function testUrl(_x62) {
1080
1119
  return _testUrl.apply(this, arguments);
1081
1120
  }
1082
1121
  return testUrl;
@@ -2,6 +2,7 @@ import type { MediaTraceContext } from '@atlaskit/media-common/analytics/types';
2
2
  import type { MediaClientConfig } from '@atlaskit/media-core/auth';
3
3
  import { type MediaStore } from '@atlaskit/media-state/media-store';
4
4
  import { type MobileUpload } from '../models/mobile-upload';
5
+ import type { ClientOptions } from '../utils/request/types';
5
6
  import { type UploadEventPayloadMap, type EventPayloadListener } from './events';
6
7
  import { type FileFetcher } from './file-fetcher';
7
8
  import { MediaStore as MediaApi } from './media-store/MediaStore';
@@ -21,11 +22,12 @@ export declare class MediaClient {
21
22
  * @internal
22
23
  */
23
24
  __DO_NOT_USE__getMediaStore(): MediaStore;
24
- getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext): Promise<Blob>;
25
+ getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext, clientOptions?: ClientOptions): Promise<Blob>;
25
26
  getImageUrl(id: string, params?: MediaStoreGetFileImageParams): Promise<string>;
26
27
  getImageUrlSync(id: string, params?: MediaStoreGetFileImageParams, seededCdnUrl?: string): string;
27
28
  getClientId(collectionName?: string): Promise<string | undefined>;
28
29
  getClientIdSync(): string | undefined;
30
+ getImageWatermarkVersion(collectionName?: string): Promise<string | undefined>;
29
31
  getImageMetadata(id: string, params?: MediaStoreGetFileImageParams): Promise<ImageMetadata>;
30
32
  mobileUploadPromise(): Promise<MobileUpload>;
31
33
  removeFileFromCollection(id: string, collectionName: string, occurrenceKey?: string, traceContext?: MediaTraceContext): Promise<void>;
@@ -4,6 +4,7 @@ import { ChunkHashAlgorithm } from '@atlaskit/media-core/chunk-hash-algorithm';
4
4
  import type { MediaFileArtifacts } from '@atlaskit/media-state/file-state';
5
5
  import { type GetDocumentPageImage, type DocumentPageRangeContent, type GetDocumentContentOptions } from '../../models/document';
6
6
  import { type MediaFile, type MediaUpload } from '../../models/media';
7
+ import { type ClientOptions } from '../../utils/request/types';
7
8
  import type { ItemsPayload, ImageMetadata, MediaStoreResponse, MediaStoreTouchFileParams, TouchFileDescriptor, MediaStoreTouchFileBody, RejectedTouchFile, MediaStoreRequestOptions, MediaStoreCreateFileFromUploadParams, MediaStoreCreateFileFromUploadBody, MediaStoreGetFileParams, MediaStoreGetFileImageParams, MediaStoreCopyFileWithTokenBody, MediaStoreCopyFileWithTokenParams, AppendChunksToUploadRequestBody, TouchedFiles, MediaApi, CopyFileParams } from './types';
8
9
  export declare const MEDIA_API_REGION: any;
9
10
  export declare const MEDIA_API_ENVIRONMENT: any;
@@ -34,7 +35,13 @@ export declare class MediaStore implements MediaApi {
34
35
  getArtifactBinary: MediaApi['getArtifactBinary'];
35
36
  uploadArtifact: MediaApi['uploadArtifact'];
36
37
  deleteArtifact: MediaApi['deleteArtifact'];
37
- getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext): Promise<Blob>;
38
+ /**
39
+ * The watermark version `getImage` sends as `wmv` for `collectionName`, or
40
+ * `undefined` when it sends none. A caller that reuses an image fetched earlier can
41
+ * compare it to tell whether the watermark config has changed since.
42
+ */
43
+ getImageWatermarkVersion(collectionName?: string): Promise<string | undefined>;
44
+ getImage(id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext, clientOptions?: ClientOptions): Promise<Blob>;
38
45
  getItems(ids: string[], collectionName?: string, traceContext?: MediaTraceContext, includeHashForDuplicateFiles?: boolean): Promise<MediaStoreResponse<ItemsPayload>>;
39
46
  getImageMetadata(id: string, params?: MediaStoreGetFileImageParams, traceContext?: MediaTraceContext): Promise<{
40
47
  metadata: ImageMetadata;
@@ -185,7 +185,7 @@ export interface MediaApi {
185
185
  getArtifactBinary(artifacts: MediaFileArtifacts, artifactName: keyof MediaFileArtifacts, options: GetArtifactBinaryOptions): Promise<Blob>;
186
186
  uploadArtifact(id: string, file: File, params: UploadArtifactParams, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaItemDetails>>;
187
187
  deleteArtifact(id: string, artifactName: string, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
188
- getImage: (id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext) => Promise<Blob>;
188
+ getImage: (id: string, params?: MediaStoreGetFileImageParams, controller?: AbortController, fetchMaxRes?: boolean, traceContext?: MediaTraceContext, clientOptions?: ClientOptions) => Promise<Blob>;
189
189
  getItems: (ids: string[], collectionName?: string, traceContext?: MediaTraceContext, includeHashForDuplicateFiles?: boolean) => Promise<MediaStoreResponse<ItemsPayload>>;
190
190
  getImageMetadata: (id: string, params?: MediaStoreGetFileImageParams, traceContext?: MediaTraceContext) => Promise<{
191
191
  metadata: ImageMetadata;
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "@atlaskit/media-client/is-error-file-state",
3
+ "main": "../dist/cjs/models/is-error-file-state.js",
4
+ "module": "../dist/esm/models/is-error-file-state.js",
5
+ "module:es2019": "../dist/es2019/models/is-error-file-state.js",
6
+ "sideEffects": false,
7
+ "types": "../dist/types/models/is-error-file-state.d.ts"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "@atlaskit/media-client/is-file-identifier",
3
+ "main": "../dist/cjs/is-file-identifier.js",
4
+ "module": "../dist/esm/is-file-identifier.js",
5
+ "module:es2019": "../dist/es2019/is-file-identifier.js",
6
+ "sideEffects": false,
7
+ "types": "../dist/types/is-file-identifier.d.ts"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "@atlaskit/media-client/is-image-representation-ready",
3
+ "main": "../dist/cjs/models/is-image-representation-ready.js",
4
+ "module": "../dist/esm/models/is-image-representation-ready.js",
5
+ "module:es2019": "../dist/es2019/models/is-image-representation-ready.js",
6
+ "sideEffects": false,
7
+ "types": "../dist/types/models/is-image-representation-ready.d.ts"
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "39.2.7",
3
+ "version": "39.3.1",
4
4
  "description": "Media API Web Client Library",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -25,7 +25,7 @@
25
25
  "@atlaskit/chunkinator": "^8.2.0",
26
26
  "@atlaskit/media-common": "^14.7.0",
27
27
  "@atlaskit/platform-feature-flags": "^2.2.0",
28
- "@atlaskit/tmp-editor-statsig": "^246.1.0",
28
+ "@atlaskit/tmp-editor-statsig": "^247.0.0",
29
29
  "@babel/runtime": "^7.0.0",
30
30
  "dataloader": "^2.1.0",
31
31
  "deep-equal": "^1.0.1",
@@ -48,7 +48,7 @@
48
48
  "@atlaskit/media-core": "^39.0.0",
49
49
  "@atlaskit/media-state": "^4.0.0",
50
50
  "@atlaskit/ssr": "workspace:^",
51
- "@atlaskit/tokens": "^20.7.0",
51
+ "@atlaskit/tokens": "^20.8.0",
52
52
  "@atlassian/a11y-jest-testing": "^0.17.0",
53
53
  "@atlassian/feature-flags-test-utils": "^1.3.0",
54
54
  "@atlassian/workbench": "workspace:^",