@atlaskit/embedded-document 0.8.15 → 0.8.17

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.
@@ -30,21 +30,19 @@ var EmbeddedDocument = /*#__PURE__*/function (_Component) {
30
30
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(objectId, language) {
31
31
  var doc;
32
32
  return _regeneratorRuntime.wrap(function _callee$(_context) {
33
- while (1) {
34
- switch (_context.prev = _context.next) {
35
- case 0:
36
- _this.setState({
37
- isLoading: true
38
- });
39
- _context.next = 3;
40
- return _this.provider.getDocumentByObjectId(objectId, language);
41
- case 3:
42
- doc = _context.sent;
43
- _this.setDocumentState(doc);
44
- case 5:
45
- case "end":
46
- return _context.stop();
47
- }
33
+ while (1) switch (_context.prev = _context.next) {
34
+ case 0:
35
+ _this.setState({
36
+ isLoading: true
37
+ });
38
+ _context.next = 3;
39
+ return _this.provider.getDocumentByObjectId(objectId, language);
40
+ case 3:
41
+ doc = _context.sent;
42
+ _this.setDocumentState(doc);
43
+ case 5:
44
+ case "end":
45
+ return _context.stop();
48
46
  }
49
47
  }, _callee);
50
48
  }));
@@ -56,21 +54,19 @@ var EmbeddedDocument = /*#__PURE__*/function (_Component) {
56
54
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(documentId, language) {
57
55
  var doc;
58
56
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
59
- while (1) {
60
- switch (_context2.prev = _context2.next) {
61
- case 0:
62
- _this.setState({
63
- isLoading: true
64
- });
65
- _context2.next = 3;
66
- return _this.provider.getDocument(documentId, language);
67
- case 3:
68
- doc = _context2.sent;
69
- _this.setDocumentState(doc);
70
- case 5:
71
- case "end":
72
- return _context2.stop();
73
- }
57
+ while (1) switch (_context2.prev = _context2.next) {
58
+ case 0:
59
+ _this.setState({
60
+ isLoading: true
61
+ });
62
+ _context2.next = 3;
63
+ return _this.provider.getDocument(documentId, language);
64
+ case 3:
65
+ doc = _context2.sent;
66
+ _this.setDocumentState(doc);
67
+ case 5:
68
+ case "end":
69
+ return _context2.stop();
74
70
  }
75
71
  }, _callee2);
76
72
  }));
@@ -81,16 +77,14 @@ var EmbeddedDocument = /*#__PURE__*/function (_Component) {
81
77
  _defineProperty(_assertThisInitialized(_this), "setDocumentMode", /*#__PURE__*/function () {
82
78
  var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(mode) {
83
79
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
84
- while (1) {
85
- switch (_context3.prev = _context3.next) {
86
- case 0:
87
- _this.setState({
88
- mode: mode
89
- });
90
- case 1:
91
- case "end":
92
- return _context3.stop();
93
- }
80
+ while (1) switch (_context3.prev = _context3.next) {
81
+ case 0:
82
+ _this.setState({
83
+ mode: mode
84
+ });
85
+ case 1:
86
+ case "end":
87
+ return _context3.stop();
94
88
  }
95
89
  }, _callee3);
96
90
  }));
