Skip to main content

Selections

Related links:

Selections can be used to make changes to the deck based on any inputs and choices made in the fieldsets. The most common operations performed here will be turning on/off sections/slides and reordering sections/slides.

Installing

In your hooks folder, create the file selections.js: (usually src/js/hooks/)

export default {
onSave({ sections }) {
return sections;
},
};

In your hooks file, add to your interface: (usually src/js/hooks.js)

import Selections from "./hooks/selections.js";

export default {
selections: Selections,
};

Events

EventDescription
onSave(sections[,options...])Called after a successful preso creation or edit

The return value should be the list of sections passed in, with whatever modifications you made.

warning

While it is possible to alter other aspects of the sections object, we recommend sticking to the modification of sequencing, visibility and adjunct subslides at this stage. Anything beyond this and you will need to test it thoroughly in both the CDK and the App, as support has not been developed beyond sequencing, visibility and adjunct subslides.

Options

Each event is passed an object of values that can be used to determine slide ordering and visibility, as well as the generation and content of adjunct subslides.

export default {
onSave({ sections, data, context, feeds }) {
return sections;
},
};

sections

Contains the current state of sections, slides and subslides in the presentation.

context

Contains the context at the point of the event. This will by default only contain a fields key, containing values from fields.

feeds

Contains the feeds at the point of the event. Each feed is supplied as a separate entry within the feeds object. You can understand the outputs here by viewing the feeds tab when working on hooks.

fields

Shortcut access to the same values as context.fields, which is the values selected by fields.

data

Contains useful general data from preso creation/editing process that you may need for your selections logic: data from the server, user information, preso data, etc.

data.appointment

{
"adjunctSections": [],
"adjunctSlides": [],
"adjunctSubSlides": [],
"appointmentssection_set": [],
"appointmentsslide_set": [],
"attendees": "",
"begin": "2017-07-11T06:05:29.000000Z",
"bookmarks": [],
"contact_set": [
{
"customer": "https://demo-server.salespreso.com/api/customers/1/",
"email": "john.smith@testcustomer.com",
"fullName": "John Smith",
"id": 1,
"name_first": "John",
"name_last": "Smith",
"notes": "Skinny latte with one sugar",
"opportunity_set": [],
"phone": "0400 000 000",
"photo_128": null,
"photo_256": null,
"photo_512": null,
"position": "CEO",
"url": "https://demo-server.salespreso.com/api/contacts/1/",
"user": null
}
],
"created_by_support": false,
"created_date": "2017-07-11T06:06:40.000000Z",
"creation_status": "ready",
"deckversion_set": [],
"display_contacts": "John Smith",
"display_title": "Test customer",
"end": "2017-07-11T07:05:29.000000Z",
"id": 1,
"latest_snapshot": {
"id": 1,
"url": "https://demo-server.salespreso.com/api/snapshots/1/"
},
"latest_tele": {
"url": "https://demo-server.salespreso.com/api/hostedpresos/"
},
"modified_date": "2017-07-11T06:06:40.000000Z",
"opportunity_set": [
{
"appointment_set": [],
"contact_set": [],
"customer": "https://demo-server.salespreso.com/api/customers/1/",
"id": 1,
"is_default": false,
"name": "Happiness opportunity",
"profile": {
"cost": 1200,
"product": "premium"
},
"soft_deleted": false,
"stage_name": "Proposal accepted",
"url": "https://demo-server.salespreso.com/api/opportunities/1/"
}
],
"preset": null,
"sort_date": "2017-07-11T06:06:40.000000Z",
"support_mode": false,
"url": "https://demo-server.salespreso.com/api/appointments/1/",
"user": {
"actions": [],
"email": "jane.doe@example.com",
"first_name": "Jane",
"fullName": "Jane Doe",
"groups": [],
"id": 1,
"is_support": false,
"last_name": "Doe",
"permissions": {
"appointments": {
"canUploadCustomSlides": false,
"isContentAdmin": false,
"livePresenter": false,
"telePresenter": false
},
"presets": {
"canCreateCompanyPresets": false
},
"tempslides": {
"canModifyTemporarySlides": false
}
},
"preferences": {
"app_prefs": {},
"email_signature": "",
"notification_sender": "default",
"timezone": ""
},
"url": "https://demo-server.salespreso.com/api/users/1/",
"username": "jane.doe"
},
"viewtype": "live"
}

data.appointment.preset

If a preset is selected at preso creation, the relevant preset URL will be available - otherwise, data.appointment.preset will be null.

"https://server.livepreso.com/api/presets/2/"
note

Preset data is fetched in the fieldsets hook, giving you detailed information on the selected slides, if the preset is a company or personal preset etc. If you require this information for your selections logic, we recommend saving it to the context using fieldsets.

data.customers

A list of the customers associated with the preso.

