@atlaskit/collab-provider 19.0.4 → 19.0.5

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.
@@ -40,8 +40,8 @@ export var Api = /*#__PURE__*/function () {
40
40
  _classCallCheck(this, Api);
41
41
  _defineProperty(this, "submitComment", /*#__PURE__*/function () {
42
42
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(steps, version) {
43
- var reqBody, url, tracingHeaders, fetchOptions;
44
- return _regeneratorRuntime.wrap(function _callee$(_context) {
43
+ var reqBody, url, tracingHeaders, fetchOptions, _t, _t2, _t3, _t4, _t5, _t6, _t7;
44
+ return _regeneratorRuntime.wrap(function (_context) {
45
45
  while (1) switch (_context.prev = _context.next) {
46
46
  case 0:
47
47
  reqBody = JSON.stringify({
@@ -52,47 +52,42 @@ export var Api = /*#__PURE__*/function () {
52
52
  url = "".concat(_this2.config.url, "/document/").concat(encodeURIComponent(_this2.config.documentAri), "/comment");
53
53
  logger("Request url: ", url);
54
54
  tracingHeaders = getActiveTraceHttpRequestHeaders(url);
55
- _context.t0 = _objectSpread;
56
- _context.t1 = _objectSpread;
57
- _context.t2 = {};
55
+ _t = _objectSpread;
56
+ _t2 = _objectSpread;
57
+ _t3 = {};
58
58
  if (!_this2.config.permissionTokenRefresh) {
59
- _context.next = 14;
59
+ _context.next = 2;
60
60
  break;
61
61
  }
62
- _context.next = 10;
62
+ _context.next = 1;
63
63
  return _this2.channel.getChannelToken();
64
- case 10:
65
- _context.t4 = _context.sent;
66
- _context.t3 = {
67
- 'x-token': _context.t4
64
+ case 1:
65
+ _t5 = _context.sent;
66
+ _t4 = {
67
+ 'x-token': _t5
68
68
  };
69
- _context.next = 15;
69
+ _context.next = 3;
70
70
  break;
71
- case 14:
72
- _context.t3 = {};
73
- case 15:
74
- _context.t5 = _context.t3;
75
- _context.t6 = (0, _context.t1)(_context.t2, _context.t5);
76
- _context.t7 = {};
77
- _context.t8 = {
71
+ case 2:
72
+ _t4 = {};
73
+ case 3:
74
+ _t6 = _t(_t2(_t3, _t4), {}, {
78
75
  'x-product': getProduct(_this2.config.productInfo),
79
76
  'x-subproduct': getSubProduct(_this2.config.productInfo),
80
77
  'Content-Type': 'application/json'
81
- };
82
- _context.t9 = tracingHeaders;
83
- _context.t10 = (0, _context.t0)(_context.t6, _context.t7, _context.t8, _context.t9);
84
- _context.t11 = reqBody;
78
+ }, tracingHeaders);
79
+ _t7 = reqBody;
85
80
  fetchOptions = {
86
81
  credentials: 'include',
87
- headers: _context.t10,
82
+ headers: _t6,
88
83
  method: 'POST',
89
- body: _context.t11
84
+ body: _t7
90
85
  };
91
- _context.next = 25;
86
+ _context.next = 4;
92
87
  return fetch(url, fetchOptions);
93
- case 25:
88
+ case 4:
94
89
  return _context.abrupt("return", _context.sent);
95
- case 26:
90
+ case 5:
96
91
  case "end":
97
92
  return _context.stop();
98
93
  }
@@ -110,56 +105,56 @@ export var Api = /*#__PURE__*/function () {
110
105
  key: "addComment",
111
106
  value: function () {
112
107
  var _addComment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(steps) {
113
- var stepVersion, response, status, _yield$response$json, message, meta;
114
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
108
+ var stepVersion, response, status, _yield$response$json, message, meta, _t8;
109
+ return _regeneratorRuntime.wrap(function (_context2) {
115
110
  while (1) switch (_context2.prev = _context2.next) {
116
111
  case 0:
117
112
  stepVersion = this.documentService.getCurrentPmVersion();
118
113
  _context2.prev = 1;
119
- _context2.next = 4;
114
+ _context2.next = 2;
120
115
  return this.submitComment(steps, stepVersion);
121
- case 4:
116
+ case 2:
122
117
  response = _context2.sent;
123
118
  status = response.status;
124
- _context2.next = 8;
119
+ _context2.next = 3;
125
120
  return response.json();
126
- case 8:
121
+ case 3:
127
122
  _yield$response$json = _context2.sent;
128
123
  message = _yield$response$json.message;
129
124
  meta = _yield$response$json.meta;
130
125
  if (!(status === 201)) {
131
- _context2.next = 14;
126
+ _context2.next = 4;
132
127
  break;
133
128
  }
134
129
  logger("NCS response: ".concat(message));
135
130
  return _context2.abrupt("return", {
136
131
  message: message
137
132
  });
138
- case 14:
133
+ case 4:
139
134
  if (!(status >= 400 && status <= 499)) {
140
- _context2.next = 17;
135
+ _context2.next = 5;
141
136
  break;
142
137
  }
143
138
  logger("NCS error meta: ".concat(JSON.stringify(meta)));
144
139
  // Include details in error response
145
140
  throw new AddCommentError("Failed to add comment - Client error: ".concat(message), status, JSON.stringify(meta));
146
- case 17:
141
+ case 5:
147
142
  throw new AddCommentError("Failed to add comment - Server error", status);
148
- case 20:
149
- _context2.prev = 20;
150
- _context2.t0 = _context2["catch"](1);
151
- if (!(_context2.t0 instanceof AddCommentError)) {
152
- _context2.next = 26;
143
+ case 6:
144
+ _context2.prev = 6;
145
+ _t8 = _context2["catch"](1);
146
+ if (!(_t8 instanceof AddCommentError)) {
147
+ _context2.next = 7;
153
148
  break;
154
149
  }
155
- throw _context2.t0;
156
- case 26:
157
- throw new Error("Error submitting comment: ".concat(_context2.t0));
158
- case 27:
150
+ throw _t8;
151
+ case 7:
152
+ throw new Error("Error submitting comment: ".concat(_t8));
153
+ case 8:
159
154
  case "end":
160
155
  return _context2.stop();
161
156
  }
162
- }, _callee2, this, [[1, 20]]);
157
+ }, _callee2, this, [[1, 6]]);
163
158
  }));
164
159
  function addComment(_x3) {
165
160
  return _addComment.apply(this, arguments);
@@ -13,7 +13,7 @@ export var NullApi = /*#__PURE__*/function () {
13
13
  // eslint-disable-next-line require-await
14
14
  function () {
15
15
  var _addComment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
16
- return _regeneratorRuntime.wrap(function _callee$(_context) {
16
+ return _regeneratorRuntime.wrap(function (_context) {
17
17
  while (1) switch (_context.prev = _context.next) {
18
18
  case 0:
19
19
  return _context.abrupt("return");