@@ -102,39 +96,37 @@ var EmbeddedDocument = /*#__PURE__*/function (_Component) {
102
96
  var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(body) {
103
97
  var _ref5, documentId, objectId, language, doc;
104
98
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
105
- while (1) {
106
- switch (_context4.prev = _context4.next) {
107
- case 0:
108
- _ref5 = _this.state.doc || _this.props, documentId = _ref5.documentId, objectId = _ref5.objectId, language = _ref5.language;
109
- if (documentId) {
110
- _context4.next = 3;
111
- break;
112
- }
113
- return _context4.abrupt("return", _this.createDocument(body));
114
- case 3:
115
- _context4.next = 5;
116
- return _this.provider.updateDocument(documentId, JSON.stringify(body), objectId, '', language);
117
- case 5:
118
- doc = _context4.sent;
119
- if (!doc) {
120
- _context4.next = 11;
121
- break;
122
- }
123
- _this.setState({
124
- doc: doc,
125
- mode: 'view'
126
- });
127
- return _context4.abrupt("return", doc);
128
- case 11:
129
- _this.setState({
130
- hasError: true,
131
- mode: 'view'
132
- });
133
- throw new Error('Failed to update document');
134
- case 13:
135
- case "end":
136
- return _context4.stop();
137
- }
99
+ while (1) switch (_context4.prev = _context4.next) {
100
+ case 0:
101
+ _ref5 = _this.state.doc || _this.props, documentId = _ref5.documentId, objectId = _ref5.objectId, language = _ref5.language;
102
+ if (documentId) {
103
+ _context4.next = 3;
104
+ break;
105
+ }
106
+ return _context4.abrupt("return", _this.createDocument(body));
107
+ case 3:
108
+ _context4.next = 5;
109
+ return _this.provider.updateDocument(documentId, JSON.stringify(body), objectId, '', language);
110
+ case 5:
111
+ doc = _context4.sent;
112
+ if (!doc) {
113
+ _context4.next = 11;
114
+ break;
115
+ }
116
+ _this.setState({
117
+ doc: doc,
118
+ mode: 'view'
119
+ });
120
+ return _context4.abrupt("return", doc);
121
+ case 11:
122
+ _this.setState({
123
+ hasError: true,
124
+ mode: 'view'
125
+ });
126
+ throw new Error('Failed to update document');
127
+ case 13:
128
+ case "end":
129
+ return _context4.stop();
138
130
  }
139
131
  }, _callee4);
140
132
  }));
@@ -146,33 +138,31 @@ var EmbeddedDocument = /*#__PURE__*/function (_Component) {
146
138
  var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(body) {
147
139
  var _this$props, objectId, language, doc;
148
140
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
149
- while (1) {
150
- switch (_context5.prev = _context5.next) {
151
- case 0:
152
- _this$props = _this.props, objectId = _this$props.objectId, language = _this$props.language;
153
- _context5.next = 3;
154
- return _this.provider.createDocument(JSON.stringify(body), objectId, '', language);
155
- case 3:
156
- doc = _context5.sent;
157
- if (!doc) {
158
- _context5.next = 9;
159
- break;
160
- }
161
- _this.setState({
162
- doc: doc,
163
- mode: 'view'
164
- });
165
- return _context5.abrupt("return", doc);
166
- case 9:
167
- _this.setState({
168
- hasError: true,
169
- mode: 'view'
170
- });
171
- throw new Error('Failed to create document');
172
- case 11:
173
- case "end":
174
- return _context5.stop();
175
- }
141
+ while (1) switch (_context5.prev = _context5.next) {
142
+ case 0:
143
+ _this$props = _this.props, objectId = _this$props.objectId, language = _this$props.language;
144
+ _context5.next = 3;
145
+ return _this.provider.createDocument(JSON.stringify(body), objectId, '', language);
146
+ case 3:
147
+ doc = _context5.sent;
148
+ if (!doc) {
149
+ _context5.next = 9;
150
+ break;
151
+ }
152
+ _this.setState({
153
+ doc: doc,
154
+ mode: 'view'
155
+ });
156
+ return _context5.abrupt("return", doc);
157
+ case 9:
158
+ _this.setState({
159
+ hasError: true,
160
+ mode: 'view'
161
+ });
162
+ throw new Error('Failed to create document');
163
+ case 11:
164
+ case "end":
165
+ return _context5.stop();
176
166
  }
177
167
  }, _callee5);
178
168
  }));
