@atlaskit/media-client 36.0.1 → 36.0.2

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,12 @@
1
1
  # @atlaskit/media-client
2
2
 
3
+ ## 36.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`fa50dabb4be8f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/fa50dabb4be8f) -
8
+ Retrieve clientId synchronously during Media SSR blob URL construction.
9
+
3
10
  ## 36.0.1
4
11
 
5
12
  ### Patch Changes
@@ -82,6 +82,11 @@ var MediaClient = exports.MediaClient = /*#__PURE__*/function () {
82
82
  }
83
83
  return getClientId;
84
84
  }()
85
+ }, {
86
+ key: "getClientIdSync",
87
+ value: function getClientIdSync() {
88
+ return this.mediaStore.getClientIdSync();
89
+ }
85
90
  }, {
86
91
  key: "getImageMetadata",
87
92
  value: function () {
@@ -18,6 +18,8 @@ var _helpers = require("../../utils/request/helpers");
18
18
  var _mediaCdn = require("../../utils/mediaCdn");
19
19
  var _resolveAuth = require("./resolveAuth");
20
20
  var _pathBasedUrl = require("../../utils/pathBasedUrl");
21
+ var _watermarkVersion = require("../../utils/watermarkVersion");
22
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
21
23
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
22
24
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
23
25
  var MEDIA_API_REGION = 'media-api-region';
@@ -176,7 +178,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
176
178
  key: "getClientId",
177
179
  value: function () {
178
180
  var _getClientId = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(collectionName) {
179
- var auth, jwtPayload;
181
+ var auth;
180
182
  return _regenerator.default.wrap(function _callee4$(_context4) {
181
183
  while (1) switch (_context4.prev = _context4.next) {
182
184
  case 0:
@@ -186,29 +188,29 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
186
188
  });
187
189
  case 2:
188
190
  auth = _context4.sent;
189
- if ((0, _mediaCore.isClientBasedAuth)(auth)) {
190
- _context4.next = 11;
191
- break;
192
- }
193
- _context4.prev = 4;
194
- jwtPayload = decodeJwtToken(auth.token);
195
- return _context4.abrupt("return", jwtPayload.clientId);
196
- case 9:
197
- _context4.prev = 9;
198
- _context4.t0 = _context4["catch"](4);
199
- case 11:
200
- return _context4.abrupt("return", (0, _mediaCore.isClientBasedAuth)(auth) ? auth.clientId : undefined);
201
- case 12:
191
+ return _context4.abrupt("return", MediaStore.extractClientIdFromAuth(auth));
192
+ case 4:
202
193
  case "end":
203
194
  return _context4.stop();
204
195
  }
205
- }, _callee4, this, [[4, 9]]);
196
+ }, _callee4, this);
206
197
  }));
207
198
  function getClientId(_x11) {
208
199
  return _getClientId.apply(this, arguments);
209
200
  }
210
201
  return getClientId;
211
202
  }()
