idmission-web-sdk 2.2.55 → 2.2.57

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.
@@ -211,7 +211,7 @@
211
211
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
212
212
  };
213
213
 
214
- var webSdkVersion = '2.2.55';
214
+ var webSdkVersion = '2.2.57';
215
215
 
216
216
  function getPlatform() {
217
217
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -493,7 +493,16 @@
493
493
  var GrayOverlayContainer = styled(OverlayContainer)(templateObject_5$c || (templateObject_5$c = __makeTemplateObject(["\n background: #f7f6fb;\n"], ["\n background: #f7f6fb;\n"])));
494
494
  var ButtonsColumn = styled.div(templateObject_6$9 || (templateObject_6$9 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 15px 0;\n justify-content: center;\n margin-top: 24px;\n"], ["\n display: flex;\n flex-direction: column;\n gap: 15px 0;\n justify-content: center;\n margin-top: 24px;\n"])));
495
495
  var WideButton = styled(LoaderButton)(templateObject_7$6 || (templateObject_7$6 = __makeTemplateObject(["\n width: 100%;\n border-radius: 30px;\n"], ["\n width: 100%;\n border-radius: 30px;\n"])));
496
- var WideBorderButton = styled(WideButton)(templateObject_8$3 || (templateObject_8$3 = __makeTemplateObject(["\n color: black;\n background: white;\n border: 1px solid var(--idm-color-secondary-500);\n box-sizing: border-box;\n"], ["\n color: black;\n background: white;\n border: 1px solid var(--idm-color-secondary-500);\n box-sizing: border-box;\n"])));
496
+ var WideBorderButton = styled(WideButton)(templateObject_8$3 || (templateObject_8$3 = __makeTemplateObject(["\n color: ", ";\n background: ", ";\n border: 1px solid\n ", ";\n box-sizing: border-box;\n"], ["\n color: ", ";\n background: ", ";\n border: 1px solid\n ", ";\n box-sizing: border-box;\n"])), function (props) {
497
+ var _a, _b;
498
+ return (_b = (_a = props.colors) === null || _a === void 0 ? void 0 : _a.textColor) !== null && _b !== void 0 ? _b : 'black';
499
+ }, function (props) {
500
+ var _a, _b;
501
+ return (_b = (_a = props.colors) === null || _a === void 0 ? void 0 : _a.backgroundColor) !== null && _b !== void 0 ? _b : 'white';
502
+ }, function (props) {
503
+ var _a, _b;
504
+ return (_b = (_a = props.colors) === null || _a === void 0 ? void 0 : _a.borderColor) !== null && _b !== void 0 ? _b : 'var(--idm-color-secondary-500)';
505
+ });
497
506
  var templateObject_1$J, templateObject_2$A, templateObject_3$r, templateObject_4$l, templateObject_5$c, templateObject_6$9, templateObject_7$6, templateObject_8$3;
498
507
 
499
508
  function _extends() {
@@ -2268,7 +2277,7 @@
2268
2277
  var uploadDocument = React.useCallback(function (src, metadata) {
2269
2278
  return new Promise(function (resolve, reject) {
2270
2279
  return __awaiter(void 0, void 0, void 0, function () {
2271
- var blob, _a, upload, _b, _c;
2280
+ var blob, _a, documentId, upload, _b, _c;
2272
2281
  var _d, _e;
2273
2282
  var _f;
2274
2283
  return __generator(this, function (_g) {
@@ -2306,9 +2315,22 @@
2306
2315
  percentage: (bytesUploaded / bytesTotal * 100).toFixed(2) + '%',
2307
2316
  metadata: metadata
2308
2317
  });
2318
+ }, _d.onAfterResponse = function (_req, res) {
2319
+ var contentType = res.getHeader('Content-Type');
2320
+ if (!(contentType === null || contentType === void 0 ? void 0 : contentType.startsWith('application/json'))) return;
2321
+ var body = res.getBody();
2322
+ if (!body) return;
2323
+ try {
2324
+ var parsedId = JSON.parse(body).id;
2325
+ if (parsedId.startsWith('urn:documentsv1:')) {
2326
+ documentId = parsedId;
2327
+ }
2328
+ } catch (e) {
2329
+ warn('Failed to parse documents service response body', e);
2330
+ }
2309
2331
  }, _d.onSuccess = function () {
2310
2332
  var _a, _b;
2311
- var documentId = 'urn:documentsv1:' + ((_a = upload.url.split('/files/').pop()) === null || _a === void 0 ? void 0 : _a.split('+').shift());
2333
+ documentId || (documentId = "urn:documentsv1:".concat((_a = upload.url.split('/files/').pop()) === null || _a === void 0 ? void 0 : _a.split('+').shift()));
2312
2334
  (_b = onDocumentUploaded.current) === null || _b === void 0 ? void 0 : _b.call(onDocumentUploaded, documentId, metadata);
2313
2335
  resolve(documentId);
2314
2336
  }, _d.onError = function (error) {