@ezeep/ezeep-js 1.0.272 → 1.0.277

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 (120) hide show
  1. package/dist/cjs/{app-globals-D7ISNeUi.js → app-globals-L_3XPZxT.js} +7 -1
  2. package/dist/cjs/ezeep.cjs.js +4 -4
  3. package/dist/cjs/ezp-auth_15.cjs.entry.js +7240 -3678
  4. package/dist/cjs/{index-dv_gozsq.js → index-DM5v_sge.js} +3 -2
  5. package/dist/cjs/loader.cjs.js +3 -3
  6. package/dist/collection/collection-manifest.json +1 -1
  7. package/dist/collection/components/ezp-auth/ezp-auth.css +1 -1
  8. package/dist/collection/components/ezp-auth/ezp-auth.js +56 -15
  9. package/dist/collection/components/ezp-backdrop/ezp-backdrop.js +5 -5
  10. package/dist/collection/components/ezp-dialog/ezp-dialog.js +85 -13
  11. package/dist/collection/components/ezp-icon/ezp-icon.js +7 -2
  12. package/dist/collection/components/ezp-icon-button/ezp-icon-button.js +4 -1
  13. package/dist/collection/components/ezp-input/ezp-input.css +9 -12
  14. package/dist/collection/components/ezp-input/ezp-input.js +15 -13
  15. package/dist/collection/components/ezp-printer-selection/ezp-printer-selection.js +207 -323
  16. package/dist/collection/components/ezp-printing/ezp-printing.css +9 -9
  17. package/dist/collection/components/ezp-printing/ezp-printing.js +107 -35
  18. package/dist/collection/components/ezp-select/ezp-select.css +2 -2
  19. package/dist/collection/components/ezp-select/ezp-select.js +92 -13
  20. package/dist/collection/components/ezp-status/ezp-status.js +23 -13
  21. package/dist/collection/components/ezp-stepper/ezp-stepper.js +13 -6
  22. package/dist/collection/components/ezp-text-button/ezp-text-button.js +1 -1
  23. package/dist/collection/components/ezp-upload/ezp-upload.css +9 -9
  24. package/dist/collection/components/ezp-upload/ezp-upload.js +26 -8
  25. package/dist/collection/components/ezp-user-menu/ezp-user-menu.css +2 -1
  26. package/dist/collection/components/ezp-user-menu/ezp-user-menu.js +15 -15
  27. package/dist/collection/services/auth.js +37 -36
  28. package/dist/collection/services/http.js +11 -0
  29. package/dist/collection/services/print-job.js +72 -0
  30. package/dist/collection/services/print.js +21 -69
  31. package/dist/collection/services/user.js +2 -9
  32. package/dist/collection/shared/constants.js +55 -0
  33. package/dist/collection/shared/global.js +7 -1
  34. package/dist/collection/shared/storage.js +71 -0
  35. package/dist/collection/types/shared/types.d.ts +40 -9
  36. package/dist/collection/utils/printer.js +68 -0
  37. package/dist/collection/utils/utils.js +24 -9
  38. package/dist/components/auth.js +1 -1
  39. package/dist/components/ezp-auth2.js +1 -1
  40. package/dist/components/ezp-backdrop2.js +1 -1
  41. package/dist/components/ezp-dialog2.js +1 -1
  42. package/dist/components/ezp-icon-button2.js +1 -1
  43. package/dist/components/ezp-icon2.js +1 -1
  44. package/dist/components/ezp-input2.js +1 -1
  45. package/dist/components/ezp-printer-selection2.js +1 -1
  46. package/dist/components/ezp-printing.js +1 -1
  47. package/dist/components/ezp-select2.js +1 -1
  48. package/dist/components/ezp-status2.js +1 -1
  49. package/dist/components/ezp-stepper2.js +1 -1
  50. package/dist/components/ezp-text-button2.js +1 -1
  51. package/dist/components/ezp-upload2.js +1 -1
  52. package/dist/components/ezp-user-menu.js +1 -1
  53. package/dist/components/ezp-user-menu2.js +1 -1
  54. package/dist/components/index.js +1 -1
  55. package/dist/components/utils.js +1 -0
  56. package/dist/directives/proxies.ts +65 -42
  57. package/dist/esm/{app-globals-CpP67t2l.js → app-globals-C0WTlb31.js} +7 -1
  58. package/dist/esm/ezeep.js +5 -5
  59. package/dist/esm/ezp-auth_15.entry.js +7240 -3678
  60. package/dist/esm/{index-BTfWEHH9.js → index-BButrLnB.js} +3 -3
  61. package/dist/esm/loader.js +4 -4
  62. package/dist/esm-es5/{app-globals-CpP67t2l.js → app-globals-C0WTlb31.js} +1 -1
  63. package/dist/esm-es5/ezeep.js +1 -1
  64. package/dist/esm-es5/ezp-auth_15.entry.js +2 -2
  65. package/dist/esm-es5/{index-BTfWEHH9.js → index-BButrLnB.js} +3 -3
  66. package/dist/esm-es5/loader.js +1 -1
  67. package/dist/ezeep/ezeep.esm.js +1 -1
  68. package/dist/ezeep/ezeep.js +1 -1
  69. package/dist/ezeep/p-644e48a0.system.entry.js +7 -0
  70. package/dist/ezeep/{p-BTfWEHH9.js → p-BButrLnB.js} +2 -2
  71. package/dist/ezeep/{p-CpP67t2l.js → p-C0WTlb31.js} +1 -1
  72. package/{www/build/p-DhXN1yGM.system.js → dist/ezeep/p-CYpousxy.system.js} +2 -2
  73. package/dist/ezeep/{p-5ok9OZMg.system.js → p-D4aCr1OK.system.js} +1 -1
  74. package/dist/ezeep/{p-CfQRcOh8.system.js → p-DCznw2Ee.system.js} +1 -1
  75. package/dist/ezeep/p-ebd2beda.entry.js +1 -0
  76. package/dist/ezeep/types/shared/types.d.ts +40 -9
  77. package/dist/types/components/ezp-auth/ezp-auth.d.ts +8 -5
  78. package/dist/types/components/ezp-backdrop/ezp-backdrop.d.ts +2 -2
  79. package/dist/types/components/ezp-dialog/ezp-dialog.d.ts +14 -3
  80. package/dist/types/components/ezp-input/ezp-input.d.ts +17 -14
  81. package/dist/types/components/ezp-printer-selection/ezp-printer-selection.d.ts +23 -7
  82. package/dist/types/components/ezp-printing/ezp-printing.d.ts +25 -2
  83. package/dist/types/components/ezp-select/ezp-select.d.ts +10 -4
  84. package/dist/types/components/ezp-status/ezp-status.d.ts +6 -4
  85. package/dist/types/components/ezp-stepper/ezp-stepper.d.ts +1 -1
  86. package/dist/types/components/ezp-upload/ezp-upload.d.ts +4 -1
  87. package/dist/types/components/ezp-user-menu/ezp-user-menu.d.ts +5 -2
  88. package/dist/types/components.d.ts +38 -38
  89. package/dist/types/services/auth.d.ts +10 -0
  90. package/dist/types/services/http.d.ts +4 -0
  91. package/dist/types/services/print-job.d.ts +48 -0
  92. package/dist/types/services/print.d.ts +10 -9
  93. package/dist/types/services/user.d.ts +13 -2
  94. package/dist/types/shared/constants.d.ts +51 -0
  95. package/dist/types/shared/storage.d.ts +24 -0
  96. package/dist/types/shared/types.d.ts +40 -9
  97. package/dist/types/stencil-public-runtime.d.ts +1 -0
  98. package/dist/types/utils/printer.d.ts +22 -0
  99. package/dist/types/utils/utils.d.ts +22 -10
  100. package/package.json +30 -18
  101. package/readme.md +1 -0
  102. package/www/build/ezeep.esm.js +1 -1
  103. package/www/build/ezeep.js +1 -1
  104. package/www/build/p-644e48a0.system.entry.js +7 -0
  105. package/www/build/{p-BTfWEHH9.js → p-BButrLnB.js} +2 -2
  106. package/www/build/{p-CpP67t2l.js → p-C0WTlb31.js} +1 -1
  107. package/{dist/ezeep/p-DhXN1yGM.system.js → www/build/p-CYpousxy.system.js} +2 -2
  108. package/www/build/{p-5ok9OZMg.system.js → p-D4aCr1OK.system.js} +1 -1
  109. package/www/build/{p-CfQRcOh8.system.js → p-DCznw2Ee.system.js} +1 -1
  110. package/www/build/p-c7252f1c.js +1 -0
  111. package/www/build/p-ebd2beda.entry.js +1 -0
  112. package/www/data/locales/de.json +1 -0
  113. package/www/data/locales/en.json +1 -0
  114. package/www/index.html +2 -5
  115. package/dist/components/i18next.js +0 -1
  116. package/dist/ezeep/p-2177b8f4.system.entry.js +0 -7
  117. package/dist/ezeep/p-de8f6583.entry.js +0 -1
  118. package/www/build/p-2177b8f4.system.entry.js +0 -7
  119. package/www/build/p-256870db.js +0 -1
  120. package/www/build/p-de8f6583.entry.js +0 -1