203
+ }, {
204
+ key: "getClientIdSync",
205
+ value: function getClientIdSync() {
206
+ try {
207
+ var auth = this.resolveInitialAuth();
208
+ return MediaStore.extractClientIdFromAuth(auth);
209
+ } catch (_unused) {
210
+ // initialAuth may not be available, return undefined
211
+ return undefined;
212
+ }
213
+ }
212
214
  }, {
213
215
  key: "removeCollectionFile",
214
216
  value: function () {
@@ -445,8 +447,11 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
445
447
  }, {
446
448
  key: "createFileImageURL",
447
449
  value: function createFileImageURL(id, auth, params) {
450
+ var wmv = (0, _platformFeatureFlags.fg)('confluence_watermark_admin_ui') ? (0, _watermarkVersion.getWatermarkVersionFromToken)(auth.token) : undefined;
448
451
  var options = {
449
- params: extendImageParams(params),
452
+ params: _objectSpread(_objectSpread({}, extendImageParams(params)), wmv ? {
453
+ wmv: wmv
454
+ } : {}),
450
455
  auth: auth
451
456
  };
452
457
  var imageEndpoint = cdnFeatureFlag('image');
@@ -612,7 +617,7 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
612
617
  key: "getImage",
613
618
  value: function () {
614
619
  var _getImage = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(id, params, controller, fetchMaxRes, traceContext) {
615
- var isWebpSupported, headers, imageEndpoint, metadata, options;
620
+ var isWebpSupported, headers, imageEndpoint, metadata, wmvParams, authOptions, auth, wmv, options;
616
621
  return _regenerator.default.wrap(function _callee10$(_context10) {
617
622
  while (1) switch (_context10.prev = _context10.next) {
618
623
  case 0:
@@ -627,17 +632,38 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
627
632
  method: 'GET',
628
633
  endpoint: "/file/{fileId}/".concat(imageEndpoint)
629
634
  };
630
- options = _objectSpread(_objectSpread({}, metadata), {}, {
635
+ wmvParams = {};
636
+ authOptions = {
631
637
  authContext: {
632
638
  collectionName: params && params.collection
633
- },
634
- params: extendImageParams(params, fetchMaxRes),
639
+ }
640
+ };
641
+ if (!(0, _platformFeatureFlags.fg)('confluence_watermark_admin_ui')) {
642
+ _context10.next = 14;
643
+ break;
644
+ }
645
+ _context10.next = 10;
646
+ return this.resolveAuth(authOptions.authContext);
647
+ case 10:
648
+ auth = _context10.sent;
649
+ wmv = (0, _watermarkVersion.getWatermarkVersionFromToken)(auth.token);
650
+ if (wmv) {
651
+ wmvParams = {
652
+ wmv: wmv
653
+ };
654
+ }
655
+ authOptions = {
656
+ resolvedAuth: auth
657
+ };
658
+ case 14:
659
+ options = _objectSpread(_objectSpread(_objectSpread({}, metadata), authOptions), {}, {
660
+ params: _objectSpread(_objectSpread({}, extendImageParams(params, fetchMaxRes)), wmvParams),
635
661
  headers: headers,
636
662
  traceContext: traceContext,
637
663
  addMediaClientParam: true
638
664
  });
639
665
  return _context10.abrupt("return", this.request("/file/".concat(id, "/").concat(imageEndpoint), options, controller, true).then((0, _helpers.createMapResponseToBlob)(metadata)));
640
- case 7:
666
+ case 16:
641
667
  case "end":
642
668
  return _context10.stop();
643
669
  }
@@ -1053,6 +1079,21 @@ var MediaStore = exports.MediaStore = /*#__PURE__*/function () {
1053
1079
  get: function get() {
1054
1080
  return this._chunkHashAlgorithm;
1055
1081
  }
1082
+ }], [{
1083
+ key: "extractClientIdFromAuth",
1084
+ value: function extractClientIdFromAuth(auth) {
1085
+ if ((0, _mediaCore.isClientBasedAuth)(auth)) {
1086
+ return auth.clientId;
1087
+ }
1088
+ // decode JWT token and get clientId (or iss) from payload
1089
+ try {
1090
+ var jwtPayload = decodeJwtToken(auth.token);
1091
+ return jwtPayload.clientId;
1092
+ } catch (_unused2) {
1093
+ // leave clientId as undefined
1094
+ }
1095
+ return undefined;
1096
+ }
1056
1097
  }]);
1057
1098
  }();
1058
1099
  var getValueFromSessionStorage = function getValueFromSessionStorage(key) {
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getWatermarkVersionFromToken = getWatermarkVersionFromToken;
7
+ /**
8
+ * Extracts the watermark version string from a JWT auth token.
9
+ *
10
+ * The token payload may contain a `watermark` field, which is a JSON-encoded
11
+ * string like `{"v":"WjtFdA","ari":"ari:cloud:confluence:..."}`.
12
+ *
13
+ * Returns the `v` value if present, or `undefined` if the token has no
14
+ * watermark or cannot be decoded.
15
+ */
16
+ function getWatermarkVersionFromToken(token) {
17
+ try {
18
+ var parts = token.split('.');
19
+ if (parts.length < 2) {
20
+ return undefined;
21
+ }
22
+ var payload = JSON.parse(atob(parts[1].replace(/-/g, '+').replace(/_/g, '/')));
23
+ if (!payload.watermark) {
24
+ return undefined;
25
+ }
26
+ var watermarkData = JSON.parse(payload.watermark);
27
+ return watermarkData.v;
28
+ } catch (_unused) {
29
+ return undefined;
30
+ }
31
+ }
@@ -42,6 +42,9 @@ export class MediaClient {
42
42
  async getClientId(collectionName) {
43
43
  return this.mediaStore.getClientId(collectionName);
44
44
  }
45
+ getClientIdSync() {
46
+ return this.mediaStore.getClientIdSync();
47
+ }
45
48
  async getImageMetadata(id, params) {
46
49
  return (await this.mediaStore.getImageMetadata(id, params)).metadata;
47
50
  }
@@ -8,6 +8,8 @@ import { isCDNEnabled, mapToMediaCdnUrl } from '../../utils/mediaCdn';
8
8
  import { resolveAuth, resolveInitialAuth } from './resolveAuth';
9
9
  import { ChunkHashAlgorithm } from '@atlaskit/media-core';
10
10
  import { isPathBasedEnabled, mapToPathBasedUrl } from '../../utils/pathBasedUrl';
11
+ import { getWatermarkVersionFromToken } from '../../utils/watermarkVersion';
12
+ import { fg } from '@atlaskit/platform-feature-flags';
11
13
  const MEDIA_API_REGION = 'media-api-region';
12
14
  const MEDIA_API_ENVIRONMENT = 'media-api-environment';
13
15
  const extendImageParams = (params, fetchMaxRes = false) => {
@@ -121,16 +123,29 @@ export class MediaStore {
121
123
  const auth = await this.resolveAuth({
122
124
  collectionName
123
125
  });
124
- if (!isClientBasedAuth(auth)) {
125
- // decode JWT token and get clientId from payload
126
- try {
127
- const jwtPayload = decodeJwtToken(auth.token);
128
- return jwtPayload.clientId;
129
- } catch {
130
- // leave clientId as undefined
131
- }
126
+ return MediaStore.extractClientIdFromAuth(auth);
127
+ }
128
+ getClientIdSync() {
129
+ try {
130
+ const auth = this.resolveInitialAuth();
131
+ return MediaStore.extractClientIdFromAuth(auth);
132
+ } catch {
133
+ // initialAuth may not be available, return undefined
134
+ return undefined;
135
+ }
136
+ }
137
+ static extractClientIdFromAuth(auth) {
138
+ if (isClientBasedAuth(auth)) {
139
+ return auth.clientId;
140
+ }
141
+ // decode JWT token and get clientId (or iss) from payload
142
+ try {
143
+ const jwtPayload = decodeJwtToken(auth.token);
144
+ return jwtPayload.clientId;
145
+ } catch {
146
+ // leave clientId as undefined
132
147
  }
133
- return isClientBasedAuth(auth) ? auth.clientId : undefined;
148
+ return undefined;
134
149
  }
135
150
  async removeCollectionFile(id, collectionName, occurrenceKey, traceContext) {
136
151
  const metadata = {
@@ -280,8 +295,14 @@ export class MediaStore {
280
295
  return this.createFileImageURL(id, auth, params);
281
296
  }
282
297
  createFileImageURL(id, auth, params) {
298
+ const wmv = fg('confluence_watermark_admin_ui') ? getWatermarkVersionFromToken(auth.token) : undefined;
283
299
  const options = {
284
- params: extendImageParams(params),
300
+ params: {
301
+ ...extendImageParams(params),
302
+ ...(wmv ? {
303
+ wmv
304
+ } : {})
305
+ },
285
306
  auth
286
307
  };
287
308
  const imageEndpoint = cdnFeatureFlag('image');
@@ -374,12 +395,31 @@ export class MediaStore {
374
395
  method: 'GET',
375
396
  endpoint: `/file/{fileId}/${imageEndpoint}`
376
397
  };
377
- const options = {
378
- ...metadata,
398
+ let wmvParams = {};
399
+ let authOptions = {
379
400
  authContext: {
380
401
  collectionName: params && params.collection
402
+ }
403
+ };
404
+ if (fg('confluence_watermark_admin_ui')) {
405
+ const auth = await this.resolveAuth(authOptions.authContext);
406
+ const wmv = getWatermarkVersionFromToken(auth.token);
407
+ if (wmv) {
408
+ wmvParams = {
409
+ wmv
410
+ };
411
+ }
412
+ authOptions = {
413
+ resolvedAuth: auth
414
+ };
415
+ }
416
+ const options = {
417
+ ...metadata,
418
+ ...authOptions,
419
+ params: {
420
+ ...extendImageParams(params, fetchMaxRes),
421
+ ...wmvParams
381
422
  },
382
- params: extendImageParams(params, fetchMaxRes),
383
423
  headers,
384
424
  traceContext,
385
425
  addMediaClientParam: true
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Extracts the watermark version string from a JWT auth token.
3
+ *
4
+ * The token payload may contain a `watermark` field, which is a JSON-encoded
5
+ * string like `{"v":"WjtFdA","ari":"ari:cloud:confluence:..."}`.
6
+ *
7
+ * Returns the `v` value if present, or `undefined` if the token has no
8
+ * watermark or cannot be decoded.
9
+ */
10
+ export function getWatermarkVersionFromToken(token) {
11
+ try {
12
+ const parts = token.split('.');
13
+ if (parts.length < 2) {
14
+ return undefined;
15
+ }
16
+ const payload = JSON.parse(atob(parts[1].replace(/-/g, '+').replace(/_/g, '/')));
17
+ if (!payload.watermark) {
18
+ return undefined;
19
+ }
20
+ const watermarkData = JSON.parse(payload.watermark);
21
+ return watermarkData.v;
22
+ } catch {
23
+ return undefined;
24
+ }
25
+ }
@@ -73,6 +73,11 @@ export var MediaClient = /*#__PURE__*/function () {
73
73
  }
74
74
  return getClientId;
75
75
  }()
76
+ }, {
77
+ key: "getClientIdSync",
78
+ value: function getClientIdSync() {
79
+ return this.mediaStore.getClientIdSync();
80
+ }
76
81
  }, {
77
82
  key: "getImageMetadata",
78
83
  value: function () {
@@ -14,6 +14,8 @@ import { isCDNEnabled, mapToMediaCdnUrl } from '../../utils/mediaCdn';
14
14
  import { resolveAuth, resolveInitialAuth } from './resolveAuth';
15
15
  import { ChunkHashAlgorithm } from '@atlaskit/media-core';
16
16
  import { isPathBasedEnabled, mapToPathBasedUrl } from '../../utils/pathBasedUrl';
17
+ import { getWatermarkVersionFromToken } from '../../utils/watermarkVersion';
18
+ import { fg } from '@atlaskit/platform-feature-flags';
17
19
  var MEDIA_API_REGION = 'media-api-region';
18
20
  var MEDIA_API_ENVIRONMENT = 'media-api-environment';
19
21
  var extendImageParams = function extendImageParams(params) {
@@ -170,7 +172,7 @@ export var MediaStore = /*#__PURE__*/function () {
170
172
  key: "getClientId",
171
173
  value: function () {
172
174
  var _getClientId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(collectionName) {
173
- var auth, jwtPayload;
175
+ var auth;
174
176
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
175
177
  while (1) switch (_context4.prev = _context4.next) {
176
178
  case 0:
@@ -180,29 +182,29 @@ export var MediaStore = /*#__PURE__*/function () {
180
182
  });
181
183
  case 2:
182
184
  auth = _context4.sent;
183
- if (isClientBasedAuth(auth)) {
184
- _context4.next = 11;
185
- break;
186
- }
187
- _context4.prev = 4;
188
- jwtPayload = decodeJwtToken(auth.token);
189
- return _context4.abrupt("return", jwtPayload.clientId);
190
- case 9:
191
- _context4.prev = 9;
192
- _context4.t0 = _context4["catch"](4);
193
- case 11:
194
- return _context4.abrupt("return", isClientBasedAuth(auth) ? auth.clientId : undefined);
195
- case 12:
185
+ return _context4.abrupt("return", MediaStore.extractClientIdFromAuth(auth));
186
+ case 4:
196
187
  case "end":
197
188
  return _context4.stop();
198
189
  }
199
- }, _callee4, this, [[4, 9]]);
190
+ }, _callee4, this);
200
191
  }));
201
192
  function getClientId(_x11) {
202
193
  return _getClientId.apply(this, arguments);
203
194
  }
204
195
  return getClientId;
205
196
  }()
197
+ }, {
198
+ key: "getClientIdSync",
199
+ value: function getClientIdSync() {
200
+ try {
201
+ var auth = this.resolveInitialAuth();
202
+ return MediaStore.extractClientIdFromAuth(auth);
203
+ } catch (_unused) {
204
+ // initialAuth may not be available, return undefined
205
+ return undefined;
206
+ }
207
+ }
206
208
  }, {
207
209
  key: "removeCollectionFile",
208
210
  value: function () {
@@ -439,8 +441,11 @@ export var MediaStore = /*#__PURE__*/function () {
439
441
  }, {
440
442
  key: "createFileImageURL",
441
443
  value: function createFileImageURL(id, auth, params) {
444
+ var wmv = fg('confluence_watermark_admin_ui') ? getWatermarkVersionFromToken(auth.token) : undefined;
442
445
  var options = {
443
- params: extendImageParams(params),
446
+ params: _objectSpread(_objectSpread({}, extendImageParams(params)), wmv ? {
447
+ wmv: wmv
448
+ } : {}),
444
449
  auth: auth
445
450
  };
446
451
  var imageEndpoint = cdnFeatureFlag('image');
@@ -606,7 +611,7 @@ export var MediaStore = /*#__PURE__*/function () {
606
611
  key: "getImage",
607
612
  value: function () {
608
613
  var _getImage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(id, params, controller, fetchMaxRes, traceContext) {
609
- var isWebpSupported, headers, imageEndpoint, metadata, options;
614
+ var isWebpSupported, headers, imageEndpoint, metadata, wmvParams, authOptions, auth, wmv, options;
610
615
  return _regeneratorRuntime.wrap(function _callee10$(_context10) {
611
616
  while (1) switch (_context10.prev = _context10.next) {
612
617
  case 0:
@@ -621,17 +626,38 @@ export var MediaStore = /*#__PURE__*/function () {
621
626
  method: 'GET',
622
627
  endpoint: "/file/{fileId}/".concat(imageEndpoint)
623
628
  };
624
- options = _objectSpread(_objectSpread({}, metadata), {}, {
629
+ wmvParams = {};
630
+ authOptions = {
625
631
  authContext: {
626
632
  collectionName: params && params.collection
627
- },
628
- params: extendImageParams(params, fetchMaxRes),
633
+ }
634
+ };
635
+ if (!fg('confluence_watermark_admin_ui')) {
636
+ _context10.next = 14;
637
+ break;
638
+ }
639
+ _context10.next = 10;
640
+ return this.resolveAuth(authOptions.authContext);
641
+ case 10:
642
+ auth = _context10.sent;
643
+ wmv = getWatermarkVersionFromToken(auth.token);
644
+ if (wmv) {
645
+ wmvParams = {
646
+ wmv: wmv
647
+ };
648
+ }
649
+ authOptions = {
650
+ resolvedAuth: auth
651
+ };
652
+ case 14:
653
+ options = _objectSpread(_objectSpread(_objectSpread({}, metadata), authOptions), {}, {
654
+ params: _objectSpread(_objectSpread({}, extendImageParams(params, fetchMaxRes)), wmvParams),
629
655
  headers: headers,
630
656
  traceContext: traceContext,
631
657
  addMediaClientParam: true
632
658
  });
633
659
  return _context10.abrupt("return", this.request("/file/".concat(id, "/").concat(imageEndpoint), options, controller, true).then(createMapResponseToBlob(metadata)));
634
- case 7:
660
+ case 16:
635
661
  case "end":
636
662
  return _context10.stop();
637
663
  }
@@ -1047,6 +1073,21 @@ export var MediaStore = /*#__PURE__*/function () {
1047
1073
  get: function get() {
1048
1074
  return this._chunkHashAlgorithm;
1049
1075
  }
1076
+ }], [{
1077
+ key: "extractClientIdFromAuth",
1078
+ value: function extractClientIdFromAuth(auth) {
1079
+ if (isClientBasedAuth(auth)) {
1080
+ return auth.clientId;
1081
+ }
1082
+ // decode JWT token and get clientId (or iss) from payload
1083
+ try {
1084
+ var jwtPayload = decodeJwtToken(auth.token);
1085
+ return jwtPayload.clientId;
1086
+ } catch (_unused2) {
1087
+ // leave clientId as undefined
1088
+ }
1089
+ return undefined;
1090
+ }
1050
1091
  }]);
1051
1092
  }();
1052
1093
  var getValueFromSessionStorage = function getValueFromSessionStorage(key) {
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Extracts the watermark version string from a JWT auth token.
3
+ *
4
+ * The token payload may contain a `watermark` field, which is a JSON-encoded
5
+ * string like `{"v":"WjtFdA","ari":"ari:cloud:confluence:..."}`.
6
+ *
7
+ * Returns the `v` value if present, or `undefined` if the token has no
8
+ * watermark or cannot be decoded.
9
+ */
10
+ export function getWatermarkVersionFromToken(token) {
11
+ try {
12
+ var parts = token.split('.');
13
+ if (parts.length < 2) {
14
+ return undefined;
15
+ }
16
+ var payload = JSON.parse(atob(parts[1].replace(/-/g, '+').replace(/_/g, '/')));
17
+ if (!payload.watermark) {
18
+ return undefined;
19
+ }
20
+ var watermarkData = JSON.parse(payload.watermark);
21
+ return watermarkData.v;
22
+ } catch (_unused) {
23
+ return undefined;
24
+ }
25
+ }
@@ -24,6 +24,7 @@ export declare class MediaClient {
24
24
  getImageUrl(id: string, params?: MediaStoreGetFileImageParams): Promise<string>;
25
25
  getImageUrlSync(id: string, params?: MediaStoreGetFileImageParams): string;
26
26
  getClientId(collectionName?: string): Promise<string | undefined>;
27
+ getClientIdSync(): string | undefined;
27
28
  getImageMetadata(id: string, params?: MediaStoreGetFileImageParams): Promise<ImageMetadata>;
28
29
  mobileUploadPromise(): Promise<MobileUpload>;
29
30
  removeFileFromCollection(id: string, collectionName: string, occurrenceKey?: string, traceContext?: MediaTraceContext): Promise<void>;
@@ -10,6 +10,8 @@ export declare class MediaStore implements MediaApi {
10
10
  private readonly _chunkHashAlgorithm;
11
11
  constructor(config: MediaApiConfig);
12
12
  getClientId(collectionName?: string): Promise<string | undefined>;
13
+ getClientIdSync(): string | undefined;
14
+ private static extractClientIdFromAuth;
13
15
  removeCollectionFile(id: string, collectionName: string, occurrenceKey?: string, traceContext?: MediaTraceContext): Promise<void>;
14
16
  createUpload(createUpTo?: number, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaUpload[]>>;
15
17
  uploadChunk(etag: string, blob: Blob, uploadId: string, partNumber: number, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Extracts the watermark version string from a JWT auth token.
3
+ *
4
+ * The token payload may contain a `watermark` field, which is a JSON-encoded
5
+ * string like `{"v":"WjtFdA","ari":"ari:cloud:confluence:..."}`.
6
+ *
7
+ * Returns the `v` value if present, or `undefined` if the token has no
8
+ * watermark or cannot be decoded.
9
+ */
10
+ export declare function getWatermarkVersionFromToken(token: string): string | undefined;
@@ -24,6 +24,7 @@ export declare class MediaClient {
24
24
  getImageUrl(id: string, params?: MediaStoreGetFileImageParams): Promise<string>;
25
25
  getImageUrlSync(id: string, params?: MediaStoreGetFileImageParams): string;
26
26
  getClientId(collectionName?: string): Promise<string | undefined>;
27
+ getClientIdSync(): string | undefined;
27
28
  getImageMetadata(id: string, params?: MediaStoreGetFileImageParams): Promise<ImageMetadata>;
28
29
  mobileUploadPromise(): Promise<MobileUpload>;
29
30
  removeFileFromCollection(id: string, collectionName: string, occurrenceKey?: string, traceContext?: MediaTraceContext): Promise<void>;
@@ -10,6 +10,8 @@ export declare class MediaStore implements MediaApi {
10
10
  private readonly _chunkHashAlgorithm;
11
11
  constructor(config: MediaApiConfig);
12
12
  getClientId(collectionName?: string): Promise<string | undefined>;
13
+ getClientIdSync(): string | undefined;
14
+ private static extractClientIdFromAuth;
13
15
  removeCollectionFile(id: string, collectionName: string, occurrenceKey?: string, traceContext?: MediaTraceContext): Promise<void>;
14
16
  createUpload(createUpTo?: number, collectionName?: string, traceContext?: MediaTraceContext): Promise<MediaStoreResponse<MediaUpload[]>>;
15
17
  uploadChunk(etag: string, blob: Blob, uploadId: string, partNumber: number, collectionName?: string, traceContext?: MediaTraceContext): Promise<void>;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Extracts the watermark version string from a JWT auth token.
3
+ *
4
+ * The token payload may contain a `watermark` field, which is a JSON-encoded
5
+ * string like `{"v":"WjtFdA","ari":"ari:cloud:confluence:..."}`.
6
+ *
7
+ * Returns the `v` value if present, or `undefined` if the token has no
8
+ * watermark or cannot be decoded.
9
+ */
10
+ export declare function getWatermarkVersionFromToken(token: string): string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/media-client",
3
- "version": "36.0.1",
3
+ "version": "36.0.2",
4
4
  "description": "Media API Web Client Library",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -53,7 +53,7 @@
53
53
  "@atlaskit/media-core": "^37.0.0",
54
54
  "@atlaskit/media-state": "^2.0.0",
55
55
  "@atlaskit/ssr": "workspace:^",
56
- "@atlaskit/tokens": "^11.0.0",
56
+ "@atlaskit/tokens": "^11.1.0",
57
57
  "@atlassian/a11y-jest-testing": "^0.10.0",
58
58
  "@atlassian/feature-flags-test-utils": "^1.0.0",
59
59
  "@emotion/react": "^11.7.1",
@@ -91,6 +91,9 @@
91
91
  },
92
92
  "platform_media_auth_provider_analytics": {
93
93
  "type": "boolean"
94
+ },
95
+ "confluence_watermark_admin_ui": {
96
+ "type": "boolean"
94
97
  }
95
98
  }
96
99
  }