@deliverart/sdk-js-receipt-template
v2.25.2
Published
Deliverart JavaScript SDK for versioned receipt templates
Readme
@deliverart/sdk-js-receipt-template
Typed SDK contract for point-of-sale receipt templates.
The package provides:
- Zod schemas for versioned block definitions;
- list, detail, point-of-sale collection, create, and update requests;
- optimistic concurrency through
If-MatchonUpdateReceiptTemplate; - IRI schemas for relationships from print rules.
import {
GetReceiptTemplateDetails,
UpdateReceiptTemplate,
} from '@deliverart/sdk-js-receipt-template'
const template = await sdk.call(new GetReceiptTemplateDetails(templateId))
const updated = await sdk.call(
new UpdateReceiptTemplate(template.id, template.revision, {
name: 'Cucina',
definition: nextDefinition,
}),
)UpdateReceiptTemplate emits application/merge-patch+json and a strong If-Match header. A stale revision is rejected by the API instead of silently overwriting a newer edit.
Time, customer, address, and note blocks support fieldLayout: "inline" | "stacked". Existing definitions default to inline. In stacked mode, labelStyle controls each field heading while style independently controls its value; stacked layout is rejected for other block types.
order_times blocks support showDate: false when a receipt should print only the localized time. Missing or null values retain the legacy date-and-time format. The option is rejected on every other block type.
