@ornikar/kitt-universal 32.5.1 → 32.5.2

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/dist/index.es.js CHANGED
@@ -6893,15 +6893,16 @@ var DatePicker = /*#__PURE__*/forwardRef(function (_ref, ref) {
6893
6893
  });
6894
6894
 
6895
6895
  function DocumentPicker(_ref) {
6896
- var onDocumentUpload = _ref.onDocumentUpload,
6897
- children = _ref.children,
6896
+ var children = _ref.children,
6898
6897
  disabled = _ref.disabled,
6899
- documentPickerOptions = _ref.documentPickerOptions;
6898
+ documentPickerOptions = _ref.documentPickerOptions,
6899
+ onDocumentUpload = _ref.onDocumentUpload,
6900
+ onGetDocumentAsyncError = _ref.onGetDocumentAsyncError;
6900
6901
  var childElement = Children.only(children);
6901
6902
  var handlePickDocument = /*#__PURE__*/function () {
6902
6903
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
6903
- var _childElement$props$o, _childElement$props, _result$assets$;
6904
- var result;
6904
+ var _childElement$props$o, _childElement$props, _result$assets;
6905
+ var result, file;
6905
6906
  return _regeneratorRuntime().wrap(function (_context) {
6906
6907
  while (1) switch (_context.prev = _context.next) {
6907
6908
  case 0:
@@ -6912,20 +6913,33 @@ function DocumentPicker(_ref) {
6912
6913
  return _context.abrupt("return");
6913
6914
  case 2:
6914
6915
  (_childElement$props$o = (_childElement$props = childElement.props).onPress) === null || _childElement$props$o === void 0 || _childElement$props$o.call(_childElement$props);
6915
- _context.next = 5;
6916
+ _context.prev = 3;
6917
+ _context.next = 6;
6916
6918
  return getDocumentAsync(_objectSpread(_objectSpread({}, documentPickerOptions), {}, {
6917
6919
  multiple: false
6918
6920
  }));
6919
- case 5:
6921
+ case 6:
6920
6922
  result = _context.sent;
6921
- if (!result.canceled && (_result$assets$ = result.assets[0]) !== null && _result$assets$ !== void 0 && _result$assets$.file) {
6922
- onDocumentUpload(result.assets[0].file);
6923
+ _context.next = 13;
6924
+ break;
6925
+ case 9:
6926
+ _context.prev = 9;
6927
+ _context.t0 = _context["catch"](3);
6928
+ onGetDocumentAsyncError === null || onGetDocumentAsyncError === void 0 || onGetDocumentAsyncError();
6929
+ result = {
6930
+ canceled: true,
6931
+ assets: null
6932
+ };
6933
+ case 13:
6934
+ file = (_result$assets = result.assets) === null || _result$assets === void 0 || (_result$assets = _result$assets.at(0)) === null || _result$assets === void 0 ? void 0 : _result$assets.file;
6935
+ if (!result.canceled && file) {
6936
+ onDocumentUpload(file);
6923
6937
  }
6924
- case 7:
6938
+ case 15:
6925
6939
  case "end":
6926
6940
  return _context.stop();
6927
6941
  }
6928
- }, _callee);
6942
+ }, _callee, null, [[3, 9]]);
6929
6943
  }));
6930
6944
  return function () {
6931
6945
  return _ref2.apply(this, arguments);