@mindbill/react 0.37.0 → 0.37.1

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.js CHANGED
@@ -5204,6 +5204,7 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
5204
5204
  const [panel, setPanel] = useState10("");
5205
5205
  const [notice, setNotice] = useState10("");
5206
5206
  const [reason, setReason] = useState10("");
5207
+ const [correctionError, setCorrectionError] = useState10("");
5207
5208
  const [payment, setPayment] = useState10({ amount: 0, penaltyAmount: 0, interestAmount: 0, method: "check", checkNumber: "", depositDate: today(), note: "" });
5208
5209
  const [review, setReview] = useState10({ reason: "", payerClaimControlNumber: "", disputedAmount: void 0, attachmentIds: [], route: "ebill" });
5209
5210
  const [duplicateDelivery, setDuplicateDelivery] = useState10(null);
@@ -5262,18 +5263,26 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
5262
5263
  };
5263
5264
  const submitCorrection = async (value) => {
5264
5265
  setNotice("");
5265
- const documents = await prepareBillSubmissionDocuments({
5266
- attachments: correctionAttachments,
5267
- selectedIds: value.sourceAttachmentIds,
5268
- reportTypeCodeByAttachmentId: value.sourceAttachmentReportTypes,
5269
- uploads: value.uploads,
5270
- ...options.fetch ? { fetch: options.fetch } : {}
5271
- });
5272
- await lifecycle.resubmitBill({
5273
- bill: value.bill,
5274
- ...documents.length ? { documents } : {},
5275
- ...reason.trim() ? { reason: reason.trim() } : {}
5276
- });
5266
+ setCorrectionError("");
5267
+ try {
5268
+ const documents = await prepareBillSubmissionDocuments({
5269
+ attachments: correctionAttachments,
5270
+ selectedIds: value.sourceAttachmentIds,
5271
+ reportTypeCodeByAttachmentId: value.sourceAttachmentReportTypes,
5272
+ uploads: value.uploads,
5273
+ ...options.fetch ? { fetch: options.fetch } : {}
5274
+ });
5275
+ await lifecycle.resubmitBill({
5276
+ bill: value.bill,
5277
+ ...documents.length ? { documents } : {},
5278
+ ...reason.trim() ? { reason: reason.trim() } : {}
5279
+ });
5280
+ } catch (cause) {
5281
+ setCorrectionError(
5282
+ cause instanceof Error && cause.message ? cause.message : "The corrected bill could not be resubmitted."
5283
+ );
5284
+ return;
5285
+ }
5277
5286
  setPanel("");
5278
5287
  setReason("");
5279
5288
  setNotice("Corrected submission sent.");
@@ -5334,6 +5343,7 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
5334
5343
  actions.map((action) => /* @__PURE__ */ jsx13("button", { type: "button", className: action.primary ? "mb-lifecycle-button primary" : "mb-lifecycle-button secondary", onClick: () => {
5335
5344
  const next = actionPanel(action);
5336
5345
  if (!next) return;
5346
+ if (next === "resubmit") setCorrectionError("");
5337
5347
  if (next === "send_duplicate") loadDuplicateDelivery();
5338
5348
  if (next === "second_review") setReview((current) => current.reason.trim() ? current : { ...current, reason: SECOND_REVIEW_REASON_TEMPLATE });
5339
5349
  setPanel(next);
@@ -5387,7 +5397,8 @@ function ConnectedBillLifecycle({ appearance, sandboxControls = false, className
5387
5397
  ...options.fetch ? { fetch: options.fetch } : {},
5388
5398
  ...appearance ? { appearance } : {}
5389
5399
  }
5390
- )
5400
+ ),
5401
+ correctionError ? /* @__PURE__ */ jsx13("div", { className: "mb-lifecycle-message error", role: "alert", children: correctionError }) : null
5391
5402
  ] }) }) : null,
5392
5403
  panel === "second_review" ? /* @__PURE__ */ jsx13(LifecycleDialog, { title: "Submit Second Review", onClose: () => setPanel(""), children: /* @__PURE__ */ jsxs13("section", { className: "mb-lifecycle-panel", children: [
5393
5404
  /* @__PURE__ */ jsxs13("div", { children: [