@atlaskit/editor-synced-block-provider 2.15.3 → 2.15.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,12 @@
1
1
  # @atlaskit/editor-synced-block-provider
2
2
 
3
+ ## 2.15.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`a41bf96788d92`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a41bf96788d92) -
8
+ [ux] Fix sync block permissions denied error to show the correct state
9
+
3
10
  ## 2.15.3
4
11
 
5
12
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -63,6 +63,12 @@ Object.defineProperty(exports, "fetchConfluencePageInfo", {
63
63
  return _sourceInfo.fetchConfluencePageInfo;
64
64
  }
65
65
  });
66
+ Object.defineProperty(exports, "fetchErrorPayload", {
67
+ enumerable: true,
68
+ get: function get() {
69
+ return _errorHandling.fetchErrorPayload;
70
+ }
71
+ });
66
72
  Object.defineProperty(exports, "fetchReferences", {
67
73
  enumerable: true,
68
74
  get: function get() {
@@ -87,6 +93,12 @@ Object.defineProperty(exports, "getConfluencePageAri", {
87
93
  return _ari2.getConfluencePageAri;
88
94
  }
89
95
  });
96
+ Object.defineProperty(exports, "getContentIdAndProductFromResourceId", {
97
+ enumerable: true,
98
+ get: function get() {
99
+ return _utils.getContentIdAndProductFromResourceId;
100
+ }
101
+ });
90
102
  Object.defineProperty(exports, "getLocalIdFromBlockResourceId", {
91
103
  enumerable: true,
92
104
  get: function get() {
@@ -179,4 +191,5 @@ var _syncBlockProvider = require("./providers/syncBlockProvider");
179
191
  var _referenceSyncBlockStoreManager = require("./store-manager/referenceSyncBlockStoreManager");
180
192
  var _syncBlockStoreManager = require("./store-manager/syncBlockStoreManager");
181
193
  var _resolveSyncBlockInstance = require("./utils/resolveSyncBlockInstance");
182
- var _utils = require("./utils/utils");
194
+ var _utils = require("./utils/utils");
195
+ var _errorHandling = require("./utils/errorHandling");
@@ -3,7 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.createSyncBlockNode = exports.convertSyncBlockPMNodeToSyncBlockData = exports.convertSyncBlockJSONNodeToSyncBlockNode = exports.convertPMNodesToSyncBlockNodes = exports.convertPMNodeToSyncBlockNode = void 0;
6
+ exports.getContentIdAndProductFromResourceId = exports.createSyncBlockNode = exports.convertSyncBlockPMNodeToSyncBlockData = exports.convertSyncBlockJSONNodeToSyncBlockNode = exports.convertPMNodesToSyncBlockNodes = exports.convertPMNodeToSyncBlockNode = void 0;
7
+ /* eslint-disable require-unicode-regexp */
8
+
7
9
  var convertSyncBlockPMNodeToSyncBlockData = exports.convertSyncBlockPMNodeToSyncBlockData = function convertSyncBlockPMNodeToSyncBlockData(node) {
8
10
  return {
9
11
  blockInstanceId: node.attrs.localId,
@@ -39,4 +41,20 @@ var convertPMNodesToSyncBlockNodes = exports.convertPMNodesToSyncBlockNodes = fu
39
41
  }).filter(function (node) {
40
42
  return node !== undefined;
41
43
  }) || [];
44
+ };
45
+
46
+ /*
47
+ * From a reference block resource id (the resourceId stored in the node attributes)
48
+ * e.g. confluence-page/5769323474/cdf6a1bc-b241-487a-93e9-e30bde363cbc
49
+ * Extracts the source page content id and source product
50
+ */
51
+ var getContentIdAndProductFromResourceId = exports.getContentIdAndProductFromResourceId = function getContentIdAndProductFromResourceId(resourceId) {
52
+ var match = resourceId.match(/^(confluence-page|jira-work-item)\/([^/]+)/);
53
+ if (match !== null && match !== void 0 && match[2]) {
54
+ return {
55
+ sourceProduct: match[1],
56
+ sourceContentId: match[2]
57
+ };
58
+ }
59
+ throw new Error("Invalid resourceId: ".concat(resourceId));
42
60
  };
@@ -23,5 +23,6 @@ export { SyncBlockStoreManager } from './store-manager/syncBlockStoreManager';
23
23
 
24
24
  // utils
25
25
  export { resolveSyncBlockInstance } from './utils/resolveSyncBlockInstance';
26
- export { createSyncBlockNode, convertSyncBlockPMNodeToSyncBlockData, convertSyncBlockJSONNodeToSyncBlockNode, convertPMNodesToSyncBlockNodes } from './utils/utils';
26
+ export { createSyncBlockNode, convertSyncBlockPMNodeToSyncBlockData, convertSyncBlockJSONNodeToSyncBlockNode, convertPMNodesToSyncBlockNodes, getContentIdAndProductFromResourceId } from './utils/utils';
27
+ export { fetchErrorPayload } from './utils/errorHandling';
27
28
  export { fetchReferences } from './providers/block-service/blockServiceAPI';
@@ -1,3 +1,5 @@
1
+ /* eslint-disable require-unicode-regexp */
2
+
1
3
  export const convertSyncBlockPMNodeToSyncBlockData = node => {
2
4
  return {
3
5
  blockInstanceId: node.attrs.localId,
@@ -29,4 +31,20 @@ export const convertPMNodeToSyncBlockNode = node => {
29
31
  };
30
32
  export const convertPMNodesToSyncBlockNodes = nodes => {
31
33
  return nodes.map(node => convertPMNodeToSyncBlockNode(node)).filter(node => node !== undefined) || [];
34
+ };
35
+
36
+ /*
37
+ * From a reference block resource id (the resourceId stored in the node attributes)
38
+ * e.g. confluence-page/5769323474/cdf6a1bc-b241-487a-93e9-e30bde363cbc
39
+ * Extracts the source page content id and source product
40
+ */
41
+ export const getContentIdAndProductFromResourceId = resourceId => {
42
+ const match = resourceId.match(/^(confluence-page|jira-work-item)\/([^/]+)/);
43
+ if (match !== null && match !== void 0 && match[2]) {
44
+ return {
45
+ sourceProduct: match[1],
46
+ sourceContentId: match[2]
47
+ };
48
+ }
49
+ throw new Error(`Invalid resourceId: ${resourceId}`);
32
50
  };
package/dist/esm/index.js CHANGED
@@ -23,5 +23,6 @@ export { SyncBlockStoreManager } from './store-manager/syncBlockStoreManager';
23
23
 
24
24
  // utils
25
25
  export { resolveSyncBlockInstance } from './utils/resolveSyncBlockInstance';
26
- export { createSyncBlockNode, convertSyncBlockPMNodeToSyncBlockData, convertSyncBlockJSONNodeToSyncBlockNode, convertPMNodesToSyncBlockNodes } from './utils/utils';
26
+ export { createSyncBlockNode, convertSyncBlockPMNodeToSyncBlockData, convertSyncBlockJSONNodeToSyncBlockNode, convertPMNodesToSyncBlockNodes, getContentIdAndProductFromResourceId } from './utils/utils';
27
+ export { fetchErrorPayload } from './utils/errorHandling';
27
28
  export { fetchReferences } from './providers/block-service/blockServiceAPI';
@@ -1,3 +1,5 @@
1
+ /* eslint-disable require-unicode-regexp */
2
+
1
3
  export var convertSyncBlockPMNodeToSyncBlockData = function convertSyncBlockPMNodeToSyncBlockData(node) {
2
4
  return {
3
5
  blockInstanceId: node.attrs.localId,
@@ -33,4 +35,20 @@ export var convertPMNodesToSyncBlockNodes = function convertPMNodesToSyncBlockNo
33
35
  }).filter(function (node) {
34
36
  return node !== undefined;
35
37
  }) || [];
38
+ };
39
+
40
+ /*
41
+ * From a reference block resource id (the resourceId stored in the node attributes)
42
+ * e.g. confluence-page/5769323474/cdf6a1bc-b241-487a-93e9-e30bde363cbc
43
+ * Extracts the source page content id and source product
44
+ */
45
+ export var getContentIdAndProductFromResourceId = function getContentIdAndProductFromResourceId(resourceId) {
46
+ var match = resourceId.match(/^(confluence-page|jira-work-item)\/([^/]+)/);
47
+ if (match !== null && match !== void 0 && match[2]) {
48
+ return {
49
+ sourceProduct: match[1],
50
+ sourceContentId: match[2]
51
+ };
52
+ }
53
+ throw new Error("Invalid resourceId: ".concat(resourceId));
36
54
  };
@@ -14,5 +14,6 @@ export type { ADFFetchProvider, ADFWriteProvider, SyncBlockDataProvider, SyncBlo
14
14
  export { ReferenceSyncBlockStoreManager } from './store-manager/referenceSyncBlockStoreManager';
15
15
  export { SyncBlockStoreManager } from './store-manager/syncBlockStoreManager';
16
16
  export { resolveSyncBlockInstance } from './utils/resolveSyncBlockInstance';
17
- export { createSyncBlockNode, convertSyncBlockPMNodeToSyncBlockData, convertSyncBlockJSONNodeToSyncBlockNode, convertPMNodesToSyncBlockNodes, } from './utils/utils';
17
+ export { createSyncBlockNode, convertSyncBlockPMNodeToSyncBlockData, convertSyncBlockJSONNodeToSyncBlockNode, convertPMNodesToSyncBlockNodes, getContentIdAndProductFromResourceId } from './utils/utils';
18
+ export { fetchErrorPayload } from './utils/errorHandling';
18
19
  export { fetchReferences } from './providers/block-service/blockServiceAPI';
@@ -1,8 +1,12 @@
1
1
  import type { JSONNode } from '@atlaskit/editor-json-transformer';
2
2
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
- import type { SyncBlockData, BlockInstanceId, ResourceId, SyncBlockNode } from '../common/types';
3
+ import type { SyncBlockData, BlockInstanceId, ResourceId, SyncBlockNode, SyncBlockProduct } from '../common/types';
4
4
  export declare const convertSyncBlockPMNodeToSyncBlockData: (node: PMNode) => SyncBlockData;
5
5
  export declare const createSyncBlockNode: (localId: BlockInstanceId, resourceId: ResourceId) => SyncBlockNode;
6
6
  export declare const convertSyncBlockJSONNodeToSyncBlockNode: (node: JSONNode) => SyncBlockNode | undefined;
7
7
  export declare const convertPMNodeToSyncBlockNode: (node: PMNode) => SyncBlockNode | undefined;
8
8
  export declare const convertPMNodesToSyncBlockNodes: (nodes: PMNode[]) => SyncBlockNode[];
9
+ export declare const getContentIdAndProductFromResourceId: (resourceId: string) => {
10
+ sourceProduct: SyncBlockProduct;
11
+ sourceContentId: string;
12
+ };
@@ -14,5 +14,6 @@ export type { ADFFetchProvider, ADFWriteProvider, SyncBlockDataProvider, SyncBlo
14
14
  export { ReferenceSyncBlockStoreManager } from './store-manager/referenceSyncBlockStoreManager';
15
15
  export { SyncBlockStoreManager } from './store-manager/syncBlockStoreManager';
16
16
  export { resolveSyncBlockInstance } from './utils/resolveSyncBlockInstance';
17
- export { createSyncBlockNode, convertSyncBlockPMNodeToSyncBlockData, convertSyncBlockJSONNodeToSyncBlockNode, convertPMNodesToSyncBlockNodes, } from './utils/utils';
17
+ export { createSyncBlockNode, convertSyncBlockPMNodeToSyncBlockData, convertSyncBlockJSONNodeToSyncBlockNode, convertPMNodesToSyncBlockNodes, getContentIdAndProductFromResourceId } from './utils/utils';
18
+ export { fetchErrorPayload } from './utils/errorHandling';
18
19
  export { fetchReferences } from './providers/block-service/blockServiceAPI';
@@ -1,8 +1,12 @@
1
1
  import type { JSONNode } from '@atlaskit/editor-json-transformer';
2
2
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
- import type { SyncBlockData, BlockInstanceId, ResourceId, SyncBlockNode } from '../common/types';
3
+ import type { SyncBlockData, BlockInstanceId, ResourceId, SyncBlockNode, SyncBlockProduct } from '../common/types';
4
4
  export declare const convertSyncBlockPMNodeToSyncBlockData: (node: PMNode) => SyncBlockData;
5
5
  export declare const createSyncBlockNode: (localId: BlockInstanceId, resourceId: ResourceId) => SyncBlockNode;
6
6
  export declare const convertSyncBlockJSONNodeToSyncBlockNode: (node: JSONNode) => SyncBlockNode | undefined;
7
7
  export declare const convertPMNodeToSyncBlockNode: (node: PMNode) => SyncBlockNode | undefined;
8
8
  export declare const convertPMNodesToSyncBlockNodes: (nodes: PMNode[]) => SyncBlockNode[];
9
+ export declare const getContentIdAndProductFromResourceId: (resourceId: string) => {
10
+ sourceProduct: SyncBlockProduct;
11
+ sourceContentId: string;
12
+ };
package/package.json CHANGED
@@ -33,7 +33,7 @@
33
33
  "uuid": "^3.1.0"
34
34
  },
35
35
  "peerDependencies": {
36
- "@atlaskit/editor-common": "^110.41.0",
36
+ "@atlaskit/editor-common": "^110.42.0",
37
37
  "react": "^18.2.0"
38
38
  },
39
39
  "devDependencies": {
@@ -76,7 +76,7 @@
76
76
  }
77
77
  },
78
78
  "name": "@atlaskit/editor-synced-block-provider",
79
- "version": "2.15.3",
79
+ "version": "2.15.4",
80
80
  "description": "Synced Block Provider for @atlaskit/editor-plugin-synced-block",
81
81
  "author": "Atlassian Pty Ltd",
82
82
  "license": "Apache-2.0",