Default pdf templates
@pozylon what do you think? Default order pdf svg template Importable order PDF that uses react-pdf
and importable google wallet pass
All imprts are with optional dependencies
I haven't tested the apple wallet pass, please do on your end if you can
It's hard to test this functionality as the ticketing example does currently not use the new functions, i'd expect something like this in the ticketing example:
setupTicketing(platform.unchainedAPI as TicketingAPI, {
renderOrderPDF: createPDFTicketRenderer((orderId: string, context): DefaultTicketProperties => {
const order = context.modules.orders.getOrderById(orderId);
const tokens = await modules.warehousing.findTokens({
"meta.orderId": orderId,
});
return {
title: "Event XY",
logoUrl: "https://example.com/logo.png",
orderNumber: orde.orderNumber
tickets: tokens.map(token => ({
title: `VIP Ticket: ${token.serialNumber}`,
qrCode: token.id,
stripText: `Place: blabla, come early or get the fuck out of here`,
})),
}
}),
});
renderOrderPDF should be typed to something like this:
createPDFTicketRenderer: (orderId, context) => { contentType: string; blob: ArrayBuffer }
Goal is to give users of the ticketing module a sane default to at least generate usable tickets. If the document generated is unusable it doesn't make sense to give helpers. It should actually print general tickets like in the theater or gastro projects but with a much more generalized design.
User can do:
- use the default pdf ticket renderer (no pdf but generateOrderSVG renderer, this should generate svg tickets that are completely unbranded but look like tickets and could be used in a mvp)
- configure the ticketing renderer like above to create at least "logo" branded customized tickets
- completely re-implement the renderer and take over binary creation