@alviere/ui 0.8.2 → 0.9.0

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
@@ -5546,6 +5546,12 @@ class SchemaValidator {
5546
5546
  errors.push(error);
5547
5547
  }
5548
5548
  }
5549
+ if (schema.match) {
5550
+ const error = this.validateMatch(value, schema.match, context);
5551
+ if (error) {
5552
+ errors.push(error);
5553
+ }
5554
+ }
5549
5555
  return {
5550
5556
  isValid: errors.length === 0,
5551
5557
  errors,
@@ -5605,10 +5611,32 @@ class SchemaValidator {
5605
5611
  const error = validator.date(value, rule.format);
5606
5612
  return error && rule.message ? rule.message : error;
5607
5613
  }
5614
+ /**
5615
+ * Validate that the field value matches another field's value
5616
+ */
5617
+ validateMatch(value, rule, context) {
5618
+ let matchValue;
5619
+ if (rule.fieldRef) {
5620
+ if (typeof rule.fieldRef === "function") {
5621
+ matchValue = rule.fieldRef();
5622
+ } else if (rule.fieldRef && "value" in rule.fieldRef) {
5623
+ matchValue = rule.fieldRef.value || "";
5624
+ }
5625
+ } else if (rule.fieldId && context.getMatchFieldValue) {
5626
+ matchValue = context.getMatchFieldValue(rule.fieldId);
5627
+ }
5628
+ if (matchValue === void 0) {
5629
+ return null;
5630
+ }
5631
+ if (value !== matchValue) {
5632
+ return rule.message || "Values do not match";
5633
+ }
5634
+ return null;
5635
+ }
5608
5636
  }
5609
5637
  const schemaValidator = new SchemaValidator();
5610
- function validateWithSchema(value, schema, fieldName) {
5611
- return schemaValidator.validate({ value, schema, fieldName });
5638
+ function validateWithSchema(value, schema, fieldName, getMatchFieldValue) {
5639
+ return schemaValidator.validate({ value, schema, fieldName, getMatchFieldValue });
5612
5640
  }
5613
5641
  const visaLogo = '<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Visa</title><path d="M9.112 8.262L5.97 15.758H3.92L2.374 9.775c-.094-.368-.175-.503-.461-.658C1.447 8.864.677 8.627 0 8.479l.046-.217h3.3a.904.904 0 01.894.764l.817 4.338 2.018-5.102zm8.033 5.049c.008-1.979-2.736-2.088-2.717-2.972.006-.269.262-.555.822-.628a3.66 3.66 0 011.913.336l.34-1.59a5.207 5.207 0 00-1.814-.333c-1.917 0-3.266 1.02-3.278 2.479-.012 1.079.963 1.68 1.698 2.04.756.367 1.01.603 1.006.931-.005.504-.602.725-1.16.734-.975.015-1.54-.263-1.992-.473l-.351 1.642c.453.208 1.289.39 2.156.398 2.037 0 3.37-1.006 3.377-2.564m5.061 2.447H24l-1.565-7.496h-1.656a.883.883 0 00-.826.55l-2.909 6.946h2.036l.405-1.12h2.488zm-2.163-2.656l1.02-2.815.588 2.815zm-8.16-4.84l-1.603 7.496H8.34l1.605-7.496z"/></svg>';
5614
5642
  const mastercardLogo = '<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>MasterCard</title><path d="M11.343 18.031c.058.049.12.098.181.146-1.177.783-2.59 1.238-4.107 1.238C3.32 19.416 0 16.096 0 12c0-4.095 3.32-7.416 7.416-7.416 1.518 0 2.931.456 4.105 1.238-.06.051-.12.098-.165.15C9.6 7.489 8.595 9.688 8.595 12c0 2.311 1.001 4.51 2.748 6.031zm5.241-13.447c-1.52 0-2.931.456-4.105 1.238.06.051.12.098.165.15C14.4 7.489 15.405 9.688 15.405 12c0 2.31-1.001 4.507-2.748 6.031-.058.049-.12.098-.181.146 1.177.783 2.588 1.238 4.107 1.238C20.68 19.416 24 16.096 24 12c0-4.094-3.32-7.416-7.416-7.416zM12 6.174c-.096.075-.189.15-.28.231C10.156 7.764 9.169 9.765 9.169 12c0 2.236.987 4.236 2.551 5.595.09.08.185.158.28.232.096-.074.189-.152.28-.232 1.563-1.359 2.551-3.359 2.551-5.595 0-2.235-.987-4.236-2.551-5.595-.09-.08-.184-.156-.28-.231z"/></svg>';
@@ -7144,7 +7172,7 @@ const $$css$f = {
7144
7172
  function TextInput($$anchor, $$props) {
7145
7173
  push($$props, true);
7146
7174
  append_styles$1($$anchor, $$css$f);
7147
- let value = prop($$props, "value", 15, ""), label = prop($$props, "label", 15, ""), placeholder = prop($$props, "placeholder", 15, ""), disabled = prop($$props, "disabled", 15, false), required = prop($$props, "required", 15, false), readonly = prop($$props, "readonly", 15, false), size = prop($$props, "size", 15, "md"), id = prop($$props, "id", 15, ""), name = prop($$props, "name", 15, ""), autocomplete = prop($$props, "autocomplete", 15, ""), validationState = prop($$props, "validationState", 15, "neutral"), errorMessage = prop($$props, "errorMessage", 15, ""), helpText = prop($$props, "helpText", 15, ""), validationSchema = prop($$props, "validationSchema", 31, () => proxy({})), sensitive = prop($$props, "sensitive", 15, false), maxlength = prop($$props, "maxlength", 15, void 0), minlength = prop($$props, "minlength", 15, void 0), oninput = prop($$props, "oninput", 15), onchange = prop($$props, "onchange", 15), onfocus = prop($$props, "onfocus", 15), onblur = prop($$props, "onblur", 15), type = prop($$props, "type", 15, "text"), rows = prop($$props, "rows", 15, 3), cols = prop($$props, "cols", 15, void 0), resize = prop($$props, "resize", 15, "vertical");
7175
+ let value = prop($$props, "value", 15, ""), label = prop($$props, "label", 15, ""), placeholder = prop($$props, "placeholder", 15, ""), disabled = prop($$props, "disabled", 15, false), required = prop($$props, "required", 15, false), readonly = prop($$props, "readonly", 15, false), size = prop($$props, "size", 15, "md"), id = prop($$props, "id", 15, ""), name = prop($$props, "name", 15, ""), autocomplete = prop($$props, "autocomplete", 15, ""), validationState = prop($$props, "validationState", 15, "neutral"), errorMessage = prop($$props, "errorMessage", 15, ""), helpText = prop($$props, "helpText", 15, ""), validationSchema = prop($$props, "validationSchema", 31, () => proxy({})), sensitive = prop($$props, "sensitive", 15, false), maxlength = prop($$props, "maxlength", 15, void 0), minlength = prop($$props, "minlength", 15, void 0), oninput = prop($$props, "oninput", 15), onchange = prop($$props, "onchange", 15), onfocus = prop($$props, "onfocus", 15), onblur = prop($$props, "onblur", 15), type = prop($$props, "type", 15, "text"), rows = prop($$props, "rows", 15, 3), cols = prop($$props, "cols", 15, void 0), resize = prop($$props, "resize", 15, "vertical"), blockPaste = prop($$props, "blockPaste", 15, false);
7148
7176
  const baseInput = createEnhancedBaseInputMixin({
7149
7177
  get value() {
7150
7178
  return value();
@@ -7167,7 +7195,26 @@ function TextInput($$anchor, $$props) {
7167
7195
  componentName: "TextInput",
7168
7196
  componentType: "text",
7169
7197
  customValidator: (val) => {
7170
- const result = validateWithSchema(val, validationSchema(), label());
7198
+ const getMatchFieldValue = (fieldId) => {
7199
+ var _a2;
7200
+ if ((_a2 = validationSchema().match) === null || _a2 === void 0 ? void 0 : _a2.fieldRef) {
7201
+ const ref = validationSchema().match.fieldRef;
7202
+ if (typeof ref === "function") {
7203
+ return ref();
7204
+ }
7205
+ if (ref && "value" in ref) {
7206
+ return ref.value || "";
7207
+ }
7208
+ }
7209
+ if (fieldId && typeof document !== "undefined") {
7210
+ const matchedField = document.getElementById(fieldId);
7211
+ if (matchedField && "value" in matchedField) {
7212
+ return matchedField.value || "";
7213
+ }
7214
+ }
7215
+ return "";
7216
+ };
7217
+ const result = validateWithSchema(val, validationSchema(), label(), getMatchFieldValue);
7171
7218
  return { isValid: result.isValid, error: result.firstError };
7172
7219
  }
7173
7220
  });
@@ -7260,16 +7307,55 @@ function TextInput($$anchor, $$props) {
7260
7307
  }
7261
7308
  }
7262
7309
  });
7310
+ user_effect(() => {
7311
+ if (!validationSchema().match || !baseInput.state.hasInteracted) return;
7312
+ if (validationSchema().match.fieldRef) ;
7313
+ if (validationSchema().match.fieldId && typeof document !== "undefined") {
7314
+ const handleFieldValueChanged = (event2) => {
7315
+ var _a2, _b;
7316
+ const customEvent = event2;
7317
+ const changedFieldId = (_a2 = customEvent.detail) === null || _a2 === void 0 ? void 0 : _a2.fieldId;
7318
+ if (changedFieldId === ((_b = validationSchema().match) === null || _b === void 0 ? void 0 : _b.fieldId)) {
7319
+ if (baseInput.state.inputElement) {
7320
+ const syntheticEvent = new Event("input", { bubbles: true });
7321
+ baseInput.handlers.handleInput(syntheticEvent);
7322
+ }
7323
+ }
7324
+ };
7325
+ document.addEventListener("field-value-changed", handleFieldValueChanged);
7326
+ return () => {
7327
+ document.removeEventListener("field-value-changed", handleFieldValueChanged);
7328
+ };
7329
+ }
7330
+ });
7263
7331
  function handleInput(event2) {
7332
+ var _a2;
7264
7333
  const target = event2.target;
7265
- value(target.value);
7334
+ const newValue = target.value;
7335
+ value(newValue);
7266
7336
  baseInput.handlers.handleInput(event2);
7337
+ if (id() && ((_a2 = validationSchema().match) === null || _a2 === void 0 ? void 0 : _a2.fieldId)) {
7338
+ const matchEvent = new CustomEvent("field-value-changed", {
7339
+ detail: { fieldId: id(), value: newValue },
7340
+ bubbles: true,
7341
+ composed: true
7342
+ });
7343
+ if (typeof document !== "undefined") {
7344
+ document.dispatchEvent(matchEvent);
7345
+ }
7346
+ }
7267
7347
  get$1(eventDispatcher).dispatch(ComponentEvents.TEXT_INPUT, createEventDetail());
7268
7348
  if (oninput()) {
7269
7349
  uiLogger.info("TextInput: oninput", event2);
7270
7350
  oninput()(event2);
7271
7351
  }
7272
7352
  }
7353
+ function handlePaste(event2) {
7354
+ if (blockPaste()) {
7355
+ event2.preventDefault();
7356
+ return false;
7357
+ }
7358
+ }
7273
7359
  function handleChange2(event2) {
7274
7360
  baseInput.handlers.handleChange(event2);
7275
7361
  get$1(eventDispatcher).dispatch(ComponentEvents.TEXT_CHANGE, createEventDetail());
@@ -7400,6 +7486,7 @@ function TextInput($$anchor, $$props) {
7400
7486
  });
7401
7487
  event$1("focus", textarea, handleFocus);
7402
7488
  event$1("blur", textarea, handleBlur);
7489
+ event$1("paste", textarea, handlePaste);
7403
7490
  bind_value(textarea, value);
7404
7491
  append($$anchor2, textarea);
7405
7492
  };
@@ -7428,6 +7515,7 @@ function TextInput($$anchor, $$props) {
7428
7515
  });
