@xpert-ai/chatkit-ui5 0.11.2 → 0.12.2

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
@@ -47,7 +47,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
47
47
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
48
48
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
49
49
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
50
- var _a, _b, _setTrainingOptOut_dec, _hideHistory_dec, _showHistory_dec, _sendCustomAction_dec, _shareThread_dec, _setThreadId_dec, _setRuntimeCapabilities_dec, _setComposerValue_dec, _sendUserMessage_dec, _fetchUpdates_dec, _focusComposer_dec, _c, _opts, _frameUrl, _frame, _wrapper, _windowDrag, _launcherCloseButton, _launcherOpen, _chatMinimizedToPet, _framePetOptionsOverride, _petClosedByContextMenu, _shadow, _petOverlay, _resolveLoaded, _loaded, _channelId, _messenger, _ChatKitElementBase_instances, emitAndThrow_fn, setOptionsDataAttributes_fn, getDisplayMode_fn, getConfiguredPetOptions_fn, mergeConfiguredPetPositionDefaults_fn, getOverlayPetOptions_fn, resolvePetAssetUrl_fn, resolveOverlayPetOptions_fn, getFrameOptions_fn, setLauncherOpen_fn, setChatMinimizedToPet_fn, syncPetOverlayOptions_fn, handlePetActivate_fn, handlePetClose_fn, handlePetReply_fn, handlePetThreadSummaryActivate_fn, _handleLauncherClose, getFrameUrl_fn, setFrameUrl_fn, consumeFrameUrl_fn, _handleFrameLoad, _initialized, maybeInit_fn, _init;
50
+ var _a, _b, _setTrainingOptOut_dec, _hideHistory_dec, _showHistory_dec, _sendCustomAction_dec, _shareThread_dec, _focusMessage_dec, _setThreadId_dec, _setRuntimeCapabilities_dec, _setComposerValue_dec, _sendUserMessage_dec, _fetchUpdates_dec, _focusComposer_dec, _c, _opts, _frameUrl, _frame, _wrapper, _windowDrag, _launcherCloseButton, _launcherOpen, _chatMinimizedToPet, _framePetOptionsOverride, _petClosedByContextMenu, _shadow, _petOverlay, _resolveLoaded, _loaded, _channelId, _messenger, _ChatKitElementBase_instances, emitAndThrow_fn, setOptionsDataAttributes_fn, getDisplayMode_fn, getConfiguredPetOptions_fn, mergeConfiguredPetPositionDefaults_fn, getOverlayPetOptions_fn, resolvePetAssetUrl_fn, resolveOverlayPetOptions_fn, getFrameOptions_fn, setLauncherOpen_fn, setChatMinimizedToPet_fn, syncPetOverlayOptions_fn, handlePetActivate_fn, handlePetClose_fn, handlePetReply_fn, handlePetThreadSummaryActivate_fn, _handleLauncherClose, getFrameUrl_fn, setFrameUrl_fn, consumeFrameUrl_fn, _handleFrameLoad, _initialized, maybeInit_fn, _init;
51
51
  import { normalizePetOptions, DEFAULT_PET_STORAGE_KEY, resolvePetCharacter, normalizeBoundsPadding, getPinnedPetPosition, clampPetPosition } from "@xpert-ai/chatkit-types";
