# Implementation

## Copyright Widget SDK Integration Guide

This guide provides detailed instructions for integrating the widget SDK into your project.

***

### 1. Install the SDK

Add the SDK files to your project by including the following `<script>` and `<link>` tags in your HTML file:

```html
<link rel="stylesheet" href="https://dhsieq44txzc4.cloudfront.net/dev/sdk-widget.css">
<script src="https://dhsieq44txzc4.cloudfront.net/dev/sdk-widget.iife.js"></script>
```

***

### 2. Initialize the SDK

Initialize the widget by calling the `initBlinderWidget` function after the page loads:

```html
<script>
  window.addEventListener('load', () => {
    window.initAuthorshipWidget({
      public_key: 'your-public-key',
      additional_open_id: 'blider_widget_button',
      ui_config: {
        floating_button_bg: '#3498db',
        floating_button_text_color: '#ffffff',
        floating_button_text: 'Protect Doc',
      },
    });
  });
</script>
```

***

### Widget Configuration

The widget configuration object passed to `initBlinderWidget` allows you to customize the widget's behavior and appearance.

#### WidgetConfig Interface

| Property             | Type       | Required | Description                                                      |
| -------------------- | ---------- | -------- | ---------------------------------------------------------------- |
| `public_key`         | `string`   | Yes      | Your public API key for accessing the widget services.           |
| `additional_open_id` | `string`   | No       | The ID of an HTML element that triggers the widget when clicked. |
| `the_mode`           | `string`   | No       | An optional mode for the widget's behavior.                      |
| `ui_config`          | `UiConfig` | No       | An object to customize the widget's appearance.                  |

#### UiConfig Interface

The `UiConfig` object lets you style the widget's floating button.

<table><thead><tr><th width="240">Property</th><th>Type</th><th>Default Value</th><th>Description</th></tr></thead><tbody><tr><td><code>floating_button_bg</code></td><td><code>string</code></td><td><code>undefined</code></td><td>Background color of the floating button. Accepts valid CSS color values.</td></tr><tr><td><code>floating_button_text_color</code></td><td><code>string</code></td><td><code>undefined</code></td><td>Text color of the floating button. Accepts valid CSS color values.</td></tr><tr><td><code>floating_button_text</code></td><td><code>string</code></td><td><code>undefined</code></td><td>Text displayed inside the floating button.</td></tr></tbody></table>

***

### Example Integration

Here’s a complete example of integrating the widget into an HTML file:

```html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="https://dhsieq44txzc4.cloudfront.net/dev/sdk-widget.css">
    <script src="https://dhsieq44txzc4.cloudfront.net/dev/sdk-widget.iife.js"></script>
  </head>
  <body>
    <div id="blider_widget_button">Click Me!</div>

    <script>
      window.addEventListener('load', () => {
        window.initAuthorshipWidget({
          public_key: 'your-public-key',
          additional_open_id: 'blider_widget_button',
          ui_config: {
            floating_button_bg: '#3498db',
            floating_button_text_color: '#ffffff',
            floating_button_text: 'Protect Doc',
          },
        });
      });
    </script>
  </body>
</html>
```

***

### Notes

* Replace `your-public-key` with the API key provided for your account.
* Use `additional_open_id` to specify a trigger element ID for the widget.
* Customize the `UiConfig` to match your design requirements.
