cello.boot(options)

Initializes Cello Referral Component in your product. Returns a promise that is resolved once the whole initialization process is finished or rejected if the boot command failed.
window.cello = window.cello || { cmd: [] };

window.cello.cmd.push(async (cello) => {
  try {
    await cello.boot(options);
  } catch (error) {
    // Handle the error appropriately
  }
});
The solution above is designed so that you don’t have to wait for the library to finish loading before you call the command - follow it and use the window.cello object to avoid that particular race condition. For any other commands, or when you are sure that the command is called after the library has finished loading, you can opt to use the regular command syntax:
await window.Cello("boot", options);

Accepts

options
object
required
The initialization options object:

Example

window.cello = window.cello || { cmd: [] };

window.cello.cmd.push(async (cello) => {
  try {
    const options = {
      productId: "REPLACE_WITH_PRODUCT_ID",
      token: "REPLACE_WITH_TOKEN",
      language: "en",
      productUserDetails: {
        firstName: "Bob",
        lastName: "Bobsky",
        fullName: "Bob B Bobsky",
        email: "bob@gmail.com",
      },
    };

    await cello.boot(options);
    // Call other Cello commands, if necessary
  } catch (error) {
    console.error("Failed to boot cello:", error);
  }
});

changeLanguage(language)

Changes the Referral Component language at runtime without re-initializing it.
window.Cello("changeLanguage", "de");

Accepts

language
string
required
The language string in ISO 639-1

close()

Closes Referral Component.
window.Cello.close();

getActiveUcc()

Returns active ucc and invite link for the currently logged-in user.
const { ucc, link } = await window.Cello("getActiveUcc");

Returns

activeUcc
object
The active ucc object:

getCampaignConfig()

Returns campaign config values for the currently logged-in user.
const campaignConfig = await window.Cello("getCampaignConfig");

Returns

campaignConfig
object
The campaign config object:

getLabels()

Returns select labels used in our Referral Component.
const labels = await window.Cello("getLabels");

Returns

labels
object
The labels object:

hide()

Hides the Cello button or bookmark that launches the Referral Component.
window.Cello("hide");

open(destination)

Opens Referral Component.
window.Cello("open", destination);

Accepts

destination
string
Optional destination string to open Referral Component on a specific tab or page:
  • "rewards" - open Referral Component on the rewards tab
  • "edit-payments" - open Referral Component on the payment details page

show()

Shows the Cello button or bookmark that launches the Referral Component.
window.Cello("show");

showAnnouncement(announcement)

Triggers an announcement.
window.Cello("showAnnouncement", announcement);

Accepts

announcement
string
required

Example

Example below triggers a default welcome announcement:
const announcement = { type: "welcome-announcement-1" };
window.Cello("showAnnouncement", announcement);

shutdown()

Shuts down connection to Cello and unmounts the Referral Component.
window.Cello("shutdown");

updateProductUserDetails(productUserDetails)

Updates user details at runtime without re-initializing the Referral Component.
window.Cello("updateProductUserDetails", productUserDetails);

Accepts

productUserDetails
object
required
The product user details object

Example

const productUserDetails = {
  email: "bob@gmail.com",
  firstName: "Bob",
  lastName: "Bobsky",
  fullName: "Bob Bobsky",
};
window.Cello("updateProductUserDetails", productUserDetails);