@combeenation/custom-code-sdk
    Preparing search index...

    @combeenation/custom-code-sdk

    Custom Code SDK

    TypeScript SDK for building Combeenation configurators with custom code.

    The custom code SDK is available as npm package.

    npm install @combeenation/custom-code-sdk
    

    The SDK contains functionality for interacting with a Combeenation configurator, such as:

    • reading and setting component values, listening to value changes
    • creating and manipulating controls (button, checkbox, input, dataview, panel, ...)
    • configurator tasks like finishing/restarting a configuration, sharing, file upload, PDF creation, AR pages
    • communication with the parent page when the configurator is embedded in an iframe

    Everything can be imported directly from the package or via the CbnSdk barrel object:

    import { CbnSdk, onAnyCmpValueChanged } from '@combeenation/custom-code-sdk';

    CbnSdk.onAnyCmpValueChanged(/* ... */);

    Components are accessed via the objects from the generated definitions file (see Typings).

    import { MyComponent } from './typings/cfgr-defs.generated';

    const value = await MyComponent.getValue();
    await MyComponent.setInput(newCmpValue);

    // Returns an object which allows removing the listener again
    const { unsubscribe } = await MyComponent.onValueChanged(newValue => {
    console.log('value changed', newValue);
    });

    Controls are accessed via the generated definitions file as well.

    import { MyButton } from './typings/cfgr-defs.generated';

    MyButton.onClick(() => {
    console.log('button clicked');
    });

    Controls can also be added dynamically via the add*Control functions, e.g. addButtonControl.

    import { finishConfiguration } from '@combeenation/custom-code-sdk';

    const result = await finishConfiguration({ input: 'MyFinishAction' sendDataToParentPage: false });

    The typings for the components and controls of your configurator are generated and updated automatically into the file cfgr-defs.generated.ts as soon as a local dev server connection to the configurator editor is established.

    The package ships all typings needed to use the SDK, so no additional @types/* packages are required.

    The SDK only covers the public custom code API.
    Other Combeenation system code or third party libraries present at runtime in the configurator are not part of the typings and must not be relied on.