@@ -213,26 +203,24 @@ var EmbeddedDocument = /*#__PURE__*/function (_Component) {
213
203
  var _componentDidMount = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
214
204
  var _this$props2, documentId, language, objectId;
215
205
  return _regeneratorRuntime.wrap(function _callee6$(_context6) {
216
- while (1) {
217
- switch (_context6.prev = _context6.next) {
218
- case 0:
219
- _this$props2 = this.props, documentId = _this$props2.documentId, language = _this$props2.language, objectId = _this$props2.objectId;
220
- if (!documentId) {
221
- _context6.next = 6;
222
- break;
223
- }
224
- _context6.next = 4;
225
- return this.getDocument(documentId, language);
226
- case 4:
227
- _context6.next = 8;
206
+ while (1) switch (_context6.prev = _context6.next) {
207
+ case 0:
208
+ _this$props2 = this.props, documentId = _this$props2.documentId, language = _this$props2.language, objectId = _this$props2.objectId;
209
+ if (!documentId) {
210
+ _context6.next = 6;
228
211
  break;
229
- case 6:
230
- _context6.next = 8;
231
- return this.getDocumentByObjectId(objectId, language);
232
- case 8:
233
- case "end":
234
- return _context6.stop();
235
- }
212
+ }
213
+ _context6.next = 4;
214
+ return this.getDocument(documentId, language);
215
+ case 4:
216
+ _context6.next = 8;
217
+ break;
218
+ case 6:
219
+ _context6.next = 8;
220
+ return this.getDocumentByObjectId(objectId, language);
221
+ case 8:
222
+ case "end":
223
+ return _context6.stop();
236
224
  }
237
225
  }, _callee6, this);
238
226
  }));
@@ -22,27 +22,25 @@ var ServiceProvider = /*#__PURE__*/function () {
22
22
  var _getDocument = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(documentId, language) {
23
23
  var document;
24
24
  return _regeneratorRuntime.wrap(function _callee$(_context) {
25
- while (1) {
26
- switch (_context.prev = _context.next) {
27
- case 0:
28
- _context.prev = 0;
29
- _context.next = 3;
30
- return utils.requestService(this.config, {
31
- path: "document/".concat(documentId, "/").concat(language || '')
32
- });
33
- case 3:
34
- document = _context.sent;
35
- return _context.abrupt("return", document);
36
- case 7:
37
- _context.prev = 7;
38
- _context.t0 = _context["catch"](0);
39
- // eslint-disable-next-line no-console
40
- console.warn("Failed to get document: ".concat(JSON.stringify(_context.t0)));
41
- return _context.abrupt("return", null);
42
- case 11:
43
- case "end":
44
- return _context.stop();
45
- }
25
+ while (1) switch (_context.prev = _context.next) {
26
+ case 0:
27
+ _context.prev = 0;
28
+ _context.next = 3;
29
+ return utils.requestService(this.config, {
30
+ path: "document/".concat(documentId, "/").concat(language || '')
31
+ });
32
+ case 3:
33
+ document = _context.sent;
34
+ return _context.abrupt("return", document);
35
+ case 7:
36
+ _context.prev = 7;
37
+ _context.t0 = _context["catch"](0);
38
+ // eslint-disable-next-line no-console
39
+ console.warn("Failed to get document: ".concat(JSON.stringify(_context.t0)));
40
+ return _context.abrupt("return", null);
41
+ case 11:
42
+ case "end":
43
+ return _context.stop();
46
44
  }
47
45
  }, _callee, this, [[0, 7]]);
48
46
  }));
