@volter/teams 0.1.22 → 0.1.24

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/viewer/viewer.mjs CHANGED
@@ -93,6 +93,8 @@ async function showSession(session, control) {
93
93
  element.hidden = false;
94
94
  const view = mountSessionView(element, {
95
95
  control,
96
+ // The name the Room gives this session's agent (the token's session.agentName), else "Agent".
97
+ agentName: typeof session.agentName === 'string' && session.agentName.trim() ? session.agentName.trim().slice(0, 80) : null,
96
98
  onSend: async (text) => {
97
99
  view.update({ sending: true });
98
100
  try {
@@ -100,8 +102,9 @@ async function showSession(session, control) {
100
102
  try {
101
103
  const answer = await sendBrowserTurn(channel, text);
102
104
  status(answer.code === 0 ? '' : `Not delivered: ${answer.text ?? 'the session did not take the turn'}`);
105
+ return answer.code === 0;
103
106
  } finally { channel.close(); }
104
- } catch (error) { status(`Not delivered: ${error.message}`); } finally { view.update({ sending: false }); }
107
+ } catch (error) { status(`Not delivered: ${error.message}`); return false; } finally { view.update({ sending: false }); }
105
108
  },
106
109
  });
107
110
  const headers = async () => ({ Authorization: `Bearer ${await freshToken()}` });