📥Set signal

Using set signal

The set signal is how a partner 1) creates a quote request for a customer, 2) formats the displayed currency and 3) defines the order total value displayed in the element.

For existing XCover partners, this replaces the quote API request, with a similar field structure.

Call signalLayer.push() with set as the value for the signal property, add onSet and data as in the following example:

/* 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: {
    quote_request: {
      currency: "USD", 
      customer_language: "en-US",
      customer_country: "US",
      customer_postcode: "12345",
      customer_region: "NY",
      partner_customer_id: "220974115-8713648",
      partner_subsidiary: "Cover Genius",
      partner_metadata: {
        context_id: 220974115,
        event_id: 357
      },
      request: [
        {
          policy_type: "event_ticket_protection",
          policy_start_date: "{{policy_start_date}}",
          event_datetime: "{{policy_end_date}}",
          event_name: "Lil Baby",
          event_country: "US",
          event_city: "Los Angeles",
          event_address: "1111 S. Figueroa Street",
          event_postcode: "90015",
          event_location: "Crypto.com Arena",
          number_of_tickets: 1,
          tickets: [
            {
              price: 99.5
            }
          ],
          total_event_cost: 99.5
        }
      ]
    },
    currency_config: {
      trailingZeroDisplay: 'stripIfInteger'
    },
    order_total: 99.5
  }
});

The onSet property is a Promise function that will resolve with the quote response if successful, and the data property is the quote request object needed for the request.

In order to get the quote response data for booking request make sure to store the response from the onSet promise.

The resolved value contains the needed fields for Booking request, including the new BrightWrite details object.

See Quote request fields for a simplified reference to the data object

Last updated