# Client side

## Script Major Version bump

Migrating from quotes to offers endpoint introduce breaking changes into the XCE scripts. This means the changes must be introduced through a bump to the current major version of your script.

The major version change helps us to mitigate introducing any breaking change that would affect your existing XCE integration.

If you are still not getting the benefits of using Offers, please request your CSE an XCE script migration from quotes to offer.

## Signals

### `set` signal

The `set` signal will **now create an offer instead of quotes**. To do so you must pass in your offer request body in the property `offer_request` instead of `quote_request` in `data` as in the following example:

<pre class="language-javascript"><code class="lang-javascript">/* Traveling xce-protection-offer example */
window.signalLayer.push({
  signal: 'set',
  element: 'xce-protection-offer',
  onSet: async (req) => {
    try {
      const response = await req
      if (!response) throw new Error('Empty response');
      // your disable checkout logic here..
    } catch (err) {
      console.error('XCE Request Error: ', err);
    }
  },
  data: {
<strong>    offer_request: {
</strong><strong>      schema: "demo-partner-travel:1",
</strong><strong>      customer: {
</strong><strong>        currency: "USD", 
</strong><strong>        language: "en-US",
</strong><strong>        country: "US",
</strong><strong>        postcode: "12345",
</strong><strong>        region: "NY",
</strong><strong>      },
</strong><strong>      partner: {
</strong><strong>        customer_id: "220974115-8713648",
</strong><strong>        subsidiary: "Cover Genius",
</strong><strong>        metadata: {
</strong><strong>          context_id: 220974115,
</strong><strong>          event_id: 357
</strong><strong>        },
</strong><strong>      },
</strong><strong>      context: {
</strong><strong>        policy_start_date: "{{policy_start_date}}",
</strong><strong>        event_datetime: "{{policy_end_date}}",
</strong><strong>        event_name: "Lil Baby",
</strong><strong>        event_country: "US",
</strong><strong>        event_city: "Los Angeles",
</strong><strong>        event_address: "1111 S. Figueroa Street",
</strong><strong>        event_postcode: "90015",
</strong><strong>        event_location: "Crypto.com Arena",
</strong><strong>        number_of_tickets: 1,
</strong><strong>        tickets: [
</strong><strong>          {
</strong><strong>            price: 99.5
</strong><strong>          }
</strong><strong>        ],
</strong><strong>        total_event_cost: 99.5
</strong><strong>      }
</strong>    },
    currency_config: {
      trailingZeroDisplay: 'stripIfInteger'
    },
    order_total: 99.5
  }
});
</code></pre>

### `listen` signal

#### **`selectedOption`**

The `selectedOption` property continues being a string value returned in the callback arguments object that will match the radio input value attribute that the customer selected, but the input **value** attribute changed.

Now, for option 'YES' the radio input value and the `selectedOption` property **equals the product** `id` not the policy type.

#### **`selectedPolicies` is now `selectedProducts`**

The `selectedPolicies` is now `selectedProducts` property.

It continues being an array of objects but the objects schema changed from a policy metadata to a product metadata.

XCover Product type metadata:

```javascript
{
    id: string;
    type: string;
    start_date: string;
    end_date: string;
    policy_version_id: string;
    price: float;
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://partner-docs.covergenius.com/xcover-elements/migration-from-quotes-to-offers/client-side.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
