Advanced

We offer some enhanced functionality for those who require more advanced features.

BidJS Events

Some websites require functionality beyond that which BidJS requires.

In order to help support this, we expose many of the events which happen within BidJS, so that third party developers can react to them.

Listening to Events

We provide a callback option within the BidJS configuration. This can be overwritten with your own functionality

window.bidjs = {
config: {
...
},
modules: {
...
},
options: {
callback: function(event) {
// you can have any of your own logic here
}
}
}

Event format

We have a standardised format for all events, so you can write your own functionality to handle multiple types of event.

Your callback method will always be called with an event in the following format

{
"action": "BIDJS_EVENT_NAME",
"data": {
// any related information (if any) will be inserted here
}
}

Events

There are numerous events that are broadcast.

General Functionality

  • BIDJS_INITIALISED / BIDJS_MODULES_INITIALISED - BidJS Scripts first begin running
  • BIDJS_LOADED / BIDJS_MODULES_LOADED - BidJS has finished loading
  • BIDJS_NAVIGATED / BIDJS_MODULES_NAVIGATED - The user has changed page on BidJS
  • BIDJS_AUTHENTICATED / BIDJS_UNAUTHENTICATED - The user login state has changed

Auction Functionality (currently Webcast only)

  • AUCTION_SUBSCRIBED - The user is receiving live updates for an auction
  • BID_PLACED / BID_CANCELLED / BID_REINSTATED - Informs of a change in the bid, or a new bid for a listing
  • REGISTRANT_UPDATED - Registration state has changed for a user
  • SALE_ADDED / SALE_WITHDRAWN - A listing has been added or removed on the Auction
  • SALE_COMPLETED / SALE_STARTED - An item has been completed (sold, passed etc), or been started (re-listed, re-offered etc)
  • SALE_INCREMENT_SET / SALE_NEXT_BID_SET - The increment or next bid value of a listing has changed
  • SALE_UNIT_BIDDING_TYPE_SET - Advises of a change in how the units for a listing are being priced
  • WEBCAST_FEED_SET - The webcast video / audio feed has changed properties
  • WEBCAST_INPLAY_SET - The webcast inplay lot has changed
  • WEBCAST_INPLAY_STATE_SET - The webcast has been paused / resumed
  • WEBCAST_INPLAY_WARNING - The sale warning for inplay item has updated
  • WEBCAST_MESSAGE_SET - A webcast message has changed

Custom OAuth Authentication

We support the usage of other OAuth servers, in the case of you having your own existing authentication.

Requirements

  • You have your OAuth server set-up
  • The OAuth server authenticates the user onto the same domain as the website on which BidJS is located
  • The Authentication token is published as either a cookie or localStorage item onto the client browser
  • If using a cookie, the cookie domain and path should allow access on the domain on which BidJS is located
  • The OAuth server has an endpoint to return a user based on the token (commonly referred to as a /user endpoint)

User endpoint requirements

The user endpoint should return the following information, in order to ensure your users don't need to supply this upon logging in.

  • Email address
  • Forename
  • Surname
  • Address Line 1
  • City
  • Postcode
  • Country
  • Tel (Daytime)

Additionally, we accept the following information, which will be inserted into the user account if supplied

  • username
  • externalRef
  • Company Name
  • Address Line 2
  • County

Setup

  1. Contact support@bidlogix.net, supplying us with the information above. We will then update this on your account.
  2. Add the OAuth options to your BidJS configuration, as below
window.bidjs = {
config: {
...
},
modules: {
...
},
options: {
oAuth: {
isTokenLocalStorage: true,
loginUrl: 'https://www.yourdomain.com?redirect_to=<<REDIRECT>>',
logoutUrl: 'https://www.yourdomain.com/logout',
tokenName: 'yourAuthTokenName'
}
}
}

if isTokenLocalStorage is false, then we assume your OAuth credentials are stored as a cookie.

The tokenName is either the name of the cookie, or the localStorage item.

Modules

Disabling Modules

BidJS is currently in the process of moving to "Modules". This means we give you the ability to utilise the parts of the application that you need, and to turn off parts which you don't. This results in a more tailored, better user experience for your customers.

As covered in the installation guide, the current modules definition is as follows:

window.bidjs = {
config: {
...
},
modules: {
auctionDetails: '#!/auctionDetails/%AUCTION_ID%',
auctionsArchived: true,
invoices: true,
lotDetails: '#!/itemDetails/%AUCTION_ID%/%ITEM_ID%',
mySales: true,
webcast: true,
login: true
register: true
},
options: {
...
}
}

In most cases, it's safe to leave this definition as-is. However, if you know you will never use (for example) the invoicing part of our application, it's safe to disable this. This will prevent other parts of the application sending users to the invoicing module.

window.bidjs = {
config: {
...
},
modules: {
auctionDetails: '#!/auctionDetails/%AUCTION_ID%',
auctionsArchived: true,
invoices: false,
lotDetails: '#!/itemDetails/%AUCTION_ID%/%ITEM_ID%',
mySales: true,
webcast: true,
login: true
register: true
},
options: {
...
}
}

Default Module

You are also able to set a module as the default module to load on a page, instead of the home.

This might be useful if you wanted to display one module on another completely independent page on your site.

Standalone Module

The below example would show the auctionsArchived module only, on this page. By adjusting the URLs of the auctionDetails to point to the page on the site where the other modules are, it ensures that you're still able to link through to view the auction.

window.bidjs = {
config: {
...
},
modules: {
auctionDetails: '//mysite.com/myauctionpage/#!/auctionDetails/%AUCTION_ID%',
auctionsArchived: true,
invoices: false,
lotDetails: false,
mySales: false,
webcast: false,
login: false
register: false
},
options: {
defaultModule: 'auctionsArchived'
}
}

Empty Module

There may also be cases where you wish to have the BidJS installation running, but hidden. This may be desirable if you still want to show the navigation statuses on other pages of your site without auctions.

To do this, you can disable all the modules, and set the defaultModule

window.bidjs = {
config: {
...
},
modules: {
auctionDetails: false,
auctionsArchived: false,
invoices: false,
lotDetails: false,
mySales: false,
webcast: false,
login: false
register: false
},
options: {
defaultModule: 'empty'
}
}