Registry /
crm-productivity / bolddesk-app-framework-sdk
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
BAFClient
✓ import BAFClient from 'bolddesk-app-framework-sdk'
✗ const BAFClient = require('bolddesk-app-framework-sdk')
Package is ESM-only; CommonJS require will fail. Use named import for default export.
BAFClient (constructor)
✓ const client = BAFClient.init(callback)
✗ const client = new BAFClient()
Do not use 'new'. Use static init() method which may or may not accept a callback.
client.get
✓ client.get('ticket.subject').then(data => ...)
✗ client.get(['ticket.subject']).then(...)
Argument is a string path, not an array. Multiple fields are passed as separate string arguments.
client.on
✓ client.on('ticket.updated', handler)
✗ client.addEventListener('ticket.updated', handler)
Uses custom event methods, not DOM EventTarget API.
Shows initialization, data access, event handling, action invocation, and HTTP request proxy.
import BAFClient from 'bolddesk-app-framework-sdk';
const client = BAFClient.init((context) => {
console.log('App initialized!');
console.log('User:', context.user.name);
});
// Get data
client.get('ticket.subject', 'ticket.description').then(data => {
console.log('Ticket subject:', data['ticket.subject']);
console.log('Ticket description:', data['ticket.description']);
});
// Listen to events
const handler = (ticket) => {
console.log('Ticket updated:', ticket);
};
client.on('ticket.updated', handler);
// Invoke action
client.invoke('notification.show', {
type: 'success',
message: 'Operation completed'
});
// HTTP request via proxy
client.request({
url: 'https://api.example.com/data',
method: 'GET'
}).then(response => console.log(response));
Debug
Known issues
breakingNode.js >=18 is required. Running on older versions will cause syntax/runtime errors.fixUpgrade Node.js to v18 or later.
affects: <18
gotchainit() may return undefined if called without a callback? Check documentation; usage with callback is recommended.fixAlways provide a callback to init() to ensure the client object is fully initialized.
affects: >=1.0.0 <=1.0.29
gotchaDo not use new BAFClient(). Use BAFClient.init() static factory method.fixReplace new BAFClient() with BAFClient.init()
affects: >=1.0.0
gotchaUsing require() will fail as package is ESM-only. Use import or dynamic import().fixChange require() to import or use import() inside an async function.
affects: >=1.0.0
gotchaThe SDK must be used inside an iframe embedded in BoldDesk. It will not work standalone (no host to communicate with).fixDeploy the app within BoldDesk using the manifest system.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: BAFClient is not a constructor
Using 'new BAFClient()' incorrectly
fixUse BAFClient.init() instead.
ERR_REQUIRE_ESM: require() of ES Module
Using CommonJS require() for an ESM-only package
fixUse dynamic import() or convert project to ESM.
TypeError: client.get is not a function
Called get() before init() completed without callback
fixEnsure client is initialized: call get() inside init callback or after promise resolves if init returns a promise.
ReferenceError: BAFClient is not defined
Missing import or script include
fixAdd import BAFClient from 'bolddesk-app-framework-sdk' or include the script tag with correct path.
Audit
Dependencies
noderequiredRequired by package.json engines field (>=18)