@cosmicdrift/kumiko-samples 0.418.0 → 0.419.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/packages/bundled-features/package.json +6 -1
- package/packages/bundled-features/src/template-resolver/changes.json +38 -0
- package/packages/bundled-features/src/template-resolver/compile-document-body.ts +3 -8
- package/packages/bundled-features/src/template-resolver/compile-document-styles.ts +102 -0
- package/packages/bundled-features/src/template-resolver/document-frames.ts +25 -0
- package/packages/bundled-features/src/template-resolver/document-op-blocks.ts +568 -0
- package/packages/bundled-features/src/template-resolver/document-ops.ts +136 -126
- package/packages/bundled-features/src/template-resolver/document-print-only.ts +41 -0
- package/packages/bundled-features/src/template-resolver/document-sanitizer.ts +41 -19
- package/packages/bundled-features/src/template-resolver/feature.ts +15 -0
- package/packages/bundled-features/src/template-resolver/handlers/apply-layout.write.ts +137 -0
- package/packages/bundled-features/src/template-resolver/handlers/create-layout.write.ts +87 -0
- package/packages/bundled-features/src/template-resolver/handlers/document-base.ts +2 -2
- package/packages/bundled-features/src/template-resolver/handlers/document-blocks.query.ts +13 -8
- package/packages/bundled-features/src/template-resolver/handlers/document-region.ts +47 -0
- package/packages/bundled-features/src/template-resolver/handlers/failure-reason.ts +13 -0
- package/packages/bundled-features/src/template-resolver/handlers/import-bundle-system.write.ts +3 -0
- package/packages/bundled-features/src/template-resolver/handlers/layout-source.query.ts +17 -5
- package/packages/bundled-features/src/template-resolver/handlers/overview.query.ts +16 -4
- package/packages/bundled-features/src/template-resolver/handlers/patch-draft.write.ts +19 -6
- package/packages/bundled-features/src/template-resolver/handlers/publish-templates.write.ts +69 -0
- package/packages/bundled-features/src/template-resolver/handlers/set.write.ts +7 -0
- package/packages/bundled-features/src/template-resolver/handlers/template-write.ts +15 -3
- package/packages/bundled-features/src/template-resolver/handlers/tenant-settings.ts +122 -0
- package/packages/bundled-features/src/template-resolver/handlers/toggle-status.write.ts +25 -10
- package/packages/bundled-features/src/template-resolver/handlers/upsert-system.write.ts +7 -3
- package/packages/bundled-features/src/template-resolver/handlers/usage.query.ts +131 -18
- package/packages/bundled-features/src/template-resolver/handlers/validate.query.ts +10 -0
- package/packages/bundled-features/src/template-resolver/i18n.ts +3 -0
- package/packages/bundled-features/src/template-resolver/index.ts +29 -0
- package/packages/bundled-features/src/template-resolver/layout-regions.ts +54 -16
- package/packages/bundled-features/src/template-resolver/print-document.ts +3 -1
- package/packages/bundled-features/src/template-resolver/seeding.ts +4 -0
- package/packages/bundled-features/src/template-resolver/template-delivery-policy.ts +11 -1
- package/packages/bundled-features/src/template-resolver/template-edit-policy.ts +37 -1
- package/packages/bundled-features/src/template-resolver/template-meta.ts +25 -6
- package/packages/bundled-features/src/template-resolver/template-preview.ts +6 -7
- package/packages/bundled-features/src/template-resolver/template-validation.ts +10 -3
- package/packages/bundled-features/src/template-resolver/web/constants.ts +29 -0
- package/packages/bundled-features/src/template-resolver/web/document-blocks.ts +5 -0
- package/packages/bundled-features/src/template-resolver/web/document-editor-extensions.ts +34 -2
- package/packages/bundled-features/src/template-resolver/web/document-editor-fonts.ts +13 -0
- package/packages/bundled-features/src/template-resolver/web/document-fonts.ts +21 -0
- package/packages/bundled-features/src/template-resolver/web/document-frame-control.ts +428 -0
- package/packages/bundled-features/src/template-resolver/web/document-frame-node-view.tsx +207 -0
- package/packages/bundled-features/src/template-resolver/web/document-print-decorations.ts +196 -0
- package/packages/bundled-features/src/template-resolver/web/document-print-defaults.ts +59 -0
- package/packages/bundled-features/src/template-resolver/web/document-print-style.ts +246 -0
- package/packages/bundled-features/src/template-resolver/web/document-repeat-strip.ts +104 -0
- package/packages/bundled-features/src/template-resolver/web/document-schema.ts +29 -9
- package/packages/bundled-features/src/template-resolver/web/document-style-css.ts +107 -0
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-bubble.tsx +24 -2
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-content.tsx +66 -7
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-context.ts +13 -1
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-editor.tsx +24 -4
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-helpers.ts +149 -4
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-toolbar-groups.tsx +290 -10
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-toolbar.tsx +90 -8
- package/packages/bundled-features/src/template-resolver/web/document-toolbar-blocks.ts +20 -0
- package/packages/bundled-features/src/template-resolver/web/fontsource-css.d.ts +2 -0
- package/packages/bundled-features/src/template-resolver/web/i18n.ts +28 -0
- package/packages/bundled-features/src/template-resolver/web/index.ts +34 -0
- package/packages/bundled-features/src/template-resolver/web/pdf-constants.ts +6 -0
- package/packages/bundled-features/src/template-resolver/web/qualified-names.ts +7 -0
- package/packages/bundled-features/src/template-resolver/web/use-document-tiptap-model.ts +74 -5
- package/packages/bundled-features/src/tenant/company-config.ts +48 -0
- package/packages/bundled-features/src/tenant/feature.ts +11 -0
- package/packages/bundled-features/src/tenant/i18n.ts +14 -0
- package/samples/apps/ui-walkthrough/src/app/auth-constants.ts +51 -0
- package/samples/apps/ui-walkthrough/src/app/seed-print-editor-tenants.ts +118 -0
- package/samples/apps/ui-walkthrough/src/app/seed-templates.ts +2 -0
- package/samples/apps/ui-walkthrough/src/app/server.ts +9 -1
- package/samples/apps/ui-walkthrough/src/app/template-seed-data.ts +27 -1
- package/samples/apps/ui-walkthrough/src/run-config.ts +1 -0
- package/samples/apps/use-all-bundled/feature-manifest.json +236 -0
- package/samples/recipes/pdf-letterhead/README.md +23 -0
- package/samples/recipes/pdf-letterhead/package.json +12 -0
- package/samples/recipes/pdf-letterhead/src/letterhead.ts +92 -0
|
@@ -3045,6 +3045,29 @@
|
|
|
3045
3045
|
"usesApis": [],
|
|
3046
3046
|
"extensionsUsed": [],
|
|
3047
3047
|
"configKeys": [
|
|
3048
|
+
{
|
|
3049
|
+
"key": "default-pdf-layout-slug",
|
|
3050
|
+
"qualifiedName": "template-resolver:config:default-pdf-layout-slug",
|
|
3051
|
+
"type": "text",
|
|
3052
|
+
"scope": "tenant",
|
|
3053
|
+
"default": "",
|
|
3054
|
+
"encrypted": false,
|
|
3055
|
+
"computed": false,
|
|
3056
|
+
"validated": false,
|
|
3057
|
+
"options": null,
|
|
3058
|
+
"bounds": null,
|
|
3059
|
+
"pattern": {
|
|
3060
|
+
"regex": "^(?:[a-z0-9]{1,40}(?:-[a-z0-9]{1,40}){0,5}(?::[a-z0-9]{1,40}(?:-[a-z0-9]{1,40}){0,5}){0,3})?$"
|
|
3061
|
+
},
|
|
3062
|
+
"writeRoles": [
|
|
3063
|
+
"TenantAdmin",
|
|
3064
|
+
"Admin",
|
|
3065
|
+
"SystemAdmin"
|
|
3066
|
+
],
|
|
3067
|
+
"readRoles": [
|
|
3068
|
+
"all"
|
|
3069
|
+
]
|
|
3070
|
+
},
|
|
3048
3071
|
{
|
|
3049
3072
|
"key": "resource-max-bytes",
|
|
3050
3073
|
"qualifiedName": "template-resolver:config:resource-max-bytes",
|
|
@@ -3071,9 +3094,11 @@
|
|
|
3071
3094
|
],
|
|
3072
3095
|
"secrets": [],
|
|
3073
3096
|
"writeHandlers": [
|
|
3097
|
+
"template-resolver:write:apply-layout",
|
|
3074
3098
|
"template-resolver:write:archive",
|
|
3075
3099
|
"template-resolver:write:archive-system",
|
|
3076
3100
|
"template-resolver:write:copy-locale",
|
|
3101
|
+
"template-resolver:write:create-layout",
|
|
3077
3102
|
"template-resolver:write:discard-draft",
|
|
3078
3103
|
"template-resolver:write:discard-draft-system",
|
|
3079
3104
|
"template-resolver:write:import-bundle",
|
|
@@ -3081,6 +3106,7 @@
|
|
|
3081
3106
|
"template-resolver:write:patch-draft",
|
|
3082
3107
|
"template-resolver:write:publish",
|
|
3083
3108
|
"template-resolver:write:publish-system",
|
|
3109
|
+
"template-resolver:write:publish-templates",
|
|
3084
3110
|
"template-resolver:write:reply-snippets-set",
|
|
3085
3111
|
"template-resolver:write:reset-to-system",
|
|
3086
3112
|
"template-resolver:write:resource-link-pdf",
|
|
@@ -3135,6 +3161,132 @@
|
|
|
3135
3161
|
"usesApis": [],
|
|
3136
3162
|
"extensionsUsed": [],
|
|
3137
3163
|
"configKeys": [
|
|
3164
|
+
{
|
|
3165
|
+
"key": "company-address",
|
|
3166
|
+
"qualifiedName": "tenant:config:company-address",
|
|
3167
|
+
"type": "text",
|
|
3168
|
+
"scope": "tenant",
|
|
3169
|
+
"default": "",
|
|
3170
|
+
"encrypted": false,
|
|
3171
|
+
"computed": false,
|
|
3172
|
+
"validated": false,
|
|
3173
|
+
"options": null,
|
|
3174
|
+
"bounds": null,
|
|
3175
|
+
"pattern": null,
|
|
3176
|
+
"writeRoles": [
|
|
3177
|
+
"TenantAdmin",
|
|
3178
|
+
"Admin",
|
|
3179
|
+
"SystemAdmin"
|
|
3180
|
+
],
|
|
3181
|
+
"readRoles": [
|
|
3182
|
+
"all"
|
|
3183
|
+
]
|
|
3184
|
+
},
|
|
3185
|
+
{
|
|
3186
|
+
"key": "company-bank",
|
|
3187
|
+
"qualifiedName": "tenant:config:company-bank",
|
|
3188
|
+
"type": "text",
|
|
3189
|
+
"scope": "tenant",
|
|
3190
|
+
"default": "",
|
|
3191
|
+
"encrypted": false,
|
|
3192
|
+
"computed": false,
|
|
3193
|
+
"validated": false,
|
|
3194
|
+
"options": null,
|
|
3195
|
+
"bounds": null,
|
|
3196
|
+
"pattern": null,
|
|
3197
|
+
"writeRoles": [
|
|
3198
|
+
"TenantAdmin",
|
|
3199
|
+
"Admin",
|
|
3200
|
+
"SystemAdmin"
|
|
3201
|
+
],
|
|
3202
|
+
"readRoles": [
|
|
3203
|
+
"all"
|
|
3204
|
+
]
|
|
3205
|
+
},
|
|
3206
|
+
{
|
|
3207
|
+
"key": "company-bic",
|
|
3208
|
+
"qualifiedName": "tenant:config:company-bic",
|
|
3209
|
+
"type": "text",
|
|
3210
|
+
"scope": "tenant",
|
|
3211
|
+
"default": "",
|
|
3212
|
+
"encrypted": false,
|
|
3213
|
+
"computed": false,
|
|
3214
|
+
"validated": false,
|
|
3215
|
+
"options": null,
|
|
3216
|
+
"bounds": null,
|
|
3217
|
+
"pattern": null,
|
|
3218
|
+
"writeRoles": [
|
|
3219
|
+
"TenantAdmin",
|
|
3220
|
+
"Admin",
|
|
3221
|
+
"SystemAdmin"
|
|
3222
|
+
],
|
|
3223
|
+
"readRoles": [
|
|
3224
|
+
"all"
|
|
3225
|
+
]
|
|
3226
|
+
},
|
|
3227
|
+
{
|
|
3228
|
+
"key": "company-email",
|
|
3229
|
+
"qualifiedName": "tenant:config:company-email",
|
|
3230
|
+
"type": "text",
|
|
3231
|
+
"scope": "tenant",
|
|
3232
|
+
"default": "",
|
|
3233
|
+
"encrypted": false,
|
|
3234
|
+
"computed": false,
|
|
3235
|
+
"validated": false,
|
|
3236
|
+
"options": null,
|
|
3237
|
+
"bounds": null,
|
|
3238
|
+
"pattern": null,
|
|
3239
|
+
"writeRoles": [
|
|
3240
|
+
"TenantAdmin",
|
|
3241
|
+
"Admin",
|
|
3242
|
+
"SystemAdmin"
|
|
3243
|
+
],
|
|
3244
|
+
"readRoles": [
|
|
3245
|
+
"all"
|
|
3246
|
+
]
|
|
3247
|
+
},
|
|
3248
|
+
{
|
|
3249
|
+
"key": "company-iban",
|
|
3250
|
+
"qualifiedName": "tenant:config:company-iban",
|
|
3251
|
+
"type": "text",
|
|
3252
|
+
"scope": "tenant",
|
|
3253
|
+
"default": "",
|
|
3254
|
+
"encrypted": false,
|
|
3255
|
+
"computed": false,
|
|
3256
|
+
"validated": false,
|
|
3257
|
+
"options": null,
|
|
3258
|
+
"bounds": null,
|
|
3259
|
+
"pattern": null,
|
|
3260
|
+
"writeRoles": [
|
|
3261
|
+
"TenantAdmin",
|
|
3262
|
+
"Admin",
|
|
3263
|
+
"SystemAdmin"
|
|
3264
|
+
],
|
|
3265
|
+
"readRoles": [
|
|
3266
|
+
"all"
|
|
3267
|
+
]
|
|
3268
|
+
},
|
|
3269
|
+
{
|
|
3270
|
+
"key": "company-management",
|
|
3271
|
+
"qualifiedName": "tenant:config:company-management",
|
|
3272
|
+
"type": "text",
|
|
3273
|
+
"scope": "tenant",
|
|
3274
|
+
"default": "",
|
|
3275
|
+
"encrypted": false,
|
|
3276
|
+
"computed": false,
|
|
3277
|
+
"validated": false,
|
|
3278
|
+
"options": null,
|
|
3279
|
+
"bounds": null,
|
|
3280
|
+
"pattern": null,
|
|
3281
|
+
"writeRoles": [
|
|
3282
|
+
"TenantAdmin",
|
|
3283
|
+
"Admin",
|
|
3284
|
+
"SystemAdmin"
|
|
3285
|
+
],
|
|
3286
|
+
"readRoles": [
|
|
3287
|
+
"all"
|
|
3288
|
+
]
|
|
3289
|
+
},
|
|
3138
3290
|
{
|
|
3139
3291
|
"key": "company-name",
|
|
3140
3292
|
"qualifiedName": "tenant:config:company-name",
|
|
@@ -3156,6 +3308,90 @@
|
|
|
3156
3308
|
"all"
|
|
3157
3309
|
]
|
|
3158
3310
|
},
|
|
3311
|
+
{
|
|
3312
|
+
"key": "company-phone",
|
|
3313
|
+
"qualifiedName": "tenant:config:company-phone",
|
|
3314
|
+
"type": "text",
|
|
3315
|
+
"scope": "tenant",
|
|
3316
|
+
"default": "",
|
|
3317
|
+
"encrypted": false,
|
|
3318
|
+
"computed": false,
|
|
3319
|
+
"validated": false,
|
|
3320
|
+
"options": null,
|
|
3321
|
+
"bounds": null,
|
|
3322
|
+
"pattern": null,
|
|
3323
|
+
"writeRoles": [
|
|
3324
|
+
"TenantAdmin",
|
|
3325
|
+
"Admin",
|
|
3326
|
+
"SystemAdmin"
|
|
3327
|
+
],
|
|
3328
|
+
"readRoles": [
|
|
3329
|
+
"all"
|
|
3330
|
+
]
|
|
3331
|
+
},
|
|
3332
|
+
{
|
|
3333
|
+
"key": "company-register",
|
|
3334
|
+
"qualifiedName": "tenant:config:company-register",
|
|
3335
|
+
"type": "text",
|
|
3336
|
+
"scope": "tenant",
|
|
3337
|
+
"default": "",
|
|
3338
|
+
"encrypted": false,
|
|
3339
|
+
"computed": false,
|
|
3340
|
+
"validated": false,
|
|
3341
|
+
"options": null,
|
|
3342
|
+
"bounds": null,
|
|
3343
|
+
"pattern": null,
|
|
3344
|
+
"writeRoles": [
|
|
3345
|
+
"TenantAdmin",
|
|
3346
|
+
"Admin",
|
|
3347
|
+
"SystemAdmin"
|
|
3348
|
+
],
|
|
3349
|
+
"readRoles": [
|
|
3350
|
+
"all"
|
|
3351
|
+
]
|
|
3352
|
+
},
|
|
3353
|
+
{
|
|
3354
|
+
"key": "company-vat-id",
|
|
3355
|
+
"qualifiedName": "tenant:config:company-vat-id",
|
|
3356
|
+
"type": "text",
|
|
3357
|
+
"scope": "tenant",
|
|
3358
|
+
"default": "",
|
|
3359
|
+
"encrypted": false,
|
|
3360
|
+
"computed": false,
|
|
3361
|
+
"validated": false,
|
|
3362
|
+
"options": null,
|
|
3363
|
+
"bounds": null,
|
|
3364
|
+
"pattern": null,
|
|
3365
|
+
"writeRoles": [
|
|
3366
|
+
"TenantAdmin",
|
|
3367
|
+
"Admin",
|
|
3368
|
+
"SystemAdmin"
|
|
3369
|
+
],
|
|
3370
|
+
"readRoles": [
|
|
3371
|
+
"all"
|
|
3372
|
+
]
|
|
3373
|
+
},
|
|
3374
|
+
{
|
|
3375
|
+
"key": "company-website",
|
|
3376
|
+
"qualifiedName": "tenant:config:company-website",
|
|
3377
|
+
"type": "text",
|
|
3378
|
+
"scope": "tenant",
|
|
3379
|
+
"default": "",
|
|
3380
|
+
"encrypted": false,
|
|
3381
|
+
"computed": false,
|
|
3382
|
+
"validated": false,
|
|
3383
|
+
"options": null,
|
|
3384
|
+
"bounds": null,
|
|
3385
|
+
"pattern": null,
|
|
3386
|
+
"writeRoles": [
|
|
3387
|
+
"TenantAdmin",
|
|
3388
|
+
"Admin",
|
|
3389
|
+
"SystemAdmin"
|
|
3390
|
+
],
|
|
3391
|
+
"readRoles": [
|
|
3392
|
+
"all"
|
|
3393
|
+
]
|
|
3394
|
+
},
|
|
3159
3395
|
{
|
|
3160
3396
|
"key": "locale",
|
|
3161
3397
|
"qualifiedName": "tenant:config:locale",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# PDF Letterhead
|
|
2
|
+
|
|
3
|
+
A PDF layout with its own look, a letter with an address frame, and the transfer of the layout to templates.
|
|
4
|
+
|
|
5
|
+
## What it shows
|
|
6
|
+
|
|
7
|
+
- A system `pdf-layout` with a header, a footer in three columns (a borderless table) that prints the company placeholders `companyAddress`, `companyIban` and `companyBic`, and appearance in `meta`: font, size, table style and page margins in mm.
|
|
8
|
+
- A `document-pdf` letter with an address frame (`data-frame`, preset `address`) at the DIN 5008 form B window position, and a text style (`data-text-style`) on a run of text.
|
|
9
|
+
- Company placeholders read the tenant's own settings (`tenant:config:company-*`); the validate query lists the ones a tenant has left empty.
|
|
10
|
+
- `apply-layout` hands the layout to chosen templates as drafts (mode `selected`) or makes it the tenant default (mode `all`, no copies); `publish-templates` activates the drafts together; the usage query lists which templates use the layout.
|
|
11
|
+
|
|
12
|
+
## Source
|
|
13
|
+
|
|
14
|
+
`src/letterhead.ts` holds the layout, the letter and the tenant-editable list; the app passes the list to `createTemplateResolverFeature({ tenantEditable })`.
|
|
15
|
+
|
|
16
|
+
## Tests
|
|
17
|
+
|
|
18
|
+
Needs a running Postgres and `TEST_DATABASE_URL` set (e.g. `postgres://postgres:postgres@127.0.0.1:5432/postgres`, see `demo/.env.example`).
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
cd samples/recipes/pdf-letterhead
|
|
22
|
+
bun test
|
|
23
|
+
```
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cosmicdrift/kumiko-sample-pdf-letterhead",
|
|
3
|
+
"description": "A PDF letterhead as a layout with its own appearance and company-data footer, a letter with an address frame, and the transfer of the layout to templates (apply-layout, publish-templates).",
|
|
4
|
+
"private": true,
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@cosmicdrift/kumiko-bundled-features": "workspace:*",
|
|
7
|
+
"@cosmicdrift/kumiko-framework": "workspace:*"
|
|
8
|
+
},
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"@cosmicdrift/kumiko-testing": "workspace:*"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// The pieces an app ships for a letterhead: a system layout with its own look, a letter that places
|
|
2
|
+
// the recipient in the DIN address window, and the list of templates tenants may edit.
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
TENANT_LAYOUT_SLUG_PREFIX,
|
|
6
|
+
type TenantEditableTemplate,
|
|
7
|
+
} from "@cosmicdrift/kumiko-bundled-features/template-resolver";
|
|
8
|
+
|
|
9
|
+
export const LETTERHEAD_LAYOUT_SLUG = "letterhead";
|
|
10
|
+
export const LETTER_SLUG = "letter";
|
|
11
|
+
export const LETTER_LOCALE = "de";
|
|
12
|
+
|
|
13
|
+
// Company placeholders read the tenant's own settings (tenant:config:company-*); a tenant that
|
|
14
|
+
// left one empty is told so by the validate query instead of getting an empty line in the PDF.
|
|
15
|
+
export const LETTERHEAD_LAYOUT_HTML = [
|
|
16
|
+
'<div data-header><p data-align="center"><strong>Hausverwaltung am Sund</strong></p></div>',
|
|
17
|
+
"<div data-content></div>",
|
|
18
|
+
"<div data-signature></div>",
|
|
19
|
+
[
|
|
20
|
+
'<div data-footer><table data-borders="none"><tbody><tr>',
|
|
21
|
+
'<td><p data-size="small"><span data-variable="companyAddress"></span></p></td>',
|
|
22
|
+
'<td><p data-size="small"><span data-variable="companyIban"></span></p></td>',
|
|
23
|
+
'<td><p data-size="small"><span data-variable="companyBic"></span></p></td>',
|
|
24
|
+
"</tr></tbody></table></div>",
|
|
25
|
+
].join(""),
|
|
26
|
+
].join("");
|
|
27
|
+
|
|
28
|
+
export const LETTERHEAD_LAYOUT_META = {
|
|
29
|
+
fontFamily: "times",
|
|
30
|
+
fontSizePt: 11,
|
|
31
|
+
tableStyle: "lines",
|
|
32
|
+
margins: { top: 36, right: 24, bottom: 28, left: 30 },
|
|
33
|
+
} as const;
|
|
34
|
+
|
|
35
|
+
// DIN 5008 form B: the frame sits at the window position, 85 x 45 mm at 20 / 45 mm.
|
|
36
|
+
export const LETTER_HTML = [
|
|
37
|
+
'<div data-frame data-x="20" data-y="45" data-width="85" data-height="45" data-frame-preset="address"><p><span data-variable="recipientName"></span></p></div>',
|
|
38
|
+
'<p><span data-text-style data-size-pt="14" data-font="times">Guten Tag,</span></p>',
|
|
39
|
+
"<p>anbei erhalten Sie die Unterlagen.</p>",
|
|
40
|
+
].join("");
|
|
41
|
+
|
|
42
|
+
// What an AI assistant sends through create-layout and patch-draft to rebuild an uploaded letter:
|
|
43
|
+
// structured blocks only, never HTML. Names and addresses are made up.
|
|
44
|
+
export const REBUILT_LAYOUT_NAME = "rebuilt-letterhead";
|
|
45
|
+
export const REBUILT_LAYOUT_SLUG = `${TENANT_LAYOUT_SLUG_PREFIX}${REBUILT_LAYOUT_NAME}`;
|
|
46
|
+
export const REBUILT_LETTER_SLUG = "rebuilt-letter";
|
|
47
|
+
|
|
48
|
+
export const REBUILT_HEADER_BLOCKS = [
|
|
49
|
+
{
|
|
50
|
+
type: "paragraph",
|
|
51
|
+
align: "right",
|
|
52
|
+
runs: [{ text: "Musterfirma GmbH", bold: true, sizePt: 14, color: "#1f5468" }],
|
|
53
|
+
},
|
|
54
|
+
{ type: "paragraph", align: "right", text: "Musterstraße 1, 12345 Musterstadt" },
|
|
55
|
+
] as const;
|
|
56
|
+
|
|
57
|
+
export const REBUILT_LETTER_BLOCKS = [
|
|
58
|
+
{
|
|
59
|
+
type: "frame",
|
|
60
|
+
xMm: 20,
|
|
61
|
+
yMm: 45,
|
|
62
|
+
widthMm: 85,
|
|
63
|
+
heightMm: 45,
|
|
64
|
+
preset: "address",
|
|
65
|
+
blocks: [
|
|
66
|
+
{ type: "paragraph", text: "Max Mustermann" },
|
|
67
|
+
{ type: "paragraph", text: "Beispielweg 2" },
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
{ type: "heading", level: 2, text: "Rechnung {{invoiceNumber}}" },
|
|
71
|
+
{
|
|
72
|
+
type: "table",
|
|
73
|
+
columnWidthsPx: [320, 120],
|
|
74
|
+
header: {
|
|
75
|
+
cells: [
|
|
76
|
+
{ text: "Leistung", background: "#eeeeee" },
|
|
77
|
+
{ text: "Betrag", align: "right" },
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
rows: [],
|
|
81
|
+
repeat: {
|
|
82
|
+
each: "positions",
|
|
83
|
+
row: { cells: [{ text: "{{label}}" }, { text: "{{amount}}", align: "right" }] },
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
] as const;
|
|
87
|
+
|
|
88
|
+
export const TENANT_EDITABLE: readonly TenantEditableTemplate[] = [
|
|
89
|
+
{ kind: "pdf-layout", slug: LETTERHEAD_LAYOUT_SLUG, access: { roles: ["TenantAdmin"] } },
|
|
90
|
+
{ kind: "document-pdf", slug: LETTER_SLUG, access: { roles: ["TenantAdmin"] } },
|
|
91
|
+
{ kind: "document-pdf", slug: REBUILT_LETTER_SLUG, access: { roles: ["TenantAdmin"] } },
|
|
92
|
+
];
|