@@ -57,38 +55,36 @@ var ServiceProvider = /*#__PURE__*/function () {
57
55
  var _getDocumentByObjectId = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(objectId, language) {
58
56
  var queryString, documents;
59
57
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
60
- while (1) {
61
- switch (_context2.prev = _context2.next) {
62
- case 0:
63
- _context2.prev = 0;
64
- queryString = queryBuilder(_objectSpread({
65
- objectId: objectId
66
- }, language ? {
67
- language: language
68
- } : {}));
69
- _context2.next = 4;
70
- return utils.requestService(this.config, {
71
- path: "document?".concat(queryString)
72
- });
73
- case 4:
74
- documents = _context2.sent;
75
- if (!(documents && documents.length)) {
76
- _context2.next = 7;
77
- break;
78
- }
79
- return _context2.abrupt("return", documents[0].language[language || 'default'].versions[0]);
80
- case 7:
81
- return _context2.abrupt("return", null);
82
- case 10:
83
- _context2.prev = 10;
84
- _context2.t0 = _context2["catch"](0);
85
- // eslint-disable-next-line no-console
86
- console.warn("Failed to get document: ".concat(JSON.stringify(_context2.t0)));
87
- return _context2.abrupt("return", null);
88
- case 14:
89
- case "end":
90
- return _context2.stop();
91
- }
58
+ while (1) switch (_context2.prev = _context2.next) {
59
+ case 0:
60
+ _context2.prev = 0;
61
+ queryString = queryBuilder(_objectSpread({
62
+ objectId: objectId
63
+ }, language ? {
64
+ language: language
65
+ } : {}));
66
+ _context2.next = 4;
67
+ return utils.requestService(this.config, {
68
+ path: "document?".concat(queryString)
69
+ });
70
+ case 4:
71
+ documents = _context2.sent;
72
+ if (!(documents && documents.length)) {
73
+ _context2.next = 7;
74
+ break;
75
+ }
76
+ return _context2.abrupt("return", documents[0].language[language || 'default'].versions[0]);
77
+ case 7:
78
+ return _context2.abrupt("return", null);
79
+ case 10:
80
+ _context2.prev = 10;
81
+ _context2.t0 = _context2["catch"](0);
82
+ // eslint-disable-next-line no-console
83
+ console.warn("Failed to get document: ".concat(JSON.stringify(_context2.t0)));
84
+ return _context2.abrupt("return", null);
85
+ case 14:
86
+ case "end":
87
+ return _context2.stop();
92
88
  }
93
89
  }, _callee2, this, [[0, 10]]);
94
90
  }));
@@ -103,39 +99,37 @@ var ServiceProvider = /*#__PURE__*/function () {
103
99
  var _updateDocument = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(documentId, body, objectId, title, language) {
104
100
  var document;
105
101
  return _regeneratorRuntime.wrap(function _callee3$(_context3) {
106
- while (1) {
107
- switch (_context3.prev = _context3.next) {
108
- case 0:
109
- _context3.prev = 0;
110
- _context3.next = 3;
111
- return utils.requestService(this.config, {
112
- path: "document/".concat(documentId),
113
- requestInit: {
114
- headers: {
115
- 'Content-Type': 'application/json'
116
- },
117
- method: 'PUT',
118
- body: JSON.stringify({
119
- body: body,
120
- objectId: objectId,
121
- title: title,
122
- language: language
123
- })
124
- }
125
- });
126
- case 3:
127
- document = _context3.sent;
128
- return _context3.abrupt("return", document);
129
- case 7:
130
- _context3.prev = 7;
131
- _context3.t0 = _context3["catch"](0);
132
- // eslint-disable-next-line no-console
133
- console.warn("Failed to update document: ".concat(JSON.stringify(_context3.t0)));
134
- return _context3.abrupt("return", null);
135
- case 11:
136
- case "end":
137
- return _context3.stop();
138
- }
102
+ while (1) switch (_context3.prev = _context3.next) {
103
+ case 0:
104
+ _context3.prev = 0;
105
+ _context3.next = 3;
106
+ return utils.requestService(this.config, {
107
+ path: "document/".concat(documentId),
108
+ requestInit: {
109
+ headers: {
110
+ 'Content-Type': 'application/json'
111
+ },
112
+ method: 'PUT',
113
+ body: JSON.stringify({
114
+ body: body,
115
+ objectId: objectId,
116
+ title: title,
117
+ language: language
118
+ })
119
+ }
120
+ });
121
+ case 3:
122
+ document = _context3.sent;
123
+ return _context3.abrupt("return", document);
124
+ case 7:
125
+ _context3.prev = 7;
126
+ _context3.t0 = _context3["catch"](0);
127
+ // eslint-disable-next-line no-console
128
+ console.warn("Failed to update document: ".concat(JSON.stringify(_context3.t0)));
129
+ return _context3.abrupt("return", null);
130
+ case 11:
131
+ case "end":
132
+ return _context3.stop();
139
133
  }
140
134
  }, _callee3, this, [[0, 7]]);
141
135
  }));
