@atlaskit/media-client 39.2.6 → 39.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.
@@ -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));
@@ -18,7 +18,6 @@ import { isValidUuid } from '@atlaskit/media-common/isValidUuid';
18
18
  import { getMediaTypeFromMimeType } from '@atlaskit/media-common/mediaTypeUtils';
19
19
  import { authToOwner } from '@atlaskit/media-core/auth-to-owner';
20
20
  import { mediaStore } from '@atlaskit/media-state/media-store';
21
- import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
22
21
  import { fg } from '@atlaskit/platform-feature-flags/fg';
23
22
  import { RECENTS_COLLECTION } from '../../constants';
24
23
  import { getFileStreamsCache } from '../../file-streams-cache';
@@ -663,7 +662,7 @@ export var FileFetcherImpl = /*#__PURE__*/function () {
663
662
  return _context9.abrupt("return", reject('Could not download remote file'));
664
663
  case 2:
665
664
  type = blob.type, size = blob.size;
666
- extensionAllowed = anonymizeFilename ? isExperimentEnabled('cc_maui_polish_changes_batch_8') : fg('platform_media_unique_external_upload_name');
665
+ extensionAllowed = anonymizeFilename || fg('platform_media_unique_external_upload_name');
667
666
  _splitExtension3 = splitExtension(initialName), _splitExtension4 = _slicedToArray(_splitExtension3, 2), existingExtension = _splitExtension4[1];
668
667
  extension = extensionAllowed && !existingExtension ? getExtension(type) : undefined;
669
668
  name = extension ? "".concat(initialName, ".").concat(extension) : initialName;
@@ -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;