@@ -41,7 +41,7 @@ export class EzpStepper {
41
41
  this.handleInput = () => {
42
42
  if (!this.input)
43
43
  return;
44
- let inputString = this.input.value.trim();
44
+ const inputString = this.input.value.trim();
45
45
  // If the input is empty, set the value to the minimum
46
46
  if (inputString === '') {
47
47
  this.value = this.min;
@@ -74,7 +74,8 @@ export class EzpStepper {
74
74
  this.input.value = inputValue.toString();
75
75
  };
76
76
  this.setFocus = () => {
77
- this.input.focus();
77
+ var _a;
78
+ (_a = this.input) === null || _a === void 0 ? void 0 : _a.focus();
78
79
  };
79
80
  this.handleBlur = () => {
80
81
  this.focused = false;
@@ -85,7 +86,8 @@ export class EzpStepper {
85
86
  this.handleKeyDown = (event) => {
86
87
  // If key is allowed or a Ctrl/Cmd combination, do nothing
87
88
  if (EzpStepper.ALLOWED_KEYS.includes(event.key) ||
88
- ((event.ctrlKey || event.metaKey) && EzpStepper.CTRL_CMD_KEYS.includes(event.key.toLowerCase()))) {
89
+ ((event.ctrlKey || event.metaKey) &&
90
+ EzpStepper.CTRL_CMD_KEYS.includes(event.key.toLowerCase()))) {
89
91
  return;
90
92
  }
91
93
  // If the key is not a digit, prevent default behavior (block input)
@@ -112,6 +114,11 @@ export class EzpStepper {
112
114
  *
113
115
  */
114
116
  componentWillLoad() {
117
+ // The default value (1) can sit below a higher `min`; clamp it on load so
118
+ // the stepper never starts in an out-of-range state.
119
+ if (this.min !== undefined && this.value < this.min) {
120
+ this.value = this.min;
121
+ }
115
122
  this.watchValue();
116
123
  }
117
124
  /**
@@ -120,7 +127,7 @@ export class EzpStepper {
120
127
  *
121
128
  */
122
129
  render() {
123
- return (h(Host, { key: 'c38bfbfc2ec2a7151bb04240c2eee1b8ad3ec613', class: `${this.focused ? 'focused' : ''} ${this.icon ? 'has-icon' : ''}` }, h("div", { key: '0f4546db4e6004561114c6073672160c4cebe01b', id: "toggle", onClick: this.setFocus }), this.icon ? h("ezp-icon", { id: "icon", name: this.icon }) : null, h("ezp-label", { key: '74bd616d5336895a33b54668c3641e23267427d8', id: "label", noWrap: true, text: this.label }), h("input", { key: '612cbac350e67e5915e3bd2b68beef61d87d65f4', id: "input", type: "number", ref: (input) => (this.input = input), min: this.min.toString(), max: this.max !== undefined ? this.max.toString() : undefined, value: this.value.toString(), onInput: this.handleInput, onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur }), h("div", { key: '7b20d44d0fef4c6d206acba4ba7a5b545cefe437', class: "buttons" }, h("button", { key: 'b71ead9b92eef6e56638073d5e9e39e0f3460618', class: "button", disabled: !this.canDecrease, onClick: this.handleDecrease }, h("ezp-icon", { key: 'd2fc6589d1044644da2c40f85ad67f5a4c1aecdd', name: "minus" })), h("button", { key: 'ea7d7c6f9064c03d3a8ea2434fe26dd7f964b4d4', class: "button", disabled: !this.canIncrease, onClick: this.handleIncrease }, h("ezp-icon", { key: '5c4d5c89e329a7af4bf7cc5afd0b4b6f97ff4b3b', name: "plus" })))));
130
+ return (h(Host, { key: 'cdb3aa8969719def6546f35fac5aa35b47c1f94b', class: `${this.focused ? 'focused' : ''} ${this.icon ? 'has-icon' : ''}` }, h("div", { key: '4b0edee6d156edc6e8f79eb0639be4203b12fc5b', id: "toggle", onClick: this.setFocus }), this.icon ? h("ezp-icon", { id: "icon", name: this.icon }) : null, h("ezp-label", { key: '4fb1d96f12933ee37c05afafee8f313d77a06e9e', id: "label", noWrap: true, text: this.label }), h("input", { key: '75a462106e4fc3f7b303178a52dd41d6b9145e1c', id: "input", type: "number", ref: (input) => (this.input = input), min: this.min.toString(), max: this.max !== undefined ? this.max.toString() : undefined, value: this.value.toString(), "aria-label": this.label, onInput: this.handleInput, onKeyDown: this.handleKeyDown, onFocus: this.handleFocus, onBlur: this.handleBlur }), h("div", { key: 'a42c04e3098ec7a96d871c1e7eb12d59189ce540', class: "buttons" }, h("button", { key: '05b28026fc46ed0b14f6617880a252bf83137fa5', class: "button", type: "button", "aria-label": `Decrease ${this.label}`, disabled: !this.canDecrease, onClick: this.handleDecrease }, h("ezp-icon", { key: '66b31a81d7e7836442d342991c6a4ec3749db8ce', name: "minus" })), h("button", { key: '9380b02ebd91ea0cdd26dce6f85ccb7c825d0fe2', class: "button", type: "button", "aria-label": `Increase ${this.label}`, disabled: !this.canIncrease, onClick: this.handleIncrease }, h("ezp-icon", { key: 'b85c276634c61557a475f2951531d9ff0ff78435', name: "plus" })))));
124
131
  }
125
132
  static get is() { return "ezp-stepper"; }
126
133
  static get encapsulation() { return "shadow"; }
@@ -243,8 +250,8 @@ export class EzpStepper {
243
250
  "text": "\nEvents"
244
251
  },
245
252
  "complexType": {
246
- "original": "any",
247
- "resolved": "any",
253
+ "original": "number",
254
+ "resolved": "number",
248
255
  "references": {}
249
256
  }
250
257
  }];
@@ -31,7 +31,7 @@ export class EzpTextButton {
31
31
  href: this.href,
32
32
  target: this.blank ? '_blank' : '_self',
33
33
  };
34
- return (h(Host, { key: '24c7d7fe23395513fccfc8fc94fbc552a1763148', class: `${this.level}` }, h(TagType, Object.assign({ key: 'f983601cdd0b0312850826422a18bfaa3c16a87b', id: "button" }, attributes), h("ezp-label", { key: '63de52e9734a621baa3ec51c27429c049c7aab93', id: "label", weight: "heavy", text: this.label, level: this.small ? 'tertiary' : 'secondary' }))));
34
+ return (h(Host, { key: '24c7d7fe23395513fccfc8fc94fbc552a1763148', class: `${this.level}` }, h(TagType, Object.assign({ key: 'eded3e128d17f4b5bf5a29b01e51f4a2ba1d6d74', id: "button", "aria-label": this.label }, attributes), h("ezp-label", { key: '4974381f385143ac4828f74c580ef280357e85ac', id: "label", weight: "heavy", text: this.label, level: this.small ? 'tertiary' : 'secondary' }))));
35
35
  }
36
36
  static get is() { return "ezp-text-button"; }
37
37
  static get encapsulation() { return "shadow"; }
@@ -83,17 +83,17 @@
83
83
  display: flex;
84
84
  flex-direction: column;
85
85
  gap: var(--ezp-spacing-3);
86
- width: 100%;
87
86
  max-height: var(--ezp-upload-fileList-maxHeight, 35vh);
88
87
  overflow-y: auto;
88
+ scrollbar-color: var(--ezp-core-foreground-tertiary) transparent;
89
89
  /* Cross-platform thin scrollbar — Windows default is too chunky for this size. */
90
90
  scrollbar-width: thin;
91
- scrollbar-color: var(--ezp-core-foreground-tertiary) transparent;
91
+ width: 100%;
92
92
  /* WebKit fallback for older Safari / Chrome that don't honor scrollbar-width. */
93
93
  }
94
94
  #file-list::-webkit-scrollbar {
95
- width: 8px;
96
95
  height: 8px;
96
+ width: 8px;
97
97
  }
98
98
  #file-list::-webkit-scrollbar-thumb {
99
99
  background: var(--ezp-core-foreground-tertiary);
@@ -104,14 +104,14 @@
104
104
  }
105
105
 
106
106
  .file-item {
107
- display: grid;
108
- grid-template-columns: 1fr auto;
109
107
  align-items: center;
110
- gap: var(--ezp-spacing-3);
111
- padding: var(--ezp-spacing-2) var(--ezp-spacing-3);
112
108
  background: var(--ezp-core-background-secondary);
113
109
  border-radius: 3px;
110
+ display: grid;
111
+ gap: var(--ezp-spacing-3);
112
+ grid-template-columns: 1fr auto;
114
113
  min-height: 32px;
114
+ padding: var(--ezp-spacing-2) var(--ezp-spacing-3);
115
115
  }
116
116
 
117
117
  .file-name {
@@ -123,7 +123,7 @@
123
123
  }
124
124
 
125
125
  .file-remove {
126
- grid-column: 2;
127
- display: flex;
128
126
  align-items: center;
127
+ display: flex;
128
+ grid-column: 2;
129
129
  }
@@ -1,4 +1,5 @@
1
1
  import { Host, h, Fragment } from "@stencil/core";
2
+ import { subscribeToLanguageChange } from "../../utils/utils";
2
3
  import i18next from "i18next";
3
4
  export class EzpUpload {
4
5
  constructor() {
@@ -15,7 +16,8 @@ export class EzpUpload {
15
16
  *
16
17
  */
17
18
  this.handleInput = () => {
18
- const files = Array.from(this.input.files);
19
+ var _a, _b;
20
+ const files = Array.from((_b = (_a = this.input) === null || _a === void 0 ? void 0 : _a.files) !== null && _b !== void 0 ? _b : []);
19
21
  // Add new files to existing selection instead of replacing
20
22
  this.selectedFiles = [...this.selectedFiles, ...files];
21
23
  this.uploadFile.emit(this.selectedFiles);
@@ -35,6 +37,13 @@ export class EzpUpload {
35
37
  }
36
38
  };
37
39
  }
40
+ connectedCallback() {
41
+ this.unsubscribeLanguage = subscribeToLanguageChange(this);
42
+ }
43
+ disconnectedCallback() {
44
+ var _a;
45
+ (_a = this.unsubscribeLanguage) === null || _a === void 0 ? void 0 : _a.call(this);
46
+ }
38
47
  /**
39
48
  *
40
49
  * Listeners
@@ -46,22 +55,26 @@ export class EzpUpload {
46
55
  handleDragOver(event) {
47
56
  event.stopPropagation();
48
57
  event.preventDefault();
49
- event.dataTransfer.dropEffect = 'copy';
58
+ if (event.dataTransfer) {
59
+ event.dataTransfer.dropEffect = 'copy';
60
+ }
50
61
  }
51
62
  handleDragLeave() {
52
63
  this.dragging = false;
53
64
  }
54
65
  handleDrop(event) {
66
+ var _a, _b;
55
67
  event.stopPropagation();
56
68
  event.preventDefault();
57
69
  this.dragging = false;
58
- const files = Array.from(event.dataTransfer.files);
70
+ const files = Array.from((_b = (_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.files) !== null && _b !== void 0 ? _b : []);
59
71
  // Add new files to existing selection instead of replacing
60
72
  this.selectedFiles = [...this.selectedFiles, ...files];
61
73
  this.uploadFile.emit(this.selectedFiles);
62
74
  }
63
75
  listenPrintCancel() {
64
- this.form.reset();
76
+ var _a;
77
+ (_a = this.form) === null || _a === void 0 ? void 0 : _a.reset();
65
78
  this.selectedFiles = [];
66
79
  }
67
80
  /**
@@ -70,7 +83,7 @@ export class EzpUpload {
70
83
  *
71
84
  */
72
85
  render() {
73
- return (h(Host, { key: '4711c053e354bac32778220913800e9ddbeea4ae', class: { dragging: this.dragging } }, h("form", { key: 'bc38c6da6d342dbec11724ada061a136ce5e8ec9', id: "form", ref: (form) => (this.form = form) }, h("div", { key: '7823a9d8b9687a3dd4614a6de2d8ce9ed9e105a9', id: "header" }, h("ezp-icon", { key: '0cfe322cd35d84ca5dd55d03c2e9f485d61c36fc', name: "drag-drop", size: "huge", framed: true }), h("ezp-label", { key: '54408d9e0b2bc3837dbda634c8f0d1980cd9ca13', weight: "strong", text: i18next.t('upload.description') }), h("div", { key: '2c205310172c020fff181af64aa2b2d01b8c14a3', id: "meta" }, h("ezp-label", { key: '5d66adb460bcaa82a0f2bdff02e4bef61c926471', level: "tertiary", text: i18next.t('upload.meta_leading') }), h("label", { key: 'eb84ebab2edf72fabab9c818d609a93a0dd531d5', htmlFor: "input", id: "select" }, h("ezp-label", { key: '8daed6c65c7ba63b741d958e824e2c5e5cdc402f', level: "tertiary", weight: "strong", text: i18next.t('upload.meta_select') })), h("input", { key: 'bdc526e6393100006423e1e7fe2eacc4c7ba1984', type: "file", name: "input", id: "input", multiple: true, ref: (input) => (this.input = input), onInput: this.handleInput }), h("ezp-label", { key: '7126b66e7fa542bb4566e1b2af1a03357da08cf3', level: "tertiary", text: i18next.t('upload.meta_trailing') })), this.selectedFiles.length > 0 && (h(Fragment, null, h("ezp-label", { key: 'e0334c3a4378db13dbcf755b79564b7ecbe3630e', level: "secondary", text: i18next.t('upload.selected_files') }), h("div", { key: 'aaa7963218870cd372b67b48d7e73945f39b062a', id: "file-list" }, this.selectedFiles.map((file, index) => (h("div", { key: index, class: "file-item" }, h("div", { class: "file-name" }, h("ezp-label", { level: "tertiary", text: file.name })), h("div", { class: "file-remove" }, h("ezp-icon-button", { icon: "close", type: "button", level: "tertiary", onClick: (event) => this.removeFile(event, index) }))))))))))));
86
+ return (h(Host, { key: '3ed4218a2085c92c782e460894149608b8bc4136', class: { dragging: this.dragging } }, h("form", { key: 'de62cb59d82367edc013683d54d55f1807a1d6c7', id: "form", ref: (form) => (this.form = form) }, h("div", { key: 'a6de2ece802087868d0b0a7bf28f60a058737c6c', id: "header" }, h("ezp-icon", { key: '6c0f86cbc078a47b0c8383d9e7a68ae4a3e19c47', name: "drag-drop", size: "huge", framed: true }), h("ezp-label", { key: '8ad91024fcdecb6dfe3821ac9d04b31c47b76496', weight: "strong", text: i18next.t('upload.description') }), h("div", { key: '233ba9e003abc33cc7f95f3faba507a33fcc09f1', id: "meta" }, h("ezp-label", { key: 'e257eb18a98d5578f6476b81ffaef5813dcd2eda', level: "tertiary", text: i18next.t('upload.meta_leading') }), h("label", { key: 'a7127233e97c89af6ab3d562dd909ff79b8122d5', htmlFor: "input", id: "select" }, h("ezp-label", { key: '5d4fa0a05a2e56377a6e6130cbfab206fff4dd29', level: "tertiary", weight: "strong", text: i18next.t('upload.meta_select') })), h("input", { key: '7f3e8e45b58629176d4f41392d20dc30fd27b420', type: "file", name: "input", id: "input", multiple: true, "aria-label": i18next.t('upload.description'), ref: (input) => (this.input = input), onInput: this.handleInput }), h("ezp-label", { key: '2ab851d12e712f3fdbbee0cea2f248ad8e7de807', level: "tertiary", text: i18next.t('upload.meta_trailing') })), this.selectedFiles.length > 0 && (h(Fragment, null, h("ezp-label", { key: '12050e4b680fe14796af60bf526468dda308f439', level: "secondary", text: i18next.t('upload.selected_files') }), h("div", { key: 'fbfcb67db6d426fe45a431dcaa15db43040f9c97', id: "file-list" }, this.selectedFiles.map((file, index) => (h("div", { key: index, class: "file-item" }, h("div", { class: "file-name" }, h("ezp-label", { level: "tertiary", text: file.name })), h("div", { class: "file-remove" }, h("ezp-icon-button", { icon: "close", type: "button", level: "tertiary", onClick: (event) => this.removeFile(event, index) }))))))))))));
74
87
  }
75
88
  static get is() { return "ezp-upload"; }
76
89
  static get encapsulation() { return "shadow"; }
@@ -102,9 +115,14 @@ export class EzpUpload {
102
115
  "text": "\nEvents"
103
116
  },
104
117
  "complexType": {
105
- "original": "any",
106
- "resolved": "any",
107
- "references": {}
118
+ "original": "File[]",
119
+ "resolved": "File[]",
120
+ "references": {
121
+ "File": {
122
+ "location": "global",
123
+ "id": "global::File"
124
+ }
125
+ }
108
126
  }
109
127
  }];
110
128
  }