@@ -150,39 +144,37 @@ var ServiceProvider = /*#__PURE__*/function () {
150
144
  var _createDocument = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(body, objectId, title, language) {
151
145
  var document;
152
146
  return _regeneratorRuntime.wrap(function _callee4$(_context4) {
153
- while (1) {
154
- switch (_context4.prev = _context4.next) {
155
- case 0:
156
- _context4.prev = 0;
157
- _context4.next = 3;
158
- return utils.requestService(this.config, {
159
- path: "document",
160
- requestInit: {
161
- headers: {
162
- 'Content-Type': 'application/json'
163
- },
164
- method: 'POST',
165
- body: JSON.stringify({
166
- body: body,
167
- objectId: objectId,
168
- title: title,
169
- language: language
170
- })
171
- }
172
- });
173
- case 3:
174
- document = _context4.sent;
175
- return _context4.abrupt("return", document);
176
- case 7:
177
- _context4.prev = 7;
178
- _context4.t0 = _context4["catch"](0);
179
- // eslint-disable-next-line no-console
180
- console.warn("Failed to update document: ".concat(JSON.stringify(_context4.t0)));
181
- return _context4.abrupt("return", null);
182
- case 11:
183
- case "end":
184
- return _context4.stop();
185
- }
147
+ while (1) switch (_context4.prev = _context4.next) {
148
+ case 0:
149
+ _context4.prev = 0;
150
+ _context4.next = 3;
151
+ return utils.requestService(this.config, {
152
+ path: "document",
153
+ requestInit: {
154
+ headers: {
155
+ 'Content-Type': 'application/json'
156
+ },
157
+ method: 'POST',
158
+ body: JSON.stringify({
159
+ body: body,
160
+ objectId: objectId,
161
+ title: title,
162
+ language: language
163
+ })
164
+ }
165
+ });
166
+ case 3:
167
+ document = _context4.sent;
168
+ return _context4.abrupt("return", document);
169
+ case 7:
170
+ _context4.prev = 7;
171
+ _context4.t0 = _context4["catch"](0);
172
+ // eslint-disable-next-line no-console
173
+ console.warn("Failed to update document: ".concat(JSON.stringify(_context4.t0)));
174
+ return _context4.abrupt("return", null);
175
+ case 11:
176
+ case "end":
177
+ return _context4.stop();
186
178
  }
187
179
  }, _callee4, this, [[0, 7]]);
188
180
  }));
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/embedded-document",
3
- "version": "0.8.15",
3
+ "version": "0.8.17",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/embedded-document",
3
- "version": "0.8.15",
3
+ "version": "0.8.17",
4
4
  "description": "DEPRECATED Embedded Document component",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -26,8 +26,8 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@atlaskit/button": "^16.6.0",
29
- "@atlaskit/editor-common": "^72.7.0",
30
- "@atlaskit/editor-core": "^182.0.0",
29
+ "@atlaskit/editor-common": "^73.0.0",
30
+ "@atlaskit/editor-core": "^182.2.0",
31
31
  "@atlaskit/editor-shared-styles": "^2.3.0",
32
32
  "@atlaskit/renderer": "^107.3.0",
33
33
  "@atlaskit/util-service-support": "^6.1.0",