@atlaskit/editor-synced-block-provider 4.5.2 → 4.5.4

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,18 @@
1
1
  # @atlaskit/editor-synced-block-provider
2
2
 
3
+ ## 4.5.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`dc48cb1948508`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/dc48cb1948508) -
8
+ Return contentAri from retrieveSyncBlockParentInfo to be used for fetchJiraMediaToken.
9
+
10
+ ## 4.5.3
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
3
16
  ## 4.5.2
4
17
 
5
18
  ### Patch Changes
@@ -12,13 +12,14 @@ var requiresCrossProductAuth = exports.requiresCrossProductAuth = function requi
12
12
  return !!sourceProduct && sourceProduct !== hostProduct;
13
13
  };
14
14
  var fetchTokenForSourceProduct = exports.fetchTokenForSourceProduct = function fetchTokenForSourceProduct(_ref2) {
15
- var contentId = _ref2.contentId,
15
+ var contentAri = _ref2.contentAri,
16
+ contentId = _ref2.contentId,
16
17
  sourceProduct = _ref2.sourceProduct;
17
18
  switch (sourceProduct) {
18
19
  case 'confluence-page':
19
20
  return (0, _fetchMediaToken.fetchMediaToken)(contentId);
20
21
  case 'jira-work-item':
21
- return (0, _fetchMediaToken2.fetchJiraMediaToken)(contentId);
22
+ return (0, _fetchMediaToken2.fetchJiraMediaToken)(contentAri);
22
23
  default:
23
24
  throw new Error("Unsupported source product for token fetch: ".concat(sourceProduct));
24
25
  }
@@ -427,6 +427,7 @@ var SyncedBlockProvider = exports.SyncedBlockProvider = /*#__PURE__*/function (_
427
427
  switch (sourceProduct) {
428
428
  case 'confluence-page':
429
429
  return {
430
+ contentAri: sourceAri,
430
431
  contentId: (0, _ari2.getPageIdAndTypeFromConfluencePageAri)({
431
432
  ari: sourceAri
432
433
  }).id,
@@ -434,6 +435,7 @@ var SyncedBlockProvider = exports.SyncedBlockProvider = /*#__PURE__*/function (_
434
435
  };
435
436
  case 'jira-work-item':
436
437
  return {
438
+ contentAri: sourceAri,
437
439
  contentId: sourceAri,
438
440
  contentProduct: sourceProduct
439
441
  };
@@ -73,7 +73,7 @@ var SyncBlockProviderFactoryManager = exports.SyncBlockProviderFactoryManager =
73
73
  }, {
74
74
  key: "getSSRProviders",
75
75
  value: function getSSRProviders(resourceId) {
76
- var _syncBlock$data;
76
+ var _syncBlock$data, _syncBlock$data2;
77
77
  var dataProvider = this.deps.getDataProvider();
78
78
  if (!dataProvider) {
79
79
  return null;
@@ -90,15 +90,18 @@ var SyncBlockProviderFactoryManager = exports.SyncBlockProviderFactoryManager =
90
90
  var contentId = parsedResourceId.contentId,
91
91
  contentProduct = parsedResourceId.product;
92
92
  var syncBlock = this.deps.getFromCache(resourceId);
93
- if (syncBlock !== null && syncBlock !== void 0 && (_syncBlock$data = syncBlock.data) !== null && _syncBlock$data !== void 0 && _syncBlock$data.sourceAri && syncBlock.data.product) {
93
+ var contentAri = (syncBlock === null || syncBlock === void 0 || (_syncBlock$data = syncBlock.data) === null || _syncBlock$data === void 0 ? void 0 : _syncBlock$data.sourceAri) || '';
94
+ if (syncBlock !== null && syncBlock !== void 0 && (_syncBlock$data2 = syncBlock.data) !== null && _syncBlock$data2 !== void 0 && _syncBlock$data2.sourceAri && syncBlock.data.product) {
94
95
  var parentInfo = dataProvider.retrieveSyncBlockParentInfo(syncBlock.data.sourceAri, syncBlock.data.product);
95
96
  if (parentInfo) {
96
97
  contentId = parentInfo.contentId;
97
98
  contentProduct = parentInfo.contentProduct;
99
+ contentAri = parentInfo.contentAri;
98
100
  }
99
101
  }
100
102
  try {
101
103
  var mediaProvider = providerCreator.createSSRMediaProvider({
104
+ contentAri: contentAri,
102
105
  contentId: contentId,
103
106
  contentProduct: contentProduct
104
107
  });
@@ -153,10 +156,12 @@ var SyncBlockProviderFactoryManager = exports.SyncBlockProviderFactoryManager =
153
156
  if (!parentInfo) {
154
157
  throw new Error('Unable to retrieve sync block parent info');
155
158
  }
156
- var contentId = parentInfo.contentId,
159
+ var contentAri = parentInfo.contentAri,
160
+ contentId = parentInfo.contentId,
157
161
  contentProduct = parentInfo.contentProduct;
158
162
  if (!hasMediaProvider && providerCreator.createMediaProvider && contentId && contentProduct) {
159
163
  var mediaProvider = providerCreator.createMediaProvider({
164
+ contentAri: contentAri,
160
165
  contentProduct: contentProduct,
161
166
  contentId: contentId
162
167
  });
@@ -166,6 +171,7 @@ var SyncBlockProviderFactoryManager = exports.SyncBlockProviderFactoryManager =
166
171
  }
167
172
  if (!hasEmojiProvider && providerCreator.createEmojiProvider && contentId && contentProduct) {
168
173
  var emojiProvider = providerCreator.createEmojiProvider({
174
+ contentAri: contentAri,
169
175
  contentProduct: contentProduct,
170
176
  contentId: contentId
171
177
  });
@@ -7,6 +7,7 @@ export const requiresCrossProductAuth = ({
7
7
  return !!sourceProduct && sourceProduct !== hostProduct;
8
8
  };
9
9
  export const fetchTokenForSourceProduct = ({
10
+ contentAri,
10
11
  contentId,
11
12
  sourceProduct
12
13
  }) => {
@@ -14,7 +15,7 @@ export const fetchTokenForSourceProduct = ({
14
15
  case 'confluence-page':
15
16
  return fetchMediaToken(contentId);
16
17
  case 'jira-work-item':
17
- return fetchJiraMediaToken(contentId);
18
+ return fetchJiraMediaToken(contentAri);
18
19
  default:
19
20
  throw new Error(`Unsupported source product for token fetch: ${sourceProduct}`);
20
21
  }
@@ -275,6 +275,7 @@ export class SyncedBlockProvider extends SyncBlockDataProviderInterface {
275
275
  switch (sourceProduct) {
276
276
  case 'confluence-page':
277
277
  return {
278
+ contentAri: sourceAri,
278
279
  contentId: getPageIdAndTypeFromConfluencePageAri({
279
280
  ari: sourceAri
280
281
  }).id,
@@ -282,6 +283,7 @@ export class SyncedBlockProvider extends SyncBlockDataProviderInterface {
282
283
  };
283
284
  case 'jira-work-item':
284
285
  return {
286
+ contentAri: sourceAri,
285
287
  contentId: sourceAri,
286
288
  contentProduct: sourceProduct
287
289
  };
@@ -60,7 +60,7 @@ export class SyncBlockProviderFactoryManager {
60
60
  return providerFactory;
61
61
  }
62
62
  getSSRProviders(resourceId) {
63
- var _syncBlock$data;
63
+ var _syncBlock$data, _syncBlock$data2;
64
64
  const dataProvider = this.deps.getDataProvider();
65
65
  if (!dataProvider) {
66
66
  return null;
@@ -80,15 +80,18 @@ export class SyncBlockProviderFactoryManager {
80
80
  product: contentProduct
81
81
  } = parsedResourceId;
82
82
  const syncBlock = this.deps.getFromCache(resourceId);
83
- if (syncBlock !== null && syncBlock !== void 0 && (_syncBlock$data = syncBlock.data) !== null && _syncBlock$data !== void 0 && _syncBlock$data.sourceAri && syncBlock.data.product) {
83
+ let contentAri = (syncBlock === null || syncBlock === void 0 ? void 0 : (_syncBlock$data = syncBlock.data) === null || _syncBlock$data === void 0 ? void 0 : _syncBlock$data.sourceAri) || '';
84
+ if (syncBlock !== null && syncBlock !== void 0 && (_syncBlock$data2 = syncBlock.data) !== null && _syncBlock$data2 !== void 0 && _syncBlock$data2.sourceAri && syncBlock.data.product) {
84
85
  const parentInfo = dataProvider.retrieveSyncBlockParentInfo(syncBlock.data.sourceAri, syncBlock.data.product);
85
86
  if (parentInfo) {
86
87
  contentId = parentInfo.contentId;
87
88
  contentProduct = parentInfo.contentProduct;
89
+ contentAri = parentInfo.contentAri;
88
90
  }
89
91
  }
90
92
  try {
91
93
  const mediaProvider = providerCreator.createSSRMediaProvider({
94
+ contentAri,
92
95
  contentId,
93
96
  contentProduct
94
97
  });
@@ -136,11 +139,13 @@ export class SyncBlockProviderFactoryManager {
136
139
  throw new Error('Unable to retrieve sync block parent info');
137
140
  }
138
141
  const {
142
+ contentAri,
139
143
  contentId,
140
144
  contentProduct
141
145
  } = parentInfo;
142
146
  if (!hasMediaProvider && providerCreator.createMediaProvider && contentId && contentProduct) {
143
147
  const mediaProvider = providerCreator.createMediaProvider({
148
+ contentAri,
144
149
  contentProduct,
145
150
  contentId
146
151
  });
@@ -150,6 +155,7 @@ export class SyncBlockProviderFactoryManager {
150
155
  }
151
156
  if (!hasEmojiProvider && providerCreator.createEmojiProvider && contentId && contentProduct) {
152
157
  const emojiProvider = providerCreator.createEmojiProvider({
158
+ contentAri,
153
159
  contentProduct,
154
160
  contentId
155
161
  });
@@ -6,13 +6,14 @@ export var requiresCrossProductAuth = function requiresCrossProductAuth(_ref) {
6
6
  return !!sourceProduct && sourceProduct !== hostProduct;
7
7
  };
8
8
  export var fetchTokenForSourceProduct = function fetchTokenForSourceProduct(_ref2) {
9
- var contentId = _ref2.contentId,
9
+ var contentAri = _ref2.contentAri,
10
+ contentId = _ref2.contentId,
10
11
  sourceProduct = _ref2.sourceProduct;
11
12
  switch (sourceProduct) {
12
13
  case 'confluence-page':
13
14
  return fetchMediaToken(contentId);
14
15
  case 'jira-work-item':
15
- return fetchJiraMediaToken(contentId);
16
+ return fetchJiraMediaToken(contentAri);
16
17
  default:
17
18
  throw new Error("Unsupported source product for token fetch: ".concat(sourceProduct));
18
19
  }
@@ -420,6 +420,7 @@ export var SyncedBlockProvider = /*#__PURE__*/function (_SyncBlockDataProvide) {
420
420
  switch (sourceProduct) {
421
421
  case 'confluence-page':
422
422
  return {
423
+ contentAri: sourceAri,
423
424
  contentId: getPageIdAndTypeFromConfluencePageAri({
424
425
  ari: sourceAri
425
426
  }).id,
@@ -427,6 +428,7 @@ export var SyncedBlockProvider = /*#__PURE__*/function (_SyncBlockDataProvide) {
427
428
  };
428
429
  case 'jira-work-item':
429
430
  return {
431
+ contentAri: sourceAri,
430
432
  contentId: sourceAri,
431
433
  contentProduct: sourceProduct
432
434
  };
@@ -66,7 +66,7 @@ export var SyncBlockProviderFactoryManager = /*#__PURE__*/function () {
66
66
  }, {
67
67
  key: "getSSRProviders",
68
68
  value: function getSSRProviders(resourceId) {
69
- var _syncBlock$data;
69
+ var _syncBlock$data, _syncBlock$data2;
70
70
  var dataProvider = this.deps.getDataProvider();
71
71
  if (!dataProvider) {
72
72
  return null;
@@ -83,15 +83,18 @@ export var SyncBlockProviderFactoryManager = /*#__PURE__*/function () {
83
83
  var contentId = parsedResourceId.contentId,
84
84
  contentProduct = parsedResourceId.product;
85
85
  var syncBlock = this.deps.getFromCache(resourceId);
86
- if (syncBlock !== null && syncBlock !== void 0 && (_syncBlock$data = syncBlock.data) !== null && _syncBlock$data !== void 0 && _syncBlock$data.sourceAri && syncBlock.data.product) {
86
+ var contentAri = (syncBlock === null || syncBlock === void 0 || (_syncBlock$data = syncBlock.data) === null || _syncBlock$data === void 0 ? void 0 : _syncBlock$data.sourceAri) || '';
87
+ if (syncBlock !== null && syncBlock !== void 0 && (_syncBlock$data2 = syncBlock.data) !== null && _syncBlock$data2 !== void 0 && _syncBlock$data2.sourceAri && syncBlock.data.product) {
87
88
  var parentInfo = dataProvider.retrieveSyncBlockParentInfo(syncBlock.data.sourceAri, syncBlock.data.product);
88
89
  if (parentInfo) {
89
90
  contentId = parentInfo.contentId;
90
91
  contentProduct = parentInfo.contentProduct;
92
+ contentAri = parentInfo.contentAri;
91
93
  }
92
94
  }
93
95
  try {
94
96
  var mediaProvider = providerCreator.createSSRMediaProvider({
97
+ contentAri: contentAri,
95
98
  contentId: contentId,
96
99
  contentProduct: contentProduct
97
100
  });
@@ -146,10 +149,12 @@ export var SyncBlockProviderFactoryManager = /*#__PURE__*/function () {
146
149
  if (!parentInfo) {
147
150
  throw new Error('Unable to retrieve sync block parent info');
148
151
  }
149
- var contentId = parentInfo.contentId,
152
+ var contentAri = parentInfo.contentAri,
153
+ contentId = parentInfo.contentId,
150
154
  contentProduct = parentInfo.contentProduct;
151
155
  if (!hasMediaProvider && providerCreator.createMediaProvider && contentId && contentProduct) {
152
156
  var mediaProvider = providerCreator.createMediaProvider({
157
+ contentAri: contentAri,
153
158
  contentProduct: contentProduct,
154
159
  contentId: contentId
155
160
  });
@@ -159,6 +164,7 @@ export var SyncBlockProviderFactoryManager = /*#__PURE__*/function () {
159
164
  }
160
165
  if (!hasEmojiProvider && providerCreator.createEmojiProvider && contentId && contentProduct) {
161
166
  var emojiProvider = providerCreator.createEmojiProvider({
167
+ contentAri: contentAri,
162
168
  contentProduct: contentProduct,
163
169
  contentId: contentId
164
170
  });
@@ -4,7 +4,8 @@ export declare const requiresCrossProductAuth: ({ hostProduct, sourceProduct, }:
4
4
  hostProduct: SyncBlockProduct;
5
5
  sourceProduct?: SyncBlockProduct;
6
6
  }) => boolean;
7
- export declare const fetchTokenForSourceProduct: ({ contentId, sourceProduct, }: {
7
+ export declare const fetchTokenForSourceProduct: ({ contentAri, contentId, sourceProduct, }: {
8
+ contentAri: string;
8
9
  contentId: string;
9
10
  sourceProduct?: SyncBlockProduct;
10
11
  }) => Promise<TokenData>;
@@ -41,6 +41,7 @@ export type SyncBlockSourceInfo = {
41
41
  url?: string;
42
42
  };
43
43
  export type SyncBlockParentInfo = {
44
+ contentAri: string;
44
45
  contentId: string;
45
46
  contentProduct: SyncBlockProduct;
46
47
  };
@@ -106,6 +107,7 @@ export interface ADFWriteProvider {
106
107
  writeDataBatch?: (data: SyncBlockData[]) => Promise<WriteSyncBlockResult[]>;
107
108
  }
108
109
  export type MediaEmojiProviderOptions = {
110
+ contentAri: string;
109
111
  contentId: string;
110
112
  contentProduct: SyncBlockProduct;
111
113
  };
@@ -4,7 +4,8 @@ export declare const requiresCrossProductAuth: ({ hostProduct, sourceProduct, }:
4
4
  hostProduct: SyncBlockProduct;
5
5
  sourceProduct?: SyncBlockProduct;
6
6
  }) => boolean;
7
- export declare const fetchTokenForSourceProduct: ({ contentId, sourceProduct, }: {
7
+ export declare const fetchTokenForSourceProduct: ({ contentAri, contentId, sourceProduct, }: {
8
+ contentAri: string;
8
9
  contentId: string;
9
10
  sourceProduct?: SyncBlockProduct;
10
11
  }) => Promise<TokenData>;
@@ -41,6 +41,7 @@ export type SyncBlockSourceInfo = {
41
41
  url?: string;
42
42
  };
43
43
  export type SyncBlockParentInfo = {
44
+ contentAri: string;
44
45
  contentId: string;
45
46
  contentProduct: SyncBlockProduct;
46
47
  };
@@ -106,6 +107,7 @@ export interface ADFWriteProvider {
106
107
  writeDataBatch?: (data: SyncBlockData[]) => Promise<WriteSyncBlockResult[]>;
107
108
  }
108
109
  export type MediaEmojiProviderOptions = {
110
+ contentAri: string;
109
111
  contentId: string;
110
112
  contentProduct: SyncBlockProduct;
111
113
  };
package/package.json CHANGED
@@ -29,7 +29,7 @@
29
29
  "@atlaskit/editor-prosemirror": "^7.3.0",
30
30
  "@atlaskit/node-data-provider": "^9.0.0",
31
31
  "@atlaskit/platform-feature-flags": "^1.1.0",
32
- "@atlaskit/tmp-editor-statsig": "^61.0.0",
32
+ "@atlaskit/tmp-editor-statsig": "^62.0.0",
33
33
  "@babel/runtime": "^7.0.0",
34
34
  "@compiled/react": "^0.20.0",
35
35
  "graphql-ws": "^5.14.2",
@@ -38,7 +38,7 @@
38
38
  "uuid": "^3.1.0"
39
39
  },
40
40
  "peerDependencies": {
41
- "@atlaskit/editor-common": "^112.20.0",
41
+ "@atlaskit/editor-common": "^112.21.0",
42
42
  "react": "^18.2.0"
43
43
  },
44
44
  "devDependencies": {
@@ -81,7 +81,7 @@
81
81
  }
82
82
  },
83
83
  "name": "@atlaskit/editor-synced-block-provider",
84
- "version": "4.5.2",
84
+ "version": "4.5.4",
85
85
  "description": "Synced Block Provider for @atlaskit/editor-plugin-synced-block",
86
86
  "author": "Atlassian Pty Ltd",
87
87
  "license": "Apache-2.0",