@unimaze/billing 0.21.32 → 0.21.33

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.
@@ -119,7 +119,7 @@ var AttachmentModal = function (props) {
119
119
  var _isSaveAttachmentsDisabled = props.attachments.length > 0 ? props.attachments.some(function (attachment) { return attachment.fieldValidation !== "success" || (!attachment.description.trim()); }) : true;
120
120
  setIsSaveAttachmentsDisabled(_isSaveAttachmentsDisabled);
121
121
  }, [props.attachments]);
122
- var verifyAttachment = function (info, uploadSizeLimit, formInstance) {
122
+ var verifyAttachment = function (info, uploadSizeLimit, onRemove) {
123
123
  if (info.file.status === "removed")
124
124
  return;
125
125
  var isValid = (0, FileUploadUtility_1.reportIfFileIsValid)(info.file, uploadSizeLimit, {
@@ -130,8 +130,7 @@ var AttachmentModal = function (props) {
130
130
  uploadFailed: props.intl.formatMessage(translationMessages.attachment_error_fileFailedToUpload),
131
131
  });
132
132
  if (!isValid) {
133
- info.file.status = "error";
134
- updateFile(info.file, { file: __assign({}, info.file), fieldValidation: "error" });
133
+ onRemove(info.file);
135
134
  }
136
135
  else {
137
136
  updateFile(info.file, { file: __assign({}, info.file), fieldValidation: "success" });
@@ -151,15 +150,25 @@ var AttachmentModal = function (props) {
151
150
  if (info.file.status === "uploading") {
152
151
  setIsUploading(true);
153
152
  var fileIndex = props.attachments.findIndex(function (attachment) { return attachment.file.uid === info.file.uid; });
154
- if (fileIndex === -1) {
153
+ var isValid = (0, FileUploadUtility_1.reportIfFileIsValid)(info.file, props.uploadSizeLimit, {
154
+ uploadErrorToLarge: props.intl.formatMessage(translationMessages.attachment_error_fileTooLarge, {
155
+ uploadSizeLimit: props.uploadSizeLimit / 1024,
156
+ }),
157
+ uploadErrorWrongType: props.intl.formatMessage(translationMessages.attachment_error_fileWrongType),
158
+ uploadFailed: props.intl.formatMessage(translationMessages.attachment_error_fileFailedToUpload),
159
+ });
160
+ if (fileIndex === -1 && isValid) {
155
161
  props.setAttachments(__spreadArray(__spreadArray([], props.attachments, true), [
156
162
  { uid: info.file.uid, file: info.file, description: "", fieldValidation: "" },
157
163
  ], false));
158
164
  }
165
+ else {
166
+ setIsUploading(false);
167
+ }
159
168
  }
160
169
  else if (info.file.status === "done" || info.file.status === "error") {
161
170
  setIsUploading(false);
162
- verifyAttachment(info, props.uploadSizeLimit, props.formInstance);
171
+ verifyAttachment(info, props.uploadSizeLimit, props.onRemove);
163
172
  }
164
173
  },
165
174
  fileList: props.attachments.map(function (attachment) { return attachment.file; }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unimaze/billing",
3
- "version": "0.21.32",
3
+ "version": "0.21.33",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",