Skip to content

Commit

Permalink
Merge pull request #5571 from jay-hodgson/SWC-7120
Browse files Browse the repository at this point in the history
SWC-7120: agentId is now agentRegistrationId
  • Loading branch information
jay-hodgson authored Oct 31, 2024
2 parents f92f343 + e72e3a2 commit d73db3c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,23 @@ public class SynapseChatProps extends ReactComponentProps {
public String initialMessage;

@JsNullable
public String agentId;
public String agentRegistrationId;

@JsNullable
public String chatbotName;

@JsOverlay
public static SynapseChatProps create(
String initialMessage,
String agentId,
String agentRegistrationId,
String chatbotName
) {
SynapseChatProps props = new SynapseChatProps();
if (initialMessage != null) {
props.initialMessage = initialMessage;
}
if (agentId != null) {
props.agentId = agentId;
if (agentRegistrationId != null) {
props.agentRegistrationId = agentRegistrationId;
}
if (chatbotName != null) {
props.chatbotName = chatbotName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
public class ChatPlace extends ParameterizedPlace {

public static final String INITIAL_MESSAGE = "initialMessage";
public static final String AGENT_ID = "agentId";
public static final String AGENT_REGISTRATION_ID = "agentRegistrationId";
public static final String CHATBOT_NAME = "chatbotName";

public ChatPlace(String token) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ public void setPlace(ChatPlace place) {
if (initialMessage != null) {
initialMessage = gwt.decodeQueryString(initialMessage);
}
String agentId = place.getParam(ChatPlace.AGENT_ID);
String agentRegistrationId = place.getParam(
ChatPlace.AGENT_REGISTRATION_ID
);
String chatbotName = place.getParam(ChatPlace.CHATBOT_NAME);
if (chatbotName != null) {
chatbotName = gwt.decodeQueryString(chatbotName);
}

view.render(initialMessage, agentId, chatbotName);
view.render(initialMessage, agentRegistrationId, chatbotName);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
import com.google.gwt.user.client.ui.IsWidget;

public interface ChatView extends IsWidget {
void render(String initMessage, String agentId, String chatbotName);
void render(
String initMessage,
String agentRegistrationId,
String chatbotName
);
void scrollToTop();
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.sagebionetworks.web.client.jsinterop.ReactElement;
import org.sagebionetworks.web.client.jsinterop.SRC;
import org.sagebionetworks.web.client.jsinterop.SynapseChatProps;
import org.sagebionetworks.web.client.jsinterop.SynapseHomepageV2Props;
import org.sagebionetworks.web.client.widget.ReactComponent;
import org.sagebionetworks.web.client.widget.header.Header;

Expand All @@ -36,13 +35,17 @@ public ChatViewImpl(
}

@Override
public void render(String initMessage, String agentId, String chatbotName) {
public void render(
String initMessage,
String agentRegistrationId,
String chatbotName
) {
headerWidget.configure();
headerWidget.refresh();
scrollToTop();
SynapseChatProps props = SynapseChatProps.create(
initMessage,
agentId,
agentRegistrationId,
chatbotName
);
ReactElement component = React.createElementWithSynapseContext(
Expand Down

0 comments on commit d73db3c

Please sign in to comment.