@@ -46,7 +46,8 @@
46
46
  :host(.is-open) {
47
47
  --ezp-userMenu-opacity: 1;
48
48
  --ezp-userMenu-scale: 1, 1;
49
- --ezp-userMenu-transition: opacity var(--ezp-duration-3) var(--ezp-easing-out-quart),
49
+ --ezp-userMenu-transition:
50
+ opacity var(--ezp-duration-3) var(--ezp-easing-out-quart),
50
51
  transform var(--ezp-duration-3) var(--ezp-easing-out-quart), visibility 0s 0s;
51
52
  --ezp-userMenu-visibility: visible;
52
53
  }
@@ -1,6 +1,8 @@
1
1
  import { Host, h } from "@stencil/core";
2
2
  import authStore from "../../services/auth";
3
3
  import userStore from "../../services/user";
4
+ import { storage } from "../../shared/storage";
5
+ import { subscribeToLanguageChange } from "../../utils/utils";
4
6
  import i18next from "i18next";
5
7
  export class EzpUserMenu {
6
8
  constructor() {
@@ -29,11 +31,7 @@ export class EzpUserMenu {
29
31
  this.userMenuClosure.emit();
30
32
  };
31
33
  this.logOut = () => {
32
- localStorage.removeItem('properties');
33
- localStorage.removeItem('refreshToken');
34
- localStorage.removeItem('access_token');
35
- localStorage.removeItem('printer');
36
- localStorage.removeItem('isAuthorized');
34
+ storage.clearSession();
37
35
  authStore.state.isAuthorized = false;
38
36
  this.logoutEmitter.emit();
39
37
  };
@@ -64,11 +62,9 @@ export class EzpUserMenu {
64
62
  this.userMenuClosure.emit();
65
63
  }
66
64
  }
67
- /**
68
- *
69
- * Render method
70
- *
71
- */
65
+ connectedCallback() {
66
+ this.unsubscribeLanguage = subscribeToLanguageChange(this);
67
+ }
72
68
  componentWillLoad() {
73
69
  this.container = this.component.closest('[data-backdrop-surface]');
74
70
  this.backdrop.addEventListener('backdropHideStart', () => {
@@ -78,13 +74,17 @@ export class EzpUserMenu {
78
74
  this.container.removeChild(this.backdrop);
79
75
  });
80
76
  }
77
+ disconnectedCallback() {
78
+ var _a;
79
+ (_a = this.unsubscribeLanguage) === null || _a === void 0 ? void 0 : _a.call(this);
80
+ }
81
81
  /**
82
82
  *
83
83
  * Render method
84
84
  *
85
85
  */
86
86
  render() {
87
- return (h(Host, { key: '0be3d9326b2fd15cbb61e5b9eae17e0e8c64fefd', class: this.open ? 'is-open' : '' }, h("div", { key: 'a9c3690514cf71adb590395dc4bc71c5a5f35fce', id: "header" }, h("ezp-label", { key: 'cac928c398257f57ace98662049caee2ed992aa6', ellipsis: true, id: "name", weight: "heavy", text: this.name }), h("ezp-icon-button", { key: '5d237bee7dc3d48120a3b042a25bf392965b56a3', id: "close", level: "tertiary", icon: "close", onClick: this.handleClose })), h("div", { key: '2edf3724b7590665fbd4baf27c14fdfe5e623537', id: "links" }, this.links.map((link) => (h("a", { class: "link", href: link.href, target: "_blank", rel: "noopener noreferrer" }, h("ezp-icon", { class: "link__icon", name: link.icon }), h("ezp-label", { text: link.title })))), h("a", { key: '363e6574e75c9cc2aeaa4707f3798e8c2c0f5fd4', class: "link", onClick: this.logOut }, h("ezp-icon", { key: 'b444802cd837572f61dabb28416931498db83f0e', class: "link__icon", name: "logout" }), h("ezp-label", { key: '02958987257786688345e0da79e10f0535b41dc0', text: i18next.t('user_menu.logout') }))), h("div", { key: 'e404081c99dd59cbd3d86a502fa24a76e459718d', id: "theme" }, h("ezp-label", { key: '3a8719b3ca0d6e078fb4add24efea9b28c8e8882', class: "caption", text: `${i18next.t('user_menu.theme')}:`, weight: "heavy" }), h("div", { key: '01c030aa8e66ba2fdfe968588e7c7dd3a6a7fe09', id: "swatches" }, this.themes.map((theme) => (h("button", { class: `swatch swatch--${theme} ${theme === userStore.state.theme ? 'selected' : ''}`, onClick: () => this.handleTheme(theme) }, h("span", { class: "dot" })))))), h("div", { key: '4a04a1ed776aed50e94394ca91aa91c85002d90f', id: "appearance" }, h("ezp-label", { key: '36427d1dea114b47dc6d6b86da80c68388c3b4c2', class: "caption", text: `${i18next.t('user_menu.appearance')}:`, weight: "heavy" }), h("div", { key: '5729ca40b8228644637106f728d90b53da6c09dc', id: "tabs" }, this.appearances.map((appearance) => (h("button", { class: `tab ${appearance.name === userStore.state.appearance ? 'selected' : ''}`, onClick: () => this.handleAppearance(appearance.name) }, h("ezp-icon", { name: appearance.name }), h("ezp-label", { text: appearance.title, level: "tertiary", weight: "strong" }))))))));
87
+ return (h(Host, { key: '76b6f86b18d8aab59578ab6a3ea25e4177ff6e54', class: this.open ? 'is-open' : '' }, h("div", { key: '4179c44a0477b59606ecb769453ccdfcda0c017b', id: "header" }, h("ezp-label", { key: 'ecb776a4c4c04eadae8599fa9d077238468fc809', ellipsis: true, id: "name", weight: "heavy", text: this.name }), h("ezp-icon-button", { key: 'fba99c75cee975801bdaeb861f41c8693a149843', id: "close", level: "tertiary", icon: "close", onClick: this.handleClose })), h("div", { key: '16028fe80eb8851891ec618900ce488718d0ad3b', id: "links" }, this.links.map((link) => (h("a", { class: "link", href: link.href, target: "_blank", rel: "noopener noreferrer" }, h("ezp-icon", { class: "link__icon", name: link.icon }), h("ezp-label", { text: link.title })))), h("a", { key: '7741d760a000a78eb96709a6ad87fa962efdc375', class: "link", onClick: this.logOut }, h("ezp-icon", { key: '33b280fcea4e039c5f0dd53f348ebf0400b97b64', class: "link__icon", name: "logout" }), h("ezp-label", { key: 'ccc22c5fbd9baaf5352a61ce845b3c98e8f83e7d', text: i18next.t('user_menu.logout') }))), h("div", { key: 'a7dce7b1073af19ff90bdf1fabe214ac08c55003', id: "theme" }, h("ezp-label", { key: '66ba8c16a9c6183a577edc403074f9e3fcf55345', class: "caption", text: `${i18next.t('user_menu.theme')}:`, weight: "heavy" }), h("div", { key: '1c6f931a3040d392720d0c7c1f7a9eee4114b935', id: "swatches" }, this.themes.map((theme) => (h("button", { class: `swatch swatch--${theme} ${theme === userStore.state.theme ? 'selected' : ''}`, onClick: () => this.handleTheme(theme) }, h("span", { class: "dot" })))))), h("div", { key: '1b771bbce7b7ea213ecd489e6a3e917aed8a845b', id: "appearance" }, h("ezp-label", { key: '8f1a96513260500a6ce3319f72b6ea2ca6a0794a', class: "caption", text: `${i18next.t('user_menu.appearance')}:`, weight: "heavy" }), h("div", { key: '177a61b8f7210f6a90a36fc5bb9d4b23c64f2a10', id: "tabs" }, this.appearances.map((appearance) => (h("button", { class: `tab ${appearance.name === userStore.state.appearance ? 'selected' : ''}`, onClick: () => this.handleAppearance(appearance.name) }, h("ezp-icon", { name: appearance.name }), h("ezp-label", { text: appearance.title, level: "tertiary", weight: "strong" }))))))));
88
88
  }
89
89
  static get is() { return "ezp-user-menu"; }
90
90
  static get encapsulation() { return "shadow"; }
@@ -154,8 +154,8 @@ export class EzpUserMenu {
154
154
  "text": "\nEvents"
155
155
  },
156
156
  "complexType": {
157
- "original": "any",
158
- "resolved": "any",
157
+ "original": "void",
158
+ "resolved": "void",
159
159
  "references": {}
160
160
  }
161
161
  }, {
@@ -169,8 +169,8 @@ export class EzpUserMenu {
169
169
  "text": ""
170
170
  },
171
171
  "complexType": {
172
- "original": "any",
173
- "resolved": "any",
172
+ "original": "void",
173
+ "resolved": "void",
174
174
  "references": {}
175
175
  }
176
176
  }];
