@ozura/elements 1.3.1-next.76 → 1.3.1-next.78

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.
@@ -1282,6 +1282,10 @@ class OzVault {
1282
1282
  return false;
1283
1283
  return els.every(el => this.completionState.get(el.frameId) === true);
1284
1284
  }
1285
+ /** The state a field reports before its first change event (and after reset/reload). */
1286
+ makeDefaultFieldState() {
1287
+ return { empty: true, complete: false, valid: false };
1288
+ }
1285
1289
  /**
1286
1290
  * Snapshot of every created field's latest state, keyed by element type.
1287
1291
  * Card and bank fields are combined (their type keys never collide). Useful for
@@ -1293,10 +1297,10 @@ class OzVault {
1293
1297
  var _a, _b;
1294
1298
  const snapshot = {};
1295
1299
  for (const [type, el] of this.elementsByType) {
1296
- snapshot[type] = Object.assign({}, ((_a = this.fieldStates.get(el.frameId)) !== null && _a !== void 0 ? _a : { empty: true, complete: false, valid: false }));
1300
+ snapshot[type] = Object.assign({}, ((_a = this.fieldStates.get(el.frameId)) !== null && _a !== void 0 ? _a : this.makeDefaultFieldState()));
1297
1301
  }
1298
1302
  for (const [type, el] of this.bankElementsByType) {
1299
- snapshot[type] = Object.assign({}, ((_b = this.fieldStates.get(el.frameId)) !== null && _b !== void 0 ? _b : { empty: true, complete: false, valid: false }));
1303
+ snapshot[type] = Object.assign({}, ((_b = this.fieldStates.get(el.frameId)) !== null && _b !== void 0 ? _b : this.makeDefaultFieldState()));
1300
1304
  }
1301
1305
  return snapshot;
1302
1306
  }
@@ -1364,7 +1368,7 @@ class OzVault {
1364
1368
  }, this._debug);
1365
1369
  this.elements.set(el.frameId, el);
1366
1370
  typeMap.set(type, el);
1367
- this.fieldStates.set(el.frameId, { empty: true, complete: false, valid: false });
1371
+ this.fieldStates.set(el.frameId, this.makeDefaultFieldState());
1368
1372
  return el;
1369
1373
  }
1370
1374
  /**
@@ -1666,7 +1670,7 @@ class OzVault {
1666
1670
  }
1667
1671
  // Mirror for field states: every created field returns to its default.
1668
1672
  for (const frameId of this.fieldStates.keys()) {
1669
- this.fieldStates.set(frameId, { empty: true, complete: false, valid: false });
1673
+ this.fieldStates.set(frameId, this.makeDefaultFieldState());
1670
1674
  }
1671
1675
  // NOTE: _tokenizeSuccessCount is intentionally NOT reset.
1672
1676
  // It reflects real server-side wax key budget consumption. Zeroing it
@@ -1880,7 +1884,7 @@ class OzVault {
1880
1884
  // Mirror the completion reset: a reloaded iframe starts empty, so the
1881
1885
  // field state must return to default rather than serving pre-reload data
1882
1886
  // (e.g. a stale card brand) until the next OZ_CHANGE arrives.
1883
- this.fieldStates.set(frameId, { empty: true, complete: false, valid: false });
1887
+ this.fieldStates.set(frameId, this.makeDefaultFieldState());
1884
1888
  if (msg.__ozVersion !== PROTOCOL_VERSION) {
1885
1889
  console.warn(`[OzVault] Protocol version mismatch on element frame "${frameId}" — ` +
1886
1890
  `SDK expects v${PROTOCOL_VERSION}, frame reported v${typeof msg.__ozVersion === 'number' ? msg.__ozVersion : '(none)'}. ` +