[
{
"contact_set": [
"https://demo-server.salespreso.com/api/contacts/1/",
"https://demo-server.salespreso.com/api/contacts/2/"
],
"default_location": null,
"default_opportunity": "https://demo-server.salespreso.com/api/opportunities/0/",
"id": 1,
"logo": "file:///Users/user/Desktop/awesome_logo.jpg",
"logo_128": "file:///Users/user/Desktop/awesome_logo.jpg",
"logo_256": "file:///Users/user/Desktop/awesome_logo.jpg",
"logo_512": "file:///Users/user/Desktop/awesome_logo.jpg",
"logo_original": "file:///Users/user/Desktop/awesome_logo.jpg",
"notes": "Really awesome customer",
"opportunity_set": [
{
"appointment_set": [],
"contact_set": [],
"customer": null,
"id": 0,
"is_default": true,
"name": "__default__",
"profile": null,
"soft_deleted": false,
"stage_name": "",
"url": "https://demo-server.salespreso.com/api/opportunities/0/"
},
{
"appointment_set": [],
"contact_set": [],
"customer": null,
"id": 1,
"is_default": false,
"name": "Happiness opportunity",
"profile": {
"cost": 1200,
"product": "premium"
},
"soft_deleted": false,
"stage_name": "Proposal accepted",
"url": "https://demo-server.salespreso.com/api/opportunities/1/"
},
{
"appointment_set": [],
"contact_set": [],
"customer": null,
"id": 2,
"is_default": false,
"name": "Mediocre opportunity",
"profile": {
"cost": 800,
"product": "entry level"
},
"soft_deleted": false,
"stage_name": "Proposal pending",
"url": "https://demo-server.salespreso.com/api/opportunities/2/"
}
],
"primaryColour": "#0098ff",
"primary_colour": "#0098ff",
"profile": {
"awesomeness": 100,
"product_level": "premium"
},
"soft_deleted": false,
"title": "Test customer",
"url": "https://demo-server.salespreso.com/api/customers/1/"
}
]

data.contacts

[
{
"customer": "https://demo-server.salespreso.com/api/customers/1/",
"email": "john.smith@testcustomer.com",
"fullName": "John Smith",
"id": 1,
"name_first": "John",
"name_last": "Smith",
"notes": "Skinny latte with one sugar",
"opportunity_set": [],
"phone": "0400 000 000",
"photo_128": null,
"photo_256": null,
"photo_512": null,
"position": "CEO",
"url": "https://demo-server.salespreso.com/api/contacts/1/",
"user": null
}
]

data.headers

Contains headers (token and api version) required when interacting with LivePreso API.

data.initialContext

When editing an appointment, this will contain the context of the previous save.

Initial save:

"initialContext": {
"fields": {}
}

"context": {
"fields": {
"selected_country": "australia"
},
"selected_country": "australia"
}

After edit:

"initialContext": {
"fields": {
"selected_country": "australia"
},
"selected_country": "australia"
}

"context": {
"fields": {
"selected_country": "canada"
},
"selected_country": "canada"
}

After another edit:

"initialContext": {
"fields": {
"selected_country": "canada"
},
"selected_country": "canada"
}
>
"context": {
"fields": {
"selected_country": "new zealand"
},
"selected_country": "new zealand"
}

data.isNewAppointment

Boolean that is true if the appointment is new.

data.urls

Contains endpoints that may be necessary to interact with the LivePreso API.

data.user

Details about the owner of the preso.

{
"actions": [],
"email": "jane.doe@example.com",
"first_name": "Jane",
"fullName": "Jane Doe",
"groups": [],
"id": 1,
"is_support": false,
"last_name": "Doe",
"permissions": {
"appointments": {
"canUploadCustomSlides": false,
"isContentAdmin": false,
"livePresenter": false,
"telePresenter": false
},
"presets": {
"canCreateCompanyPresets": false
},
"tempslides": {
"canModifyTemporarySlides": false
}
},
"preferences": {
"app_prefs": {},
"email_signature": "",
"notification_sender": "default",
"timezone": ""
},
"url": "https://demo-server.salespreso.com/api/users/1/",
"username": "jane.doe"
}

Return values

sections

Modified state of sections, slides and subslides to be applied to the presentation.

warning

While it is possible to alter other aspects of the sections object, we recommend sticking to the modification of sequencing and visibility at this stage. Anything beyond this and you will need to test it thoroughly in both the CDK and the App, as support has not been developed beyond sequencing and visibility.

Adjunct subslides

Options

subslide.title (required)

A relic, is not displayed anywhere however it is still required. Select a relevant title for your own reference.

subslide.html_content (required)

Markup contents of your generated subslide.

Required classes:

  • "subslide" - required as a flag to generate a valid subslide
  • "pageN" - required by the deck's subslide.js code
html_content: `
<section class="subslide ${pageN}">
<div class="content-body">${subslideContent}</div>
</section>`;
info

Subslide ID is added automatically by the LivePreso app.

warning

JS cannot be included in this markup. Any JS required for the slide, must be added to the parent slide's <script> tag as usual.

subslide.slide (required)

The url of the target slide. Is supplied as the variable url of the parent slide.

slide: targetSlide.url;

subslide.enabled (required)

Must be set to true.

enabled: true;

subslide.visible

Toggles adjunct subslide on/off.

visible: true;

subslide.sequence (required)

Starts from 0, determines the sequence the adjunct subslides appear in the slide.

sequence: 0;