@skippr/live-agent-sdk 0.66.0 → 0.67.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/README.md CHANGED
@@ -217,7 +217,6 @@ Self-contained widget component. Renders a floating button that opens a sidebar
217
217
  | `startSessionLabel` | `string` | `'Talk to Skippr'` | Label for the start-session button (only shown when `agentId` is pinned) |
218
218
  | `autoFocusChat` | `boolean` | `true` | Whether the chat input auto-focuses when opened |
219
219
  | `captureMode` | `'screenshare' \| 'auto'` | `'screenshare'` | How the agent sees the page — `'screenshare'` prompts the user to share, `'auto'` uses DOM capture (no permission prompt) |
220
- | `agentControls` | `{ highlight?: boolean; actions?: boolean }` | — | Opt-in agent capabilities — `highlight` (element highlighting) and `actions` (on-screen actions). **Requires `captureMode: 'auto'`** and only applies when `agentId` is pinned. In picker mode, controls are configured per module in the dashboard. |
221
220
  | `animateAgentCursor` | `boolean` | `false` | Animate the agent's cursor as it points to elements on the page. Primarily configured per agent in the dashboard; this prop is a fallback when the agent has no preference set. |
222
221
 
223
222
  ### `useLiveAgent()`
@@ -298,7 +297,7 @@ Available on `window.Skippr` when using the script tag bundle.
298
297
 
299
298
  | Method | Description |
300
299
  |--------|-------------|
301
- | `Skippr.initialize(config)` | Mount the widget. Accepts `appKey` (required), `agentId` (optional — omit for picker), `getUserToken`, `userToken`, `position`, `variant`, `minimizable`, `captureMode`, `agentControls`. |
300
+ | `Skippr.initialize(config)` | Mount the widget. Accepts `appKey` (required), `agentId` (optional — omit for picker), `getUserToken`, `userToken`, `position`, `variant`, `minimizable`, `captureMode`. |
302
301
  | `Skippr.logout()` | Revoke the current session server-side, clear stored auth tokens, and show the login form (direct auth mode) |
303
302
  | `Skippr.destroy()` | Remove the widget from the page and clear auth tokens |
304
303
 
