Parameters
- success function
Success callback function. Only used for ‘beforeBooking’ hook
- error function
Error callback function. Only used for ‘beforeBooking’ hook
- data object
Event and booking data object
Form loaded
The hook ‘ViewContent’ is triggered after the form has loaded
window.ameliaActions = {
ViewContent: function (success = null, error = null, data) {
console.log('ViewContent HOOK')
console.log(data)
console.log('------------')
}
}
Event selected
The hook ‘SelectEvent’ is triggered when the event is selected/changed in the form
window.ameliaActions = {
SelectEvent: function (success = null, error = null, data) {
console.log('SelectEvent HOOK')
console.log(data)
console.log('------------')
}
}
Event Tickets
The hook ‘EventTickets’ is triggered when event tickets are displayed on the event form
window.ameliaActions = {
EventTickets: function (success = null, error = null, data) {
console.log('EventTickets HOOK')
console.log(data)
console.log('------------')
let tickets = data.event.customTickets
// ===========================
// SORT OPTIONS (choose one)
// ===========================
// --- Sort by NAME ASC ---
// tickets = tickets.sort((a, b) => a.name.localeCompare(b.name, undefined, {sensitivity: 'base'}))
// --- Sort by NAME DESC ---
// tickets = tickets.sort((a, b) => b.name.localeCompare(a.name, undefined, {sensitivity: 'base'}))
// --- Sort by ID ASC ---
// tickets = tickets.sort((a, b) => a.id - b.id)
// --- Sort by ID DESC ---
// tickets = tickets.sort((a, b) => b.id - a.id)
// --- Sort by PRICE ASC ---
// tickets = tickets.sort((a, b) => a.price - b.price)
// --- Sort by PRICE DESC ---
// tickets = tickets.sort((a, b) => b.price - a.price)
data.setTickets(tickets)
}
}
Info step loaded
The hook ‘InitInfoStep’ is triggered when the customer information step is loaded
window.ameliaActions = {
InitInfoStep: function (success = null, error = null, data) {
console.log('InitInfoStep HOOK')
console.log(data)
console.log('------------')
}
}
Custom validation on info step
The hook ‘customValidation’ is triggered when the customer information step is validated, before the payment step loads
window.ameliaActions = {
customValidation: function (success = null, error = null, data) {
console.log('customValidation HOOK')
console.log('------------')
console.log(data)
const customValidator = (rule, value, callback) => {
if (value.includes('SOME_REGEX')) {
callback(new Error())
} else {
callback()
}
}
// this example is for email input field
data.rules.email.push({message: 'CUSTOM MESSAGE', validator: customValidator})
// this example is for a custom field
var customFieldId = 2
data.rules['cf' + customFieldId].push({message: 'CUSTOM MESSAGE', validator: customValidator})
}
}
Payment step loaded
The hook ‘InitiateCheckout’ is triggered when the payment step is loaded
window.ameliaActions = {
InitiateCheckout: function (success = null, error = null, data) {
console.log('InitiateCheckout HOOK')
console.log(data)
console.log('------------')
}
}
Confirm button clicked
The hook ‘beforeBooking’ is triggered the “Confirm” button is clicked but before the booking is completed. This hook currently doesn’t work for Mollie and WooCommerce payments
window.ameliaActions = {
beforeBooking: function (success = null, error = null, data) {
console.log('Before booking is created HOOK')
console.log(data)
console.log('------------')
// call success callback for the booking to be completed
success()
}
}
On-site booking completed
The hook ‘Schedule’ is triggered after an on-site booking is completed, before the congratulations step is loaded
window.ameliaActions = {
Schedule: function (success = null, error = null, data) {
console.log('Schedule HOOK')
console.log(data)
console.log('------------')
}
}
Online booking completed
The hook ‘Purchased’ is triggered after an online booking is completed, before the congratulations step is loaded
window.ameliaActions = {
Purchased: function (success = null, error = null, data) {
console.log('Purchased HOOK')
console.log(data)
console.log('------------')
}
}