@ezeep/ezeep-js 1.0.290 → 1.0.302

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.
Files changed (75) hide show
  1. package/dist/cjs/ezeep.cjs.js +1 -1
  2. package/dist/cjs/{ezp-auth_15.cjs.entry.js → ezp-auth_16.cjs.entry.js} +572 -139
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/collection/collection-manifest.json +1 -0
  5. package/dist/collection/components/ezp-file-name/ezp-file-name.css +98 -0
  6. package/dist/collection/components/ezp-file-name/ezp-file-name.js +280 -0
  7. package/dist/collection/components/ezp-icon/ezp-icon.js +1 -1
  8. package/dist/collection/components/ezp-icon-button/ezp-icon-button.js +1 -1
  9. package/dist/collection/components/ezp-input/ezp-input.css +11 -2
  10. package/dist/collection/components/ezp-input/ezp-input.js +3 -5
  11. package/dist/collection/components/ezp-label/ezp-label.js +39 -1
  12. package/dist/collection/components/ezp-printer-selection/ezp-printer-selection.css +45 -17
  13. package/dist/collection/components/ezp-printer-selection/ezp-printer-selection.js +220 -88
  14. package/dist/collection/components/ezp-printing/ezp-printing.js +1 -1
  15. package/dist/collection/components/ezp-select/ezp-select.css +9 -12
  16. package/dist/collection/components/ezp-select/ezp-select.js +1 -1
  17. package/dist/collection/components/ezp-status/ezp-status.js +2 -2
  18. package/dist/collection/components/ezp-stepper/ezp-stepper.js +1 -1
  19. package/dist/collection/components/ezp-text-button/ezp-text-button.css +3 -1
  20. package/dist/collection/components/ezp-text-button/ezp-text-button.js +1 -1
  21. package/dist/collection/components/ezp-upload/ezp-upload.css +176 -143
  22. package/dist/collection/components/ezp-upload/ezp-upload.js +56 -9
  23. package/dist/collection/components/ezp-user-menu/ezp-user-menu.js +1 -1
  24. package/dist/collection/shared/storage.js +39 -9
  25. package/dist/collection/types/shared/types.d.ts +1 -0
  26. package/dist/collection/utils/printer.js +75 -1
  27. package/dist/components/auth.js +1 -1
  28. package/dist/components/ezp-file-name.d.ts +11 -0
  29. package/dist/components/ezp-file-name.js +1 -0
  30. package/dist/components/ezp-file-name2.js +1 -0
  31. package/dist/components/ezp-icon-button2.js +1 -1
  32. package/dist/components/ezp-icon2.js +1 -1
  33. package/dist/components/ezp-input2.js +1 -1
  34. package/dist/components/ezp-label2.js +1 -1
  35. package/dist/components/ezp-printer-selection2.js +1 -1
  36. package/dist/components/ezp-printing.js +1 -1
  37. package/dist/components/ezp-select2.js +1 -1
  38. package/dist/components/ezp-status2.js +1 -1
  39. package/dist/components/ezp-stepper2.js +1 -1
  40. package/dist/components/ezp-text-button2.js +1 -1
  41. package/dist/components/ezp-upload2.js +1 -1
  42. package/dist/components/ezp-user-menu2.js +1 -1
  43. package/dist/components/utils.js +1 -1
  44. package/dist/directives/proxies.ts +26 -1
  45. package/dist/esm/ezeep.js +1 -1
  46. package/dist/esm/{ezp-auth_15.entry.js → ezp-auth_16.entry.js} +572 -140
  47. package/dist/esm/loader.js +1 -1
  48. package/dist/esm-es5/ezeep.js +1 -1
  49. package/dist/esm-es5/{ezp-auth_15.entry.js → ezp-auth_16.entry.js} +2 -2
  50. package/dist/esm-es5/loader.js +1 -1
  51. package/dist/ezeep/ezeep.esm.js +1 -1
  52. package/dist/ezeep/{p-6a494b7b.system.entry.js → p-636e190f.system.entry.js} +2 -2
  53. package/dist/ezeep/p-DCznw2Ee.system.js +1 -1
  54. package/dist/ezeep/p-ff075048.entry.js +1 -0
  55. package/dist/ezeep/types/shared/types.d.ts +1 -0
  56. package/dist/types/components/ezp-file-name/ezp-file-name.d.ts +83 -0
  57. package/dist/types/components/ezp-label/ezp-label.d.ts +10 -0
  58. package/dist/types/components/ezp-printer-selection/ezp-printer-selection.d.ts +41 -1
  59. package/dist/types/components/ezp-upload/ezp-upload.d.ts +8 -1
  60. package/dist/types/components.d.ts +65 -4
  61. package/dist/types/shared/storage.d.ts +18 -4
  62. package/dist/types/shared/types.d.ts +1 -0
  63. package/dist/types/utils/printer.d.ts +18 -0
  64. package/package.json +1 -1
  65. package/www/build/ezeep.esm.js +1 -1
  66. package/www/build/{p-6a494b7b.system.entry.js → p-636e190f.system.entry.js} +2 -2
  67. package/www/build/p-DCznw2Ee.system.js +1 -1
  68. package/www/build/p-a2a4f55b.js +1 -0
  69. package/www/build/p-ff075048.entry.js +1 -0
  70. package/www/data/locales/de.json +6 -9
  71. package/www/data/locales/en.json +6 -9
  72. package/www/index.html +1 -1
  73. package/dist/ezeep/p-0df147f4.entry.js +0 -1
  74. package/www/build/p-0df147f4.entry.js +0 -1
  75. package/www/build/p-67021add.js +0 -1
@@ -29,11 +29,6 @@
29
29
  *
30
30
  */
