@ezeep/ezeep-js 1.0.142 → 1.0.143

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 (163) hide show
  1. package/dist/cjs/ezeep.cjs.js +2 -2
  2. package/dist/cjs/ezp-auth_14.cjs.entry.js +33750 -0
  3. package/dist/cjs/{index-a93095ed.js → index-62fc857c.js} +7 -0
  4. package/dist/cjs/loader.cjs.js +2 -2
  5. package/dist/collection/collection-manifest.json +3 -1
  6. package/dist/collection/components/ezp-auth/ezp-auth.css +3 -77
  7. package/dist/collection/components/ezp-auth/ezp-auth.js +26 -20
  8. package/dist/collection/components/ezp-backdrop/ezp-backdrop.css +3 -3
  9. package/dist/collection/components/ezp-dialog/ezp-dialog.css +48 -0
  10. package/dist/collection/components/ezp-dialog/ezp-dialog.js +220 -0
  11. package/dist/collection/components/ezp-icon/assets/glyph-account.svg +2 -2
  12. package/dist/collection/components/ezp-icon/assets/glyph-checkmark-alt.svg +3 -0
  13. package/dist/collection/components/ezp-icon/assets/glyph-checkmark.svg +2 -2
  14. package/dist/collection/components/ezp-icon/assets/glyph-close.svg +2 -2
  15. package/dist/collection/components/ezp-icon/assets/glyph-color.svg +2 -2
  16. package/dist/collection/components/ezp-icon/assets/glyph-copies.svg +2 -2
  17. package/dist/collection/components/ezp-icon/assets/glyph-dark.svg +2 -2
  18. package/dist/collection/components/ezp-icon/assets/glyph-drag-drop.svg +3 -0
  19. package/dist/collection/components/ezp-icon/assets/glyph-duplex.svg +2 -2
  20. package/dist/collection/components/ezp-icon/assets/glyph-exclamation-mark.svg +3 -0
  21. package/dist/collection/components/ezp-icon/assets/glyph-expand.svg +2 -2
  22. package/dist/collection/components/ezp-icon/assets/glyph-help.svg +2 -2
  23. package/dist/collection/components/ezp-icon/assets/glyph-light.svg +2 -2
  24. package/dist/collection/components/ezp-icon/assets/glyph-logo.svg +3 -0
  25. package/dist/collection/components/ezp-icon/assets/glyph-logout.svg +2 -2
  26. package/dist/collection/components/ezp-icon/assets/glyph-menu.svg +2 -2
  27. package/dist/collection/components/ezp-icon/assets/glyph-minus.svg +2 -2
  28. package/dist/collection/components/ezp-icon/assets/glyph-orientation.svg +2 -2
  29. package/dist/collection/components/ezp-icon/assets/glyph-plus.svg +2 -2
  30. package/dist/collection/components/ezp-icon/assets/glyph-printer.svg +2 -2
  31. package/dist/collection/components/ezp-icon/assets/glyph-quality.svg +2 -2
  32. package/dist/collection/components/ezp-icon/assets/glyph-question-mark.svg +3 -0
  33. package/dist/collection/components/ezp-icon/assets/glyph-size.svg +2 -2
  34. package/dist/collection/components/ezp-icon/assets/glyph-system.svg +2 -2
  35. package/dist/collection/components/ezp-icon/ezp-icon.css +25 -9
  36. package/dist/collection/components/ezp-icon/ezp-icon.js +23 -3
  37. package/dist/collection/components/ezp-icon-button/ezp-icon-button.css +43 -34
  38. package/dist/collection/components/ezp-icon-button/ezp-icon-button.js +1 -1
  39. package/dist/collection/components/ezp-label/ezp-label.css +32 -32
  40. package/dist/collection/components/ezp-printer-selection/ezp-printer-selection.css +21 -27
  41. package/dist/collection/components/ezp-printer-selection/ezp-printer-selection.js +278 -302
  42. package/dist/collection/components/ezp-printing/ezp-printing.css +175 -273
  43. package/dist/collection/components/ezp-printing/ezp-printing.js +109 -13
  44. package/dist/collection/components/ezp-select/ezp-select.css +98 -151
  45. package/dist/collection/components/ezp-select/ezp-select.js +51 -20
  46. package/dist/collection/components/ezp-status/ezp-status.css +111 -0
  47. package/dist/collection/components/ezp-status/ezp-status.js +236 -0
  48. package/dist/collection/components/ezp-stepper/ezp-stepper.css +21 -21
  49. package/dist/collection/components/ezp-stepper/ezp-stepper.js +1 -1
  50. package/dist/collection/components/ezp-text-button/ezp-text-button.css +44 -34
  51. package/dist/collection/components/ezp-text-button/ezp-text-button.js +22 -2
  52. package/dist/collection/components/ezp-upload/ezp-upload.css +67 -0
  53. package/dist/collection/components/ezp-upload/ezp-upload.js +121 -0
  54. package/dist/collection/components/ezp-user-menu/ezp-user-menu.css +75 -71
  55. package/dist/collection/components/ezp-user-menu/ezp-user-menu.js +12 -9
  56. package/dist/collection/services/print.js +50 -10
  57. package/dist/custom-elements/index.d.ts +18 -6
  58. package/dist/custom-elements/index.js +29053 -590
  59. package/dist/directives/proxies.ts +81 -25
  60. package/dist/esm/ezeep.js +2 -2
  61. package/dist/esm/ezp-auth_14.entry.js +33733 -0
  62. package/dist/esm/{index-9ecf6ae0.js → index-265d8cca.js} +7 -1
  63. package/dist/esm/loader.js +2 -2
  64. package/dist/esm-es5/ezeep.js +1 -1
  65. package/dist/esm-es5/ezp-auth_14.entry.js +21 -0
  66. package/dist/esm-es5/{index-9ecf6ae0.js → index-265d8cca.js} +1 -1
  67. package/dist/esm-es5/loader.js +1 -1
  68. package/dist/ezeep/assets/glyph-account.svg +2 -2
  69. package/dist/ezeep/assets/glyph-checkmark-alt.svg +3 -0
  70. package/dist/ezeep/assets/glyph-checkmark.svg +2 -2
  71. package/dist/ezeep/assets/glyph-close.svg +2 -2
  72. package/dist/ezeep/assets/glyph-color.svg +2 -2
  73. package/dist/ezeep/assets/glyph-copies.svg +2 -2
  74. package/dist/ezeep/assets/glyph-dark.svg +2 -2
  75. package/dist/ezeep/assets/glyph-drag-drop.svg +3 -0
  76. package/dist/ezeep/assets/glyph-duplex.svg +2 -2
  77. package/dist/ezeep/assets/glyph-exclamation-mark.svg +3 -0
  78. package/dist/ezeep/assets/glyph-expand.svg +2 -2
  79. package/dist/ezeep/assets/glyph-help.svg +2 -2
  80. package/dist/ezeep/assets/glyph-light.svg +2 -2
  81. package/dist/ezeep/assets/glyph-logo.svg +3 -0
  82. package/dist/ezeep/assets/glyph-logout.svg +2 -2
  83. package/dist/ezeep/assets/glyph-menu.svg +2 -2
  84. package/dist/ezeep/assets/glyph-minus.svg +2 -2
  85. package/dist/ezeep/assets/glyph-orientation.svg +2 -2
  86. package/dist/ezeep/assets/glyph-plus.svg +2 -2
  87. package/dist/ezeep/assets/glyph-printer.svg +2 -2
  88. package/dist/ezeep/assets/glyph-quality.svg +2 -2
  89. package/dist/ezeep/assets/glyph-question-mark.svg +3 -0
  90. package/dist/ezeep/assets/glyph-size.svg +2 -2
  91. package/dist/ezeep/assets/glyph-system.svg +2 -2
  92. package/dist/ezeep/ezeep.esm.js +1 -1
  93. package/dist/ezeep/ezeep.js +1 -1
  94. package/dist/ezeep/p-6d99f6f4.system.entry.js +21 -0
  95. package/dist/ezeep/p-972c2256.entry.js +15 -0
  96. package/dist/ezeep/p-98ec6965.system.js +1 -0
  97. package/dist/ezeep/p-f3065800.js +1 -0
  98. package/dist/ezeep/p-f89804ee.system.js +1 -0
  99. package/dist/types/components/ezp-auth/ezp-auth.d.ts +3 -2
  100. package/dist/types/components/ezp-dialog/ezp-dialog.d.ts +42 -0
  101. package/dist/types/components/ezp-icon/ezp-icon.d.ts +2 -0
  102. package/dist/types/components/ezp-printer-selection/ezp-printer-selection.d.ts +19 -1
  103. package/dist/types/components/ezp-printing/ezp-printing.d.ts +10 -3
  104. package/dist/types/components/ezp-select/ezp-select.d.ts +4 -0
  105. package/dist/types/components/ezp-status/ezp-status.d.ts +44 -0
  106. package/dist/types/components/ezp-text-button/ezp-text-button.d.ts +2 -0
  107. package/dist/types/components/ezp-upload/ezp-upload.d.ts +43 -0
  108. package/dist/types/components.d.ts +126 -21
  109. package/dist/types/services/print.d.ts +7 -2
  110. package/dist/types/shared/types.d.ts +15 -3
  111. package/package.json +12 -2
  112. package/readme.md +53 -17
  113. package/www/build/assets/glyph-account.svg +2 -2
  114. package/www/build/assets/glyph-checkmark-alt.svg +3 -0
  115. package/www/build/assets/glyph-checkmark.svg +2 -2
  116. package/www/build/assets/glyph-close.svg +2 -2
  117. package/www/build/assets/glyph-color.svg +2 -2
  118. package/www/build/assets/glyph-copies.svg +2 -2
  119. package/www/build/assets/glyph-dark.svg +2 -2
  120. package/www/build/assets/glyph-drag-drop.svg +3 -0
  121. package/www/build/assets/glyph-duplex.svg +2 -2
  122. package/www/build/assets/glyph-exclamation-mark.svg +3 -0
  123. package/www/build/assets/glyph-expand.svg +2 -2
  124. package/www/build/assets/glyph-help.svg +2 -2
  125. package/www/build/assets/glyph-light.svg +2 -2
  126. package/www/build/assets/glyph-logo.svg +3 -0
  127. package/www/build/assets/glyph-logout.svg +2 -2
  128. package/www/build/assets/glyph-menu.svg +2 -2
  129. package/www/build/assets/glyph-minus.svg +2 -2
  130. package/www/build/assets/glyph-orientation.svg +2 -2
  131. package/www/build/assets/glyph-plus.svg +2 -2
  132. package/www/build/assets/glyph-printer.svg +2 -2
  133. package/www/build/assets/glyph-quality.svg +2 -2
  134. package/www/build/assets/glyph-question-mark.svg +3 -0
  135. package/www/build/assets/glyph-size.svg +2 -2
  136. package/www/build/assets/glyph-system.svg +2 -2
  137. package/www/build/ezeep.esm.js +1 -1
  138. package/www/build/ezeep.js +1 -1
  139. package/www/build/p-6d99f6f4.system.entry.js +21 -0
  140. package/www/build/p-972c2256.entry.js +15 -0
  141. package/www/build/p-98ec6965.system.js +1 -0
  142. package/www/build/p-f3065800.js +1 -0
  143. package/www/build/p-f89804ee.system.js +1 -0
  144. package/www/data/file-types.json +68 -0
  145. package/www/data/locales/de.json +61 -30
  146. package/www/data/locales/en.json +61 -30
  147. package/www/index.html +27 -7
  148. package/dist/cjs/ezp-auth_12.cjs.entry.js +0 -5293
  149. package/dist/collection/components/ezp-progress/ezp-progress.css +0 -110
  150. package/dist/collection/components/ezp-progress/ezp-progress.js +0 -53
  151. package/dist/esm/ezp-auth_12.entry.js +0 -5278
  152. package/dist/esm-es5/ezp-auth_12.entry.js +0 -1
  153. package/dist/ezeep/p-c488ee3f.system.js +0 -1
  154. package/dist/ezeep/p-c7eac982.system.entry.js +0 -1
  155. package/dist/ezeep/p-c9ef1ce0.entry.js +0 -1
  156. package/dist/ezeep/p-eb3b8dbd.system.js +0 -1
  157. package/dist/ezeep/p-ff843eb4.js +0 -1
  158. package/dist/types/components/ezp-progress/ezp-progress.d.ts +0 -15
  159. package/www/build/p-c488ee3f.system.js +0 -1
  160. package/www/build/p-c7eac982.system.entry.js +0 -1
  161. package/www/build/p-c9ef1ce0.entry.js +0 -1
  162. package/www/build/p-eb3b8dbd.system.js +0 -1
  163. package/www/build/p-ff843eb4.js +0 -1