52
52
  class EventEmitter {
53
53
  constructor() {
@@ -731,6 +731,7 @@ const BASE_CAPABILITY_ALLOWLIST = [
731
731
  "command.setRuntimeCapabilities",
732
732
  "command.setThreadId",
733
733
  "command.focusComposer",
734
+ "command.focusMessage",
734
735
  "command.fetchUpdates",
735
736
  "command.sendCustomAction",
736
737
  "command.showHistory",
@@ -2480,7 +2481,7 @@ function requireCommandCapability(value, context) {
2480
2481
  return value.apply(this, args);
2481
2482
  };
2482
2483
  }
2483
- class ChatKitElementBase extends (_c = HTMLElement, _focusComposer_dec = [requireCommandCapability], _fetchUpdates_dec = [requireCommandCapability], _sendUserMessage_dec = [requireCommandCapability], _setComposerValue_dec = [requireCommandCapability], _setRuntimeCapabilities_dec = [requireCommandCapability], _setThreadId_dec = [requireCommandCapability], _shareThread_dec = [requireCommandCapability], _sendCustomAction_dec = [requireCommandCapability], _showHistory_dec = [requireCommandCapability], _hideHistory_dec = [requireCommandCapability], _setTrainingOptOut_dec = [requireCommandCapability], _c) {
2484
+ class ChatKitElementBase extends (_c = HTMLElement, _focusComposer_dec = [requireCommandCapability], _fetchUpdates_dec = [requireCommandCapability], _sendUserMessage_dec = [requireCommandCapability], _setComposerValue_dec = [requireCommandCapability], _setRuntimeCapabilities_dec = [requireCommandCapability], _setThreadId_dec = [requireCommandCapability], _focusMessage_dec = [requireCommandCapability], _shareThread_dec = [requireCommandCapability], _sendCustomAction_dec = [requireCommandCapability], _showHistory_dec = [requireCommandCapability], _hideHistory_dec = [requireCommandCapability], _setTrainingOptOut_dec = [requireCommandCapability], _c) {
2484
2485
  constructor({ profile }) {
2485
2486
  super();
2486
2487
  __runInitializers(_init, 5, this);
@@ -2605,7 +2606,8 @@ class ChatKitElementBase extends (_c = HTMLElement, _focusComposer_dec = [requir
2605
2606
  payload,
2606
2607
  hostType,
2607
2608
  hostId,
2608
- viewKey
2609
+ viewKey,
2610
+ userActivated
2609
2611
  }) => {
2610
2612
  var _a2, _b2;
2611
2613
  const onClientCommand = (_b2 = (_a2 = __privateGet(this, _opts)) == null ? void 0 : _a2.workbench) == null ? void 0 : _b2.onClientCommand;
@@ -2617,7 +2619,9 @@ class ChatKitElementBase extends (_c = HTMLElement, _focusComposer_dec = [requir
2617
2619
  payload,
2618
2620
  hostType,
2619
2621
  hostId,
2620
- viewKey
2622
+ viewKey,
2623
+ // This flag comes from the trusted ChatKit shell, never from the plugin payload.
2624
+ ...userActivated !== void 0 ? { userActivated } : {}
2621
2625
  });
2622
2626
  },
2623
2627
  onWidgetAction: async ({
@@ -3019,6 +3023,11 @@ class ChatKitElementBase extends (_c = HTMLElement, _focusComposer_dec = [requir
3019
3023
  await __privateGet(this, _loaded);
3020
3024
  await ((_a2 = __privateGet(this, _messenger)) == null ? void 0 : _a2.commands.setThreadId({ threadId }));
3021
3025
  }
3026
+ async focusMessage(request) {
3027
+ await __privateGet(this, _loaded);
3028
+ if (!__privateGet(this, _messenger)) return { success: false, code: "not_ready" };
3029
+ return __privateGet(this, _messenger).commands.focusMessage(request);
3030
+ }
3022
3031
  async shareThread() {
3023
3032
  var _a2;
3024
3033
  await __privateGet(this, _loaded);
@@ -3287,6 +3296,7 @@ __decorateElement(_init, 1, "sendUserMessage", _sendUserMessage_dec, ChatKitElem
3287
3296
  __decorateElement(_init, 1, "setComposerValue", _setComposerValue_dec, ChatKitElementBase);
3288
3297
  __decorateElement(_init, 1, "setRuntimeCapabilities", _setRuntimeCapabilities_dec, ChatKitElementBase);
3289
3298
  __decorateElement(_init, 1, "setThreadId", _setThreadId_dec, ChatKitElementBase);
3299
+ __decorateElement(_init, 1, "focusMessage", _focusMessage_dec, ChatKitElementBase);
3290
3300
  __decorateElement(_init, 1, "shareThread", _shareThread_dec, ChatKitElementBase);
3291
3301
  __decorateElement(_init, 1, "sendCustomAction", _sendCustomAction_dec, ChatKitElementBase);
3292
3302
  __decorateElement(_init, 1, "showHistory", _showHistory_dec, ChatKitElementBase);