@alviere/ui 0.15.0 → 0.15.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
@@ -16440,6 +16440,12 @@ function AddBankAccount($$anchor, $$props) {
16440
16440
  const parsedMessageCode = typeof parsed.message === "string" ? (_a3 = parsed.message.match(/Alcore API Error\s+(\d+)/)) === null || _a3 === void 0 ? void 0 : _a3[1] : void 0;
16441
16441
  return parsed.errorCode || parsed.error_code || parsed.code || ((_b2 = parsed.cause) === null || _b2 === void 0 ? void 0 : _b2.errorCode) || ((_c2 = parsed.cause) === null || _c2 === void 0 ? void 0 : _c2.error_code) || ((_d = parsed.cause) === null || _d === void 0 ? void 0 : _d.code) || ((_f = (_e = parsed.response) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.errorCode) || ((_h = (_g = parsed.response) === null || _g === void 0 ? void 0 : _g.data) === null || _h === void 0 ? void 0 : _h.error_code) || parsedMessageCode || void 0;
16442
16442
  }
16443
+ function getAddBankAccountErrorMessage(errorCode) {
16444
+ if (errorCode === "340029") {
16445
+ return getLabel("duplicateBankAccountError", "This bank account has already been added to your account.");
16446
+ }
16447
+ return getLabel("genericAddBankAccountError", "An error occurred while adding the bank account. Please try again.");
16448
+ }
16443
16449
  function getPrimaryBankAccountErrorMessage(error, errorCode) {
16444
16450
  if (errorCode === AlcoreErrorCodes.BANK_ACCOUNT_PRIMARY_REQUIRES_ACTIVE_STATUS || errorCode === "340028") {
16445
16451
  return "Only ACTIVE bank accounts can be set as primary. Please try again after verification completes.";
@@ -16534,7 +16540,8 @@ function AddBankAccount($$anchor, $$props) {
16534
16540
  set(showAddForm, false);
16535
16541
  } catch (error) {
16536
16542
  uiLogger.error("❌ Error adding bank account:", error);
16537
- set(formError, error instanceof Error ? error.message : String(error), true);
16543
+ const errorCode = getErrorCode(error);
16544
+ set(formError, getAddBankAccountErrorMessage(errorCode), true);
16538
16545
  } finally {
16539
16546
  set(isSubmitting, false);
16540
16547
  }
@@ -17037,7 +17044,10 @@ function AddBankAccount($$anchor, $$props) {
17037
17044
  var alviere_button_4 = root_12$1();
17038
17045
  set_custom_element_data(alviere_button_4, "type", "button");
17039
17046
  set_custom_element_data(alviere_button_4, "variant", "secondary");
17040
- set_custom_element_data(alviere_button_4, "handler", () => set(showAddForm, false));
17047
+ set_custom_element_data(alviere_button_4, "handler", () => {
17048
+ set(showAddForm, false);
17049
+ set(formError, null);
17050
+ });
17041
17051
  set_custom_element_data(alviere_button_4, "iconName", "X");
17042
17052
  var span_14 = child(alviere_button_4);
17043
17053
  var text_20 = child(span_14, true);