@@ -1,4 +1,4 @@
1
- import { Component, Host, Listen, Event, State, h, Prop } from '@stencil/core';
1
+ import { Component, Host, Listen, Event, State, h, Prop, Fragment, } from '@stencil/core';
2
2
  import i18next from 'i18next';
3
3
  import authStore from '../../services/auth';
4
4
  import printStore, { EzpPrintService } from '../../services/print';
@@ -7,6 +7,8 @@ import { initi18n, poll, removeEmptyStrings } from '../../utils/utils';
7
7
  import options from '../../data/options.json';
8
8
  export class EzpPrinterSelection {
9
9
  constructor() {
10
+ this.sasUri = '';
11
+ this.fileExtension = '';
10
12
  this.duplexOptions = [
11
13
  {
12
14
  id: 1,
@@ -28,222 +30,21 @@ export class EzpPrinterSelection {
28
30
  */
29
31
  this.loading = true;
30
32
  this.options = options;
31
- this.printInProgress = false;
33
+ this.printProcessing = false;
34
+ this.uploading = false;
35
+ this.preparingUpload = false;
36
+ this.printSuccess = false;
37
+ this.printFailed = false;
38
+ this.notSupported = false;
39
+ this.noPrinters = false;
32
40
  this.userMenuOpen = false;
33
- this.selectedPrinter = { id: '', location: '', name: '' };
41
+ this.printStopped = false;
34
42
  this.selectedPrinterConfig = {
35
- "Collate": true,
36
- "Color": true,
37
- "Driver": "TP Output Gateway",
38
- "DuplexMode": 1,
39
- "DuplexSupported": true,
40
- "Id": "f0c0f30c-e9ff-4e11-9181-2417fabeb23f",
41
- "Location": "",
42
- "MediaSupported": [
43
- "Auto",
44
- "Letter",
45
- "Legal",
46
- "Executive",
47
- "A4",
48
- "A5",
49
- "B5 (JIS)",
50
- "Umschlag 10",
51
- "Umschlag DL",
52
- "Umschlag C5",
53
- "Umschlag C6",
54
- "Umschlag Monarch",
55
- "Jap. Postkarte",
56
- "A6",
57
- "JIS Chou Nr. 2 119x277 mm",
58
- "4x6Zoll",
59
- "5x7 Zoll",
60
- "8x10Zoll",
61
- "Ofuku hagaki",
62
- "10x15 cm",
63
- "13x18 cm",
64
- "Karteikarte 3 x 5\"",
65
- "Karteikarte 4x6 Zoll"
66
- ],
67
- "MediaSupportedId": [
68
- 0,
69
- 1,
70
- 5,
71
- 7,
72
- 9,
73
- 11,
74
- 13,
75
- 20,
76
- 27,
77
- 28,
78
- 31,
79
- 37,
80
- 43,
81
- 70,
82
- 119,
83
- 120,
84
- 121,
85
- 122,
86
- 123,
87
- 124,
88
- 125,
89
- 126,
90
- 127
91
- ],
92
- "Name": "HP DeskJet 3630 series",
93
- "OrientationsSupported": [
94
- "portrait",
95
- "landscape"
96
- ],
97
- "OrientationsSupportedId": [
98
- 1,
99
- 2
100
- ],
101
- "PaperFormats": [
102
- {
103
- "Id": 0,
104
- "Name": "Auto",
105
- "XRes": 0,
106
- "YRes": 0
107
- },
108
- {
109
- "Id": 1,
110
- "Name": "Letter",
111
- "XRes": 2159,
112
- "YRes": 2794
113
- },
114
- {
115
- "Id": 5,
116
- "Name": "Legal",
117
- "XRes": 2159,
118
- "YRes": 3556
119
- },
120
- {
121
- "Id": 7,
122
- "Name": "Executive",
123
- "XRes": 1841,
124
- "YRes": 2667
125
- },
126
- {
127
- "Id": 9,
128
- "Name": "A4",
129
- "XRes": 2100,
130
- "YRes": 2970
131
- },
132
- {
133
- "Id": 11,
134
- "Name": "A5",
135
- "XRes": 1480,
136
- "YRes": 2100
137
- },
138
- {
139
- "Id": 13,
140
- "Name": "B5 (JIS)",
141
- "XRes": 1820,
142
- "YRes": 2570
143
- },
144
- {
145
- "Id": 20,
146
- "Name": "Umschlag 10",
147
- "XRes": 1047,
148
- "YRes": 2413
149
- },
150
- {
151
- "Id": 27,
152
- "Name": "Umschlag DL",
153
- "XRes": 1100,
154
- "YRes": 2200
155
- },
156
- {
157
- "Id": 28,
158
- "Name": "Umschlag C5",
159
- "XRes": 1620,
160
- "YRes": 2290
161
- },
162
- {
163
- "Id": 31,
164
- "Name": "Umschlag C6",
165
- "XRes": 1140,
166
- "YRes": 1620
167
- },
168
- {
169
- "Id": 37,
170
- "Name": "Umschlag Monarch",
171
- "XRes": 984,
172
- "YRes": 1905
173
- },
174
- {
175
- "Id": 43,
176
- "Name": "Jap. Postkarte",
177
- "XRes": 1000,
178
- "YRes": 1480
179
- },
180
- {
181
- "Id": 70,
182
- "Name": "A6",
183
- "XRes": 1050,
184
- "YRes": 1480
185
- },
186
- {
187
- "Id": 119,
188
- "Name": "JIS Chou Nr. 2 119x277 mm",
189
- "XRes": 1109,
190
- "YRes": 1460
191
- },
192
- {
193
- "Id": 120,
194
- "Name": "4x6Zoll",
195
- "XRes": 1016,
196
- "YRes": 1524
197
- },
198
- {
199
- "Id": 121,
200
- "Name": "5x7 Zoll",
201
- "XRes": 1270,
202
- "YRes": 1778
203
- },
204
- {
205
- "Id": 122,
206
- "Name": "8x10Zoll",
207
- "XRes": 2032,
208
- "YRes": 2540
209
- },
210
- {
211
- "Id": 123,
212
- "Name": "Ofuku hagaki",
213
- "XRes": 2000,
214
- "YRes": 1479
215
- },
216
- {
217
- "Id": 124,
218
- "Name": "10x15 cm",
219
- "XRes": 1016,
220
- "YRes": 1524
221
- },
222
- {
223
- "Id": 125,
224
- "Name": "13x18 cm",
225
- "XRes": 1270,
226
- "YRes": 1778
227
- },
228
- {
229
- "Id": 126,
230
- "Name": "Karteikarte 3 x 5\"",
231
- "XRes": 762,
232
- "YRes": 1270
233
- },
234
- {
235
- "Id": 127,
236
- "Name": "Karteikarte 4x6 Zoll",
237
- "XRes": 1016,
238
- "YRes": 1524
239
- }
240
- ],
241
- "Resolutions": [
242
- "Auto",
243
- "600",
244
- "1200"
245
- ],
246
- "TPUID": 1
43
+ OrientationsSupported: [],
44
+ PaperFormats: [],
45
+ Resolutions: [],
46
+ DuplexSupported: false,
47
+ Color: false,
247
48
  };
248
49
  // needs to be initialised with empty strings
249
50
  this.selectedProperties = {
@@ -275,20 +76,21 @@ export class EzpPrinterSelection {
275
76
  this.handleCancel = () => {
276
77
  this.printCancel.emit();
277
78
  };
79
+ this.validateData = (data) => {
80
+ if (data.jobstatus === 0) {
81
+ this.printSuccess = true;
82
+ this.printProcessing = false;
83
+ return true;
84
+ }
85
+ return false;
86
+ };
87
+ this.POLL_INTERVAL = 2000;
278
88
  /** Description... */
279
- this.handlePrint = () => {
280
- const validateData = (data) => {
281
- if (data.jobstatus === 0) {
282
- this.printInProgress = false;
283
- return true;
284
- }
285
- return false;
286
- };
287
- const POLL_INTERVAL = 2000;
288
- this.printInProgress = true;
89
+ this.handlePrint = async () => {
90
+ this.printProcessing = true;
289
91
  // we have to initialse this obj with empty strings to display the select component
290
92
  // but don't want to send any attributes with empty strings to the API
291
- removeEmptyStrings(this.selectedProperties);
93
+ this.selectedProperties = removeEmptyStrings(this.selectedProperties);
292
94
  // put it in store for further use
293
95
  printStore.state.fileUrl = this.fileurl;
294
96
  printStore.state.fileID = this.fileid;
@@ -301,8 +103,8 @@ export class EzpPrinterSelection {
301
103
  .printFileByUrl(authStore.state.accessToken, this.fileurl, this.filetype, this.selectedPrinter.id, this.selectedProperties, this.filename)
302
104
  .then((response) => {
303
105
  if (response.status === 412) {
304
- response.json().then(data => this.fileid = data.fileid);
305
- this.printService.printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, this.selectedProperties, this.filename).finally(() => this.printInProgress = false);
106
+ response.json().then((data) => (this.fileid = data.fileid));
107
+ this.printService.printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, this.selectedProperties, this.filename);
306
108
  }
307
109
  else {
308
110
  return response.json();
@@ -313,60 +115,38 @@ export class EzpPrinterSelection {
313
115
  printStore.state.jobID = data.jobid;
314
116
  poll({
315
117
  fn: this.printService.getPrintStatus,
316
- validate: validateData,
317
- interval: POLL_INTERVAL,
118
+ validate: this.validateData,
119
+ interval: this.POLL_INTERVAL,
318
120
  maxAttempts: 10,
319
- })
320
- .then(data)
321
- .catch((err) => {
121
+ }).catch((err) => {
322
122
  console.warn(err);
323
- this.printInProgress = false;
324
123
  });
325
124
  }
326
125
  else {
327
- this.printInProgress = false;
126
+ this.printFailed = true;
328
127
  }
329
128
  })
330
- .catch(error => {
129
+ .catch((error) => {
331
130
  console.log(error);
332
- this.printInProgress = false;
131
+ this.printFailed = true;
333
132
  });
334
133
  }
335
- else if (this.fileid) {
336
- this.printService.printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, this.selectedProperties, this.filename)
337
- .then((response) => response.json())
338
- .then((data) => {
339
- if (data.jobid) {
340
- printStore.state.jobID = data.jobid;
341
- poll({
342
- fn: this.printService.getPrintStatus,
343
- validate: validateData,
344
- interval: POLL_INTERVAL,
345
- maxAttempts: 10,
346
- })
347
- .then(data)
348
- .catch((err) => {
349
- console.warn(err);
350
- this.printInProgress = false;
351
- });
352
- }
353
- else {
354
- this.printInProgress = false;
355
- }
356
- })
357
- .catch(error => {
358
- console.log(error);
359
- this.printInProgress = false;
360
- });
134
+ if (this.file) {
135
+ await this.handleFiles(this.file);
361
136
  }
362
137
  localStorage.setItem('properties', JSON.stringify(this.selectedProperties));
363
138
  localStorage.setItem('printer', JSON.stringify(this.selectedPrinter));
364
139
  localStorage.setItem('previouslySelectedProperties', JSON.stringify(this.previouslySelectedProperties));
365
- // this.printSubmit.emit()
140
+ this.printStopped = false;
366
141
  };
367
142
  this.handleUserMenu = () => {
368
143
  this.userMenuOpen = true;
369
144
  };
145
+ this.validateFileType = async (name) => {
146
+ const extension = name.split('.').pop();
147
+ this.fileExtension = extension;
148
+ return printStore.state.supportedFileExtensions.includes(`${extension}`);
149
+ };
370
150
  }
371
151
  /**
372
152
  *
@@ -385,6 +165,39 @@ export class EzpPrinterSelection {
385
165
  listenLogout() {
386
166
  this.printCancel.emit();
387
167
  }
168
+ listenStatusCancel(event) {
169
+ if (event.detail === 'print-processing') {
170
+ this.printStopped = true;
171
+ this.printProcessing = false;
172
+ }
173
+ }
174
+ listenStatusClose(event) {
175
+ switch (event.detail) {
176
+ case 'print-success':
177
+ this.printSuccess = false;
178
+ this.printCancel.emit();
179
+ break;
180
+ case 'print-failed':
181
+ this.printProcessing = false;
182
+ this.printFailed = false;
183
+ break;
184
+ case 'no-printers':
185
+ this.noPrinters = false;
186
+ break;
187
+ }
188
+ }
189
+ listenStatusRetry(event) {
190
+ switch (event.detail) {
191
+ case 'not-supported':
192
+ this.printCancel.emit();
193
+ break;
194
+ case 'print-failed':
195
+ this.printFailed = false;
196
+ this.printProcessing = false;
197
+ this.handlePrint();
198
+ break;
199
+ }
200
+ }
388
201
  getPropertiesFromLocalStorage() {
389
202
  if (localStorage.getItem('properties')) {
390
203
  this.selectedProperties = JSON.parse(localStorage.getItem('properties'));
@@ -411,9 +224,9 @@ export class EzpPrinterSelection {
411
224
  case 'printer':
412
225
  this.selectedPrinter.id = eventDetails.id;
413
226
  this.selectedPrinter.name = eventDetails.title;
414
- await this.printService.getPrinterProperties(authStore.state.accessToken, this.selectedPrinter.id).then(data => this.selectedPrinterConfig = data[0]);
415
- console.log('selected printer config:');
416
- console.log(this.selectedPrinterConfig);
227
+ await this.printService
228
+ .getPrinterProperties(authStore.state.accessToken, this.selectedPrinter.id)
229
+ .then((data) => (this.selectedPrinterConfig = data[0]));
417
230
  break;
418
231
  case 'color':
419
232
  this.selectedProperties.color = !!eventDetails.id;
@@ -447,6 +260,52 @@ export class EzpPrinterSelection {
447
260
  break;
448
261
  }
449
262
  }
263
+ async handleFiles(file) {
264
+ this.preparingUpload = true;
265
+ const response = await this.printService.prepareFileUpload(authStore.state.accessToken);
266
+ this.preparingUpload = false;
267
+ this.fileid = response.fileid;
268
+ this.sasUri = response.sasUri;
269
+ this.filetype = this.fileExtension;
270
+ let res;
271
+ this.uploading = true;
272
+ try {
273
+ res = await this.printService.uploadBlobFiles(this.sasUri, file);
274
+ }
275
+ catch (error) {
276
+ this.printProcessing = false;
277
+ this.printFailed = true;
278
+ }
279
+ this.uploading = false;
280
+ if (res._response.status === 201) {
281
+ this.printService
282
+ .printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, this.selectedProperties, this.filename)
283
+ .then((data) => {
284
+ if (data.jobid) {
285
+ printStore.state.jobID = data.jobid;
286
+ poll({
287
+ fn: this.printService.getPrintStatus,
288
+ validate: this.validateData,
289
+ interval: this.POLL_INTERVAL,
290
+ maxAttempts: 10,
291
+ }).catch((err) => {
292
+ console.log(err);
293
+ this.printFailed = true;
294
+ });
295
+ }
296
+ else {
297
+ this.printFailed = true;
298
+ }
299
+ })
300
+ .catch((error) => {
301
+ console.log(error);
302
+ this.printFailed = true;
303
+ });
304
+ }
305
+ else {
306
+ this.printFailed = true;
307
+ }
308
+ }
450
309
  /**
451
310
  *
452
311
  * Lifecycle methods
@@ -459,17 +318,29 @@ export class EzpPrinterSelection {
459
318
  this.getPropertiesFromLocalStorage();
460
319
  this.getUserInfo();
461
320
  this.printService = new EzpPrintService(this.redirectURI, this.clientID);
321
+ await (await this.printService.getConfig(authStore.state.accessToken))
322
+ .json()
323
+ .then((response) => {
324
+ printStore.state.supportedFileExtensions = response.System.FILEEXT;
325
+ });
462
326
  await this.printService
463
327
  .getPrinterList(authStore.state.accessToken)
464
328
  .then((printers) => {
465
329
  this.printers = printers;
330
+ if (!(this.printers.length > 0)) {
331
+ this.noPrinters = true;
332
+ }
466
333
  });
467
334
  await this.printService
468
335
  .getAllPrinterProperties(authStore.state.accessToken)
469
336
  .then((printerConfig) => {
470
337
  this.printerConfig = printerConfig;
471
- console.log(this.printerConfig);
472
338
  });
339
+ if (this.file) {
340
+ await this.validateFileType(this.filename).then((valid) => {
341
+ this.notSupported = !valid ? true : false;
342
+ });
343
+ }
473
344
  this.loading = false;
474
345
  }
475
346
  /**
@@ -478,23 +349,29 @@ export class EzpPrinterSelection {
478
349
  *
479
350
  */
480
351
  render() {
481
- return this.loading ? (h("ezp-progress", { status: i18next.t('printer_selection.loading') })) : (h(Host, { exportparts: "test: hello" },
482
- this.printInProgress ? (h("ezp-progress", { status: i18next.t('printer_selection.print_in_progress') })) : null,
483
- h("div", { id: "container", "data-backdrop-surface": true },
352
+ return this.loading ? (h("ezp-status", { processing: true, description: i18next.t('printer_selection.loading'), instance: "loading" })) : (h(Host, null,
353
+ h("div", { id: "box", "data-backdrop-surface": true },
354
+ !this.printStopped && (h(Fragment, null, this.printProcessing ? (h("ezp-status", { processing: true, description: this.preparingUpload
355
+ ? i18next.t('printer_selection.prepare_upload')
356
+ : this.uploading
357
+ ? i18next.t('printer_selection.uploading')
358
+ : i18next.t('printer_selection.print_processing'), instance: "print-processing", cancel: true })) : this.printSuccess ? (h("ezp-status", { icon: "checkmark-alt", description: i18next.t('printer_selection.print_success'), instance: "print-success", close: true })) : this.printFailed ? (h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.print_failed'), instance: "print-failed", close: true, retry: true })) : this.notSupported ? (h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.not_supported'), instance: "not-supported", retry: true })) : this.noPrinters ? (h("ezp-status", { icon: "exclamation-mark", description: i18next.t('printer_selection.no_printers'), instance: "no-printers", close: true })) : null)),
484
359
  h("div", { id: "header" },
485
- h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') + ':' }),
486
- h("ezp-label", { text: this.filename }),
487
- h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu })),
488
- h("div", { id: "content" },
360
+ h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') + `${!this.notSupported ? ':' : ''}` }),
361
+ h("ezp-label", { text: !this.notSupported ? this.filename : '' }),
362
+ this.hidemenu && (h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu }))),
363
+ h("div", { id: "body" },
489
364
  h("div", { id: "printer" },
490
- h("ezp-select", { label: i18next.t('printer_selection.printer'), icon: "printer", placeholder: i18next.t('printer_selection.select_printer'), toggleFlow: "vertical", optionFlow: "vertical", options: this.printers.map((printer) => ({
365
+ h("ezp-select", { label: i18next.t('printer_selection.printer'), icon: "printer", placeholder: this.printers.length > 0
366
+ ? i18next.t('printer_selection.select_printer')
367
+ : i18next.t('printer_selection.no_printers'), toggleFlow: "vertical", optionFlow: "vertical", options: this.printers.map((printer) => ({
491
368
  id: printer.id,
492
369
  title: printer.name,
493
370
  meta: printer.location !== ''
494
371
  ? printer.location
495
372
  : i18next.t('printer_selection.unknown_location'),
496
373
  type: 'printer',
497
- })), preSelected: this.selectedPrinter.name })),
374
+ })), preSelected: this.selectedPrinter ? this.selectedPrinter.name : null, disabled: !(this.printers.length > 0) })),
498
375
  h("div", { id: "options" },
499
376
  h("ezp-select", { label: i18next.t('printer_selection.color'), icon: "color", placeholder: i18next.t('printer_selection.select_color'), toggleFlow: "horizontal", options: this.selectedPrinterConfig.Color
500
377
  ? [
@@ -518,40 +395,78 @@ export class EzpPrinterSelection {
518
395
  meta: '',
519
396
  type: 'color',
520
397
  },
521
- ], preSelected: this.previouslySelectedProperties.color }),
522
- h("ezp-select", { label: i18next.t('printer_selection.orientation'), icon: "orientation", placeholder: i18next.t('printer_selection.select_orientation'), toggleFlow: "horizontal", options: this.selectedPrinterConfig.OrientationsSupported.map((orientation, index) => ({
523
- id: index,
524
- title: i18next.t(`printer_selection.orientation_${orientation}`),
398
+ ],
399
+ // preSelected={
400
+ // this.previouslySelectedProperties.color
401
+ // ? this.previouslySelectedProperties.color
402
+ // : this.selectedPrinterConfig.Color
403
+ // ? i18next.t('printer_selection.color_grayscale')
404
+ // : null
405
+ // }
406
+ disabled: !this.selectedPrinterConfig.Color }),
407
+ h("ezp-select", { label: i18next.t('printer_selection.duplex'), icon: "duplex", placeholder: i18next.t('printer_selection.select_duplex'), toggleFlow: "horizontal", options: this.duplexOptions.map((option) => ({
408
+ id: option.id,
409
+ title: option.title,
525
410
  meta: '',
526
- type: 'orientation',
527
- })), preSelected: this.previouslySelectedProperties.orientation }),
411
+ type: 'duplex',
412
+ })),
413
+ // preSelected={
414
+ // this.previouslySelectedProperties.duplex
415
+ // ? this.previouslySelectedProperties.duplex
416
+ // : this.selectedPrinterConfig.DuplexSupported
417
+ // ? 'None'
418
+ // : null
419
+ // }
420
+ disabled: !this.selectedPrinterConfig.DuplexSupported }),
528
421
  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.map((format) => ({
529
422
  id: format.Id,
530
423
  title: format.Name,
531
424
  meta: `${format.XRes} x ${format.YRes}`,
532
425
  type: 'format',
533
- })), preSelected: this.previouslySelectedProperties.paper }),
534
- h("ezp-select", { label: i18next.t('printer_selection.quality'), icon: "quality", toggleFlow: "horizontal", options: this.selectedPrinterConfig.Resolutions.map((option, index) => ({
426
+ })),
427
+ // preSelected={
428
+ // this.previouslySelectedProperties.paper
429
+ // ? this.previouslySelectedProperties.paper
430
+ // : this.selectedPrinterConfig.PaperFormats.length > 0
431
+ // ? this.selectedPrinterConfig.PaperFormats[0].Name
432
+ // : null
433
+ // }
434
+ disabled: !(this.selectedPrinterConfig.PaperFormats.length > 0) }),
435
+ h("ezp-select", { label: i18next.t('printer_selection.orientation'), icon: "orientation", placeholder: i18next.t('printer_selection.select_orientation'), toggleFlow: "horizontal", options: this.selectedPrinterConfig.OrientationsSupported.map((orientation, index) => ({
436
+ id: index,
437
+ title: i18next.t(`printer_selection.orientation_${orientation}`),
438
+ meta: '',
439
+ type: 'orientation',
440
+ })),
441
+ // preSelected={
442
+ // this.previouslySelectedProperties.orientation
443
+ // ? this.previouslySelectedProperties.orientation
444
+ // : this.selectedPrinterConfig.OrientationsSupported.length > 0
445
+ // ? i18next.t(
446
+ // `printer_selection.orientation_${this.selectedPrinterConfig.OrientationsSupported[0]}`
447
+ // )
448
+ // : null
449
+ // }
450
+ disabled: !(this.selectedPrinterConfig.OrientationsSupported.length > 0) }),
451
+ h("ezp-select", { label: i18next.t('printer_selection.quality'), icon: "quality", placeholder: i18next.t('printer_selection.select_quality'), toggleFlow: "horizontal", options: this.selectedPrinterConfig.Resolutions.map((option, index) => ({
535
452
  id: index,
536
453
  title: option,
537
454
  meta: '',
538
455
  type: 'quality',
539
- })), preSelected: !this.previouslySelectedProperties.resolution
540
- ? this.selectedPrinterConfig.Resolutions[0]
541
- : this.previouslySelectedProperties.resolution }),
542
- this.selectedPrinterConfig.DuplexSupported ? (h("ezp-select", { label: i18next.t('printer_selection.duplex'), icon: "duplex", toggleFlow: "horizontal", options: this.duplexOptions.map((option) => ({
543
- id: option.id,
544
- title: option.title,
545
- meta: '',
546
- type: 'duplex',
547
- })), preSelected: !this.previouslySelectedProperties.duplex
548
- ? 'None'
549
- : this.previouslySelectedProperties.duplexmode })) : null),
456
+ })),
457
+ // preSelected={
458
+ // this.previouslySelectedProperties.resolution
459
+ // ? this.previouslySelectedProperties.resolution
460
+ // : this.selectedPrinterConfig.Resolutions.length > 0
461
+ // ? this.selectedPrinterConfig.Resolutions[0]
462
+ // : null
463
+ // }
464
+ disabled: !(this.selectedPrinterConfig.Resolutions.length > 0) })),
550
465
  h("ezp-stepper", { label: "Copies", max: 10, icon: "copies" })),
