@ezeep/ezeep-js 1.0.141 → 1.0.145

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 +33752 -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 +280 -302
  42. package/dist/collection/components/ezp-printing/ezp-printing.css +175 -273
  43. package/dist/collection/components/ezp-printing/ezp-printing.js +111 -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 +29055 -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 +33735 -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-98ec6965.system.js +1 -0
  95. package/dist/ezeep/p-a1b0d17a.system.entry.js +21 -0
  96. package/dist/ezeep/p-a7b7b386.entry.js +15 -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 +54 -18
  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-98ec6965.system.js +1 -0
  140. package/www/build/p-a1b0d17a.system.entry.js +21 -0
  141. package/www/build/p-a7b7b386.entry.js +15 -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,
@@ -21,6 +23,7 @@ export class EzpPrinterSelection {
21
23
  title: 'Short edge binding',
22
24
  },
23
25
  ];
26
+ this.hidemenu = false;
24
27
  /**
25
28
  *
26
29
  * States
@@ -28,222 +31,21 @@ export class EzpPrinterSelection {
28
31
  */
29
32
  this.loading = true;
30
33
  this.options = options;
31
- this.printInProgress = false;
34
+ this.printProcessing = false;
35
+ this.uploading = false;
36
+ this.preparingUpload = false;
37
+ this.printSuccess = false;
38
+ this.printFailed = false;
39
+ this.notSupported = false;
40
+ this.noPrinters = false;
32
41
  this.userMenuOpen = false;
33
- this.selectedPrinter = { id: '', location: '', name: '' };
42
+ this.printStopped = false;
34
43
  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
44
+ OrientationsSupported: [],
45
+ PaperFormats: [],
46
+ Resolutions: [],
47
+ DuplexSupported: false,
48
+ Color: false,
247
49
  };
248
50
  // needs to be initialised with empty strings
