Skip to main content

Address Activity

The AddressActivity prompts the user to enter their address information, including street, city, province, country, and zip code.

Inputs

The AddressActivity expects the following properties:

  • Title (string): A heading that indicates the purpose of the address input (e.g., "Enter Address").
  • Description (string): Additional instructions for the user (e.g., "Please provide your complete address.").
  • ButtonCancelText (string): Text displayed on the cancel button (e.g., "Cancel").
  • ButtonOKText (string): Text displayed on the confirmation button (e.g., "Submit").

Example Code

addressActivity: async (data: AddressActivityOptions) => {
console.log("AddressActivity from agent:", data);
await delay(300);

return new Promise<{ action: WorkflowActivityUserAction; result: any }>((resolve) => {
RootNavigation.navigate("WorkflowActivityScreen", {
type: "address",
data,
onConfirm: (result: any) => {
console.log("AddressActivity result:", result);
resolve({
action: WorkflowActivityUserAction.OK,
result,
});
},
onReject: () => {
console.log("AddressActivity result:", "Rejected");
resolve({
action: WorkflowActivityUserAction.Cancel,
result: "",
});
},
});
});
};

Handling and Layout

When the user navigates to the WorkflowActivityScreen for an Address Activity, the layout includes:

  1. Title: A heading that indicates the purpose of the address input (e.g., "Enter Address").

  2. Description: Additional instructions guiding the user’s input.

  3. Address Information Input:

    • Street Address: A text input for the street name and number.
    • City: A text input for the city.
    • Province/State: A text input for the state or province.
    • Country: A text input for the country.
    • Zip Code: A numeric input for the postal code.
  4. Action Buttons:

    • Cancel Button: Allows the user to cancel their input, returning a Cancel action.
    • Confirm Button: Submits the user’s input, returning an OK action with the entered details.

Output

The output for an Address Activity depends on the user's interaction:

  • If the user confirms, the resolved result will look like this:
{
action: WorkflowActivityUserAction.OK,
result: {
streetAddress: "123 Main St",
city: "City",
province: "State",
country: "Country",
zipCode: "12345"
}
}
  • If the user cancels, the resolved result will look like this:
{
action: WorkflowActivityUserAction.Cancel,
result: ""
}
X

Graph View