@memberjunction/realtime-widget 6.2.1 → 6.2.3

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  UserViewEngine
3
- } from "./chunk-DAGQZKVY.js";
3
+ } from "./chunk-4FX3KCZD.js";
4
4
  import "./chunk-DIDGGUK7.js";
5
5
  export {
6
6
  UserViewEngine
@@ -61,7 +61,7 @@ import {
61
61
  ValidateUserViewProperties,
62
62
  WellKnownUserSource,
63
63
  getGraphQLTypeNameBase
64
- } from "./chunk-DAGQZKVY.js";
64
+ } from "./chunk-4FX3KCZD.js";
65
65
  import {
66
66
  BehaviorSubject,
67
67
  CleanAndParseJSON,
@@ -143211,7 +143211,7 @@ var ViewInfo = class {
143211
143211
  * @async
143212
143212
  */
143213
143213
  static async GetViewEntity(viewId, contextUser) {
143214
- const { UserViewEngine } = await import("./UserViewEngine-ELH6XPEL.js");
143214
+ const { UserViewEngine } = await import("./UserViewEngine-UL2SXGFT.js");
143215
143215
  await UserViewEngine.Instance.Config(false, contextUser);
143216
143216
  const view = UserViewEngine.Instance.GetViewById(viewId);
143217
143217
  if (view) {
@@ -143230,7 +143230,7 @@ var ViewInfo = class {
143230
143230
  * @async
143231
143231
  */
143232
143232
  static async GetViewEntityByName(viewName, contextUser) {
143233
- const { UserViewEngine } = await import("./UserViewEngine-ELH6XPEL.js");
143233
+ const { UserViewEngine } = await import("./UserViewEngine-UL2SXGFT.js");
143234
143234
  await UserViewEngine.Instance.Config(false, contextUser);
143235
143235
  const view = UserViewEngine.Instance.GetViewByName(viewName);
143236
143236
  if (view) {
@@ -163309,7 +163309,7 @@ var Fe = class {
163309
163309
  return LogError(`Error checking for a duplicate entry: ${t}`), { Status: "Failed", ErrorMessage: t || "Unknown error occurred", Candidates: [] };
163310
163310
  }
163311
163311
  };
163312
- var H = "6.2.1";
163312
+ var H = "6.2.3";
163313
163313
  var F = "default";
163314
163314
  var _e = class {
163315
163315
  static {
@@ -37301,10 +37301,14 @@ var BaseEngine = class _BaseEngine extends BaseSingleton {
37301
37301
  const configsToLoad = this.CheckPermissionsOrSkipAll(this._metadataConfigs, contextUser);
37302
37302
  const entityConfigsToLoad = configsToLoad.filter((c) => c.Type === "entity");
37303
37303
  const datasetConfigsToLoad = configsToLoad.filter((c) => c.Type === "dataset");
37304
- await Promise.all([
37305
- ...datasetConfigsToLoad.map((c) => this.LoadSingleDatasetConfig(c, contextUser, bypassCache)),
37306
- this.LoadMultipleEntityConfigs(entityConfigsToLoad, contextUser, bypassCache)
37307
- ]);
37304
+ try {
37305
+ await Promise.all([
37306
+ ...datasetConfigsToLoad.map((c) => this.LoadSingleDatasetConfig(c, contextUser, bypassCache)),
37307
+ this.LoadMultipleEntityConfigs(entityConfigsToLoad, contextUser, bypassCache)
37308
+ ]);
37309
+ } finally {
37310
+ this.reconcileExpirationTimers();
37311
+ }
37308
37312
  this.RegisterCacheChangeCallbacks(entityConfigs);
37309
37313
  }
37310
37314
  static {
@@ -38621,10 +38625,17 @@ var BaseEngine = class _BaseEngine extends BaseSingleton {
38621
38625
  * path performs, and enforces in this direction the same type-homogeneity invariant
38622
38626
  * {@link canUseImmediateMutation} enforces for the sibling mutation path.
38623
38627
  *
38628
+ * Server caches hold encrypted fields as ciphertext at rest, and only the provider's cache-read
38629
+ * path decrypts them. A payload carrying ciphertext is therefore never assigned: the reload it
38630
+ * falls back to reads the same slot through that path and gets the decrypted values.
38631
+ *
38624
38632
  * @returns the rows to assign, or null when they cannot be safely materialized (caller should
38625
38633
  * fall back to a full reload).
38626
38634
  */
38627
38635
  async materializeCacheEventRows(config, rows) {
38636
+ if (this.cacheEventRowsCarryCiphertext(config, rows)) {
38637
+ return null;
38638
+ }
38628
38639
  const effectiveResultType = config.ResultType || this.EngineDefaultResultType;
38629
38640
  if (effectiveResultType === "simple") {
38630
38641
  return rows;
@@ -38634,6 +38645,21 @@ var BaseEngine = class _BaseEngine extends BaseSingleton {
38634
38645
  }
38635
38646
  return TransformSimpleObjectToEntityObject(this.ProviderToUse, config.EntityName, rows, this._contextUser);
38636
38647
  }
38648
+ /**
38649
+ * True when any payload row holds ciphertext (`$ENC$…`) on one of the entity's encrypted
38650
+ * fields. Applying such a row would hand consumers the stored ciphertext as the field's value.
38651
+ */
38652
+ cacheEventRowsCarryCiphertext(config, rows) {
38653
+ const entityInfo = config.EntityName ? this.ProviderToUse?.EntityByName?.(config.EntityName) : void 0;
38654
+ const encryptedFields = entityInfo?.EncryptedFields ?? [];
38655
+ if (encryptedFields.length === 0) {
38656
+ return false;
38657
+ }
38658
+ return rows.some((row) => encryptedFields.some((field) => {
38659
+ const value = row[field.Name];
38660
+ return typeof value === "string" && IsValueEncrypted(value);
38661
+ }));
38662
+ }
38637
38663
  /**
38638
38664
  * Sets an expiration timer for a metadata property.
38639
38665
  * @param propertyName - The name of the property
@@ -38643,9 +38669,58 @@ var BaseEngine = class _BaseEngine extends BaseSingleton {
38643
38669
  if (this._expirationTimers.has(propertyName)) {
38644
38670
  clearTimeout(this._expirationTimers.get(propertyName));
38645
38671
  }
38646
- const timer = setTimeout(() => this.RefreshItem(propertyName), expiration);
38672
+ const timer = setTimeout(() => this.runExpirationRefresh(propertyName, expiration, timer), expiration);
38673
+ if (typeof timer === "object" && timer !== null && "unref" in timer && typeof timer.unref === "function") {
38674
+ timer.unref();
38675
+ }
38647
38676
  this._expirationTimers.set(propertyName, timer);
38648
38677
  }
38678
+ /**
38679
+ * Makes the running timers match the loaded configs: a config with an Expiration and no timer
38680
+ * gets one, and a timer whose config no longer has an Expiration is stopped.
38681
+ *
38682
+ * A successful load arms its own timer from {@link HandleSingleViewResult}, but a failed one does
38683
+ * not — without this a failed first load would leave that property with no refresh until restart.
38684
+ * And a reload that drops the Expiration (an interval set to 0) must stop the timer, which
38685
+ * {@link runExpirationRefresh} would otherwise keep re-arming at the old interval.
38686
+ */
38687
+ reconcileExpirationTimers() {
38688
+ for (const c of this._metadataConfigs) {
38689
+ if (c.Expiration && !this._expirationTimers.has(c.PropertyName)) {
38690
+ this.setExpirationTimer(c.PropertyName, c.Expiration);
38691
+ } else if (!c.Expiration && this._expirationTimers.has(c.PropertyName)) {
38692
+ clearTimeout(this._expirationTimers.get(c.PropertyName));
38693
+ this._expirationTimers.delete(c.PropertyName);
38694
+ }
38695
+ }
38696
+ }
38697
+ /**
38698
+ * Runs one timed refresh and keeps the timer alive. A successful load re-arms the timer from
38699
+ * {@link HandleSingleViewResult}; a failed one (an unsuccessful result, or a thrown connection
38700
+ * error) does not, so without this the refresh would stop for good after a single failed read
38701
+ * and the property would keep its last rows indefinitely.
38702
+ * The re-arm uses the config as it is now, so a reload that dropped the Expiration while this
38703
+ * tick was running stops the timer instead of keeping it at the old interval.
38704
+ * @param timer - The handle that fired; if the map no longer holds it, a successful load, a
38705
+ * {@link reconcileExpirationTimers} or a {@link RemoveDynamicConfig} already
38706
+ * decided what happens next.
38707
+ */
38708
+ async runExpirationRefresh(propertyName, expiration, timer) {
38709
+ try {
38710
+ await this.RefreshItem(propertyName);
38711
+ } catch (e) {
38712
+ LogError(`${this.constructor.name}: timed refresh of ${propertyName} failed \u2014 ${e.message}. Retrying in ${expiration} ms.`);
38713
+ }
38714
+ if (this._expirationTimers.get(propertyName) !== timer) {
38715
+ return;
38716
+ }
38717
+ const config = this._metadataConfigs.find((c) => c.PropertyName === propertyName) || this._dynamicConfigs.get(propertyName);
38718
+ if (config?.Expiration) {
38719
+ this.setExpirationTimer(propertyName, config.Expiration);
38720
+ } else {
38721
+ this._expirationTimers.delete(propertyName);
38722
+ }
38723
+ }
38649
38724
  /**
38650
38725
  * Adds a dynamic metadata configuration at runtime.
38651
38726
  * @param config - The metadata configuration to add
@@ -38686,7 +38761,7 @@ var BaseEngine = class _BaseEngine extends BaseSingleton {
38686
38761
  config,
38687
38762
  this._contextUser,
38688
38763
  /*bypassCache*/
38689
- false,
38764
+ !!config.Expiration,
38690
38765
  /*suppressEmit*/
38691
38766
  true
38692
38767
  );
@@ -11,7 +11,7 @@ import {
11
11
  S,
12
12
  TemplateEngineBase,
13
13
  coerceFailedExecuteAgentResult
14
- } from "./chunk-JV7Z4WOH.js";
14
+ } from "./chunk-3JRAADG4.js";
15
15
  import {
16
16
  BaseEngine,
17
17
  BaseEntity,
@@ -22,7 +22,7 @@ import {
22
22
  PermissionConstrainedError,
23
23
  RegisterForStartup,
24
24
  RunView
25
- } from "./chunk-DAGQZKVY.js";
25
+ } from "./chunk-4FX3KCZD.js";
26
26
  import {
27
27
  ParseModelConfiguration,
28
28
  ParseVendorConfiguration,
@@ -28,9 +28,9 @@ import {
28
28
  SessionCardStatusChip,
29
29
  SessionCardTitle,
30
30
  SessionsObserver
31
- } from "./chunk-C4EYUJ6D.js";
32
- import "./chunk-JV7Z4WOH.js";
33
- import "./chunk-DAGQZKVY.js";
31
+ } from "./chunk-Y6T7IIQH.js";
32
+ import "./chunk-3JRAADG4.js";
33
+ import "./chunk-4FX3KCZD.js";
34
34
  import "./chunk-JOGHPRST.js";
35
35
  import "./chunk-DIDGGUK7.js";
36
36
  export {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  S
3
- } from "./chunk-JV7Z4WOH.js";
4
- import "./chunk-DAGQZKVY.js";
3
+ } from "./chunk-3JRAADG4.js";
4
+ import "./chunk-4FX3KCZD.js";
5
5
  import "./chunk-JOGHPRST.js";
6
6
  import "./chunk-DIDGGUK7.js";
7
7
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  S
3
- } from "./chunk-JV7Z4WOH.js";
4
- import "./chunk-DAGQZKVY.js";
3
+ } from "./chunk-3JRAADG4.js";
4
+ import "./chunk-4FX3KCZD.js";
5
5
  import {
6
6
  ParseRealtimeClientTransport
7
7
  } from "./chunk-JOGHPRST.js";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  ConversationsRuntime
3
- } from "./chunk-C4EYUJ6D.js";
3
+ } from "./chunk-Y6T7IIQH.js";
4
4
  import {
5
5
  Bt,
6
6
  ConversationEngine,
7
7
  Ot,
8
8
  agentFailureMessage
9
- } from "./chunk-JV7Z4WOH.js";
9
+ } from "./chunk-3JRAADG4.js";
10
10
  import {
11
11
  RunView
12
- } from "./chunk-DAGQZKVY.js";
12
+ } from "./chunk-4FX3KCZD.js";
13
13
  import "./chunk-JOGHPRST.js";
14
14
  import "./chunk-DIDGGUK7.js";
15
15
 
@@ -960,14 +960,14 @@ function defaultSessionClient(apiUrl, widgetKey) {
960
960
  return new WidgetSessionClient(apiUrl, widgetKey);
961
961
  }
962
962
  async function defaultTransport(apiUrl) {
963
- const { RuntimeWidgetTransport } = await import("./chunks/runtime-widget-transport-DZR7VBV7.js");
963
+ const { RuntimeWidgetTransport } = await import("./chunks/runtime-widget-transport-IBHMD3WB.js");
964
964
  return new RuntimeWidgetTransport(apiUrl);
965
965
  }
966
966
  async function defaultVoiceController(session) {
967
967
  const [{ RealtimeVoiceController }, { createGuestVoiceMint }, { createGuestToolRelay }] = await Promise.all([
968
968
  import("./chunks/realtime-voice-controller-76SVXCXJ.js"),
969
- import("./chunks/guest-voice-mint-WM3ENO4I.js"),
970
- import("./chunks/guest-tool-relay-OEPZIKL6.js")
969
+ import("./chunks/guest-voice-mint-MTBRH4NR.js"),
970
+ import("./chunks/guest-tool-relay-NO7U6FOC.js")
971
971
  ]);
972
972
  return new RealtimeVoiceController(
973
973
  createGuestVoiceMint(session),
@@ -998,7 +998,7 @@ function resolveMountTarget(target) {
998
998
  return document.body;
999
999
  }
1000
1000
  function registerNotificationAdapter(element) {
1001
- void import("./chunks/dist-WHGVGNVU.js").then(({ ConversationsRuntime }) => {
1001
+ void import("./chunks/dist-JSNBUU62.js").then(({ ConversationsRuntime }) => {
1002
1002
  ConversationsRuntime.Instance.UseNotificationAdapter({
1003
1003
  Notify: (level, message) => {
1004
1004
  if (level === "error" || level === "warning") {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@memberjunction/realtime-widget",
3
3
  "type": "module",
4
- "version": "6.2.1",
4
+ "version": "6.2.3",
5
5
  "description": "MemberJunction: Droppable, embeddable public customer-support widget (text + voice). A shadow-DOM web component that reuses ConversationsRuntime + the realtime client stack against MJAPI with a guest session JWT. No MJ login required.",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -11,14 +11,14 @@
11
11
  "author": "MemberJunction.com",
12
12
  "license": "BUSL-1.1",
13
13
  "dependencies": {
14
- "@memberjunction/global": "6.2.1",
15
- "@memberjunction/core": "6.2.1",
16
- "@memberjunction/core-entities": "6.2.1",
17
- "@memberjunction/ai": "6.2.1",
18
- "@memberjunction/ai-core-plus": "6.2.1",
19
- "@memberjunction/ai-realtime-client": "6.2.1",
20
- "@memberjunction/conversations-runtime": "6.2.1",
21
- "@memberjunction/graphql-dataprovider": "6.2.1"
14
+ "@memberjunction/global": "6.2.3",
15
+ "@memberjunction/core": "6.2.3",
16
+ "@memberjunction/core-entities": "6.2.3",
17
+ "@memberjunction/ai": "6.2.3",
18
+ "@memberjunction/ai-core-plus": "6.2.3",
19
+ "@memberjunction/ai-realtime-client": "6.2.3",
20
+ "@memberjunction/conversations-runtime": "6.2.3",
21
+ "@memberjunction/graphql-dataprovider": "6.2.3"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/node": "24.10.11",