249
51
  this.selectedProperties = {
@@ -275,20 +77,21 @@ export class EzpPrinterSelection {
275
77
  this.handleCancel = () => {
276
78
  this.printCancel.emit();
277
79
  };
80
+ this.validateData = (data) => {
81
+ if (data.jobstatus === 0) {
82
+ this.printSuccess = true;
83
+ this.printProcessing = false;
84
+ return true;
85
+ }
86
+ return false;
87
+ };
88
+ this.POLL_INTERVAL = 2000;
278
89
  /** 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;
90
+ this.handlePrint = async () => {
91
+ this.printProcessing = true;
289
92
  // we have to initialse this obj with empty strings to display the select component
290
93
  // but don't want to send any attributes with empty strings to the API
291
- removeEmptyStrings(this.selectedProperties);
94
+ this.selectedProperties = removeEmptyStrings(this.selectedProperties);
292
95
  // put it in store for further use
293
96
  printStore.state.fileUrl = this.fileurl;
294
97
  printStore.state.fileID = this.fileid;
@@ -301,8 +104,8 @@ export class EzpPrinterSelection {
301
104
  .printFileByUrl(authStore.state.accessToken, this.fileurl, this.filetype, this.selectedPrinter.id, this.selectedProperties, this.filename)
302
105
  .then((response) => {
303
106
  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);
107
+ response.json().then((data) => (this.fileid = data.fileid));
108
+ this.printService.printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, this.selectedProperties, this.filename);
306
109
  }
307
110
  else {
308
111
  return response.json();
@@ -313,60 +116,38 @@ export class EzpPrinterSelection {
313
116
  printStore.state.jobID = data.jobid;
314
117
  poll({
315
118
  fn: this.printService.getPrintStatus,
316
- validate: validateData,
317
- interval: POLL_INTERVAL,
119
+ validate: this.validateData,
120
+ interval: this.POLL_INTERVAL,
318
121
  maxAttempts: 10,
319
- })
320
- .then(data)
321
- .catch((err) => {
122
+ }).catch((err) => {
322
123
  console.warn(err);
323
- this.printInProgress = false;
324
124
  });
325
125
  }
326
126
  else {
327
- this.printInProgress = false;
127
+ this.printFailed = true;
328
128
  }
329
129
  })
330
- .catch(error => {
130
+ .catch((error) => {
331
131
  console.log(error);
332
- this.printInProgress = false;
132
+ this.printFailed = true;
333
133
  });
334
134
  }
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
- });
135
+ if (this.file) {
136
+ await this.handleFiles(this.file);
361
137
  }
362
138
  localStorage.setItem('properties', JSON.stringify(this.selectedProperties));
363
139
  localStorage.setItem('printer', JSON.stringify(this.selectedPrinter));
364
140
  localStorage.setItem('previouslySelectedProperties', JSON.stringify(this.previouslySelectedProperties));
365
- // this.printSubmit.emit()
141
+ this.printStopped = false;
366
142
  };
367
143
  this.handleUserMenu = () => {
368
144
  this.userMenuOpen = true;
369
145
  };
146
+ this.validateFileType = async (name) => {
147
+ const extension = name.split('.').pop();
148
+ this.fileExtension = extension;
149
+ return printStore.state.supportedFileExtensions.includes(`${extension}`);
150
+ };
370
151
  }
371
152
  /**
372
153
  *
@@ -385,6 +166,39 @@ export class EzpPrinterSelection {
385
166
  listenLogout() {
386
167
  this.printCancel.emit();
387
168
  }
169
+ listenStatusCancel(event) {
170
+ if (event.detail === 'print-processing') {
171
+ this.printStopped = true;
172
+ this.printProcessing = false;
173
+ }
174
+ }
175
+ listenStatusClose(event) {
176
+ switch (event.detail) {
177
+ case 'print-success':
178
+ this.printSuccess = false;
179
+ this.printCancel.emit();
180
+ break;
181
+ case 'print-failed':
182
+ this.printProcessing = false;
183
+ this.printFailed = false;
184
+ break;
185
+ case 'no-printers':
186
+ this.noPrinters = false;
187
+ break;
188
+ }
189
+ }
190
+ listenStatusRetry(event) {
191
+ switch (event.detail) {
192
+ case 'not-supported':
193
+ this.printCancel.emit();
194
+ break;
195
+ case 'print-failed':
196
+ this.printFailed = false;
197
+ this.printProcessing = false;
198
+ this.handlePrint();
199
+ break;
200
+ }
201
+ }
388
202
  getPropertiesFromLocalStorage() {
389
203
  if (localStorage.getItem('properties')) {
390
204
  this.selectedProperties = JSON.parse(localStorage.getItem('properties'));
@@ -411,9 +225,9 @@ export class EzpPrinterSelection {
411
225
  case 'printer':
412
226
  this.selectedPrinter.id = eventDetails.id;
413
227
  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);
228
+ await this.printService
229
+ .getPrinterProperties(authStore.state.accessToken, this.selectedPrinter.id)
230
+ .then((data) => (this.selectedPrinterConfig = data[0]));
417
231
  break;
418
232
  case 'color':
419
233
  this.selectedProperties.color = !!eventDetails.id;
@@ -447,6 +261,52 @@ export class EzpPrinterSelection {
447
261
  break;
448
262
  }
449
263
  }
264
+ async handleFiles(file) {
265
+ this.preparingUpload = true;
266
+ const response = await this.printService.prepareFileUpload(authStore.state.accessToken);
267
+ this.preparingUpload = false;
268
+ this.fileid = response.fileid;
269
+ this.sasUri = response.sasUri;
270
+ this.filetype = this.fileExtension;
271
+ let res;
272
+ this.uploading = true;
273
+ try {
274
+ res = await this.printService.uploadBlobFiles(this.sasUri, file);
275
+ }
276
+ catch (error) {
277
+ this.printProcessing = false;
278
+ this.printFailed = true;
279
+ }
280
+ this.uploading = false;
281
+ if (res._response.status === 201) {
282
+ this.printService
283
+ .printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, this.selectedProperties, this.filename)
284
+ .then((data) => {
285
+ if (data.jobid) {
286
+ printStore.state.jobID = data.jobid;
287
+ poll({
288
+ fn: this.printService.getPrintStatus,
289
+ validate: this.validateData,
290
+ interval: this.POLL_INTERVAL,
291
+ maxAttempts: 10,
292
+ }).catch((err) => {
293
+ console.log(err);
294
+ this.printFailed = true;
295
+ });
296
+ }
297
+ else {
298
+ this.printFailed = true;
299
+ }
300
+ })
301
+ .catch((error) => {
302
+ console.log(error);
303
+ this.printFailed = true;
304
+ });
305
+ }
306
+ else {
307
+ this.printFailed = true;
308
+ }
309
+ }
450
310
  /**
451
311
  *
452
312
  * Lifecycle methods
@@ -459,17 +319,29 @@ export class EzpPrinterSelection {
459
319
  this.getPropertiesFromLocalStorage();
460
320
  this.getUserInfo();
461
321
  this.printService = new EzpPrintService(this.redirectURI, this.clientID);
322
+ await (await this.printService.getConfig(authStore.state.accessToken))
323
+ .json()
324
+ .then((response) => {
325
+ printStore.state.supportedFileExtensions = response.System.FILEEXT;
326
+ });
462
327
  await this.printService
463
328
  .getPrinterList(authStore.state.accessToken)
464
329
  .then((printers) => {
465
330
  this.printers = printers;
331
+ if (!(this.printers.length > 0)) {
332
+ this.noPrinters = true;
333
+ }
466
334
  });
467
335
  await this.printService
468
336
  .getAllPrinterProperties(authStore.state.accessToken)
469
337
  .then((printerConfig) => {
470
338
  this.printerConfig = printerConfig;
471
- console.log(this.printerConfig);
472
339
  });
340
+ if (this.file) {
341
+ await this.validateFileType(this.filename).then((valid) => {
342
+ this.notSupported = !valid ? true : false;
343
+ });
344
+ }
473
345
  this.loading = false;
474
346
  }
475
347
  /**
@@ -478,23 +350,29 @@ export class EzpPrinterSelection {
478
350
  *
479
351
  */
480
352
  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 },
353
+ return this.loading ? (h("ezp-status", { processing: true, description: i18next.t('printer_selection.loading'), instance: "loading" })) : (h(Host, null,
354
+ h("div", { id: "box", "data-backdrop-surface": true },
355
+ !this.printStopped && (h(Fragment, null, this.printProcessing ? (h("ezp-status", { processing: true, description: this.preparingUpload
356
+ ? i18next.t('printer_selection.prepare_upload')
357
+ : this.uploading
358
+ ? i18next.t('printer_selection.uploading')
359
+ : 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
360
  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" },
361
+ h("ezp-label", { weight: "heavy", text: i18next.t('printer_selection.print') + `${!this.notSupported ? ':' : ''}` }),
362
+ h("ezp-label", { text: !this.notSupported ? this.filename : '' }),
363
+ !this.hidemenu && (h("ezp-icon-button", { level: "tertiary", icon: "menu", id: "toggle-menu", type: "button", onClick: this.handleUserMenu }))),
364
+ h("div", { id: "body" },
489
365
  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) => ({
366
+ h("ezp-select", { label: i18next.t('printer_selection.printer'), icon: "printer", placeholder: this.printers.length > 0
367
+ ? i18next.t('printer_selection.select_printer')
368
+ : i18next.t('printer_selection.no_printers'), toggleFlow: "vertical", optionFlow: "vertical", options: this.printers.map((printer) => ({
491
369
  id: printer.id,
492
370
  title: printer.name,
493
371
  meta: printer.location !== ''
494
372
  ? printer.location
495
373
  : i18next.t('printer_selection.unknown_location'),
496
374
  type: 'printer',
497
- })), preSelected: this.selectedPrinter.name })),
375
+ })), preSelected: this.selectedPrinter ? this.selectedPrinter.name : null, disabled: !(this.printers.length > 0) })),
498
376
  h("div", { id: "options" },
499
377
  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
378
  ? [
@@ -518,40 +396,78 @@ export class EzpPrinterSelection {
518
396
  meta: '',
519
397
  type: 'color',
520
398
  },
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}`),
399
+ ],
400
+ // preSelected={
401
+ // this.previouslySelectedProperties.color
402
+ // ? this.previouslySelectedProperties.color
403
+ // : this.selectedPrinterConfig.Color
404
+ // ? i18next.t('printer_selection.color_grayscale')
405
+ // : null
406
+ // }
407
+ disabled: !this.selectedPrinterConfig.Color }),
408
+ 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) => ({
409
+ id: option.id,
410
+ title: option.title,
525
411
  meta: '',
526
- type: 'orientation',
527
- })), preSelected: this.previouslySelectedProperties.orientation }),
412
+ type: 'duplex',
413
+ })),
414
+ // preSelected={
415
+ // this.previouslySelectedProperties.duplex
416
+ // ? this.previouslySelectedProperties.duplex
417
+ // : this.selectedPrinterConfig.DuplexSupported
418
+ // ? 'None'
419
+ // : null
420
+ // }
421
+ disabled: !this.selectedPrinterConfig.DuplexSupported }),
528
422
  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
423
  id: format.Id,
530
424
  title: format.Name,
531
425
  meta: `${format.XRes} x ${format.YRes}`,
532
426
  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) => ({
427
+ })),
428
+ // preSelected={
429
+ // this.previouslySelectedProperties.paper
430
+ // ? this.previouslySelectedProperties.paper
431
+ // : this.selectedPrinterConfig.PaperFormats.length > 0
432
+ // ? this.selectedPrinterConfig.PaperFormats[0].Name
433
+ // : null
434
+ // }
435
+ disabled: !(this.selectedPrinterConfig.PaperFormats.length > 0) }),
436
+ 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) => ({
437
+ id: index,
438
+ title: i18next.t(`printer_selection.orientation_${orientation}`),
439
+ meta: '',
440
+ type: 'orientation',
441
+ })),
442
+ // preSelected={
443
+ // this.previouslySelectedProperties.orientation
444
+ // ? this.previouslySelectedProperties.orientation
445
+ // : this.selectedPrinterConfig.OrientationsSupported.length > 0
446
+ // ? i18next.t(
447
+ // `printer_selection.orientation_${this.selectedPrinterConfig.OrientationsSupported[0]}`
448
+ // )
449
+ // : null
450
+ // }
451
+ disabled: !(this.selectedPrinterConfig.OrientationsSupported.length > 0) }),
452
+ 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
453
  id: index,
536
454
  title: option,
537
455
  meta: '',
538
456
  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),
457
+ })),
458
+ // preSelected={
459
+ // this.previouslySelectedProperties.resolution
460
+ // ? this.previouslySelectedProperties.resolution
461
+ // : this.selectedPrinterConfig.Resolutions.length > 0
462
+ // ? this.selectedPrinterConfig.Resolutions[0]
463
+ // : null
464
+ // }
465
+ disabled: !(this.selectedPrinterConfig.Resolutions.length > 0) })),
550
466
  h("ezp-stepper", { label: "Copies", max: 10, icon: "copies" })),
551
467
  h("div", { id: "footer" },
552
468
  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 }))));
469
+ h("ezp-text-button", { disabled: this.selectedPrinter.id === '', type: "button", onClick: this.handlePrint, label: i18next.t('button_actions.print') })),
470
+ !this.hidemenu && h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
555
471
  }
556
472
  static get is() { return "ezp-printer-selection"; }
557
473
  static get encapsulation() { return "shadow"; }
@@ -598,7 +514,7 @@ export class EzpPrinterSelection {
598
514
  },
599
515
  "filename": {
600
516
  "type": "string",
601
- "mutable": false,
517
+ "mutable": true,
602
518
  "complexType": {
603
519
  "original": "string",
604
520
  "resolved": "string",
@@ -632,7 +548,7 @@ export class EzpPrinterSelection {
632
548
  },
633
549
  "filetype": {
634
550
  "type": "string",
635
- "mutable": false,
551
+ "mutable": true,
636
552
  "complexType": {
637
553
  "original": "string",
638
554
  "resolved": "string",
@@ -649,7 +565,7 @@ export class EzpPrinterSelection {
649
565
  },
650
566
  "fileid": {
651
567
  "type": "string",
652
- "mutable": false,
568
+ "mutable": true,
653
569
  "complexType": {
654
570
  "original": "string",
655
571
  "resolved": "string",
@@ -663,13 +579,57 @@ export class EzpPrinterSelection {
663
579
  },
664
580
  "attribute": "fileid",
665
581
  "reflect": false
582
+ },
583
+ "file": {
584
+ "type": "unknown",
585
+ "mutable": false,
586
+ "complexType": {
587
+ "original": "File",
588
+ "resolved": "File",
589
+ "references": {
590
+ "File": {
591
+ "location": "global"
592
+ }
593
+ }
594
+ },
595
+ "required": false,
596
+ "optional": false,
597
+ "docs": {
598
+ "tags": [],
599
+ "text": ""
600
+ }
601
+ },
602
+ "hidemenu": {
603
+ "type": "boolean",
604
+ "mutable": false,
605
+ "complexType": {
606
+ "original": "boolean",
607
+ "resolved": "boolean",
608
+ "references": {}
609
+ },
610
+ "required": false,
611
+ "optional": false,
612
+ "docs": {
613
+ "tags": [],
614
+ "text": ""
615
+ },
616
+ "attribute": "hidemenu",
617
+ "reflect": false,
618
+ "defaultValue": "false"
666
619
  }
667
620
  }; }
668
621
  static get states() { return {
669
622
  "loading": {},
670
623
  "options": {},
671
- "printInProgress": {},
624
+ "printProcessing": {},
625
+ "uploading": {},
626
+ "preparingUpload": {},
627
+ "printSuccess": {},
628
+ "printFailed": {},
629
+ "notSupported": {},
630
+ "noPrinters": {},
672
631
  "userMenuOpen": {},
632
+ "printStopped": {},
673
633
  "userName": {},
674
634
  "printers": {},
675
635
  "selectedPrinter": {},
@@ -741,5 +701,23 @@ export class EzpPrinterSelection {
741
701
  "target": undefined,
742
702
  "capture": false,
743
703
  "passive": false
704
+ }, {
705
+ "name": "statusCancel",
706
+ "method": "listenStatusCancel",
707
+ "target": undefined,
708
+ "capture": false,
709
+ "passive": false
710
+ }, {
711
+ "name": "statusClose",
712
+ "method": "listenStatusClose",
713
+ "target": undefined,
714
+ "capture": false,
715
+ "passive": false
716
+ }, {
717
+ "name": "statusRetry",
718
+ "method": "listenStatusRetry",
719
+ "target": undefined,
720
+ "capture": false,
721
+ "passive": false
744
722
  }]; }
745
723
  }