> ## Documentation Index
> Fetch the complete documentation index at: https://docs.methodfi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# General Events

export const ParamList = ({items = [], is_child = false}) => {
  return items.map(item => {
    const field_props = {
      id: Math.random().toString(),
      body: item.name,
      name: item.name,
      type: item.type,
      required: item.required
    };
    const enums = item.enums || [];
    const items = item.items || [];
    const has_items = items?.length > 0;
    const has_enums = enums?.length > 0;
    const should_default_open = item.defaultOpen || false;
    const render_child_item = () => {
      const child_props = {
        title: has_enums ? "Possible enum values" : "properties"
      };
      if (should_default_open) child_props.defaultOpen = true;
      const has_inline_enums = has_enums && enums.every(enum_item => typeof enum_item === 'string') && enums.map((enum_item, idx) => {
        const is_last = idx === enums.length - 1;
        const is_2nd_to_last = idx === enums.length - 2;
        return <>
            <code>{enum_item}</code>
            {is_last && ''}
            {is_2nd_to_last && ' or '}
            {!is_last && !is_2nd_to_last && ', '}
          </>;
      });
      const enum_list = has_enums && !has_inline_enums && <Accordion {...child_props}>
          {enums.map((enum_item, index) => <div key={`enum-${index}`}>
              <code>{enum_item.name}</code>
              <br />
              <p>{enum_item.description}</p>
            </div>)}
        </Accordion>;
      const item_list = has_items && <Expandable {...child_props}>
          <ParamList items={items || []} is_child />
        </Expandable>;
      return <>
          <p>
            {item.description}
            {has_inline_enums && [has_inline_enums.length > 1 ? ' One of ' : ' Must be ', ...has_inline_enums]}
          </p>

          {enum_list}
          {item_list}
        </>;
    };
    return is_child ? <ResponseField {...field_props}>{render_child_item()}</ResponseField> : <ParamField {...field_props}>{render_child_item()}</ParamField>;
  });
};

<Warning>
  Method Elements will no longer be supported or maintained beginning December
  31st, 2025. We recommend using [Method Opal](/opal/overview) for all new
  integrations. If you are currently using Elements, please reach out to your
  CSM to discuss your migration options.
</Warning>

## Open

The open event is triggered when an element has successfully launched. No additional data is passed at this time.

```bash theme={null}
methodelements://general
  ?op=open
  &element_type=connect
```

The event payload will have the following form:

<ParamList
  items={[
{
name: 'op',
type: 'string',
description: 'The operation type returned by the element.',
},
{
name: 'element_type',
type: 'string',
description: (
  <>
    The name of the element that triggered the event. Possible values are:{" "}
    <code>connect</code>,{" "}
    <code>auth</code>,{" "}
    <code>account_verify</code>,{" "}
    <code>unknown</code>
  </>
),
}
]}
/>

## Error

The error event is sent for any element that encounters any error while it's active.

```bash theme={null}
methodelements://general
  ?op=error
  &element_type=unknown
  &type=INVALID_REQUEST
  &sub_type=EXPIRED_TOKEN
  &message=The public element token is no longer valid. Element tokens are short lived and can only be used once. Request a new element token and try your request again.
  &code=400
```

The event payload will have the following form:

<ParamList
  items={[
{
name: 'op',
type: 'string',
description: 'The operation type returned by the element.',
},
{
name: 'element_type',
type: 'string',
description: (
  <>
    The name of the element that triggered the event. Possible values are:{" "}
    <code>connect</code>,{" "}
    <code>auth</code>,{" "}
    <code>account_verify</code>,{" "}
    <code>unknown</code>
  </>
),
},
{
name: 'code',
type: 'integer',
description: 'The status code of the response.',
},
{
name: 'type',
type: 'string',
description: 'A broad description of the error',
},
{
name: 'sub_type',
type: 'string',
description: 'The specific error type',
},
{
name: 'message',
type: 'string',
description: 'A human-readable message providing more details about the error',
},
]}
/>

## Exit

The exit event is the last event in the element flow, at this point your app should no longer present the Method Element. Exit is triggered after an error, a user requested exit or a successful element event.

```bash theme={null}
methodelements://general
  ?op=exit
  &element_type=connect
```

The event payload will have the following form:

<ParamList
  items={[
{
name: 'op',
type: 'string',
description: 'The operation type returned by the element.',
},
{
name: 'element_type',
type: 'string',
description: (
  <>
    The name of the element that triggered the event. Possible values are:{" "}
    <code>connect</code>,{" "}
    <code>auth</code>,{" "}
    <code>account_verify</code>,{" "}
    <code>unknown</code>
  </>
),
}
]}
/>