31
31
  :host {
32
- --ezp-drucken-gradient: linear-gradient(
33
- 135deg,
34
- color-mix(in srgb, var(--ezp-theme-solid), white 14%) 0%,
35
- color-mix(in srgb, var(--ezp-theme-solid), black 22%) 100%
36
- );
37
32
  --ezp-status-border-radius: 16px;
38
33
  background: var(--ezp-printerSelection-background, var(--ezp-core-backdrop));
39
34
  box-sizing: border-box;
@@ -151,9 +146,11 @@
151
146
  display: flex;
152
147
  gap: var(--ezp-spacing-3);
153
148
  min-width: 0;
149
+ /* Anchors the file name's tooltip, so it can span the row. */
150
+ position: relative;
154
151
  }
155
- .file-row ezp-label {
156
- --ezp-label-minWidth: 0;
152
+ .file-row ezp-file-name {
153
+ flex: 0 1 auto;
157
154
  }
158
155
 
159
156
  .file-row-icon {
@@ -168,18 +165,34 @@
168
165
  * Printer card + print button
169
166
  *
170
167
  */
168
+ #printer-caption {
169
+ color: var(--ezp-core-foreground-secondary);
170
+ letter-spacing: 0.08em;
171
+ padding: 0 var(--ezp-spacing-1);
172
+ text-transform: uppercase;
173
+ }
174
+
171
175
  #printer-card {
172
176
  border-radius: 12px;
173
177
  box-shadow: inset 0 0 0 1px var(--ezp-core-outline);
174
178
  position: relative;
175
179
  }
176
180
 
181
+ /* The caption above the card names this select, so hide its built-in label and
182
+ let the printer name sit next to the badge instead of hugging the chevron. */
183
+ #printer {
184
+ --ezp-select-label-display: none;
185
+ --ezp-select-toggle-gridTemplateAreas: 'icon value accessory';
186
+ --ezp-select-toggle-gridTemplateRows: auto;
187
+ --ezp-select-value-textAlign: left;
188
+ }
189
+
177
190
  #print {
178
191
  align-items: center;
179
192
  appearance: none;
180
- background: var(--ezp-drucken-gradient);
193
+ background: var(--ezp-theme-solid);
181
194
  border: 0;
182
- border-radius: 0 0 12px 12px;
195
+ border-radius: 8px;
183
196
  color: var(--ezp-white-100);
184
197
  cursor: pointer;
185
198
  display: flex;
@@ -188,7 +201,7 @@
188
201
  justify-content: center;
189
202
  margin: 0;
190
203
  outline: none;
191
- padding: var(--ezp-spacing-4);
204
+ padding: 13px var(--ezp-spacing-4);
192
205
  transition: opacity var(--ezp-duration-2) var(--ezp-easing-out-quart);
193
206
  width: 100%;
194
207
  }
@@ -219,25 +232,40 @@
219
232
  display: flex;
220
233
  flex-direction: column;
221
234
  }
235
+ #options > * {
236
+ box-shadow: inset 0 -1px 0 0 var(--ezp-core-outline);
237
+ }
238
+ #options > *:last-child {
239
+ box-shadow: none;
240
+ }
222
241
 
223
242
  /**
224
243
  *
225
244
  * Footer
226
245
  *
227
246
  */
247
+ /* Sticky so Print stays in view when the dialog is taller than the viewport
248
+ and the backdrop scrolls. A scrolling #body would clip the selects, which
249
+ expand in place and measure themselves against #box. */
228
250
  #footer {
229
- display: flex;
230
- justify-content: flex-end;
231
- padding: var(--ezp-spacing-3) var(--ezp-spacing-4) var(--ezp-spacing-4);
232
- position: relative;
251
+ background: var(--ezp-printerSelection-body-background, var(--ezp-core-surface-tertiary));
252
+ border-radius: 0 0 16px 16px;
253
+ border-top: 1px solid var(--ezp-core-outline);
254
+ bottom: 0;
255
+ display: grid;
256
+ gap: var(--ezp-spacing-3);
257
+ grid-template-columns: 1fr 1.4fr;
258
+ padding: var(--ezp-spacing-4);
259
+ position: sticky;
233
260
  z-index: 3;
234
261
  }
235
262
 
236
263
  #cancel {
237
- --ezp-textButton-background-init: transparent;
264
+ --ezp-textButton-background-active: var(--ezp-core-shade-secondary);
238
265
  --ezp-textButton-background-hover: var(--ezp-core-shade-primary);
266
+ --ezp-textButton-background-init: transparent;
267
+ --ezp-textButton-borderRadius: 8px;
239
268
  --ezp-textButton-boxShadow: inset 0 0 0 1px var(--ezp-core-outline);
240
- --ezp-textButton-borderRadius: 999px;
241
269
  --ezp-textButton-color-init: var(--ezp-core-foreground-primary);
242
- --ezp-textButton-padding: var(--ezp-spacing-3) var(--ezp-spacing-6);
270
+ --ezp-textButton-padding: 13px var(--ezp-spacing-3);
243
271
  }
@@ -3,9 +3,9 @@ import i18next from "i18next";
3
3
  import authStore from "../../services/auth";
4
4
  import printStore, { EzpPrintService } from "../../services/print";
5
5
  import userStore, { EzpUserService } from "../../services/user";
6
- import { managePaperDimensions, poll, removeEmptyStrings, subscribeToLanguageChange } from "../../utils/utils";
6
+ import { managePaperDimensions, poll, removeEmptyStrings, subscribeToLanguageChange, } from "../../utils/utils";
7
7
  import { PAPER_ID, validatePageRange, formatPageRange } from "../../utils/utils";
8
- import { applyPrinterDefaults, classifyJobStatus, hasTrays, hasNoTrays } from "../../utils/printer";
8
+ import { applySavedProperties, classifyJobStatus, hasTrays, hasNoTrays, pickRememberedProperties, } from "../../utils/printer";
9
9
  import { uploadAndPrintFile } from "../../services/print-job";
10
10
  import { storage } from "../../shared/storage";
