Events method

Rocketlane apps must initialize using the window.rliSdk to access product data and register for intercept events.

App Initialization

Use the following pattern to initialize the app and fetch current user data:

window.rliSdk.init({}).then((client) => {
  console.log("Initialised app", client);

  client.data.get(client.data.dataIdentifiers.GET_USER_DATA).then((userData) => {
    console.log("User data", userData);
    onLoaded(client);
    setLoaded(true);
  });
});

Supported Intercept Events

Rocketlane currently supports intercepting the following task-related events via the TaskEvents enum:

export enum TaskEvents {
  TaskUpdate = 'task_update',
  TaskCreate = 'task_create',
  TaskDelete = 'task_delete',
  BulkTaskUpdate = 'bulk_task_update',
  DependentTaskCreate = 'dependent_task_create',
  DependentTaskDelete = 'dependent_task_delete',
}

Usage Example

You can register intercept handlers during initialization to run logic when these events occur:

client.intercept(TaskEvents.TaskDelete, async (event) => {
  console.log("Intercepted task delete", event);
  // Add custom logic or async checks
});
Note: Intercepts allow you to block, modify, or validate task actions before they complete. Return a rejected promise to cancel the operation.