@@ -1,11 +1,15 @@
1
1
  import { createStore } from "@stencil/store";
2
2
  import { encodeFormData } from "../utils/utils";
3
+ import { storage } from "../shared/storage";
3
4
  export class EzpAuthorizationService {
4
5
  constructor(redirectURI, clientID) {
5
6
  this.urlParams = new URLSearchParams();
6
7
  this.isAuthorized = false;
7
8
  this.redirectURI = redirectURI;
8
9
  this.clientID = clientID;
10
+ // Mirror the client id into the store so a token refresh can be triggered
11
+ // centrally (e.g. from the fetch helper) without a service instance.
12
+ authStore.state.clientID = clientID;
9
13
  this.oauthUrl = authStore.state.authApiHostUrl;
10
14
  this.authURI = new URL(`https://${this.oauthUrl}/oauth/authorize/`);
11
15
  this.accessTokenURL = `https://${this.oauthUrl}/oauth/access_token/`;
@@ -26,7 +30,7 @@ export class EzpAuthorizationService {
26
30
  const encoder = new TextEncoder();
27
31
  const codeData = encoder.encode(codeVerifier);
28
32
  const digest = await crypto.subtle.digest('SHA-256', codeData);
29
- const base64Digest = btoa(String.fromCharCode.apply(null, new Uint8Array(digest)));
33
+ const base64Digest = btoa(String.fromCharCode(...new Uint8Array(digest)));
30
34
  this.codeChallenge = base64Digest.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
31
35
  }
32
36
  buildAuthURI() {
@@ -38,13 +42,33 @@ export class EzpAuthorizationService {
38
42
  this.authURI.search = this.urlParams.toString();
39
43
  authStore.state.authUri = this.authURI.toString();
40
44
  }
45
+ /** Shared auth headers for the OAuth token endpoints (Basic auth, form body). */
46
+ oauthHeaders() {
47
+ return {
48
+ Authorization: 'Basic ' + btoa(this.clientID + ':'),
49
+ 'Content-Type': 'application/x-www-form-urlencoded',
50
+ };
51
+ }
52
+ /**
53
+ * Persist tokens. The access token is kept in memory only (auth store +
54
+ * instance field) — it is deliberately NOT written to localStorage, so an XSS
55
+ * on the host page can't read it. Only the refresh token (needed to re-auth
56
+ * after a reload) and the isAuthorized hint are persisted.
57
+ */
58
+ persistTokens(accessToken, refreshToken) {
59
+ this.accessToken = accessToken;
60
+ authStore.state.accessToken = accessToken;
61
+ this.refreshToken = refreshToken;
62
+ authStore.state.refreshToken = refreshToken;
63
+ storage.setRefreshToken(refreshToken);
64
+ this.isAuthorized = true;
65
+ authStore.state.isAuthorized = true;
66
+ storage.setIsAuthorized(true);
67
+ }
41
68
  getAccessToken() {
42
69
  return fetch(this.accessTokenURL, {
43
70
  credentials: 'include',
44
- headers: {
45
- Authorization: 'Basic ' + btoa(this.clientID + ':'),
46
- 'Content-Type': 'application/x-www-form-urlencoded',
47
- },
71
+ headers: this.oauthHeaders(),
48
72
  method: 'POST',
49
73
  body: encodeFormData({
50
74
  grant_type: 'authorization_code',
@@ -54,31 +78,17 @@ export class EzpAuthorizationService {
54
78
  code_verifier: authStore.state.codeVerifier,
55
79
  }),
56
80
  })
57
- .then((response) => {
58
- return response.json(); // parse response
59
- })
81
+ .then((response) => response.json())
60
82
  .then((data) => {
61
- // actual object
62
83
  if (data.access_token) {
63
- authStore.state.isAuthorized = true;
64
- this.isAuthorized = authStore.state.isAuthorized;
65
- localStorage.setItem('isAuthorized', this.isAuthorized.toString());
66
- this.accessToken = data.access_token;
67
- localStorage.setItem('access_token', this.accessToken);
68
- authStore.state.accessToken = this.accessToken;
69
- this.refreshToken = data.refresh_token;
70
- localStorage.setItem('refreshToken', this.refreshToken);
71
- authStore.state.refreshToken = this.refreshToken;
84
+ this.persistTokens(data.access_token, data.refresh_token);
72
85
  }
73
86
  });
74
87
  }
75
88
  refreshTokens() {
76
89
  return fetch(this.accessTokenURL, {
77
90
  credentials: 'include',
78
- headers: {
79
- Authorization: 'Basic ' + btoa(this.clientID + ':'),
80
- 'Content-Type': 'application/x-www-form-urlencoded',
81
- },
91
+ headers: this.oauthHeaders(),
82
92
  method: 'POST',
83
93
  body: encodeFormData({
84
94
  grant_type: 'refresh_token',
@@ -89,14 +99,7 @@ export class EzpAuthorizationService {
89
99
  .then((response) => response.json())
90
100
  .then((data) => {
91
101
  if (data.access_token) {
92
- this.accessToken = data.access_token;
93
- localStorage.setItem('access_token', this.accessToken);
94
- authStore.state.accessToken = this.accessToken;
95
- this.refreshToken = data.refresh_token;
96
- localStorage.setItem('refreshToken', this.refreshToken);
97
- authStore.state.refreshToken = this.refreshToken;
98
- authStore.state.isAuthorized = true;
99
- localStorage.setItem('isAuthorized', 'true');
102
+ this.persistTokens(data.access_token, data.refresh_token);
100
103
  }
101
104
  });
102
105
  }
@@ -104,16 +107,13 @@ export class EzpAuthorizationService {
104
107
  if (authStore.state.refreshToken)
105
108
  fetch(`https://${this.oauthUrl}/oauth/revoke/`, {
106
109
  credentials: 'include',
107
- headers: {
108
- Authorization: 'Basic ' + btoa(this.clientID + ':'),
109
- 'Content-Type': 'application/x-www-form-urlencoded',
110
- },
110
+ headers: this.oauthHeaders(),
111
111
  method: 'POST',
112
112
  body: encodeFormData({
113
113
  token: authStore.state.refreshToken,
114
114
  }),
115
- }).catch((error) => {
116
- console.log(error);
115
+ }).catch(() => {
116
+ // Revocation is best-effort; ignore network failures.
117
117
  });
118
118
  }
119
119
  }
@@ -127,6 +127,7 @@ const authStore = createStore({
127
127
  authApiHostUrl: '',
128
128
  redirectUri: '',
129
129
  authUri: '',
130
+ clientID: '',
130
131
  });
131
132
  export default authStore;
132
133
  export function sendCodeToParentWindow() {
@@ -0,0 +1,11 @@
1
+ /** Authorization header for a Bearer-token request. */
2
+ export function bearer(accessToken) {
3
+ return { Authorization: 'Bearer ' + accessToken };
4
+ }
5
+ /** GET a URL with a Bearer token and parse the JSON body. */
6
+ export function authGetJson(url, accessToken) {
7
+ return fetch(url, {
8
+ method: 'GET',
9
+ headers: bearer(accessToken),
10
+ }).then((response) => response.json());
11
+ }
@@ -0,0 +1,72 @@
1
+ import { classifyJobStatus } from "../utils/printer";
2
+ import { BLOB_UPLOAD_CREATED, PRINT_REJECTED_CODE, HUB_DRIVER_ERROR_CODES, POLL_INTERVAL_MS, MAX_POLL_ATTEMPTS, } from "../shared/constants";
3
+ /** Lower-cased file extension, or '' when there is none. */
4
+ export function fileExtension(filename) {
5
+ const ext = filename.split('.').pop();
6
+ return ext ? ext.toLowerCase() : '';
7
+ }
8
+ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
9
+ /**
10
+ * Poll the print status until the job reaches a terminal state. Resolves on
11
+ * success; throws on failure, a hub-driver error, or when the polling budget is
12
+ * exhausted (so a stuck job fails instead of polling forever). Unknown statuses
13
+ * are treated as failures for safety.
14
+ */
15
+ export async function waitForJobCompletion(getStatus, isQueue, pollIntervalMs = POLL_INTERVAL_MS, maxAttempts = MAX_POLL_ATTEMPTS) {
16
+ let attempts = 0;
17
+ // eslint-disable-next-line no-constant-condition
18
+ while (true) {
19
+ const data = await getStatus();
20
+ attempts++;
21
+ const outcome = classifyJobStatus(data.jobstatus, isQueue);
22
+ if (outcome === 'success')
23
+ return;
24
+ if (outcome === 'hub-error') {
25
+ throw new Error('Hub printer driver error: ' + (data.jobstatusstring || data.jobstatus));
26
+ }
27
+ if (outcome === 'failed') {
28
+ throw new Error('Print job failed: ' + (data.jobstatusstring || data.jobstatus));
29
+ }
30
+ // 'processing' — keep waiting until the polling budget is exhausted.
31
+ if (attempts >= maxAttempts) {
32
+ throw new Error(`Print job timed out after ${attempts} status checks`);
33
+ }
34
+ await sleep(pollIntervalMs);
35
+ }
36
+ }
37
+ /**
38
+ * Upload one file then print it, waiting for the job to finish. Throws (with a
39
+ * message that includes "Hub printer driver error" for queue-driver failures) on
40
+ * any failure, so callers can aggregate per-file outcomes.
41
+ */
42
+ export async function uploadAndPrintFile(ctx, file, hooks = {}) {
43
+ var _a, _b, _c, _d, _e;
44
+ (_a = hooks.onPreparing) === null || _a === void 0 ? void 0 : _a.call(hooks, true);
45
+ const response = await ctx.service.prepareFileUpload(ctx.accessToken);
46
+ (_b = hooks.onPreparing) === null || _b === void 0 ? void 0 : _b.call(hooks, false);
47
+ const fileid = response.fileid;
48
+ const sasUri = response.sasUri;
49
+ const filetype = fileExtension(file.name);
50
+ (_c = hooks.onUploading) === null || _c === void 0 ? void 0 : _c.call(hooks, true);
51
+ try {
52
+ const res = await ctx.service.uploadBlobFiles(sasUri, file);
53
+ if (res._response.status !== BLOB_UPLOAD_CREATED) {
54
+ throw new Error(`Upload failed for file: ${file.name}`);
55
+ }
56
+ const data = await ctx.service.printByFileID(ctx.accessToken, fileid, filetype, ctx.printerId, ctx.properties, file.name);
57
+ if (data.code === PRINT_REJECTED_CODE) {
58
+ throw new Error(`Print failed for file: ${file.name}`);
59
+ }
60
+ if (ctx.isQueue && data.code !== undefined && HUB_DRIVER_ERROR_CODES.includes(data.code)) {
61
+ throw new Error(`Hub printer driver error for file: ${file.name}`);
62
+ }
63
+ if (!data.jobid) {
64
+ throw new Error(`No job ID returned for file: ${file.name}`);
65
+ }
66
+ (_d = hooks.onJobId) === null || _d === void 0 ? void 0 : _d.call(hooks, data.jobid);
67
+ await waitForJobCompletion(() => ctx.service.getPrintStatus(), ctx.isQueue, ctx.pollIntervalMs);
68
+ }
69
+ finally {
70
+ (_e = hooks.onUploading) === null || _e === void 0 ? void 0 : _e.call(hooks, false);
71
+ }
72
+ }