@@ -3063,9 +3063,8 @@ function MinimizedBubble({
3063
3063
  popsDown,
3064
3064
  adoptionGoals,
3065
3065
  startAdoptionSession,
3066
- hasModuleSelector,
3067
3066
  isAuthenticated,
3068
- availableModules,
3067
+ displayModules,
3069
3068
  hasResolvedModules,
3070
3069
  selectModule,
3071
3070
  expandPanel,
@@ -3091,15 +3090,15 @@ function MinimizedBubble({
3091
3090
  };
3092
3091
  }, []);
3093
3092
  const { wasDraggedRef } = useLauncherDrag(hoverContainerRef, commitLauncherDrop);
3094
- const actionableModules = hasModuleSelector ? availableModules.filter((module) => {
3093
+ const actionableModules = displayModules.filter((module) => {
3095
3094
  const state = getModuleSessionState(module.currentSession, module.mode);
3096
3095
  return state !== "completed" && state !== "expired";
3097
- }) : [];
3096
+ });
3098
3097
  const alwaysOnModule = actionableModules.find((module) => module.mode === AGENT_MODE.AlwaysOn);
3099
3098
  const pillCandidates = actionableModules.filter((module) => module.mode !== AGENT_MODE.AlwaysOn);
3100
3099
  const onboardingModule = pillCandidates.find((module) => module.type === "onboarding");
3101
3100
  const modulePills = onboardingModule ? [onboardingModule] : pillCandidates.slice(0, MAX_MODULE_PILLS).reverse();
3102
- const goalsEligible = adoptionGoals.length > 0 && !onboardingModule && (!hasModuleSelector || hasResolvedModules);
3101
+ const goalsEligible = adoptionGoals.length > 0 && !onboardingModule && hasResolvedModules;
3103
3102
  useEffect12(() => {
3104
3103
  if (!goalsEligible)
3105
3104
  return;
@@ -3128,13 +3127,12 @@ function MinimizedBubble({
3128
3127
  const launchDefaultSession = () => {
3129
3128
  if (wasDraggedRef.current || isStarting)
3130
3129
  return;
3131
- if (!hasModuleSelector || !isAuthenticated) {
3130
+ const target = isAuthenticated ? alwaysOnModule ?? onboardingModule ?? pillCandidates[0] : null;
3131
+ if (target) {
3132
+ selectModule(target.id);
3133
+ } else {
3132
3134
  expandPanel();
3133
- return;
3134
3135
  }
3135
- const target = alwaysOnModule ?? onboardingModule ?? pillCandidates[0];
3136
- if (target)
3137
- selectModule(target.id);
3138
3136
  };
3139
3137
  return /* @__PURE__ */ jsxs4("div", {
3140
3138
  ref: hoverContainerRef,
@@ -5453,10 +5451,7 @@ function LiveAgent(props) {
5453
5451
  const auth = useAuth({ appKey });
5454
5452
  const usesHostAuth = !!getUserToken || !!userToken || !!authTokenProp;
5455
5453
  const effectiveAuthToken = usesHostAuth ? authTokenProp : auth.authToken ?? undefined;
5456
- const hasModuleSelector = !hostAgentId;
5457
5454
  const [activeModule, setActiveModule] = useState17(null);
5458
- const agentId = hasModuleSelector ? activeModule?.id ?? null : hostAgentId;
5459
- const agentControls = hasModuleSelector ? activeModule?.controls : hostAgentControls;
5460
5455
  const minimizeOnSessionStart = useCallback14(() => {
5461
5456
  if (minimizable) {
5462
5457
  setIsMinimized(true);
@@ -5468,14 +5463,12 @@ function LiveAgent(props) {
5468
5463
  setIsPanelOpen(true);
5469
5464
  }, []);
5470
5465
  const minimizeOnSessionDisconnect = useCallback14(() => {
5471
- if (hasModuleSelector) {
5472
- setActiveModule(null);
5473
- }
5466
+ setActiveModule(null);
5474
5467
  if (minimizable) {
5475
5468
  setIsMinimized(true);
5476
5469
  setIsPanelOpen(false);
5477
5470
  }
5478
- }, [minimizable, hasModuleSelector]);
5471
+ }, [minimizable]);
5479
5472
  const {
5480
5473
  connection,
5481
5474
  shouldConnect,
@@ -5546,16 +5539,13 @@ function LiveAgent(props) {
5546
5539
  bearerToken,
5547
5540
  authedFetch
5548
5541
  });
5549
- const activeModuleForAgent = useMemo6(() => {
5550
- if (activeModule)
5551
- return activeModule;
5552
- if (!hostAgentId)
5553
- return null;
5554
- return availableModules.find((m) => m.id === hostAgentId) ?? null;
5555
- }, [activeModule, hostAgentId, availableModules]);
5556
- const agentMode = activeModuleForAgent?.mode ?? null;
5557
- const shouldAnimateCursor = activeModuleForAgent?.uiPreferences?.animateCursor ?? animateAgentCursor;
5558
- const resumableSession = useMemo6(() => getResumableSession(activeModuleForAgent), [activeModuleForAgent]);
5542
+ const displayModules = useMemo6(() => hostAgentId ? availableModules.filter((m) => m.id === hostAgentId) : availableModules, [hostAgentId, availableModules]);
5543
+ const operatingModule = activeModule ?? (hostAgentId ? displayModules[0] ?? null : null);
5544
+ const agentId = operatingModule?.id ?? null;
5545
+ const agentControls = operatingModule?.controls ?? hostAgentControls;
5546
+ const agentMode = operatingModule?.mode ?? null;
5547
+ const shouldAnimateCursor = operatingModule?.uiPreferences?.animateCursor ?? animateAgentCursor;
5548
+ const resumableSession = useMemo6(() => getResumableSession(operatingModule), [operatingModule]);
5559
5549
  const resumeSession = useCallback14(async () => {
5560
5550
  if (!resumableSession)
5561
5551
  return;
@@ -5708,8 +5698,7 @@ function LiveAgent(props) {
5708
5698
  agentId,
5709
5699
  agentMode,
5710
5700
  agentControls,
5711
- hasModuleSelector,
5712
- availableModules,
5701
+ displayModules,
5713
5702
  activeModule,
5714
5703
  isLoadingModules,
5715
5704
  modulesError,
@@ -5769,8 +5758,7 @@ function LiveAgent(props) {
5769
5758
  agentId,
5770
5759
  agentMode,
5771
5760
  agentControls,
5772
- hasModuleSelector,
5773
- availableModules,
5761
+ displayModules,
5774
5762
  activeModule,
5775
5763
  isLoadingModules,
5776
5764
  modulesError,