> For the complete documentation index, see [llms.txt](https://docs.facephi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.facephi.com/docs.facephi-en/sdks/sdk-mobile/ios-sdk/modulos/terminos-y-condiciones-de-uso.md).

# Terms and conditions

This component requires iOS 13 or later.

## Introduction

Acceptance of the terms and conditions of use is handled through the ***TermsConditions Component***.

This component manages the capture of the user's response to terms and conditions of use. Its main processes are:

* Launching an HTML text viewer.
* Capturing the user's response.

The [Simplified Launch](https://docs.facephi.com/docs.facephi-en/sdks/sdk-mobile/ios-sdk/inicializacion/lanzamiento-simplificado.md) section details the steps required for the basic SDK Integration. This section provides the specific information needed to launch this component.

***

## Dependencies

To avoid conflicts and compatibility issues, if you want to install the component in a project containing an older version of Facephi libraries, you must completely remove them before installing the **SDK Mobile**.

### CocoaPods

* The required dependencies that must be installed beforehand (by adding them to the project's `Podfile` ) are:

```swift
pod 'FPHISDKMainComponent', '~> $VERSION'
```

* To install the terms and conditions of use component, add the following dependency to the project's `Podfile` :

```swift
pod 'FPHISDKTermsConditionsComponent', '~> $VERSION'
```

### Swift Package Manager (SPM)

* The required dependencies that must be installed beforehand are:

```swift
//HTTPS
https://github.com/facephi-clienters/SDK-SdkPackage-SPM.git
//SSH
git@github.com:facephi-clienters/SDK-SdkPackage-SPM.git
```

* To install the terms and conditions of use component, include it in the project's modules:

```swift
//HTTPS
https://github.com/facephi-clienters/SDK-TermsConditionsComponent-SPM.git
//SSH
git@github.com:facephi-clienters/SDK-TermsConditionsComponent-SPM.git
```

***

## Available controllers

| **Controller**            | **Description**                                |
| ------------------------- | ---------------------------------------------- |
| TermsConditionsController | Main controller for capturing terms acceptance |

***

## Simplified Launch

Once the SDK has been initialized and a new operation has been created, the component can be launched using its main controller.

```swift
let controller = TermsConditionsController(
    data: termsConditionsConfigurationData,
    output: { sdkResult in
        // Do whatever with the result
        ...
    }
)
SDKController.shared.launch(controller: controller)
```

***

## Basic configuration

To launch the component, you must create a `TermsConditionsConfigurationData`, which defines the controller's configuration.

The required basic configuration is as follows:

```swift
TermsConditionsConfigurationData(
    termsConditions: "...html..."
)
```

The available parameters are:

* `termsConditions`: HTML text containing the terms and conditions of use to be displayed to the user.
* `extractionTimeout`: maximum time allowed to complete the process.
* `orientation`: SDK screen orientation.

***

## Receiving the result

The launch returns the information in `SdkResult`format. It can be used to distinguish between a successful and an unsuccessful launch.

### Receiving errors

For errors, the common `ErrorType`.

List of errors:

* `TER_APPLICATION_CONTEXT_ERROR`: The required application context is null.
* `TER_CANCEL_BY_USER`: The user canceled the process.
* `TER_CANCEL_LAUNCH`: The SDK has been canceled entirely.
* `TER_COMPONENT_LICENSE_ERROR`: The component license is invalid.
* `TER_EMPTY_LICENSE`: The license string is empty.
* `TER_FLOW_ERROR`: Error in the flow process.
* `TER_INITIALIZATION_ERROR`: Initialization error.
* `TER_MANAGER_NOT_INITIALIZED`: The managers are null.
* `TER_NO_DATA_ERROR`: The input data is null.
* `TER_OPERATION_NOT_CREATED`: There is no operation in progress.
* `TER_PERMISSION_DENIED`: The user denied the permissions.
* `TER_TIMEOUT`: Timeout in the process.
* `TER_UNKNOWN_ERROR`: Unknown error.

### Receiving the successful result - data

In the `SdkResult.Success - data`, we will have the `TermsConditionsResult`.

`TermsConditionsResult` does not expose any additional fields. If the user accepts the terms, the component returns a successful result; if they reject them, it returns an error `OTHER("USER_REJECTED_TERMS_AND_CONDITIONS")`.

***

## Advanced information

### Advanced component configuration

To launch the component, you must create a `TermsConditionsConfigurationData`.

The fields of this class are detailed below:

* `termsConditions`: terms and conditions text to display to the user.
* `extractionTimeout`: sets the maximum time allowed for capture.
* `orientation`: SDK interface orientation.

***

## Component customization

In addition to the changes that can be made at the SDK level, this component lets you customize its interface using the iOS wrapper's theming system.

### Theme

Visual customization is defined by `ThemeTermsConditionsProtocol`.

The themes available in the wrapper are:

* `ThemeTermsConditions`: the component's default theme.
* `ThemeTermsConditionsFlow`: theme applied when external customization is resolved.

The component's color and dimension resources are resolved using the SDK customization system keys:

* `sdkPrimaryColor`
* `sdkSecondaryColor`
* `sdkBackgroundPrimaryColor`
* `sdkErrorColor`
* `sdkSuccessColor`
* `sdkNeutralColor`
* `sdkAccentColor`
* `sdkTitleTextColor`
* `sdkBodyTextColor`
* `sdkTopIconsColor`
* `sdkButtonTextColor`

The available configurable dimension is:

* `radiusCorner`

***