11
11
  import { HUB_DRIVER_ERROR_CODES, PRINT_REJECTED_CODE, FILE_EXPIRED_STATUS, POLL_INTERVAL_MS, MAX_POLL_ATTEMPTS, HUB_TIMEOUT_MS, } from "../../shared/constants";
@@ -56,6 +56,10 @@ export class EzpPrinterSelection {
56
56
  this.hubDriverError = false;
57
57
  this.userMenuOpen = false;
58
58
  this.printStopped = false;
59
+ /** Starts empty so the dialog can still render if the list never arrives. */
60
+ this.printers = [];
61
+ /** Starts empty so the dialog renders even if the list never loads. */
62
+ this.selectedPrinter = { id: '', location: '', name: '', is_queue: false };
59
63
  this.selectedPrinterConfig = {
60
64
  Default: {
61
65
  Color: '',
@@ -88,6 +92,8 @@ export class EzpPrinterSelection {
88
92
  trayname: '',
89
93
  PageRanges: '',
90
94
  };
95
+ /** True while a printer's capabilities are being fetched. */
96
+ this.loadingPrinterConfig = false;
91
97
  this.currentFileIndex = 0;
92
98
  this.totalFiles = 0;
93
99
  this.failedFiles = [];
@@ -278,8 +284,7 @@ export class EzpPrinterSelection {
278
284
  if (hubTimeout)
279
285
  clearTimeout(hubTimeout);
280
286
  }
281
- storage.setProperties(this.selectedProperties);
282
- storage.setPrinter(this.selectedPrinter);
287
+ this.rememberSelection();
283
288
  this.printStopped = false;
284
289
  };
285
290
  this.handleUserMenu = () => {
@@ -372,20 +377,45 @@ export class EzpPrinterSelection {
372
377
  break;
373
378
  }
374
379
  }
375
- getPropertiesFromLocalStorage() {
376
- const savedProperties = storage.getProperties();
377
- if (savedProperties) {
378
- this.selectedProperties = savedProperties;
379
- }
380
+ /** Print needs a printer with its capabilities in hand, no job in flight and
381
+ * a valid page range. The config matters: between picking a printer and its
382
+ * properties arriving, the selection is set but the properties still hold
383
+ * blank defaults, and printing then saves those as that printer's settings. */
384
+ get printDisabled() {
385
+ return (this.selectedPrinter.id === '' ||
386
+ this.loadingPrinterConfig ||
387
+ this.printProcessing ||
388
+ this.pageRangeInvalid);
389
+ }
390
+ /** Keep this printer and its settings for the next print. Stored per printer,
391
+ * so each one keeps its own and no setting follows the user to a printer
392
+ * that cannot do it. */
393
+ rememberSelection() {
394
+ if (!this.selectedPrinter.id)
395
+ return;
396
+ storage.setPrinterSettings(this.selectedPrinter.id, pickRememberedProperties(this.selectedProperties));
397
+ storage.setPrinter(this.selectedPrinter);
398
+ }
399
+ /**
400
+ * Decide which printer the dialog opens on: the one last printed to, or the
401
+ * user's only printer when there is nothing to choose between. Its settings
402
+ * follow once its config is in, since they can only be validated against the
403
+ * printer's capabilities.
404
+ */
405
+ selectInitialPrinter() {
406
+ var _a, _b;
380
407
  const savedPrinter = storage.getPrinter();
381
- if (savedPrinter) {
382
- if (this.printers.some((printer) => printer.id === savedPrinter.id)) {
383
- this.selectedPrinter = savedPrinter;
384
- }
385
- else {
386
- this.selectedPrinter = { id: '', location: '', name: '', is_queue: false };
387
- storage.clearSavedPrinter();
388
- }
408
+ const savedIsAvailable = (_a = this.printers) === null || _a === void 0 ? void 0 : _a.some((printer) => printer.id === (savedPrinter === null || savedPrinter === void 0 ? void 0 : savedPrinter.id));
409
+ // A printer the user no longer has must not stay preselected.
410
+ if (savedPrinter && !savedIsAvailable)
411
+ storage.clearSavedPrinter();
412
+ if (savedPrinter && savedIsAvailable) {
413
+ this.selectedPrinter = savedPrinter;
414
+ }
415
+ else if (((_b = this.printers) === null || _b === void 0 ? void 0 : _b.length) === 1) {
416
+ // Nothing to pick between: opening a dropdown with one entry in it is
417
+ // busywork, so start on it.
418
+ this.selectedPrinter = this.printers[0];
389
419
  }
390
420
  else {
391
421
  this.selectedPrinter = { id: '', location: '', name: '', is_queue: false };
@@ -404,17 +434,22 @@ export class EzpPrinterSelection {
404
434
  }
405
435
  async setSelectedProperties(eventDetails) {
406
436
  switch (eventDetails.type) {
407
- case 'printer':
408
- this.selectedPrinter.id = eventDetails.id;
409
- this.selectedPrinter.name = eventDetails.title;
410
- this.selectedPrinter.is_queue = eventDetails.is_queue;
411
- await this.printService
412
- .getPrinterProperties(authStore.state.accessToken, this.selectedPrinter.id)
413
- .then((data) => {
414
- this.selectedPrinterConfig = Object.assign(Object.assign({}, this.selectedPrinterConfig), data[0]);
415
- applyPrinterDefaults(this.selectedPrinterConfig, this.selectedProperties);
416
- });
437
+ case 'printer': {
438
+ const picked = this.printers.find((printer) => printer.id === eventDetails.id);
439
+ this.selectedPrinter = picked !== null && picked !== void 0 ? picked : {
440
+ id: eventDetails.id,
441
+ name: eventDetails.title,
442
+ location: '',
443
+ is_queue: eventDetails.is_queue,
444
+ };
445
+ // Same guard as the initial load. Without it a failed fetch left the
446
+ // printer selected while the config still described the *previous*
447
+ // one: Print stayed enabled, the job went out with settings nothing
448
+ // had checked against this printer, and those settings were then
449
+ // saved under its id and restored on later opens.
450
+ await this.loadSelectedPrinterConfig();
417
451
  break;
452
+ }
418
453
  case 'color':
419
454
  this.selectedProperties.color =
420
455
  eventDetails.title == i18next.t('printer_selection.color_color') ? true : false;
@@ -481,6 +516,55 @@ export class EzpPrinterSelection {
481
516
  onJobId: (jobId) => (printStore.state.jobID = jobId),
482
517
  });
483
518
  }
519
+ /**
520
+ * What a dropdown should show: the current selection — restored from the last
521
+ * print, or just made by the user — and otherwise the printer's own default.
522
+ *
523
+ * The fallbacks matter because a config may describe its default only by name
524
+ * (`Default.Duplex`, `Default.Paper`, `Default.Tray`) without flagging the
525
+ * matching entry, which is all these dropdowns had to go on before settings
526
+ * were remembered.
527
+ */
528
+ duplexPreSelection() {
529
+ var _a;
530
+ if (!this.selectedPrinter.id)
531
+ return null;
532
+ const mode = Number(this.selectedProperties.duplexmode);
533
+ if (mode)
534
+ return mode;
535
+ switch ((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Duplex) {
536
+ case 'duplex_simplex':
537
+ return i18next.t('printer_selection.duplex_none');
538
+ case 'duplex_vertical':
539
+ return i18next.t('printer_selection.duplex_long');
540
+ case 'duplex_horizontal':
541
+ return i18next.t('printer_selection.duplex_short');
542
+ default:
543
+ return null;
544
+ }
545
+ }
546
+ paperPreSelection() {
547
+ var _a, _b;
548
+ if (!this.selectedPrinter.id)
549
+ return null;
550
+ if (this.selectedProperties.paper)
551
+ return this.selectedProperties.paper;
552
+ const name = (_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Paper;
553
+ return name && ((_b = this.selectedPrinterConfig.PaperFormats) === null || _b === void 0 ? void 0 : _b.some((el) => el.Name.includes(name)))
554
+ ? name
555
+ : null;
556
+ }
557
+ trayPreSelection() {
558
+ var _a, _b;
559
+ if (!this.selectedPrinter.id)
560
+ return null;
561
+ if (this.selectedProperties.trayname)
562
+ return this.selectedProperties.trayname;
563
+ const name = (_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Tray;
564
+ return name && ((_b = this.selectedPrinterConfig.Trays) === null || _b === void 0 ? void 0 : _b.some((el) => el === null || el === void 0 ? void 0 : el.Name.includes(name)))
565
+ ? name
566
+ : null;
567
+ }
484
568
  setDefaultPaperFormat() {
485
569
  var _a, _b, _c, _d, _e;
486
570
  let format;
@@ -549,46 +633,105 @@ export class EzpPrinterSelection {
549
633
  this.unsubscribeLanguage = subscribeToLanguageChange(this);
550
634
  this.printService = new EzpPrintService(this.redirectURI, this.clientID);
551
635
  this.printService.registerFetchInterceptor();
552
- await this.getUserInfo();
553
- await this.printService
554
- .getPrinterList(authStore.state.accessToken)
555
- .then((printers) => {
556
- this.printers = printers;
557
- if (!(this.printers.length > 0)) {
636
+ try {
637
+ // A missing display name must not stop the user from printing.
638
+ await this.getUserInfo().catch(() => undefined);
639
+ let printersLoaded = false;
640
+ try {
641
+ const printers = await this.printService.getPrinterList(authStore.state.accessToken);
642
+ // A failed request still resolves: the API answers with a `{code,
643
+ // message}` body, which would survive `?? []` and break on `.some`.
644
+ if (!Array.isArray(printers))
645
+ throw new Error('Unexpected printer list payload');
646
+ this.printers = printers;
647
+ printersLoaded = true;
648
+ }
649
+ catch (_a) {
650
+ this.printers = [];
651
+ }
652
+ if (!printersLoaded) {
653
+ // Nothing is known about this user's printers, so the saved printer is
654
+ // left untouched: treating it as gone would clear it from storage and
655
+ // lose the settings that are only reachable through it.
558
656
  this.noPrinters = true;
559
657
  }
560
- });
561
- this.getPropertiesFromLocalStorage();
562
- // if printer is stored from previous print, get the config to enable property selection
563
- if (this.selectedPrinter.id != '') {
564
- await this.printService
565
- .getPrinterProperties(authStore.state.accessToken, this.selectedPrinter.id)
566
- .then((data) => {
567
- this.selectedPrinterConfig = data[0];
568
- applyPrinterDefaults(this.selectedPrinterConfig, this.selectedProperties);
569
- });
658
+ else {
659
+ if (this.printers.length === 0) {
660
+ this.noPrinters = true;
661
+ }
662
+ this.selectInitialPrinter();
663
+ // A printer carried over from a previous print, or the only one the
664
+ // user has, needs its config before its properties can be offered.
665
+ if (this.selectedPrinter.id != '') {
666
+ await this.loadSelectedPrinterConfig();
667
+ }
668
+ }
669
+ let supportedExtensionsLoaded = false;
670
+ try {
671
+ const response = await (await this.printService.getConfig(authStore.state.accessToken)).json();
672
+ printStore.state.supportedFileExtensions = response.System.FILEEXT;
673
+ supportedExtensionsLoaded = true;
674
+ }
675
+ catch (_b) {
676
+ // Handled below: without the list, nothing can be validated against it.
677
+ }
678
+ try {
679
+ await this.printService
680
+ .getAllPrinterProperties(authStore.state.accessToken)
681
+ .then((printerConfig) => {
682
+ this.printerConfig = printerConfig;
683
+ });
684
+ }
685
+ catch (_c) {
686
+ // Only used to describe other printers; the dialog works without it.
687
+ }
688
+ // Skipped when the list never arrived: every file would compare as
689
+ // unsupported and the user would be told their document cannot be
690
+ // printed when nothing is actually wrong with it.
691
+ if (supportedExtensionsLoaded && this.files && this.files.length > 0) {
692
+ // Validate all files
693
+ const validationPromises = this.files.map((file) => this.validateFileType(file.name));
694
+ const validationResults = await Promise.all(validationPromises);
695
+ const allValid = validationResults.every((valid) => valid);
696
+ this.notSupported = !allValid;
697
+ }
698
+ }
699
+ finally {
700
+ // Whatever failed above, the dialog has to become usable: the loading
701
+ // status carries no close button, so throwing out of here would strand
702
+ // the user on "Loading My Printers…" with no way back.
703
+ this.loading = false;
704
+ }
705
+ }
706
+ /**
707
+ * Fetch the selected printer's capabilities and restore its saved settings.
708
+ *
709
+ * A failure drops the selection rather than keeping a printer the dialog
710
+ * cannot describe: the options would stay disabled while Print stayed
711
+ * enabled, so the job would go out with properties nothing has verified.
712
+ * With no selection the user picks from the list, which fetches again.
713
+ */
714
+ async loadSelectedPrinterConfig() {
715
+ this.loadingPrinterConfig = true;
716
+ try {
717
+ const data = await this.printService.getPrinterProperties(authStore.state.accessToken, this.selectedPrinter.id);
718
+ // An empty list or an error body leaves nothing to configure from.
719
+ const config = data === null || data === void 0 ? void 0 : data[0];
720
+ if (!config)
721
+ throw new Error('No properties returned for the selected printer');
722
+ this.selectedPrinterConfig = config;
723
+ applySavedProperties(config, storage.getPrinterSettings(this.selectedPrinter.id), this.selectedProperties);
724
+ this.setPaperid();
570
725
  if (this.selectedProperties.paper === '') {
571
726
  this.setDefaultPaperFormat();
572
727
  }
573
728
  }
574
- await (await this.printService.getConfig(authStore.state.accessToken))
575
- .json()
576
- .then((response) => {
577
- printStore.state.supportedFileExtensions = response.System.FILEEXT;
578
- });
579
- await this.printService
580
- .getAllPrinterProperties(authStore.state.accessToken)
581
- .then((printerConfig) => {
582
- this.printerConfig = printerConfig;
583
- });
584
- if (this.files && this.files.length > 0) {
585
- // Validate all files
586
- const validationPromises = this.files.map((file) => this.validateFileType(file.name));
587
- const validationResults = await Promise.all(validationPromises);
588
- const allValid = validationResults.every((valid) => valid);
589
- this.notSupported = !allValid;
729
+ catch (_a) {
730
+ this.selectedPrinter = { id: '', location: '', name: '', is_queue: false };
731
+ }
732
+ finally {
733
+ this.loadingPrinterConfig = false;
590
734
  }
591
- this.loading = false;
592
735
  }
593
736
  disconnectedCallback() {
594
737
  var _a;
@@ -674,14 +817,14 @@ export class EzpPrinterSelection {
674
817
  return null;
675
818
  }
676
819
  render() {
677
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
820
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
678
821
  const fileNames = this.files && this.files.length > 0
679
822
  ? this.files.map((file) => file.name)
680
823
  : this.filename
681
824
  ? [this.filename]
682
825
  : [];
683
826
  const fileCount = fileNames.length;
684
- return this.loading ? (h("ezp-status", { processing: true, description: i18next.t('printer_selection.loading'), instance: "loading" })) : (h(Host, { class: { seamless: this.seamless } }, h("div", { id: "box", "data-backdrop-surface": true }, !this.printStopped && this.renderStatus(), !this.hideheader && (h("div", { id: "header" }, h("div", { id: "title" }, h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') }), !this.notSupported && fileCount > 0 && (h("span", { id: "files-badge" }, i18next.t('printer_selection.file_count', { count: fileCount })))), h("div", { id: "header-actions" }, !this.hidemenu && (h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu })), h("ezp-icon-button", { level: "tertiary", icon: "close", id: "close", type: "button", onClick: this.handleCancel })))), h("div", { id: "body" }, !this.notSupported && fileNames.length > 0 && (h("div", { id: "files-card" }, fileNames.map((name, index) => (h("div", { class: "file-row", key: index }, h("ezp-icon", { name: "file", class: "file-row-icon" }), h("ezp-label", { ellipsis: true, text: name })))))), h("div", { id: "printer-card" }, h("ezp-select", { id: "printer", label: i18next.t('printer_selection.printer'), icon: "printer", placeholder: this.printers.length > 0
827
+ return this.loading ? (h("ezp-status", { processing: true, description: i18next.t('printer_selection.loading'), instance: "loading" })) : (h(Host, { class: { seamless: this.seamless } }, h("div", { id: "box", "data-backdrop-surface": true }, !this.printStopped && this.renderStatus(), !this.hideheader && (h("div", { id: "header" }, h("div", { id: "title" }, h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') }), !this.notSupported && fileCount > 0 && (h("span", { id: "files-badge" }, i18next.t('printer_selection.file_count', { count: fileCount })))), h("div", { id: "header-actions" }, !this.hidemenu && (h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu })), h("ezp-icon-button", { level: "tertiary", icon: "close", id: "close", type: "button", onClick: this.handleCancel })))), h("div", { id: "body" }, !this.notSupported && fileNames.length > 0 && (h("div", { id: "files-card" }, fileNames.map((name, index) => (h("div", { class: "file-row", key: index }, h("ezp-icon", { name: "file", class: "file-row-icon" }), h("ezp-file-name", { name: name, placement: index === 0 ? 'bottom' : 'top' })))))), h("ezp-label", { id: "printer-caption", level: "tertiary", weight: "heavy", text: i18next.t('printer_selection.printer') }), h("div", { id: "printer-card" }, h("ezp-select", { id: "printer", label: i18next.t('printer_selection.printer'), icon: "printer", placeholder: this.printers.length > 0
685
828
  ? i18next.t('printer_selection.select_printer')
686
829
  : i18next.t('printer_selection.no_printers'), toggleFlow: "vertical", optionFlow: "vertical", options: this.printers.map((printer) => ({
687
830
  id: printer.id,
@@ -689,60 +832,48 @@ export class EzpPrinterSelection {
689
832
  meta: printer.location !== '' ? printer.location : '',
690
833
  type: 'printer',
691
834
  is_queue: printer.is_queue,
692
- })), preSelected: this.selectedPrinter.id ? this.selectedPrinter.name : null, disabled: !(this.printers.length > 0) }), h("button", { id: "print", type: "button", disabled: this.selectedPrinter.id === '' || this.printProcessing || this.pageRangeInvalid, onClick: this.handlePrint, ref: (button) => (this.printButton = button) }, h("ezp-icon", { name: "printer" }), h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') }))), h("div", { id: "options" }, h("ezp-stepper", { label: i18next.t('printer_selection.copies'), icon: "copies" }), h("ezp-select", { label: i18next.t('printer_selection.color'), icon: "color", placeholder: i18next.t('printer_selection.select_color'), toggleFlow: "horizontal", options: (_a = this.ColorOptions) === null || _a === void 0 ? void 0 : _a.map((option) => ({
835
+ })), preSelected: this.selectedPrinter.id ? this.selectedPrinter.name : null, disabled: !(this.printers.length > 0) })), h("div", { id: "options" }, h("ezp-stepper", { label: i18next.t('printer_selection.copies') }), h("ezp-select", { label: i18next.t('printer_selection.color'), placeholder: i18next.t('printer_selection.select_color'), toggleFlow: "horizontal", options: (_a = this.ColorOptions) === null || _a === void 0 ? void 0 : _a.map((option) => ({
693
836
  id: option.id,
694
837
  title: option.title,
695
838
  meta: '',
696
839
  type: 'color',
697
- })), preSelected: this.selectedPrinter.id && ((_b = this.selectedPrinterConfig.Default) === null || _b === void 0 ? void 0 : _b.Color) == 'color'
698
- ? i18next.t('printer_selection.color_color')
699
- : i18next.t('printer_selection.color_grayscale'), disabled: !this.selectedPrinterConfig.ColorSupported }), h("ezp-select", { label: i18next.t('printer_selection.duplex'), icon: "duplex", placeholder: i18next.t('printer_selection.select_duplex'), toggleFlow: "horizontal", options: (_c = this.duplexOptions) === null || _c === void 0 ? void 0 : _c.map((option) => ({
840
+ })), preSelected: this.selectedPrinter.id
841
+ ? this.selectedProperties.color
842
+ ? i18next.t('printer_selection.color_color')
843
+ : i18next.t('printer_selection.color_grayscale')
844
+ : null, disabled: !this.selectedPrinterConfig.ColorSupported }), h("ezp-select", { label: i18next.t('printer_selection.duplex'), placeholder: i18next.t('printer_selection.select_duplex'), toggleFlow: "horizontal", options: (_b = this.duplexOptions) === null || _b === void 0 ? void 0 : _b.map((option) => ({
700
845
  id: option.id,
701
846
  title: option.title,
702
847
  meta: '',
703
848
  type: 'duplex',
704
- })), preSelected: this.selectedPrinter.id &&
705
- ((_d = this.selectedPrinterConfig.Default) === null || _d === void 0 ? void 0 : _d.Duplex) == 'duplex_simplex'
706
- ? i18next.t('printer_selection.duplex_none')
707
- : ((_e = this.selectedPrinterConfig.Default) === null || _e === void 0 ? void 0 : _e.Duplex) == 'duplex_vertical'
708
- ? i18next.t('printer_selection.duplex_long')
709
- : ((_f = this.selectedPrinterConfig.Default) === null || _f === void 0 ? void 0 : _f.Duplex) == 'duplex_horizontal'
710
- ? i18next.t('printer_selection.duplex_short')
711
- : null, disabled: !this.selectedPrinterConfig.DuplexSupported }), h("ezp-select", { label: i18next.t('printer_selection.size'), icon: "size", placeholder: i18next.t('printer_selection.select_size'), toggleFlow: "horizontal", optionFlow: "horizontal", options: this.selectedPrinterConfig.PaperFormats &&
849
+ })), preSelected: this.duplexPreSelection(), disabled: !this.selectedPrinterConfig.DuplexSupported }), h("ezp-select", { label: i18next.t('printer_selection.size'), placeholder: i18next.t('printer_selection.select_size'), toggleFlow: "horizontal", optionFlow: "horizontal", options: this.selectedPrinterConfig.PaperFormats &&
712
850
  this.selectedPrinterConfig.PaperFormats.map((format) => ({
713
851
  id: format.Id,
714
852
  title: format.Name,
715
853
  meta: `${format.XRes} x ${format.YRes}`,
716
854
  type: 'format',
717
- })), preSelected: this.selectedPrinter.id &&
718
- ((_g = this.selectedPrinterConfig.PaperFormats) === null || _g === void 0 ? void 0 : _g.find((el) => { var _a; return el.Name.includes((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Paper); }))
719
- ? (_h = this.selectedPrinterConfig.Default) === null || _h === void 0 ? void 0 : _h.Paper
720
- : null, disabled: !(((_k = (_j = this.selectedPrinterConfig.PaperFormats) === null || _j === void 0 ? void 0 : _j.length) !== null && _k !== void 0 ? _k : 0) > 0) }), this.paperid == PAPER_ID ? (h(Fragment, null, h("ezp-input", { icon: "width", suffix: "mm", value: this.selectedProperties.paperwidth, eventType: "width", type: "number", label: i18next.t('printer_selection.width') }), h("ezp-input", { icon: "height", suffix: "mm", value: this.selectedProperties.paperlength, eventType: "length", type: "number", label: i18next.t('printer_selection.length') }))) : null, h("ezp-select", { label: i18next.t('printer_selection.orientation'), icon: "orientation", placeholder: i18next.t('printer_selection.select_orientation'), toggleFlow: "horizontal", options: (_l = this.selectedPrinterConfig.OrientationsSupported) === null || _l === void 0 ? void 0 : _l.map((orientation, index) => ({
855
+ })), preSelected: this.paperPreSelection(), disabled: !(((_d = (_c = this.selectedPrinterConfig.PaperFormats) === null || _c === void 0 ? void 0 : _c.length) !== null && _d !== void 0 ? _d : 0) > 0) }), this.paperid == PAPER_ID ? (h(Fragment, null, h("ezp-input", { suffix: "mm", value: this.selectedProperties.paperwidth, eventType: "width", type: "number", label: i18next.t('printer_selection.width') }), h("ezp-input", { suffix: "mm", value: this.selectedProperties.paperlength, eventType: "length", type: "number", label: i18next.t('printer_selection.length') }))) : null, h("ezp-select", { label: i18next.t('printer_selection.orientation'), placeholder: i18next.t('printer_selection.select_orientation'), toggleFlow: "horizontal", options: (_e = this.selectedPrinterConfig.OrientationsSupported) === null || _e === void 0 ? void 0 : _e.map((orientation, index) => ({
721
856
  id: index + 1,
722
857
  title: i18next.t(`printer_selection.orientation_${orientation}`),
723
858
  meta: '',
724
859
  type: 'orientation',
725
- })), preSelected: this.selectedPrinter.id ? this.selectedProperties.orientation : null, disabled: !(((_o = (_m = this.selectedPrinterConfig.OrientationsSupported) === null || _m === void 0 ? void 0 : _m.length) !== null && _o !== void 0 ? _o : 0) > 0) }), h("ezp-select", { label: i18next.t('printer_selection.quality'), icon: "quality", placeholder: i18next.t('printer_selection.select_quality'), toggleFlow: "horizontal", options: (_p = this.selectedPrinterConfig.Resolutions) === null || _p === void 0 ? void 0 : _p.map((option, index) => ({
860
+ })), preSelected: this.selectedPrinter.id ? this.selectedProperties.orientation : null, disabled: !(((_g = (_f = this.selectedPrinterConfig.OrientationsSupported) === null || _f === void 0 ? void 0 : _f.length) !== null && _g !== void 0 ? _g : 0) > 0) }), h("ezp-select", { label: i18next.t('printer_selection.quality'), placeholder: i18next.t('printer_selection.select_quality'), toggleFlow: "horizontal", options: (_h = this.selectedPrinterConfig.Resolutions) === null || _h === void 0 ? void 0 : _h.map((option, index) => ({
726
861
  id: index,
727
862
  title: option,
728
863
  meta: '',
729
864
  type: 'quality',
730
- })), preSelected: this.selectedPrinter.id &&
731
- ((_q = this.selectedPrinterConfig.Resolutions) === null || _q === void 0 ? void 0 : _q.includes((_r = this.selectedPrinterConfig.Default) === null || _r === void 0 ? void 0 : _r.Resolution))
732
- ? (_s = this.selectedPrinterConfig.Default) === null || _s === void 0 ? void 0 : _s.Resolution
733
- : null, disabled: !(((_u = (_t = this.selectedPrinterConfig.Resolutions) === null || _t === void 0 ? void 0 : _t.length) !== null && _u !== void 0 ? _u : 0) > 0) }), this.selectedPrinterConfig.Trays &&
865
+ })), preSelected: this.selectedPrinter.id
866
+ ? this.selectedProperties.resolution || null
867
+ : null, disabled: !(((_k = (_j = this.selectedPrinterConfig.Resolutions) === null || _j === void 0 ? void 0 : _j.length) !== null && _k !== void 0 ? _k : 0) > 0) }), this.selectedPrinterConfig.Trays &&
734
868
  this.selectedPrinterConfig.Trays.length >= 1 &&
735
- this.selectedPrinterConfig.Trays[0] != null ? (h("ezp-select", { label: i18next.t('printer_selection.trays'), icon: "trays", placeholder: i18next.t('printer_selection.select_trays'), toggleFlow: "horizontal", optionFlow: "horizontal", options: this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 1
869
+ this.selectedPrinterConfig.Trays[0] != null ? (h("ezp-select", { label: i18next.t('printer_selection.trays'), placeholder: i18next.t('printer_selection.select_trays'), toggleFlow: "horizontal", optionFlow: "horizontal", options: this.selectedPrinterConfig.Trays && this.selectedPrinterConfig.Trays.length >= 1
736
870
  ? this.selectedPrinterConfig.Trays.map((trays) => ({
737
871
  title: trays.Name,
738
872
  id: trays.Index,
739
873
  meta: '',
740
874
  type: 'tray',
741
875
  }))
742
- : undefined, preSelected: this.selectedPrinter.id &&
743
- ((_v = this.selectedPrinterConfig.Trays) === null || _v === void 0 ? void 0 : _v.find((el) => { var _a; return el.Name.includes((_a = this.selectedPrinterConfig.Default) === null || _a === void 0 ? void 0 : _a.Tray); }))
744
- ? (_w = this.selectedPrinterConfig.Default) === null || _w === void 0 ? void 0 : _w.Tray
745
- : null })) : null, h("ezp-input", { icon: "paper_range", suffix: "", placeholder: "1-2,4-5,8", value: this.selectedProperties.PageRanges, eventType: "paper_ranges", type: "text", label: i18next.t('printer_selection.page_ranges') }))), h("div", { id: "footer" }, h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel'), class: "action", id: "cancel" })), !this.hidemenu && h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
876
+ : undefined, preSelected: this.trayPreSelection() })) : null, h("ezp-input", { suffix: "", placeholder: "1-2,4-5,8", value: this.selectedProperties.PageRanges, eventType: "paper_ranges", type: "text", label: i18next.t('printer_selection.page_ranges') }))), h("div", { id: "footer" }, h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel'), class: "action", id: "cancel" }), h("button", { id: "print", type: "button", disabled: this.printDisabled, onClick: this.handlePrint, ref: (button) => (this.printButton = button) }, h("ezp-icon", { name: "printer" }), h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') }))), !this.hidemenu && h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
746
877
  }
747
878
  static get is() { return "ezp-printer-selection"; }
748
879
  static get encapsulation() { return "shadow"; }
@@ -976,6 +1107,7 @@ export class EzpPrinterSelection {
976
1107
  "printerConfig": {},
977
1108
  "selectedPrinterConfig": {},
978
1109
  "selectedProperties": {},
1110
+ "loadingPrinterConfig": {},
979
1111
  "paperid": {},
980
1112
  "currentFileIndex": {},
981
1113
  "totalFiles": {},
@@ -341,7 +341,7 @@ export class EzpPrinting {
341
341
  *
342
342
  */
343
343
  render() {
344
- return (h(Host, { key: '8eaeae452fb60e1c15265cf970dddf8767e4c849', class: `${userStore.state.theme} ${userStore.state.appearance === 'system'
344
+ return (h(Host, { key: '988a7acf819e139fe6d103b122bf9181e848be82', class: `${userStore.state.theme} ${userStore.state.appearance === 'system'
345
345
  ? this.systemAppearance
346
346
  : userStore.state.appearance} ${this.seamless ? 'seamless' : ''}` }, this.trigger === 'custom' ? (h("slot", null)) : this.trigger === 'file' ? (h("ezp-upload", null)) : (this.trigger === 'button' && (h("ezp-icon-button", { id: "print-trigger", icon: "printer", slot: "trigger", type: "button", onClick: () => this.open() }))), this.authOpen ? (h("ezp-auth", { clientID: this.clientid, redirectURI: this.redirecturi, hidelogin: this.hidelogin, trigger: this.trigger, code: this.code })) : this.printOpen ? (h("ezp-printer-selection", { clientID: this.clientid, redirectURI: this.redirecturi, filename: this.filename, fileurl: this.fileurl, filetype: this.filetype, fileid: this.fileid, files: this.files, hidemenu: this.hidemenu, hideheader: this.hideheader, seamless: this.seamless })) : this.noDocumentOpen ? (h("ezp-dialog", { heading: i18next.t('no_document_dialog.heading'), description: i18next.t('no_document_dialog.description'), action: i18next.t('no_document_dialog.action'), iconName: "question-mark", instance: "no-document-selected" })) : null));
347
347
  }
@@ -5,11 +5,6 @@
5
5
  */
6
6
  :host {
7
7
  --ezp-select-duration: var(--ezp-duration-3);
8
- --ezp-badge-gradient: linear-gradient(
9
- 135deg,
10
- color-mix(in srgb, var(--ezp-theme-solid), white 14%) 0%,
11
- color-mix(in srgb, var(--ezp-theme-solid), black 22%) 100%
12
- );
13
8
  display: block;
14
9
  height: var(--ezp-select-toggle-height);
15
10
  position: relative;
@@ -56,12 +51,11 @@
56
51
  --ezp-select-option-height: 52px;
57
52
  }
58
53
 
59
- /* The printer selector reads as a solid, prominent badge (screen 3). */
54
+ /* The printer selector reads as a tinted, rounded badge (screen 3). */
60
55
  :host(.toggle-vertical.has-icon) {
61
- --ezp-select-badge-background: var(--ezp-badge-gradient);
62
- --ezp-select-badge-color: var(--ezp-white-100);
63
- --ezp-select-badge-height: 44px;
64
- --ezp-select-badge-width: 44px;
56
+ --ezp-select-badge-borderRadius: 10px;
57
+ --ezp-select-badge-height: 40px;
58
+ --ezp-select-badge-width: 40px;
65
59
  --ezp-select-label-textTransform: uppercase;
66
60
  --ezp-select-label-letterSpacing: 0.08em;
67
61
  --ezp-select-label-fontSize: 11px;
@@ -124,7 +118,7 @@
124
118
 
125
119
  #icon {
126
120
  --ezp-icon-background: var(--ezp-select-badge-background, var(--ezp-theme-translucent));
127
- --ezp-icon-borderRadius: 50%;
121
+ --ezp-icon-borderRadius: var(--ezp-select-badge-borderRadius, 50%);
128
122
  --ezp-icon-height: var(--ezp-select-badge-height, 40px);
129
123
  --ezp-icon-width: var(--ezp-select-badge-width, 40px);
130
124
  align-self: center;
@@ -137,6 +131,9 @@
137
131
  --ezp-label-letterSpacing: var(--ezp-select-label-letterSpacing, normal);
138
132
  align-self: var(--ezp-select-label-alignSelf, auto);
139
133
  color: var(--ezp-select-label-color, var(--ezp-core-foreground-primary));
134
+ /* Hidden when the consumer captions the select from the outside; the label
135
+ prop still names the combobox for assistive tech. */
136
+ display: var(--ezp-select-label-display, block);
140
137
  grid-area: label;
141
138
  text-transform: var(--ezp-select-label-textTransform, none);
142
139
  }
@@ -147,7 +144,7 @@
147
144
  align-self: var(--ezp-select-value-alignSelf, auto);
148
145
  color: var(--ezp-select-value-color, var(--value-color, var(--ezp-core-foreground-secondary)));
149
146
  grid-area: value;
150
- text-align: right;
147
+ text-align: var(--ezp-select-value-textAlign, right);
151
148
  }
152
149
 
153
150
  #accessory {