The saveConfiguration() method captures the current configurator state and persists it as a configuration via the backend API. It includes selected parameters, output parameters, order-relevant parameters, and a generated preview image.
This method internally:
-
Generates a preview image using
renderPreview() -
Reads the current parameter state
-
Filters output parameters based on visibility/order rules
-
Sends the configuration to the API
Important: This method requires a Twikbot version that supports getCurrentOutputParameters. If not available, the promise will be rejected.
Parameters
None
Returns
Promise<ConfigurationDto> – Resolves with the saved configuration object.
Example
try {
const configuration = await window.twikit.saveConfiguration();
console.log('Saved configuration:', configuration.uuid);
} catch (error) {
console.error('Failed to save configuration:', error);
}
ConfigurationDto
interface ConfigurationDto {
uuid: string;
productUuid?: ProductUuidDto;
exportJsonUrl: string;
twikbotVersion: string;
parameters: OrderCreateParametersDto;
releaseVersion: ReleaseVersionDto | null;
createdAt: string;
updatedAt: string;
resources: ConfigurationResourcesDto;
productTitle: string;
organizationId?: string;
externalId?: string;
previewImage?: string | null;
project?: ProjectConfiguration;
outputParameters?: Array<ConfigurationOutputParameter>;
orderParameters?: string[];
}