@memberjunction/realtime-widget 6.2.1 → 6.3.0-edge.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.
@@ -0,0 +1,7 @@
1
+ import {
2
+ UserViewEngine
3
+ } from "./chunk-PYHZMJHO.js";
4
+ import "./chunk-3SGPPDAR.js";
5
+ export {
6
+ UserViewEngine
7
+ };
@@ -8454,6 +8454,38 @@ function GetGlobalObjectStore() {
8454
8454
  function IsPlainObject(value) {
8455
8455
  return value !== null && typeof value === "object" && !Array.isArray(value);
8456
8456
  }
8457
+ function SafeDeepMerge(...layers) {
8458
+ const result = {};
8459
+ for (const layer of layers) {
8460
+ if (IsPlainObject(layer)) {
8461
+ safeMergeInto(result, layer);
8462
+ }
8463
+ }
8464
+ return result;
8465
+ }
8466
+ function safeMergeInto(target, source) {
8467
+ for (const key of Object.keys(source)) {
8468
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
8469
+ continue;
8470
+ }
8471
+ const incoming = source[key];
8472
+ if (incoming === void 0) {
8473
+ continue;
8474
+ }
8475
+ const existing = target[key];
8476
+ if (IsPlainObject(existing) && IsPlainObject(incoming)) {
8477
+ safeMergeInto(existing, incoming);
8478
+ } else if (IsPlainObject(incoming)) {
8479
+ const copy = {};
8480
+ safeMergeInto(copy, incoming);
8481
+ target[key] = copy;
8482
+ } else if (Array.isArray(incoming)) {
8483
+ target[key] = incoming.slice();
8484
+ } else {
8485
+ target[key] = incoming;
8486
+ }
8487
+ }
8488
+ }
8457
8489
  function CleanAndParseJSON(inputString, logErrors = false) {
8458
8490
  if (!inputString) {
8459
8491
  return null;
@@ -8907,19 +8939,22 @@ var BaseSingleton = class _BaseSingleton {
8907
8939
  };
8908
8940
 
8909
8941
  // ../../MJGlobal/dist/Global.js
8910
- var MJGlobal = class extends BaseSingleton {
8942
+ var MJGlobal = class _MJGlobal extends BaseSingleton {
8911
8943
  constructor() {
8912
8944
  super(...arguments);
8913
8945
  this._eventsSubject = new Subject();
8914
8946
  this._eventsReplaySubject = new ReplaySubject(100, 3e4);
8915
8947
  this._events$ = this._eventsSubject.asObservable();
8916
- this._eventsReplay$ = this._eventsReplaySubject.asObservable();
8948
+ this._eventsReplay$ = this.createReplayAndLiveObservable();
8917
8949
  this._components = [];
8918
8950
  this._classFactory = new ClassFactory();
8919
8951
  this._properties = [];
8920
8952
  this._processUUID = null;
8921
8953
  this._objectCache = new ObjectCache();
8922
8954
  }
8955
+ static {
8956
+ this.NonReplayableEventCodes = /* @__PURE__ */ new Set(["BaseEntityEvent"]);
8957
+ }
8923
8958
  /**
8924
8959
  * Returns the global instance of the MJGlobal class. This is a singleton class, so there is only one instance of it in the application. Do not directly create new instances of MJGlobal, always use this method to get the instance.
8925
8960
  */
@@ -8955,7 +8990,34 @@ var MJGlobal = class extends BaseSingleton {
8955
8990
  this._eventsSubject = new Subject();
8956
8991
  this._eventsReplaySubject = new ReplaySubject(100, 3e4);
8957
8992
  this._events$ = this._eventsSubject.asObservable();
8958
- this._eventsReplay$ = this._eventsReplaySubject.asObservable();
8993
+ this._eventsReplay$ = this.createReplayAndLiveObservable();
8994
+ }
8995
+ /**
8996
+ * Builds an observable that synchronously drains the current {@link _eventsReplaySubject}
8997
+ * buffer on subscribe (matching `ReplaySubject` semantics) and then delegates live delivery
8998
+ * to {@link _eventsSubject}. This ensures active `GetEventListener(true)` subscribers still
8999
+ * receive live {@link NonReplayableEventCodes} events without retaining those events in the
9000
+ * replay buffer.
9001
+ */
9002
+ createReplayAndLiveObservable() {
9003
+ const replaySubject = this._eventsReplaySubject;
9004
+ const liveSubject = this._eventsSubject;
9005
+ return new Observable((subscriber) => {
9006
+ const buffered = [];
9007
+ const replaySub = replaySubject.subscribe({
9008
+ next: (event) => buffered.push(event),
9009
+ error: (err) => subscriber.error(err)
9010
+ });
9011
+ replaySub.unsubscribe();
9012
+ if (subscriber.closed) {
9013
+ return void 0;
9014
+ }
9015
+ const liveSub = liveSubject.subscribe(subscriber);
9016
+ for (let i = 0; i < buffered.length && !subscriber.closed; i++) {
9017
+ subscriber.next(buffered[i]);
9018
+ }
9019
+ return liveSub;
9020
+ });
8959
9021
  }
8960
9022
  /**
8961
9023
  * Use this method to raise an event to all component who are listening for the event.
@@ -8963,7 +9025,9 @@ var MJGlobal = class extends BaseSingleton {
8963
9025
  */
8964
9026
  RaiseEvent(event) {
8965
9027
  this._eventsSubject.next(event);
8966
- this._eventsReplaySubject.next(event);
9028
+ if (!event.eventCode || !_MJGlobal.NonReplayableEventCodes.has(event.eventCode)) {
9029
+ this._eventsReplaySubject.next(event);
9030
+ }
8967
9031
  }
8968
9032
  /**
8969
9033
  * Use this method to get an observable that will fire when an event is raised.
@@ -17188,6 +17252,7 @@ export {
17188
17252
  v4_default,
17189
17253
  GetGlobalObjectStore,
17190
17254
  IsPlainObject,
17255
+ SafeDeepMerge,
17191
17256
  CleanAndParseJSON,
17192
17257
  SafeJSONParse,
17193
17258
  GeneratePluralName,