call-center-status

stablev1.0.0

Retrieve Selectra's call centers status, schedules.

Overview

Retrieve the current service status (open/close) and time schedule of Selectra's call centers using the Dialga API.

Usage

Dependencies

To get the call-center-status utility working, include the dependencies in your project in the following order:

  1. npm
  2. Javascript
"design-system": "git+ssh://git@github.com/Selectra-Dev/design-system.git"
import getCallCenterStatus from 'design-system/src/js/00-utilities/call-center-status.js';

Basic code

getCallCenterStatus is an async function. It will return a promise with either a status object.

const options = {
  groupIDs: [ 10, 12 ],
  operation: 'schedule',
};

// Asynchronous usage.

getCallCenterStatus( options )
  .then( status => {
    // Further process/use the return value, when it's available.
  })

// Synchronous usage.

const status = await getCallCenterStatus( options );

// Example response object.
// ( These values are made up for this example )
//
// {
//    10: {
//      0: { open: '07:50', close: '21:30' },
//      state: 'open',
//    },
//    12: {
//      0: { open: '09:00', close: '22:00' },
//      state: 'open',
//    },
// }

Function call

The function call takes an options object as single argument.

getCallCenterStatus( options );
Property Type Default Required Description
options.groupIDs Array [] No An array of call center numerical IDs we want to retrieve the status of.
If no IDs are supplied using this property, the function will return the status of all call centers.
Check this relational list of the Dialga's group IDs.
options.operation String 'schedule' No One of 'status' or 'schedule'.
The return value will depend on which operation mode is used.

Return value

The return object will contain one or more objects, depending on how many call center IDs you pass to the call. The property name for each of these objects will be the call center ID to which it belongs.

For the 'status' operation, each one of these properties will have a boolean value assigned, indicating if the call center is currently open (true) or closed (false).

For the 'schedule' operation, each one of these properties will have an object assigned as its value, these objects are formed as follows.

Property Type Description
0 Object This property correspond to the current day schedule of a call center that has uninterrupted service, or to the morning schedule if the call center has a split schedule.
It has two properties, open and close.
Each one has a string value indicating the opening/closing time in the 24h format HH:MM.
1 Object Has the same format as the 0 property. But it's only present if the call center has a split schedule, containing the times for the second half of the day.
status String 'open' if the call center is open at the time this function is called, 'closed' otherwise.