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

# Welcome

> The Welcome screen serves as the entry point of your onboarding flow, providing users with essential information and instructions before they begin the verification process.

## Quick Implementation

<CodeGroup>
  ```html title="index.html" theme={null}
  <body>
    <div id="form"></div>
  </body>
  ```

  ```javascript title="welcome.js" theme={null}
  const welcome = oneSdk.component("form", {
    name: "WELCOME",
    type: "manual",
  });

  welcome.mount("#form");
  ```
</CodeGroup>

## Event Handling

<AccordionGroup>
  <Accordion title="Available Events">
    | Event Name            | Triggered When                  |
    | --------------------- | ------------------------------- |
    | `form:welcome:loaded` | Screen is successfully mounted  |
    | `form:welcome:ready`  | User clicks the continue button |
    | `form:welcome:failed` | Screen encounters an error      |
  </Accordion>

  <Accordion title="Event Usage Example">
    ```javascript theme={null}
    // Listen for successful screen mount
    welcome.on('form:welcome:loaded', () => {
      console.log('Welcome screen ready');
    });

    // Handle user clicking continue
    welcome.on('form:welcome:ready', () => {
      // Load the next screen (e.g., consent form)
      consent.mount("#form");
    });

    // Handle errors
    welcome.on('form:welcome:failed', (error) => {
      console.error('Welcome screen error:', error);
    });
    ```
  </Accordion>
</AccordionGroup>

## Screen Customization

<Tabs>
  <Tab title="Basic Example">
    ```javascript theme={null}
    const welcome = oneSdk.component('form', {
      name: "WELCOME", // Set the screen name identifier
      type: "manual",  // Set form type to manual input
      title: { // Configure the title section
        label: "Let's Get Started!",
        style: { 'ff-title': { color: '#2563eb' } } // Style title color
      },
      cta: { // Configure the call-to-action button
        label: "Continue",
        style: { 'ff-button': { backgroundColor: '#2563eb' } } // button bg color
      }
    });
    ```
  </Tab>

  <Tab title="Full Customization">
    ```javascript theme={null}
    // Initialize welcome screen component with form type
    const welcome = oneSdk.component('form', {
      // Set screen name and type
      name: "WELCOME",
      type: "manual",
      title: { // Configure title section
        label: "Let's verify your identity",
        style: { 'ff-title': { 
          'font-family': 'Helvetica',
          'font-size': '24px'
        }}
      },
      descriptions: [ // Add descriptive text below title
        {
          label: 'Please have your documents ready',
          style: { 'ff-description': { color: '#4b5563' } }
        }
      ],
      instructions: { // Configure document requirements list
        content: [
          {
            label: "A valid passport OR",
            icon: './assets/bullet-point.svg'  // Bullet point icon for list items
          },
          {
            label: "An Australian driver's license", 
            icon: './assets/bullet-point.svg'
          }
        ],
        logo: { // Add logo to top of the page
          src: './assets/logo.png'
        },
        // Style instructions container
        style: {
          'ff-instructions': {
            'font-family': 'Helvetica',
            'margin-top': '20px'
          },
          'ff-logo': {
            'width': '50px',
          }
        }
      },

      // Configure the call-to-action button
      cta: {
        label: 'Begin Verification',
        style: {
          'ff-button': {
            backgroundColor: '#2563eb',
            padding: '12px 24px'
          }
        }
      }
    });
    ```
  </Tab>
</Tabs>

## Customization Options

<AccordionGroup>
  <Accordion title="Title Configuration">
    ```javascript theme={null}
    title: {
      label: "Custom Title",    // The heading text
      style: {                  // Optional styling
        'ff-title': {
          'font-family': 'Arial',
          'font-size': '24px',
          color: '#000000'
        }
      }
    }
    ```
  </Accordion>

  <Accordion title="Descriptions">
    ```javascript theme={null}
    descriptions: [
      {
        label: 'First description line',
        style: { 'ff-description': {} }
      },
      {
        label: 'Second description line',
        style: { 'ff-description': {} }
      }
    ]
    ```
  </Accordion>

  <Accordion title="Instructions">
    ```javascript theme={null}
    instructions: {
      content: [
        {
          label: "Instruction item 1",
          icon: './assets/icon1.svg'
        },
        {
          label: "Instruction item 2",
          icon: './assets/icon2.svg'
        }
      ],
      style: {
        'ff-instructions': {
          'margin-top': '16px'
        }
      }
    }
    ```
  </Accordion>

  <Accordion title="Button (CTA)">
    ```javascript theme={null}
    cta: {
      label: 'Continue',
      style: {
        'ff-button': {
          backgroundColor: '#2563eb',
          color: '#ffffff',
          borderRadius: '4px',
          padding: '12px 24px'
        }
      }
    }
    ```
  </Accordion>

  <Accordion title="Logo">
    ```javascript theme={null}
    logo: {
      src: './assets/logo.png'
    },
    style: {
      'ff-logo': {
        'width': '50px'
      }
    }
    ```
  </Accordion>
</AccordionGroup>

<Callout icon="star" color="#3DD892" iconType="regular">
  ##### Styling Best Practices

  * Use consistent colors and fonts across your implementation
  * Ensure sufficient contrast for accessibility
  * Maintain padding and spacing for readability
  * Test your customizations across different screen sizes
</Callout>

<Callout icon="bell" color="#FFCA16" iconType="regular">
  All styling should be applied through the appropriate style objects
  (`ff-title`, `ff-description`, `ff-instructions`, `ff-button`). Direct CSS
  manipulation isn't recommended.
</Callout>

## UI Structure

<Frame caption="Welcome Screen Components">
  <img src="https://mintcdn.com/frankieone-f5583b1b/MpEYW70dy4W-choU/images/docs/image-20240904-061341.png?fit=max&auto=format&n=MpEYW70dy4W-choU&q=85&s=a8816fb0d86b780b533e6ab5fce77f38" alt="Welcome Screen Layout" width="1912" height="1528" data-path="images/docs/image-20240904-061341.png" />
</Frame>