551
466
  h("div", { id: "footer" },
552
467
  h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel') }),
553
- h("ezp-text-button", { type: "button", onClick: this.handlePrint, label: i18next.t('button_actions.print') })),
554
- h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
468
+ h("ezp-text-button", { disabled: this.selectedPrinter.id === '', type: "button", onClick: this.handlePrint, label: i18next.t('button_actions.print') })),
469
+ this.hidemenu && h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
555
470
  }
556
471
  static get is() { return "ezp-printer-selection"; }
557
472
  static get encapsulation() { return "shadow"; }
@@ -598,7 +513,7 @@ export class EzpPrinterSelection {
598
513
  },
599
514
  "filename": {
600
515
  "type": "string",
601
- "mutable": false,
516
+ "mutable": true,
602
517
  "complexType": {
603
518
  "original": "string",
604
519
  "resolved": "string",
@@ -632,7 +547,7 @@ export class EzpPrinterSelection {
632
547
  },
633
548
  "filetype": {
634
549
  "type": "string",
635
- "mutable": false,
550
+ "mutable": true,
636
551
  "complexType": {
637
552
  "original": "string",
638
553
  "resolved": "string",
@@ -649,7 +564,7 @@ export class EzpPrinterSelection {
649
564
  },
650
565
  "fileid": {
651
566
  "type": "string",
652
- "mutable": false,
567
+ "mutable": true,
653
568
  "complexType": {
654
569
  "original": "string",
655
570
  "resolved": "string",
@@ -663,13 +578,56 @@ export class EzpPrinterSelection {
663
578
  },
664
579
  "attribute": "fileid",
665
580
  "reflect": false
581
+ },
582
+ "file": {
583
+ "type": "unknown",
584
+ "mutable": false,
585
+ "complexType": {
586
+ "original": "File",
587
+ "resolved": "File",
588
+ "references": {
589
+ "File": {
590
+ "location": "global"
591
+ }
592
+ }
593
+ },
594
+ "required": false,
595
+ "optional": false,
596
+ "docs": {
597
+ "tags": [],
598
+ "text": ""
599
+ }
600
+ },
601
+ "hidemenu": {
602
+ "type": "boolean",
603
+ "mutable": false,
604
+ "complexType": {
605
+ "original": "boolean",
606
+ "resolved": "boolean",
607
+ "references": {}
608
+ },
609
+ "required": false,
610
+ "optional": false,
611
+ "docs": {
612
+ "tags": [],
613
+ "text": ""
614
+ },
615
+ "attribute": "hidemenu",
616
+ "reflect": false
666
617
  }
667
618
  }; }
668
619
  static get states() { return {
669
620
  "loading": {},
670
621
  "options": {},
671
- "printInProgress": {},
622
+ "printProcessing": {},
623
+ "uploading": {},
624
+ "preparingUpload": {},
625
+ "printSuccess": {},
626
+ "printFailed": {},
627
+ "notSupported": {},
628
+ "noPrinters": {},
672
629
  "userMenuOpen": {},
630
+ "printStopped": {},
673
631
  "userName": {},
674
632
  "printers": {},
675
633
  "selectedPrinter": {},
@@ -741,5 +699,23 @@ export class EzpPrinterSelection {
741
699
  "target": undefined,
742
700
  "capture": false,
743
701
  "passive": false
702
+ }, {
703
+ "name": "statusCancel",
704
+ "method": "listenStatusCancel",
705
+ "target": undefined,
706
+ "capture": false,
707
+ "passive": false
708
+ }, {
709
+ "name": "statusClose",
710
+ "method": "listenStatusClose",
711
+ "target": undefined,
712
+ "capture": false,
713
+ "passive": false
714
+ }, {
715
+ "name": "statusRetry",
716
+ "method": "listenStatusRetry",
717
+ "target": undefined,
718
+ "capture": false,
719
+ "passive": false
744
720
  }]; }
745
721
  }