7429
7516
  event$1("focus", input, handleFocus);
7430
7517
  event$1("blur", input, handleBlur);
7518
+ event$1("paste", input, handlePaste);
7431
7519
  bind_value(input, value);
7432
7520
  append($$anchor2, input);
7433
7521
  };
@@ -7727,6 +7815,13 @@ function TextInput($$anchor, $$props) {
7727
7815
  set resize($$value = "vertical") {
7728
7816
  resize($$value);
7729
7817
  flushSync();
7818
+ },
7819
+ get blockPaste() {
7820
+ return blockPaste();
7821
+ },
7822
+ set blockPaste($$value = false) {
7823
+ blockPaste($$value);
7824
+ flushSync();
7730
7825
  }
7731
7826
  });
7732
7827
  }
@@ -7758,7 +7853,8 @@ customElements.define("alviere-text-input", create_custom_element(
7758
7853
  type: {},
7759
7854
  rows: {},
7760
7855
  cols: {},
7761
- resize: {}
7856
+ resize: {},
7857
+ blockPaste: {}
7762
7858
  },
7763
7859
  [],
7764
7860
  [
@@ -10320,7 +10416,7 @@ function createBaseFormMixin(options) {
10320
10416
  }
10321
10417
  var root_1$8 = /* @__PURE__ */ from_html(`<h2 class="svelte-hf49ea">Create Consumer Account</h2>`);
10322
10418
  var root_2$3 = /* @__PURE__ */ from_html(`<div><alviere-spinner><span slot="message"><!></span></alviere-spinner></div>`, 2);
10323
- var root_11 = /* @__PURE__ */ from_html(`<span class="validation-hint svelte-hf49ea">Please fill in all required fields to continue</span>`);
10419
+ var root_11$1 = /* @__PURE__ */ from_html(`<span class="validation-hint svelte-hf49ea">Please fill in all required fields to continue</span>`);
10324
10420
  var root_12$2 = /* @__PURE__ */ from_html(`<span class="validation-error">Please fix the errors above</span>`);
10325
10421
  var root$8 = /* @__PURE__ */ from_html(`<div class="alviere-create-consumer-account svelte-hf49ea"><!> <!> <form novalidate=""><div class="form-section svelte-hf49ea"><h3 class="svelte-hf49ea">Personal Information</h3> <div class="form-row svelte-hf49ea"><!> <!></div> <div class="form-row svelte-hf49ea"><!></div></div> <div class="form-actions svelte-hf49ea"><div class="form-status svelte-hf49ea"><!> <!></div> <alviere-button><!></alviere-button></div></form></div>`, 2);
10326
10422
  const $$css$a = {
@@ -10838,7 +10934,7 @@ function CreateConsumerAccount($$anchor, $$props) {
10838
10934
  var node_9 = child(div_6);
10839
10935
  {
10840
10936
  var consequent_6 = ($$anchor2) => {
10841
- var span_1 = root_11();
10937
+ var span_1 = root_11$1();
10842
10938
  append($$anchor2, span_1);
10843
10939
  };
10844
10940
  if_block(node_9, ($$render) => {
@@ -10982,104 +11078,89 @@ customElements.define("alviere-create-consumer-account", create_custom_element(
10982
11078
  [],
10983
11079
  true
10984
11080
  ));
11081
+ const bankInfoCache = /* @__PURE__ */ new Map();
10985
11082
  const COMMON_ROUTING_NUMBERS = {
10986
11083
  // Federal Reserve Banks (these are the actual routing numbers)
10987
11084
  "011000015": {
11085
+ routing_number: "011000015",
10988
11086
  name: "Federal Reserve Bank",
10989
- type: "Federal Reserve",
10990
- region: "Atlanta",
10991
- description: "Federal Reserve Bank of Atlanta"
11087
+ city: "Atlanta"
10992
11088
  },
10993
11089
  "021001208": {
11090
+ routing_number: "021001208",
10994
11091
  name: "Federal Reserve Bank",
10995
- type: "Federal Reserve",
10996
- region: "East Rutherford",
10997
- description: "Federal Reserve Bank of East Rutherford"
11092
+ city: "East Rutherford"
10998
11093
  },
10999
11094
  "021000322": {
11095
+ routing_number: "021000322",
11000
11096
  name: "Bank of America, N.A.",
11001
- type: "Bank of America",
11002
- region: "Richmond",
11003
- description: "Bank of America Richmond"
11097
+ city: "Richmond"
11004
11098
  },
11005
11099
  "031000503": {
11100
+ routing_number: "031000503",
11006
11101
  name: "Wells Fargo Bank",
11007
- type: "Wells Fargo",
11008
- region: "Minneapolis",
11009
- description: "Wells Fargo Bank, N.A."
11102
+ city: "Minneapolis"
11010
11103
  },
11011
11104
  "041000014": {
11105
+ routing_number: "041000014",
11012
11106
  name: "Federal Reserve Bank",
11013
- type: "Federal Reserve",
11014
- region: "Atlanta",
11015
- description: "Federal Reserve Bank of Atlanta (ACH Department)"
11107
+ city: "Atlanta"
11016
11108
  },
11017
11109
  "051000017": {
11018
- name: "Bank of America, N.A.",
11019
- type: "Bank of America",
11020
- region: "Henrico",
11021
- description: "Bank of America Henrico"
11110
+ routing_number: "051000017",
11111
+ name: "Bank of A merica, N.A.",
11112
+ city: "Henrico"
11022
11113
  },
11023
11114
  "061000104": {
11115
+ routing_number: "061000104",
11024
11116
  name: "Suntrust",
11025
- type: "Suntrust",
11026
- region: "Orlando",
11027
- description: "Suntrust Bank Orlando"
11117
+ city: "Orlando"
11028
11118
  },
11029
11119
  "071000013": {
11120
+ routing_number: "071000013",
11030
11121
  name: "JPMorgan Chase",
11031
- type: "JPMorgan Chase",
11032
- region: "Belleville",
11033
- description: "JPMorgan Chase Belleville"
11122
+ city: "Belleville"
11034
11123
  },
11035
11124
  "081000032": {
11125
+ routing_number: "081000032",
11036
11126
  name: "Bank of America, N.A.",
11037
- type: "Bank of America",
11038
- region: "Henrico",
11039
- description: "Bank of America Henrico"
11127
+ city: "Henrico"
11040
11128
  },
11041
11129
  "091000019": {
11130
+ routing_number: "091000019",
11042
11131
  name: "Wells Fargo Bank",
11043
- type: "Wells Fargo",
11044
- region: "Minneapolis",
11045
- description: "Wells Fargo Bank NA (Minnesota)"
11132
+ city: "Minneapolis"
11046
11133
  },
11047
11134
  "111000025": {
11135
+ routing_number: "111000025",
11048
11136
  name: "Bank of America, N.A.",
11049
- type: "Bank of America",
11050
- region: "Henrico",
11051
- description: "Bank of America Henrico"
11137
+ city: "Henrico"
11052
11138
  },
11053
11139
  "121058313": {
11140
+ routing_number: "121058313",
11054
11141
  name: "Federal Reserve Bank SF- B, S & R",
11055
- type: "Federal Reserve",
11056
- region: "San Francisco",
11057
- description: "Federal Reserve Bank of San Francisco"
11142
+ city: "San Francisco"
11058
11143
  },
11059
11144
  // Major commercial banks (verified routing numbers)
11060
11145
  "021000021": {
11146
+ routing_number: "021000021",
11061
11147
  name: "JPMorgan Chase Bank",
11062
- type: "JPMorgan Chase",
11063
- region: "Tampa",
11064
- description: "JPMorgan Chase Tampa"
11148
+ city: "Tampa"
11065
11149
  },
11066
11150
  "026009593": {
11151
+ routing_number: "026009593",
11067
11152
  name: "Bank of America, N.A.",
11068
- type: "Bank of America",
11069
- region: "Richmond",
11070
- description: "Bank of America, N.A."
11153
+ city: "Richmond"
11071
11154
  },
11072
11155
  "121000248": {
11156
+ routing_number: "121000248",
11073
11157
  name: "Wells Fargo Bank",
11074
- type: "Wells Fargo",
11075
- region: "Minneapolis",
11076
- description: "Wells Fargo Bank, National Association"
11158
+ city: "Minneapolis"
11077
11159
  },
11078
11160
  "021000089": {
11161
+ routing_number: "021000089",
11079
11162
  name: "Citibank",
11080
- type: "Citibank",
11081
- region: "New Castle",
11082
- description: "Citibank, N.A."
11163
+ city: "New Castle"
11083
11164
  }
11084
11165
  };
11085
11166
  const FEDERAL_RESERVE_REGIONS = {
@@ -11096,7 +11177,35 @@ const FEDERAL_RESERVE_REGIONS = {
11096
11177
  "11": "Dallas",
11097
11178
  "12": "San Francisco"
11098
11179
  };
11099
- function lookupRoutingNumber(routingNumber) {
11180
+ async function lookupRoutingNumber(routingNumber, alviereCore) {
11181
+ const cleanRouting = routingNumber.replace(/[-\s]/g, "");
11182
+ if (!/^\d{9}$/.test(cleanRouting)) {
11183
+ return null;
11184
+ }
11185
+ if (bankInfoCache.has(cleanRouting)) {
11186
+ return bankInfoCache.get(cleanRouting);
11187
+ }
11188
+ if (alviereCore) {
11189
+ try {
11190
+ const bankInfoService = alviereCore.createBankInfoService();
11191
+ const apiResult = await bankInfoService.getBankInfo(cleanRouting);
11192
+ if (apiResult && apiResult.bank_info) {
11193
+ return apiResult.bank_info;
11194
+ }
11195
+ } catch (error) {
11196
+ alviereCore.getLogger().info(`Bank info API call failed, using local lookup: ${error}`);
11197
+ alviereCore.getLogger().warn(
11198
+ "⚠️ [DEPRECATED] Using local routing number lookup as fallback. This will be removed in a future version. Ensure API connectivity for accurate bank information."
11199
+ );
11200
+ return localLookupRoutingNumber(cleanRouting);
11201
+ }
11202
+ }
11203
+ alviereCore == null ? void 0 : alviereCore.getLogger().warn(
11204
+ "⚠️ [DEPRECATED] Using local routing number lookup. This will be removed in a future version. Pass AlviereCore instance to lookupRoutingNumber() for API-based lookup."
11205
+ );
11206
+ return localLookupRoutingNumber(cleanRouting);
11207
+ }
11208
+ function localLookupRoutingNumber(routingNumber) {
11100
11209
  const cleanRouting = routingNumber.replace(/[-\s]/g, "");
11101
11210
  if (!/^\d{9}$/.test(cleanRouting)) {
11102
11211
  return null;
@@ -11107,48 +11216,47 @@ function lookupRoutingNumber(routingNumber) {
11107
11216
  const fedSymbol = cleanRouting.substring(0, 2);
11108
11217
  if (FEDERAL_RESERVE_REGIONS[fedSymbol]) {
11109
11218
  return {
11219
+ routing_number: cleanRouting,
11110
11220
  name: "Federal Reserve Bank",
11111
- type: "Federal Reserve",
11112
- region: FEDERAL_RESERVE_REGIONS[fedSymbol],
11113
- description: `Federal Reserve Bank of ${FEDERAL_RESERVE_REGIONS[fedSymbol]}`
11221
+ city: FEDERAL_RESERVE_REGIONS[fedSymbol]
11114
11222
  };
11115
11223
  }
11116
11224
  const firstDigit = parseInt(cleanRouting.charAt(0));
11117
11225
  if (firstDigit === 0 || firstDigit === 1) {
11118
11226
  return {
11227
+ routing_number: cleanRouting,
11119
11228
  name: "Federal Reserve Bank",
11120
- type: "Federal Reserve",
11121
- description: "Federal Reserve Bank (based on routing pattern)"
11229
+ city: FEDERAL_RESERVE_REGIONS[fedSymbol]
11122
11230
  };
11123
11231
  } else if (firstDigit === 2 || firstDigit === 3) {
11124
11232
  return {
11233
+ routing_number: cleanRouting,
11125
11234
  name: "Commercial Bank",
11126
- type: "Commercial Bank",
11127
- description: "Commercial Bank (based on routing pattern)"
11235
+ city: "Unknown"
11128
11236
  };
11129
11237
  } else if (firstDigit === 4 || firstDigit === 5) {
11130
11238
  return {
11239
+ routing_number: cleanRouting,
11131
11240
  name: "Thrift Institution",
11132
- type: "Thrift Institution",
11133
- description: "Thrift Institution (based on routing pattern)"
11241
+ city: "Unknown"
11134
11242
  };
11135
11243
  } else if (firstDigit === 6 || firstDigit === 7) {
11136
11244
  return {
11245
+ routing_number: cleanRouting,
11137
11246
  name: "Credit Union",
11138
- type: "Credit Union",
11139
- description: "Credit Union (based on routing pattern)"
11247
+ city: "Unknown"
11140
11248
  };
11141
11249
  } else if (firstDigit === 8) {
11142
11250
  return {
11251
+ routing_number: cleanRouting,
11143
11252
  name: "Special Purpose",
11144
- type: "Commercial Bank",
11145
- description: "Special Purpose Bank (based on routing pattern)"
11253
+ city: "Unknown"
11146
11254
  };
11147
11255
  }
11148
11256
  return {
11257
+ routing_number: cleanRouting,
11149
11258
  name: "Unknown Bank",
11150
- type: "Commercial Bank",
11151
- description: "Unable to determine bank type from routing number"
11259
+ city: "Unknown"
11152
11260
  };
11153
11261
  }
11154
11262
  function formatRoutingNumber(routingNumber) {
@@ -11168,10 +11276,12 @@ var root_2$2 = /* @__PURE__ */ from_html(`<div class="bank-accounts-section svel
11168
11276
  var root_9$1 = /* @__PURE__ */ from_html(`<alviere-button><span class="alviere-add-bank-account__button__label">Back to Bank Accounts</span></alviere-button>`, 2);
11169
11277
  var root_13$1 = /* @__PURE__ */ from_html(`<span class="bank-region svelte-hrbllu"> </span>`);
11170
11278
  var root_12$1 = /* @__PURE__ */ from_html(`<div class="routing-info svelte-hrbllu"><div class="routing-info-header svelte-hrbllu"><span class="bank-name svelte-hrbllu"> </span> <!></div></div>`);
11171
- var root_10 = /* @__PURE__ */ from_html(`<div class="alviere-add-bank-account__form__row alviere-add-bank-account__form__row--banking-info svelte-hrbllu"><alviere-badge>ACH</alviere-badge> <!></div> <div class="alviere-add-bank-account__form__row svelte-hrbllu"><!></div> <div class="alviere-add-bank-account__form__row svelte-hrbllu"><!></div>`, 3);
11172
- var root_14$1 = /* @__PURE__ */ from_html(`<span class="validation-hint svelte-hrbllu">Please fill in all required fields to continue</span>`);
11173
- var root_15$1 = /* @__PURE__ */ from_html(`<span class="validation-error svelte-hrbllu">Please fix the errors above</span>`);
11174
- var root_16$1 = /* @__PURE__ */ from_html(`<span class="validation-error svelte-hrbllu" role="alert"> </span>`);
11279
+ var root_14$1 = /* @__PURE__ */ from_html(`<alviere-spinner></alviere-spinner>`, 2);
11280
+ var root_11 = /* @__PURE__ */ from_html(`<!> <!>`, 1);
11281
+ var root_10 = /* @__PURE__ */ from_html(`<div class="alviere-add-bank-account__form__row alviere-add-bank-account__form__row--banking-info svelte-hrbllu"><alviere-badge>ACH</alviere-badge> <!></div> <div class="alviere-add-bank-account__form__row svelte-hrbllu"><!> <!></div> <div class="alviere-add-bank-account__form__row svelte-hrbllu"><!> <!></div>`, 3);
11282
+ var root_17$1 = /* @__PURE__ */ from_html(`<span class="validation-hint svelte-hrbllu">Please fill in all required fields to continue</span>`);
11283
+ var root_18$1 = /* @__PURE__ */ from_html(`<span class="validation-error svelte-hrbllu">Please fix the errors above</span>`);
11284
+ var root_19$1 = /* @__PURE__ */ from_html(`<span class="validation-error svelte-hrbllu" role="alert"> </span>`);
11175
11285
  var root_8$1 = /* @__PURE__ */ from_html(`<form novalidate="" class="alviere-add-bank-account__form svelte-hrbllu"><div class="alviere-add-bank-account__header svelte-hrbllu"><h2 class="svelte-hrbllu">Add Bank Account</h2> <!></div> <div class="alviere-add-bank-account__form__section"><!></div> <div class="form-actions svelte-hrbllu"><div class="form-status svelte-hrbllu"><!> <!> <!></div> <alviere-button> </alviere-button></div></form>`, 2);
11176
11286
  var root$7 = /* @__PURE__ */ from_html(`<div class="alviere-add-bank-account svelte-hrbllu"><!> <!> <!></div>`);
11177
11287
  const $$css$9 = {
@@ -11181,7 +11291,7 @@ const $$css$9 = {
11181
11291
  function AddBankAccount($$anchor, $$props) {
11182
11292
  push($$props, true);
11183
11293
  append_styles$1($$anchor, $$css$9);
11184
- let jwt = prop($$props, "jwt", 7, ""), accountUuid = prop($$props, "accountUuid", 7, ""), debug = prop($$props, "debug", 7, true), onsuccess = prop($$props, "onsuccess", 15), publicCertificate = prop($$props, "publicCertificate", 7, ""), publicCertificateId = prop($$props, "publicCertificateId", 7, "");
11294
+ let jwt = prop($$props, "jwt", 7, ""), accountUuid = prop($$props, "accountUuid", 7, ""), debug = prop($$props, "debug", 7, true), onsuccess = prop($$props, "onsuccess", 15), publicCertificate = prop($$props, "publicCertificate", 7, ""), publicCertificateId = prop($$props, "publicCertificateId", 7, ""), requireRoutingAndAccountConfirmation = prop($$props, "requireRoutingAndAccountConfirmation", 7, false);
11185
11295
  const initialFormData = {
11186
11296
  external_id: "",
11187
11297
  country: "USA",
@@ -11196,29 +11306,59 @@ function AddBankAccount($$anchor, $$props) {
11196
11306
  iban_details: { iban: "" },
11197
11307
  swift_details: { swift_code: "", account_number: "" },
11198
11308
  clabe_details: { swift_code: "", account_number: "" },
11199
- metadata: ""
11309
+ metadata: "",
11310
+ // Confirmation fields
11311
+ confirm_routing_number: "",
11312
+ confirm_account_number: ""
11200
11313
  };
11201
- const fieldSchemas = {
11202
- external_id: { required: true },
11203
- country: { required: true },
11204
- currency: { required: true },
11205
- bankAccountType: { required: true },
11206
- ach_routing_number: {
11207
- required: "Routing number is required",
11208
- pattern: {
11209
- regex: /^\d{9}$/,
11210
- message: "Routing number must be exactly 9 digits"
11314
+ const fieldSchemas = Object.assign(
11315
+ {
11316
+ external_id: { required: true },
11317
+ country: { required: true },
11318
+ currency: { required: true },
11319
+ bankAccountType: { required: true },
11320
+ ach_routing_number: {
11321
+ required: "Routing number is required",
11322
+ pattern: {
11323
+ regex: /^\d{9}$/,
11324
+ message: "Routing number must be exactly 9 digits"
11325
+ }
11326
+ },
11327
+ ach_account_number: {
11328
+ required: "Account number is required",
11329
+ numeric: "Account number must contain only digits",
11330
+ minLength: {
11331
+ value: 3,
11332
+ message: "Account number must be at least 3 digits"
11333
+ }
11211
11334
  }
11212
11335
  },
11213
- ach_account_number: {
11214
- required: "Account number is required",
11215
- numeric: "Account number must contain only digits",
11216
- minLength: {
11217
- value: 3,
11218
- message: "Account number must be at least 3 digits"
11336
+ requireRoutingAndAccountConfirmation() && {
11337
+ confirm_routing_number: {
11338
+ required: "Please confirm your routing number",
11339
+ pattern: {
11340
+ regex: /^\d{9}$/,
11341
+ message: "Routing number must be exactly 9 digits"
11342
+ },
11343
+ match: {
11344
+ fieldRef: () => baseForm.state.formData.ach_details.routing_number || "",
11345
+ message: "Routing number confirmation does not match"
11346
+ }
11347
+ },
11348
+ confirm_account_number: {
11349
+ required: "Please confirm your account number",
11350
+ numeric: "Account number must contain only digits",
11351
+ minLength: {
11352
+ value: 3,
11353
+ message: "Account number must be at least 3 digits"
11354
+ },
11355
+ match: {
11356
+ fieldRef: () => baseForm.state.formData.ach_details.account_number || "",
11357
+ message: "Account number confirmation does not match"
11358
+ }
11219
11359
  }
11220
11360
  }
11221
- };
11361
+ );
11222
11362
  const baseForm = createBaseFormMixin({
11223
11363
  jwt: jwt(),
11224
11364
  debug: debug(),
@@ -11239,6 +11379,8 @@ function AddBankAccount($$anchor, $$props) {
11239
11379
  let showAddForm = /* @__PURE__ */ state(false);
11240
11380
  let selectedBankAccountUuid = /* @__PURE__ */ state(null);
11241
11381
  let formError = /* @__PURE__ */ state(null);
11382
+ let bankInfo = /* @__PURE__ */ state(null);
11383
+ let isLoadingBankInfo = /* @__PURE__ */ state(false);
11242
11384
  let hostElement = /* @__PURE__ */ state(null);
11243
11385
  const hasCredentials = /* @__PURE__ */ user_derived(() => jwt() && accountUuid());
11244
11386
  user_effect(() => {
@@ -11249,21 +11391,29 @@ function AddBankAccount($$anchor, $$props) {
11249
11391
  uiLogger.info("🔄 Generated new external_id for bank account:", newExternalId);
11250
11392
  }
11251
11393
  });
11394
+ user_effect(() => {
11395
+ const routingNumber = baseForm.state.formData.ach_details.routing_number;
11396
+ if (routingNumber && routingNumber.length === 9 && baseForm.state.alviereCore) {
11397
+ set(isLoadingBankInfo, true);
11398
+ lookupRoutingNumber(routingNumber, baseForm.state.alviereCore).then((info) => {
11399
+ set(bankInfo, info, true);
11400
+ }).catch((error) => {
11401
+ set(bankInfo, null);
11402
+ console.warn("Failed to lookup bank info:", error);
11403
+ }).finally(() => {
11404
+ set(isLoadingBankInfo, false);
11405
+ });
11406
+ } else {
11407
+ set(bankInfo, null);
11408
+ }
11409
+ });
11252
11410
  onMount(async () => {
11253
11411
  set(isCheckingBankAccounts, true);
11254
11412
  if (!get$1(hasCredentials)) {
11255
11413
  throw new Error("Missing required credentials");
11256
11414
  }
11257
- if (accountUuid() !== "862a2524-ce32-4fa7-b138-e7ac7e93c022") {
11258
- await checkForBankAccounts();
11259
- }
11260
11415
  baseForm.actions.setFieldValue("external_id", `bank_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`);
11261
- setTimeout(
11262
- () => {
11263
- set(isCheckingBankAccounts, false);
11264
- },
11265
- 1e3
11266
- );
11416
+ await checkForBankAccounts();
11267
11417
  });
11268
11418
  async function checkForBankAccounts() {
11269
11419
  var _a2;
@@ -11277,6 +11427,7 @@ function AddBankAccount($$anchor, $$props) {
11277
11427
  get$1(bankAccounts).bank_accounts = accountsWithExpansion.filter((account) => account.status === "ACTIVE");
11278
11428
  set(selectedBankAccountUuid, ((_a2 = get$1(bankAccounts).bank_accounts[0]) === null || _a2 === void 0 ? void 0 : _a2.payment_method_uuid) || null, true);
11279
11429
  }
11430
+ set(isCheckingBankAccounts, false);
11280
11431
  }
11281
11432
  async function deleteBankAccount(uuid) {
11282
11433
  set(isSubmitting, true);
@@ -11323,18 +11474,6 @@ function AddBankAccount($$anchor, $$props) {
11323
11474
  case "ACH":
11324
11475
  request.bank_account_details.ach_details = formData.ach_details;
11325
11476
  break;
11326
- case "EFT":
11327
- request.bank_account_details.eft_details = formData.eft_details;
11328
- break;
11329
- case "IBAN":
11330
- request.bank_account_details.iban_details = formData.iban_details;
11331
- break;
11332
- case "SWIFT":
11333
- request.bank_account_details.swift_details = formData.swift_details;
11334
- break;
11335
- case "CLABE":
11336
- request.bank_account_details.clabe_details = formData.clabe_details;
11337
- break;
11338
11477
  }
11339
11478
  const paymentsService = baseForm.state.alviereCore.createPaymentsService();
11340
11479
  const response = await paymentsService.processAddBankAccountWithValidation(accountUuid(), request);
@@ -11372,48 +11511,15 @@ function AddBankAccount($$anchor, $$props) {
11372
11511
  }
11373
11512
  }
11374
11513
  function getBankAccountDisplayInfo(bankAccount) {
11375
- var _a2;
11376
11514
  const details = bankAccount.bank_account_details;
11377
11515
  if (details === null || details === void 0 ? void 0 : details.ach_details) {
11378
- const bankInfo = lookupRoutingNumber(details.ach_details.routing_number || "");
11516
+ const bankInfo2 = lookupRoutingNumber(details.ach_details.routing_number || "");
11379
11517
  return {
11380
11518
  type: "ACH",
11381
11519
  accountNumber: bankAccount.last_4 || "N/A",
11382
11520
  routingNumber: formatRoutingNumber(details.ach_details.routing_number || ""),
11383
11521
  accountType: bankAccount.type || "N/A",
11384
- bankInfo
11385
- };
11386
- } else if (details === null || details === void 0 ? void 0 : details.eft_details) {
11387
- return {
11388
- type: "EFT",
11389
- accountNumber: bankAccount.last_4 || "N/A",
11390
- routingNumber: `${details.eft_details.institution_number || ""}-${details.eft_details.transit_number || ""}`,
11391
- accountType: "N/A",
11392
- bankInfo: null
11393
- };
11394
- } else if (details === null || details === void 0 ? void 0 : details.iban_details) {
11395
- return {
11396
- type: "IBAN",
11397
- accountNumber: bankAccount.last_4 || "N/A",
11398
- routingNumber: ((_a2 = details.iban_details.iban) === null || _a2 === void 0 ? void 0 : _a2.slice(0, 4)) || "N/A",
11399
- accountType: "N/A",
11400
- bankInfo: null
11401
- };
11402
- } else if (details === null || details === void 0 ? void 0 : details.swift_details) {
11403
- return {
11404
- type: "SWIFT",
11405
- accountNumber: bankAccount.last_4 || "N/A",
11406
- routingNumber: details.swift_details.swift_code || "N/A",
11407
- accountType: "N/A",
11408
- bankInfo: null
11409
- };
11410
- } else if (details === null || details === void 0 ? void 0 : details.clabe_details) {
11411
- return {
11412
- type: "CLABE",
11413
- accountNumber: bankAccount.last_4 || "N/A",
11414
- routingNumber: details.clabe_details.swift_code || "N/A",
11415
- accountType: "N/A",
11416
- bankInfo: null
11522
+ bankInfo: bankInfo2
11417
11523
  };
11418
11524
  }
11419
11525
  return {
@@ -11629,7 +11735,7 @@ function AddBankAccount($$anchor, $$props) {
11629
11735
  }
11630
11736
  var node_6 = sibling(node_1, 2);
11631
11737
  {
11632
- var consequent_14 = ($$anchor2) => {
11738
+ var consequent_17 = ($$anchor2) => {
11633
11739
  var form = root_8$1();
11634
11740
  var div_18 = child(form);
11635
11741
  var node_7 = sibling(child(div_18), 2);
@@ -11650,7 +11756,7 @@ function AddBankAccount($$anchor, $$props) {
11650
11756
  var div_19 = sibling(div_18, 2);
11651
11757
  var node_8 = child(div_19);
11652
11758
  {
11653
- var consequent_10 = ($$anchor3) => {
11759
+ var consequent_13 = ($$anchor3) => {
11654
11760
  var fragment_1 = root_10();
11655
11761
  var div_20 = first_child(fragment_1);
11656
11762
  var alviere_badge_1 = child(div_20);
@@ -11658,9 +11764,8 @@ function AddBankAccount($$anchor, $$props) {
11658
11764
  set_custom_element_data(alviere_badge_1, "variant", "tertiary");
11659
11765
  var node_9 = sibling(alviere_badge_1, 2);
11660
11766
  {
11661
- var consequent_9 = ($$anchor4) => {
11662
- var fragment_2 = comment();
11663
- const bankInfo = /* @__PURE__ */ user_derived(() => lookupRoutingNumber(baseForm.state.formData.ach_details.routing_number));
11767
+ var consequent_10 = ($$anchor4) => {
11768
+ var fragment_2 = root_11();
11664
11769
  var node_10 = first_child(fragment_2);
11665
11770
  {
11666
11771
  var consequent_8 = ($$anchor5) => {
@@ -11675,35 +11780,51 @@ function AddBankAccount($$anchor, $$props) {
11675
11780
  var span_10 = root_13$1();
11676
11781
  var text_12 = child(span_10);
11677
11782
  reset(span_10);
11678
- template_effect(() => set_text(text_12, `(${get$1(bankInfo).region ?? ""})`));
11783
+ template_effect(() => set_text(text_12, `(${get$1(bankInfo).city ?? ""})`));
11679
11784
  append($$anchor6, span_10);
11680
11785
  };
11681
11786
  if_block(node_11, ($$render) => {
11682
- if (get$1(bankInfo).region) $$render(consequent_7);
11787
+ var _a2;
11788
+ if ((_a2 = get$1(bankInfo)) == null ? void 0 : _a2.city) $$render(consequent_7);
11683
11789
  });
11684
11790
  }
11685
11791
  reset(div_22);
11686
11792
  reset(div_21);
11687
- template_effect(() => set_text(text_11, get$1(bankInfo).name));
11793
+ template_effect(() => {
11794
+ var _a2;
11795
+ return set_text(text_11, (_a2 = get$1(bankInfo)) == null ? void 0 : _a2.name);
11796
+ });
11688
11797
  append($$anchor5, div_21);
11689
11798
  };
11690
11799
  if_block(node_10, ($$render) => {
11691
11800
  if (get$1(bankInfo)) $$render(consequent_8);
11692
11801
  });
11693
11802
  }
11803
+ var node_12 = sibling(node_10, 2);
11804
+ {
11805
+ var consequent_9 = ($$anchor5) => {
11806
+ var alviere_spinner_1 = root_14$1();
11807
+ set_custom_element_data(alviere_spinner_1, "size", "sm");
11808
+ set_custom_element_data(alviere_spinner_1, "variant", "circular");
11809
+ append($$anchor5, alviere_spinner_1);
11810
+ };
11811
+ if_block(node_12, ($$render) => {
11812
+ if (get$1(isLoadingBankInfo)) $$render(consequent_9);
11813
+ });
11814
+ }
11694
11815
  append($$anchor4, fragment_2);
11695
11816
  };
11696
11817
  if_block(node_9, ($$render) => {
11697
- if (baseForm.state.formData.ach_details.routing_number && baseForm.state.formData.ach_details.routing_number.length === 9) $$render(consequent_9);
11818
+ if (baseForm.state.formData.ach_details.routing_number && baseForm.state.formData.ach_details.routing_number.length === 9) $$render(consequent_10);
11698
11819
  });
11699
11820
  }
11700
11821
  reset(div_20);
11701
11822
  var div_23 = sibling(div_20, 2);
11702
- var node_12 = child(div_23);
11823
+ var node_13 = child(div_23);
11703
11824
  {
11704
11825
  let $0 = /* @__PURE__ */ user_derived(() => baseForm.state.validationErrors.ach_routing_number ? "invalid" : "neutral");
11705
11826
  let $1 = /* @__PURE__ */ user_derived(() => baseForm.state.validationErrors.ach_routing_number || "");
11706
- TextInput(node_12, {
11827
+ TextInput(node_13, {
11707
11828
  get value() {
11708
11829
  return baseForm.state.formData.ach_details.routing_number;
11709
11830
  },
@@ -11712,6 +11833,9 @@ function AddBankAccount($$anchor, $$props) {
11712
11833
  helpText: "You can find your routing number on your check or bank statement.",
11713
11834
  required: true,
11714
11835
  id: "ach_routing",
11836
+ get validationSchema() {
11837
+ return fieldSchemas.ach_routing_number;
11838
+ },
11715
11839
  get validationState() {
11716
11840
  return get$1($0);
11717
11841
  },
@@ -11725,13 +11849,50 @@ function AddBankAccount($$anchor, $$props) {
11725
11849
  }
11726
11850
  });
11727
11851
  }
11852
+ var node_14 = sibling(node_13, 2);
11853
+ {
11854
+ var consequent_11 = ($$anchor4) => {
11855
+ {
11856
+ let $0 = /* @__PURE__ */ user_derived(() => baseForm.state.validationErrors.confirm_routing_number ? "invalid" : "neutral");
11857
+ let $1 = /* @__PURE__ */ user_derived(() => baseForm.state.validationErrors.confirm_routing_number || "");
11858
+ TextInput($$anchor4, {
11859
+ get value() {
11860
+ return baseForm.state.formData.confirm_routing_number;
11861
+ },
11862
+ label: "Confirm Routing Number",
11863
+ placeholder: "Re-enter 9-digit routing number",
11864
+ helpText: "Please confirm your routing number to ensure accuracy.",
11865
+ required: true,
11866
+ id: "confirm_ach_routing",
11867
+ get validationSchema() {
11868
+ return fieldSchemas.confirm_routing_number;
11869
+ },
11870
+ get validationState() {
11871
+ return get$1($0);
11872
+ },
11873
+ get errorMessage() {
11874
+ return get$1($1);
11875
+ },
11876
+ oninput: (e) => {
11877
+ const newValue = e.target.value;
11878
+ baseForm.state.formData.confirm_routing_number = newValue;
11879
+ baseForm.handlers.handleFieldChange("confirm_routing_number", newValue);
11880
+ },
11881
+ blockPaste: true
11882
+ });
11883
+ }
11884
+ };
11885
+ if_block(node_14, ($$render) => {
11886
+ if (requireRoutingAndAccountConfirmation()) $$render(consequent_11);
11887
+ });
11888
+ }
11728
11889
  reset(div_23);
11729
11890
  var div_24 = sibling(div_23, 2);
11730
- var node_13 = child(div_24);
11891
+ var node_15 = child(div_24);
11731
11892
  {
11732
11893
  let $0 = /* @__PURE__ */ user_derived(() => baseForm.state.validationErrors.ach_account_number ? "invalid" : "neutral");
11733
11894
  let $1 = /* @__PURE__ */ user_derived(() => baseForm.state.validationErrors.ach_account_number || "");
11734
- TextInput(node_13, {
11895
+ TextInput(node_15, {
11735
11896
  get value() {
11736
11897
  return baseForm.state.formData.ach_details.account_number;
11737
11898
  },
@@ -11740,6 +11901,9 @@ function AddBankAccount($$anchor, $$props) {
11740
11901
  required: true,
11741
11902
  minlength: 3,
11742
11903
  id: "ach_account",
11904
+ get validationSchema() {
11905
+ return fieldSchemas.ach_account_number;
11906
+ },
11743
11907
  get validationState() {
11744
11908
  return get$1($0);
11745
11909
  },
@@ -11753,47 +11917,85 @@ function AddBankAccount($$anchor, $$props) {
11753
11917
  }
11754
11918
  });
11755
11919
  }
11920
+ var node_16 = sibling(node_15, 2);
11921
+ {
11922
+ var consequent_12 = ($$anchor4) => {
11923
+ {
11924
+ let $0 = /* @__PURE__ */ user_derived(() => baseForm.state.validationErrors.confirm_account_number ? "invalid" : "neutral");
11925
+ let $1 = /* @__PURE__ */ user_derived(() => baseForm.state.validationErrors.confirm_account_number || "");
11926
+ TextInput($$anchor4, {
11927
+ get value() {
11928
+ return baseForm.state.formData.confirm_account_number;
11929
+ },
11930
+ label: "Confirm Account Number",
11931
+ placeholder: "Re-enter account number",
11932
+ helpText: "Please confirm your account number to ensure accuracy.",
11933
+ required: true,
11934
+ minlength: 3,
11935
+ id: "confirm_ach_account",
11936
+ get validationSchema() {
11937
+ return fieldSchemas.confirm_account_number;
11938
+ },
11939
+ get validationState() {
11940
+ return get$1($0);
11941
+ },
11942
+ get errorMessage() {
11943
+ return get$1($1);
11944
+ },
11945
+ oninput: (e) => {
11946
+ const newValue = e.target.value;
11947
+ baseForm.state.formData.confirm_account_number = newValue;
11948
+ baseForm.handlers.handleFieldChange("confirm_account_number", newValue);
11949
+ },
11950
+ blockPaste: true
11951
+ });
11952
+ }
11953
+ };
11954
+ if_block(node_16, ($$render) => {
11955
+ if (requireRoutingAndAccountConfirmation()) $$render(consequent_12);
11956
+ });
11957
+ }
11756
11958
  reset(div_24);
11757
11959
  append($$anchor3, fragment_1);
11758
11960
  };
11759
11961
  if_block(node_8, ($$render) => {
11760
- if (baseForm.state.formData.bankAccountType === "ACH") $$render(consequent_10);
11962
+ if (baseForm.state.formData.bankAccountType === "ACH") $$render(consequent_13);
11761
11963
  });
11762
11964
  }
11763
11965
  reset(div_19);
11764
11966
  var div_25 = sibling(div_19, 2);
11765
11967
  var div_26 = child(div_25);
11766
- var node_14 = child(div_26);
11968
+ var node_17 = child(div_26);
11767
11969
  {
11768
- var consequent_11 = ($$anchor3) => {
11769
- var span_11 = root_14$1();
11970
+ var consequent_14 = ($$anchor3) => {
11971
+ var span_11 = root_17$1();
11770
11972
  append($$anchor3, span_11);
11771
11973
  };
11772
- if_block(node_14, ($$render) => {
11773
- if (!baseForm.computed.canSubmit) $$render(consequent_11);
11974
+ if_block(node_17, ($$render) => {
11975
+ if (!baseForm.computed.canSubmit) $$render(consequent_14);
11774
11976
  });
11775
11977
  }
11776
- var node_15 = sibling(node_14, 2);
11978
+ var node_18 = sibling(node_17, 2);
11777
11979
  {
11778
- var consequent_12 = ($$anchor3) => {
11779
- var span_12 = root_15$1();
11980
+ var consequent_15 = ($$anchor3) => {
11981
+ var span_12 = root_18$1();
11780
11982
  append($$anchor3, span_12);
11781
11983
  };
11782
- if_block(node_15, ($$render) => {
11783
- if (baseForm.computed.hasErrors && baseForm.computed.canSubmit) $$render(consequent_12);
11984
+ if_block(node_18, ($$render) => {
11985
+ if (baseForm.computed.hasErrors && baseForm.computed.canSubmit) $$render(consequent_15);
11784
11986
  });
11785
11987
  }
11786
- var node_16 = sibling(node_15, 2);
11988
+ var node_19 = sibling(node_18, 2);
11787
11989
  {
11788
- var consequent_13 = ($$anchor3) => {
11789
- var span_13 = root_16$1();
11990
+ var consequent_16 = ($$anchor3) => {
11991
+ var span_13 = root_19$1();
11790
11992
  var text_13 = child(span_13, true);
11791
11993
  reset(span_13);
11792
11994
  template_effect(() => set_text(text_13, get$1(formError)));
11793
11995
  append($$anchor3, span_13);
11794
11996
  };
11795
- if_block(node_16, ($$render) => {
11796
- if (get$1(formError)) $$render(consequent_13);
11997
+ if_block(node_19, ($$render) => {
11998
+ if (get$1(formError)) $$render(consequent_16);
11797
11999
  });
11798
12000
  }
11799
12001
  reset(div_26);
@@ -11816,7 +12018,7 @@ function AddBankAccount($$anchor, $$props) {
11816
12018
  append($$anchor2, form);
11817
12019
  };
11818
12020
  if_block(node_6, ($$render) => {
11819
- if (get$1(showAddForm) || !get$1(isCheckingBankAccounts) && !get$1(bankAccounts).bank_accounts.length) $$render(consequent_14);
12021
+ if (get$1(showAddForm) || !get$1(isCheckingBankAccounts) && !get$1(bankAccounts).bank_accounts.length) $$render(consequent_17);
11820
12022
  });
11821
12023
  }
11822
12024
  reset(div);
@@ -11864,6 +12066,13 @@ function AddBankAccount($$anchor, $$props) {
11864
12066
  set publicCertificateId($$value = "") {
11865
12067
  publicCertificateId($$value);
11866
12068
  flushSync();
12069
+ },
12070
+ get requireRoutingAndAccountConfirmation() {
12071
+ return requireRoutingAndAccountConfirmation();
12072
+ },
12073
+ set requireRoutingAndAccountConfirmation($$value = false) {
12074
+ requireRoutingAndAccountConfirmation($$value);
12075
+ flushSync();
11867
12076
  }
11868
12077
  });
11869
12078
  }
@@ -11875,7 +12084,8 @@ customElements.define("alviere-add-bank-account", create_custom_element(
11875
12084
  debug: {},
11876
12085
  onsuccess: {},
11877
12086
  publicCertificate: {},
11878
- publicCertificateId: {}
12087
+ publicCertificateId: {},
12088
+ requireRoutingAndAccountConfirmation: {}
11879
12089
  },
11880
12090
  [],
11881
12091
  [],
@@ -11894,7 +12104,7 @@ const $$css$8 = {
11894
12104
  function CheckoutConfirm($$anchor, $$props) {
11895
12105
  push($$props, true);
11896
12106
  append_styles$1($$anchor, $$css$8);
11897
- let jwt = prop($$props, "jwt", 15, ""), accountUuid = prop($$props, "accountUuid", 15, ""), paymentMethodUuid = prop($$props, "paymentMethodUuid", 15, ""), amount = prop($$props, "amount", 15, 0), debug = prop($$props, "debug", 15, true), publicCertificate = prop($$props, "publicCertificate", 15, ""), publicCertificateId = prop($$props, "publicCertificateId", 15, "");
12107
+ let jwt = prop($$props, "jwt", 15, ""), accountUuid = prop($$props, "accountUuid", 15, ""), paymentMethodUuid = prop($$props, "paymentMethodUuid", 15, ""), amount = prop($$props, "amount", 15, ""), debug = prop($$props, "debug", 15, true), publicCertificate = prop($$props, "publicCertificate", 15, ""), publicCertificateId = prop($$props, "publicCertificateId", 15, "");
11898
12108
  let hostElement = /* @__PURE__ */ state(null);
11899
12109
  let isSending = /* @__PURE__ */ state(false);
11900
12110
  let selfAmount = /* @__PURE__ */ state(proxy(amount()));
@@ -11985,7 +12195,7 @@ function CheckoutConfirm($$anchor, $$props) {
11985
12195
  get amount() {
11986
12196
  return amount();
11987
12197
  },
11988
- set amount($$value = 0) {
12198
+ set amount($$value = "") {
11989
12199
  amount($$value);
11990
12200
  flushSync();
11991
12201
  },
@@ -13251,7 +13461,8 @@ function buildStepProps(stepType, config) {
13251
13461
  }
13252
13462
  return {
13253
13463
  ...baseProps,
13254
- accountUuid
13464
+ accountUuid,
13465
+ requireRoutingAndAccountConfirmation: true
13255
13466
  };
13256
13467
  }
13257
13468
  case "CREATE_CONSUMER_ACCOUNT":
@@ -13341,7 +13552,7 @@ function MultiStepFlow($$anchor, $$props) {
13341
13552
  const [$$stores, $$cleanup] = setup_stores();
13342
13553
  const $flowCoreStore = () => store_get(flowCoreStore, "$flowCoreStore", $$stores);
13343
13554
  var _a2, _b;
13344
- let config = prop($$props, "config", 31, () => proxy({ steps: [] })), jwt = prop($$props, "jwt", 15, ""), businessUuid = prop($$props, "businessUuid", 15, ""), debug = prop($$props, "debug", 31, () => proxy("false")), publicCertificate = prop($$props, "publicCertificate", 15, ""), publicCertificateId = prop($$props, "publicCertificateId", 15, ""), amount = prop($$props, "amount", 15, 0), onflowcomplete = prop($$props, "onflowcomplete", 15), onstepcomplete = prop($$props, "onstepcomplete", 15), onsteperror = prop($$props, "onsteperror", 15), onreset = prop($$props, "onreset", 15);
13555
+ let config = prop($$props, "config", 31, () => proxy({ steps: [] })), jwt = prop($$props, "jwt", 15, ""), businessUuid = prop($$props, "businessUuid", 15, ""), debug = prop($$props, "debug", 31, () => proxy("false")), publicCertificate = prop($$props, "publicCertificate", 15, ""), publicCertificateId = prop($$props, "publicCertificateId", 15, ""), amount = prop($$props, "amount", 15, ""), onflowcomplete = prop($$props, "onflowcomplete", 15), onstepcomplete = prop($$props, "onstepcomplete", 15), onsteperror = prop($$props, "onsteperror", 15), onreset = prop($$props, "onreset", 15);
13345
13556
  debug(debug() === "true");
13346
13557
  debug() && uiLogger.warn("MultiStepFlow initialized, debug:", debug());
13347
13558
  let flowElement = /* @__PURE__ */ state(null);
@@ -13415,7 +13626,7 @@ function MultiStepFlow($$anchor, $$props) {
13415
13626
  try {
13416
13627
  const parsedConfig = JSON.parse(attrConfig);
13417
13628
  if (parsedConfig.amount !== void 0) {
13418
- amount(Number(parsedConfig.amount));
13629
+ amount(parsedConfig.amount);
13419
13630
  }
13420
13631
  config(Object.assign(Object.assign(Object.assign({}, config()), parsedConfig), { steps: parsedConfig.steps || config().steps || [] }));
13421
13632
  debug() && uiLogger.info("✅ Config loaded from attribute:", parsedConfig);
@@ -13449,7 +13660,7 @@ function MultiStepFlow($$anchor, $$props) {
13449
13660
  publicCertificateId(value);
13450
13661
  break;
13451
13662
  case "amount":
13452
- amount(Number(value));
13663
+ amount(value);
13453
13664
  break;
13454
13665
  }
13455
13666
  }
@@ -13909,7 +14120,7 @@ function MultiStepFlow($$anchor, $$props) {
13909
14120
  get amount() {
13910
14121
  return amount();
13911
14122
  },
13912
- set amount($$value = 0) {
14123
+ set amount($$value = "") {
13913
14124
  amount($$value);
13914
14125
  flushSync();
13915
14126
  },