@ezeep/ezeep-js 1.0.159 → 1.0.163

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 (33) hide show
  1. package/dist/cjs/ezeep.cjs.js +1 -1
  2. package/dist/cjs/ezp-auth_14.cjs.entry.js +68 -152
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/collection/components/ezp-auth/ezp-auth.js +17 -17
  5. package/dist/collection/components/ezp-printer-selection/ezp-printer-selection.js +34 -55
  6. package/dist/collection/components/ezp-printing/ezp-printing.js +33 -1
  7. package/dist/collection/components/ezp-select/ezp-select.js +2 -0
  8. package/dist/collection/services/auth.js +5 -3
  9. package/dist/collection/services/print.js +0 -1
  10. package/dist/custom-elements/index.js +70 -154
  11. package/dist/directives/proxies.ts +1 -1
  12. package/dist/esm/ezeep.js +1 -1
  13. package/dist/esm/ezp-auth_14.entry.js +68 -152
  14. package/dist/esm/loader.js +1 -1
  15. package/dist/esm-es5/ezeep.js +1 -1
  16. package/dist/esm-es5/ezp-auth_14.entry.js +3 -3
  17. package/dist/esm-es5/loader.js +1 -1
  18. package/dist/ezeep/ezeep.esm.js +1 -1
  19. package/dist/ezeep/{p-34ef877e.entry.js → p-2f6827c6.entry.js} +2 -2
  20. package/dist/ezeep/p-80d5c308.system.js +1 -1
  21. package/dist/ezeep/{p-fa41201b.system.entry.js → p-9afa0fdb.system.entry.js} +3 -3
  22. package/dist/types/components/ezp-auth/ezp-auth.d.ts +2 -1
  23. package/dist/types/components/ezp-printer-selection/ezp-printer-selection.d.ts +2 -16
  24. package/dist/types/components/ezp-printing/ezp-printing.d.ts +3 -0
  25. package/dist/types/components.d.ts +1 -0
  26. package/dist/types/services/print.d.ts +1 -1
  27. package/package.json +1 -1
  28. package/readme.md +6 -6
  29. package/www/build/ezeep.esm.js +1 -1
  30. package/www/build/{p-34ef877e.entry.js → p-2f6827c6.entry.js} +2 -2
  31. package/www/build/p-80d5c308.system.js +1 -1
  32. package/www/build/{p-fa41201b.system.entry.js → p-9afa0fdb.system.entry.js} +3 -3
  33. package/www/index.html +5 -6
@@ -17,5 +17,5 @@ const patchBrowser = () => {
17
17
 
18
18
  patchBrowser().then(options => {
19
19
  appGlobals.globalScripts();
20
- return index.bootstrapLazy([["ezp-auth_14.cjs",[[1,"ezp-printing",{"clientid":[1],"redirecturi":[1],"filename":[1025],"fileurl":[1],"filetype":[1],"custom":[4],"hidelogin":[4],"hidemenu":[4],"authapihosturl":[1],"printapihosturl":[1],"theme":[1],"fileid":[1],"appearance":[1],"trigger":[1],"language":[1],"printOpen":[32],"authOpen":[32],"noDocumentOpen":[32],"systemAppearance":[32],"open":[64],"logOut":[64]},[[0,"printCancel","listenPrintCancel"],[0,"printSubmit","listenPrintSubmit"],[0,"authCancel","listenAuthCancel"],[0,"authSuccess","listenAuthSuccess"],[0,"uploadFile","listenUploadFile"],[0,"dialogClose","listenDialogClose"],[0,"dialogAction","listenDialogAction"]]],[1,"ezp-printer-selection",{"clientID":[1,"client-i-d"],"redirectURI":[1,"redirect-u-r-i"],"filename":[1025],"fileurl":[1],"filetype":[1025],"fileid":[1025],"file":[16],"hidemenu":[4],"loading":[32],"options":[32],"printProcessing":[32],"uploading":[32],"preparingUpload":[32],"printSuccess":[32],"printFailed":[32],"notSupported":[32],"noPrinters":[32],"userMenuOpen":[32],"printStopped":[32],"userName":[32],"printers":[32],"selectedPrinter":[32],"printerConfig":[32],"selectedPrinterConfig":[32],"selectedProperties":[32]},[[0,"selectSelection","listenSelectSelection"],[0,"stepperChanged","listenStepperChanged"],[0,"userMenuClosure","listenUserMenuClosure"],[0,"logoutEmitter","listenLogout"],[0,"statusCancel","listenStatusCancel"],[0,"statusClose","listenStatusClose"],[0,"statusRetry","listenStatusRetry"]]],[1,"ezp-auth",{"clientID":[1025,"client-i-d"],"redirectURI":[1025,"redirect-u-r-i"],"hidelogin":[4],"auth":[32],"authURI":[32],"accessToken":[32]},[[0,"dialogAction","listenDialogAction"],[0,"dialogClose","listenDialogClose"]]],[1,"ezp-upload",{"dragging":[32]},[[1,"dragenter","handleDragEnter"],[0,"dragover","handleDragOver"],[1,"dragleave","handleDragLeave"],[0,"drop","handleDrop"]]],[1,"ezp-dialog",{"heading":[1],"description":[1],"action":[1],"iconName":[1,"icon-name"],"iconSize":[1,"icon-size"],"iconFramed":[4,"icon-framed"],"instance":[1]}],[1,"ezp-user-menu",{"name":[1],"open":[1028]}],[1,"ezp-select",{"icon":[1],"label":[1],"optionFlow":[1,"option-flow"],"options":[16],"placeholder":[1],"preSelected":[8,"pre-selected"],"toggleFlow":[1,"toggle-flow"],"disabled":[4],"expanded":[32],"selected":[32]}],[1,"ezp-stepper",{"icon":[1],"label":[1],"max":[2],"min":[2],"canDecrease":[32],"canIncrease":[32],"focused":[32],"value":[32]}],[1,"ezp-status",{"description":[1],"processing":[4],"instance":[1],"icon":[1],"cancel":[8],"close":[8],"retry":[8]}],[1,"ezp-backdrop",{"visible":[1028]},[[0,"animationend","listenAnimationEnd"]]],[1,"ezp-icon-button",{"blank":[4],"disabled":[4],"href":[1],"icon":[1],"level":[1],"type":[1]}],[1,"ezp-text-button",{"blank":[4],"disabled":[4],"href":[1],"level":[1],"label":[1],"type":[1],"small":[4]}],[1,"ezp-icon",{"name":[1],"size":[1],"framed":[4]}],[1,"ezp-label",{"ellipsis":[4],"level":[1],"noWrap":[4,"no-wrap"],"text":[1],"weight":[1]}]]]], options);
20
+ return index.bootstrapLazy([["ezp-auth_14.cjs",[[1,"ezp-printing",{"clientid":[1],"redirecturi":[1],"filename":[1025],"fileurl":[1],"filetype":[1],"custom":[4],"hidelogin":[4],"hidemenu":[4],"authapihosturl":[1],"printapihosturl":[1],"theme":[1],"fileid":[1],"appearance":[1],"trigger":[1],"language":[1],"printOpen":[32],"authOpen":[32],"noDocumentOpen":[32],"systemAppearance":[32],"open":[64],"logOut":[64],"getSasUri":[64]},[[0,"printCancel","listenPrintCancel"],[0,"printSubmit","listenPrintSubmit"],[0,"authCancel","listenAuthCancel"],[0,"authSuccess","listenAuthSuccess"],[0,"uploadFile","listenUploadFile"],[0,"dialogClose","listenDialogClose"],[0,"dialogAction","listenDialogAction"]]],[1,"ezp-printer-selection",{"clientID":[1,"client-i-d"],"redirectURI":[1,"redirect-u-r-i"],"filename":[1025],"fileurl":[1],"filetype":[1025],"fileid":[1025],"file":[16],"hidemenu":[4],"loading":[32],"printProcessing":[32],"uploading":[32],"preparingUpload":[32],"printSuccess":[32],"printFailed":[32],"notSupported":[32],"noPrinters":[32],"userMenuOpen":[32],"printStopped":[32],"userName":[32],"printers":[32],"selectedPrinter":[32],"printerConfig":[32],"selectedPrinterConfig":[32],"selectedProperties":[32]},[[0,"selectSelection","listenSelectSelection"],[0,"stepperChanged","listenStepperChanged"],[0,"userMenuClosure","listenUserMenuClosure"],[0,"logoutEmitter","listenLogout"],[0,"statusCancel","listenStatusCancel"],[0,"statusClose","listenStatusClose"],[0,"statusRetry","listenStatusRetry"]]],[1,"ezp-auth",{"clientID":[1025,"client-i-d"],"redirectURI":[1025,"redirect-u-r-i"],"hidelogin":[4],"auth":[32],"authURI":[32],"accessToken":[32]},[[0,"dialogAction","listenDialogAction"],[0,"dialogClose","listenDialogClose"],[0,"statusCancel","listenStatusCancel"]]],[1,"ezp-upload",{"dragging":[32]},[[1,"dragenter","handleDragEnter"],[0,"dragover","handleDragOver"],[1,"dragleave","handleDragLeave"],[0,"drop","handleDrop"]]],[1,"ezp-dialog",{"heading":[1],"description":[1],"action":[1],"iconName":[1,"icon-name"],"iconSize":[1,"icon-size"],"iconFramed":[4,"icon-framed"],"instance":[1]}],[1,"ezp-user-menu",{"name":[1],"open":[1028]}],[1,"ezp-select",{"icon":[1],"label":[1],"optionFlow":[1,"option-flow"],"options":[16],"placeholder":[1],"preSelected":[8,"pre-selected"],"toggleFlow":[1,"toggle-flow"],"disabled":[4],"expanded":[32],"selected":[32]}],[1,"ezp-stepper",{"icon":[1],"label":[1],"max":[2],"min":[2],"canDecrease":[32],"canIncrease":[32],"focused":[32],"value":[32]}],[1,"ezp-status",{"description":[1],"processing":[4],"instance":[1],"icon":[1],"cancel":[8],"close":[8],"retry":[8]}],[1,"ezp-backdrop",{"visible":[1028]},[[0,"animationend","listenAnimationEnd"]]],[1,"ezp-icon-button",{"blank":[4],"disabled":[4],"href":[1],"icon":[1],"level":[1],"type":[1]}],[1,"ezp-text-button",{"blank":[4],"disabled":[4],"href":[1],"level":[1],"label":[1],"type":[1],"small":[4]}],[1,"ezp-icon",{"name":[1],"size":[1],"framed":[4]}],[1,"ezp-label",{"ellipsis":[4],"level":[1],"noWrap":[4,"no-wrap"],"text":[1],"weight":[1]}]]]], options);
21
21
  });
@@ -3154,9 +3154,11 @@ function sendCodeToParentWindow() {
3154
3154
  const params = new URLSearchParams(window.location.search);
3155
3155
  const code = params.get('code');
3156
3156
  if (window.opener) {
3157
- // send them to the opening window
3158
- window.opener.postMessage(code, authStore.state.redirectUri);
3159
- window.close();
3157
+ if (code) {
3158
+ // send them to the opening window
3159
+ window.opener.postMessage(code, authStore.state.redirectUri);
3160
+ window.close();
3161
+ }
3160
3162
  }
3161
3163
  }
3162
3164
 
@@ -3167,7 +3169,7 @@ let EzpAuth = class {
3167
3169
  index.registerInstance(this, hostRef);
3168
3170
  this.authCancel = index.createEvent(this, "authCancel", 7);
3169
3171
  this.authSuccess = index.createEvent(this, "authSuccess", 7);
3170
- this.windowObjectReference = null;
3172
+ this.oauthPopupWindow = null;
3171
3173
  this.previousUrl = null;
3172
3174
  }
3173
3175
  listenDialogAction() {
@@ -3176,38 +3178,32 @@ let EzpAuth = class {
3176
3178
  listenDialogClose() {
3177
3179
  this.authCancel.emit();
3178
3180
  }
3181
+ listenStatusCancel() {
3182
+ this.authCancel.emit();
3183
+ }
3179
3184
  openSignInWindow(url, name) {
3180
3185
  // remove any existing event listeners
3181
3186
  window.removeEventListener('message', this.receiveMessage);
3182
3187
  // window features
3183
- const strWindowFeatures = 'toolbar=no, menubar=no, width=600, height=7000, top=100, left=100';
3184
- if (this.windowObjectReference === null || this.windowObjectReference.closed) {
3188
+ const windowFeatures = 'toolbar=no, menubar=no, width=600, height=7000, top=100, left=100';
3189
+ if (this.oauthPopupWindow === null || this.oauthPopupWindow.closed) {
3185
3190
  /* if the pointer to the window object in memory does not exist
3186
3191
  or if such pointer exists but the window was closed */
3187
- this.windowObjectReference = window.open(url, name, strWindowFeatures);
3192
+ this.oauthPopupWindow = window.open(url, name, windowFeatures);
3188
3193
  }
3189
3194
  else if (this.previousUrl !== this.auth.authURI.toString()) {
3190
3195
  /* if the resource to load is different,
3191
3196
  then we load it in the already opened secondary window and then
3192
3197
  we bring such window back on top/in front of its parent window. */
3193
- this.windowObjectReference = window.open(url, name, strWindowFeatures);
3194
- this.windowObjectReference.focus();
3198
+ this.oauthPopupWindow = window.open(url, name, windowFeatures);
3199
+ this.oauthPopupWindow.focus();
3195
3200
  }
3196
3201
  else {
3197
3202
  /* else the window reference must exist and the window
3198
3203
  is not closed; therefore, we can bring it back on top of any other
3199
3204
  window with the focus() method. There would be no need to re-create
3200
3205
  the window or to reload the referenced resource. */
3201
- this.windowObjectReference.focus();
3202
- }
3203
- // check if the window was closed and cancel login accordingly
3204
- if (this.hidelogin) {
3205
- let checkClosedTimer = setInterval(() => {
3206
- if (this.windowObjectReference.closed) {
3207
- this.authCancel.emit();
3208
- clearInterval(checkClosedTimer);
3209
- }
3210
- }, 500);
3206
+ this.oauthPopupWindow.focus();
3211
3207
  }
3212
3208
  // add the listener for receiving a message from the popup
3213
3209
  window.addEventListener('message', (event) => this.receiveMessage(event), false);
@@ -3232,7 +3228,7 @@ let EzpAuth = class {
3232
3228
  }
3233
3229
  }
3234
3230
  render() {
3235
- return this.hidelogin ? (index.h("ezp-status", { description: i18next.t('login_dialog.action'), processing: true })) : (index.h(index.Host, null, index.h("ezp-dialog", { heading: i18next.t('login_dialog.heading'), description: i18next.t('login_dialog.description'), action: i18next.t('login_dialog.action'), iconName: "logo", iconSize: "huge", iconFramed: false, instance: "login" })));
3231
+ return this.hidelogin ? (index.h("ezp-status", { description: i18next.t('login_dialog.action'), processing: true, cancel: true })) : (index.h(index.Host, null, index.h("ezp-dialog", { heading: i18next.t('login_dialog.heading'), description: i18next.t('login_dialog.description'), action: i18next.t('login_dialog.action'), iconName: "logo", iconSize: "huge", iconFramed: false, instance: "login" })));
3236
3232
  }
3237
3233
  };
3238
3234
  EzpAuth.style = ezpAuthCss;
@@ -32436,7 +32432,6 @@ class EzpPrintService {
32436
32432
  this.clientID = clientID;
32437
32433
  this.printingApi = printStore.state.printApiHostUrl;
32438
32434
  this.checkStoredRefreshToken();
32439
- this.registerFetchInterceptor();
32440
32435
  }
32441
32436
  checkStoredRefreshToken() {
32442
32437
  if (authStore.state.refreshToken !== '') {
@@ -32613,84 +32608,6 @@ const userStore = createStore({
32613
32608
  appearance: '',
32614
32609
  });
32615
32610
 
32616
- const colors = [
32617
- {
32618
- id: 1,
32619
- name: "Grayscale"
32620
- },
32621
- {
32622
- id: 2,
32623
- name: "Color"
32624
- }
32625
- ];
32626
- const orientations = [
32627
- {
32628
- id: 1,
32629
- name: "Portrait"
32630
- },
32631
- {
32632
- id: 2,
32633
- name: "Landscape"
32634
- }
32635
- ];
32636
- const sizes = [
32637
- {
32638
- id: 1,
32639
- name: "Auto",
32640
- description: "Document size"
32641
- },
32642
- {
32643
- id: 2,
32644
- name: "Letter",
32645
- description: "8.5 x 11 in"
32646
- },
32647
- {
32648
- id: 3,
32649
- name: "Ledger",
32650
- description: "11 x 17 in"
32651
- },
32652
- {
32653
- id: 4,
32654
- name: "Legal",
32655
- description: "8.5 x 14 in"
32656
- },
32657
- {
32658
- id: 5,
32659
- name: "Executive",
32660
- description: "7.25 x 10.5 in"
32661
- },
32662
- {
32663
- id: 6,
32664
- name: "A3",
32665
- description: "11.7 x 16.5 in"
32666
- },
32667
- {
32668
- id: 7,
32669
- name: "A4",
32670
- description: "8.3 x 11.7 in"
32671
- },
32672
- {
32673
- id: 8,
32674
- name: "A5",
32675
- description: "5.8 x 8.3 in"
32676
- },
32677
- {
32678
- id: 9,
32679
- name: "Folio",
32680
- description: "8.5 x 13 in"
32681
- },
32682
- {
32683
- id: 10,
32684
- name: "Com-10",
32685
- description: "4.125 x 9.5 in"
32686
- }
32687
- ];
32688
- const options = {
32689
- colors: colors,
32690
- orientations: orientations,
32691
- sizes: sizes
32692
- };
32693
-
32694
32611
  const ezpPrinterSelectionCss = ":host{-ms-flex-line-pack:center;align-content:center;background:var(--ezp-color-overlay-primary);display:grid;grid-template:auto/320px;height:100vh;-ms-flex-pack:center;justify-content:center;left:0;position:fixed;top:0;width:100vw}#box{background:var(--ezp-color-surface-tertiary);border-radius:6px;-webkit-box-shadow:var(--ezp-printerSelection-box-boxShadow, 0 0 0 1px var(--ezp-color-overlay-secondary));box-shadow:var(--ezp-printerSelection-box-boxShadow, 0 0 0 1px var(--ezp-color-overlay-secondary));position:relative}#header{border-radius:6px 6px 0 0;-webkit-box-shadow:var(--ezp-printerSelection-header-boxShadowPosition, 0 1px 0 0) var(--ezp-color-outline);box-shadow:var(--ezp-printerSelection-header-boxShadowPosition, 0 1px 0 0) var(--ezp-color-outline);color:var(--ezp-color-foreground-primary);display:grid;grid-column-gap:var(--ezp-spacing-1);grid-template-columns:auto 1fr auto;padding:var(--ezp-spacing-4) var(--ezp-spacing-3) var(--ezp-spacing-4) var(--ezp-spacing-4);position:relative;z-index:3}#toggle-menu{margin:calc(var(--ezp-spacing-3) * -1) 0;position:relative;z-index:2}#body{background:var(--ezp-color-surface-secondary);-webkit-box-shadow:var(--ezp-printerSelection-body-boxShadow, none);box-shadow:var(--ezp-printerSelection-body-boxShadow, none);display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:var(--ezp-spacing-2);padding:var(--ezp-spacing-2)}#footer{border-radius:0 0 6px 6px;-webkit-box-shadow:var(--ezp-printerSelection-footer-boxShadowPosition, 0 -1px 0 0) var(--ezp-color-outline);box-shadow:var(--ezp-printerSelection-footer-boxShadowPosition, 0 -1px 0 0) var(--ezp-color-outline);display:grid;grid-column-gap:var(--ezp-spacing-2);grid-template-columns:repeat(2, 1fr);padding:var(--ezp-spacing-2);position:relative;z-index:3}";
32695
32612
 
32696
32613
  let EzpPrinterSelection = class {
@@ -32721,7 +32638,6 @@ let EzpPrinterSelection = class {
32721
32638
  *
32722
32639
  */
32723
32640
  this.loading = true;
32724
- this.options = options;
32725
32641
  this.printProcessing = false;
32726
32642
  this.uploading = false;
32727
32643
  this.preparingUpload = false;
@@ -32767,12 +32683,13 @@ let EzpPrinterSelection = class {
32767
32683
  return false;
32768
32684
  };
32769
32685
  this.POLL_INTERVAL = 2000;
32686
+ this.MAX_POLL_ATTEMPTS = 1000;
32770
32687
  /** Description... */
32771
32688
  this.handlePrint = async () => {
32772
32689
  this.printProcessing = true;
32773
32690
  // we have to initialse this obj with empty strings to display the select component
32774
32691
  // but don't want to send any attributes with empty strings to the API
32775
- this.selectedProperties = removeEmptyStrings(this.selectedProperties);
32692
+ const cleanPrintProperties = removeEmptyStrings(this.selectedProperties);
32776
32693
  // put it in store for further use
32777
32694
  printStore.state.fileUrl = this.fileurl;
32778
32695
  printStore.state.fileID = this.fileid;
@@ -32782,11 +32699,11 @@ let EzpPrinterSelection = class {
32782
32699
  printStore.state.fileName = this.filename;
32783
32700
  if (this.fileurl) {
32784
32701
  this.printService
32785
- .printFileByUrl(authStore.state.accessToken, this.fileurl, this.filetype, this.selectedPrinter.id, this.selectedProperties, this.filename)
32702
+ .printFileByUrl(authStore.state.accessToken, this.fileurl, this.filetype, this.selectedPrinter.id, cleanPrintProperties, this.filename)
32786
32703
  .then((response) => {
32787
32704
  if (response.status === 412) {
32788
32705
  response.json().then((data) => (this.fileid = data.fileid));
32789
- this.printService.printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, this.selectedProperties, this.filename);
32706
+ this.printService.printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, cleanPrintProperties, this.filename);
32790
32707
  }
32791
32708
  else {
32792
32709
  return response.json();
@@ -32803,7 +32720,7 @@ let EzpPrinterSelection = class {
32803
32720
  fn: this.printService.getPrintStatus,
32804
32721
  validate: this.validateData,
32805
32722
  interval: this.POLL_INTERVAL,
32806
- maxAttempts: 30,
32723
+ maxAttempts: this.MAX_POLL_ATTEMPTS,
32807
32724
  }).catch((err) => {
32808
32725
  console.warn(err);
32809
32726
  this.printFailed = true;
@@ -32822,7 +32739,7 @@ let EzpPrinterSelection = class {
32822
32739
  });
32823
32740
  }
32824
32741
  if (this.file) {
32825
- await this.handleFiles(this.file);
32742
+ await this.handleFiles(this.file, cleanPrintProperties);
32826
32743
  }
32827
32744
  localStorage.setItem('properties', JSON.stringify(this.selectedProperties));
32828
32745
  localStorage.setItem('printer', JSON.stringify(this.selectedPrinter));
@@ -32917,16 +32834,24 @@ let EzpPrinterSelection = class {
32917
32834
  break;
32918
32835
  case 'color':
32919
32836
  this.selectedProperties.color = !!eventDetails.id;
32837
+ // console.log('color selected:')
32838
+ // console.log(this.selectedProperties.color)
32920
32839
  break;
32921
32840
  case 'orientation':
32922
32841
  this.selectedProperties.orientation = eventDetails.id;
32842
+ // console.log('orientation selected:')
32843
+ // console.log(this.selectedProperties.orientation)
32923
32844
  break;
32924
32845
  case 'format':
32925
32846
  this.selectedProperties.paper = eventDetails.title;
32926
32847
  this.selectedProperties.paperid = eventDetails.id;
32848
+ // console.log('paper selected:')
32849
+ // console.log(this.selectedProperties.paper)
32927
32850
  break;
32928
32851
  case 'quality':
32929
32852
  this.selectedProperties.resolution = eventDetails.title;
32853
+ // console.log('quality selected:')
32854
+ // console.log(this.selectedProperties.resolution)
32930
32855
  break;
32931
32856
  case 'duplex':
32932
32857
  if (eventDetails.title === 'None') {
@@ -32936,10 +32861,12 @@ let EzpPrinterSelection = class {
32936
32861
  this.selectedProperties.duplex = true;
32937
32862
  }
32938
32863
  this.selectedProperties.duplexmode = eventDetails.id;
32864
+ // console.log('duplex selected:')
32865
+ // console.log(this.selectedProperties.duplexmode)
32939
32866
  break;
32940
32867
  }
32941
32868
  }
32942
- async handleFiles(file) {
32869
+ async handleFiles(file, printPorperties) {
32943
32870
  this.preparingUpload = true;
32944
32871
  const response = await this.printService.prepareFileUpload(authStore.state.accessToken);
32945
32872
  this.preparingUpload = false;
@@ -32958,7 +32885,7 @@ let EzpPrinterSelection = class {
32958
32885
  this.uploading = false;
32959
32886
  if (res._response.status === 201) {
32960
32887
  this.printService
32961
- .printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, this.selectedProperties, this.filename)
32888
+ .printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, printPorperties, this.filename)
32962
32889
  .then((data) => {
32963
32890
  if (data.code === 804) {
32964
32891
  this.printFailed = true;
@@ -32970,7 +32897,7 @@ let EzpPrinterSelection = class {
32970
32897
  fn: this.printService.getPrintStatus,
32971
32898
  validate: this.validateData,
32972
32899
  interval: this.POLL_INTERVAL,
32973
- maxAttempts: 30,
32900
+ maxAttempts: this.MAX_POLL_ATTEMPTS,
32974
32901
  }).catch((err) => {
32975
32902
  console.log(err);
32976
32903
  this.printFailed = true;
@@ -33005,8 +32932,8 @@ let EzpPrinterSelection = class {
33005
32932
  else {
33006
32933
  format = 'A4';
33007
32934
  }
33008
- this.selectedProperties.paper = this.selectedPrinterConfig.PaperFormats.find((el) => el.Name === format).Name;
33009
- this.selectedProperties.paperid = this.selectedPrinterConfig.PaperFormats.find((el) => el.Name === format).Id;
32935
+ this.selectedProperties.paper = this.selectedPrinterConfig.PaperFormats.find((el) => el.Name.includes(format)).Name;
32936
+ this.selectedProperties.paperid = this.selectedPrinterConfig.PaperFormats.find((el) => el.Name.includes(format)).Id;
33010
32937
  }
33011
32938
  /**
33012
32939
  *
@@ -33016,8 +32943,9 @@ let EzpPrinterSelection = class {
33016
32943
  /** Description... */
33017
32944
  async connectedCallback() {
33018
32945
  this.getPropertiesFromLocalStorage();
33019
- this.getUserInfo();
33020
32946
  this.printService = new EzpPrintService(this.redirectURI, this.clientID);
32947
+ this.printService.registerFetchInterceptor();
32948
+ await this.getUserInfo();
33021
32949
  // if printer is stored from previous print, get the config to enable property selection
33022
32950
  if (this.selectedPrinter.id != '') {
33023
32951
  await this.printService
@@ -33097,25 +33025,9 @@ let EzpPrinterSelection = class {
33097
33025
  },
33098
33026
  ],
33099
33027
  // preSelected={
33100
- // this.selectedProperties.color ?
33101
- // [
33102
- // {
33103
- // id: 1,
33104
- // title: i18next.t('printer_selection.color'),
33105
- // meta: '',
33106
- // type: 'color',
33107
- // },
33108
- // ]
33109
- // : !this.selectedProperties.color ?
33110
- // [
33111
- // {
33112
- // id: 0,
33113
- // title: i18next.t('printer_selection.color_grayscale'),
33114
- // meta: '',
33115
- // type: 'color',
33116
- // },
33117
- // ]
33118
- // : null
33028
+ // this.selectedProperties.color
33029
+ // ? i18next.t('printer_selection.color_color')
33030
+ // : i18next.t('printer_selection.color_grayscale')
33119
33031
  // }
33120
33032
  disabled: !this.selectedPrinterConfig.Color }), index.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) => ({
33121
33033
  id: option.id,
@@ -33125,9 +33037,9 @@ let EzpPrinterSelection = class {
33125
33037
  })),
33126
33038
  // preSelected={
33127
33039
  // this.selectedProperties.duplex
33128
- // ? this.selectedProperties.duplex
33129
- // // : this.selectedPrinterConfig.DuplexSupported
33130
- // // ? 'None'
33040
+ // ? this.duplexOptions.find(
33041
+ // (option) => option.id === this.selectedProperties.duplexmode
33042
+ // ).id
33131
33043
  // : null
33132
33044
  // }
33133
33045
  disabled: !this.selectedPrinterConfig.DuplexSupported }), index.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) => ({
@@ -33136,27 +33048,17 @@ let EzpPrinterSelection = class {
33136
33048
  meta: `${format.XRes} x ${format.YRes}`,
33137
33049
  type: 'format',
33138
33050
  })),
33139
- // preSelected={
33140
- // this.selectedProperties.paper
33141
- // ? this.selectedProperties.paper
33142
- // // : this.selectedPrinterConfig.PaperFormats.length > 0
33143
- // // ? this.selectedPrinterConfig.PaperFormats[0].Name
33144
- // : null
33145
- // }
33051
+ // preSelected={this.selectedProperties.paper ? this.selectedProperties.paper : null}
33146
33052
  disabled: !(this.selectedPrinterConfig.PaperFormats.length > 0) }), index.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) => ({
33147
- id: index,
33053
+ id: index + 1,
33148
33054
  title: i18next.t(`printer_selection.orientation_${orientation}`),
33149
33055
  meta: '',
33150
33056
  type: 'orientation',
33151
33057
  })),
33152
33058
  // preSelected={
33153
33059
  // this.selectedProperties.orientation
33154
- // ? this.selectedProperties.orientation
33155
- // // : this.selectedPrinterConfig.OrientationsSupported.length > 0
33156
- // // ? i18next.t(
33157
- // // `printer_selection.orientation_${this.selectedPrinterConfig.OrientationsSupported[0]}`
33158
- // // )
33159
- // : null
33060
+ // ? this.selectedProperties.orientation
33061
+ // : null
33160
33062
  // }
33161
33063
  disabled: !(this.selectedPrinterConfig.OrientationsSupported.length > 0) }), index.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) => ({
33162
33064
  id: index,
@@ -33165,11 +33067,7 @@ let EzpPrinterSelection = class {
33165
33067
  type: 'quality',
33166
33068
  })),
33167
33069
  // preSelected={
33168
- // this.selectedProperties.resolution
33169
- // ? this.selectedProperties.resolution
33170
- // // : this.selectedPrinterConfig.Resolutions.length > 0
33171
- // // ? this.selectedPrinterConfig.Resolutions[0]
33172
- // : null
33070
+ // this.selectedProperties.resolution ? this.selectedProperties.resolution : null
33173
33071
  // }
33174
33072
  disabled: !(this.selectedPrinterConfig.Resolutions.length > 0) })), index.h("ezp-stepper", { label: i18next.t('printer_selection.copies'), max: 10, icon: "copies" })), index.h("div", { id: "footer" }, index.h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel') }), index.h("ezp-text-button", { disabled: this.selectedPrinter.id === '', type: "button", onClick: this.handlePrint, label: i18next.t('button_actions.print') })), !this.hidemenu && index.h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
33175
33073
  }
@@ -33269,6 +33167,13 @@ let EzpPrinting = class {
33269
33167
  localStorage.removeItem('isAuthorized');
33270
33168
  this.printOpen = false;
33271
33169
  }
33170
+ async getSasUri() {
33171
+ const printService = new EzpPrintService(this.redirecturi, this.clientid);
33172
+ const response = await printService.prepareFileUpload(authStore.state.accessToken)
33173
+ .catch(() => this.open());
33174
+ const sasUri = response.sasUri;
33175
+ return sasUri;
33176
+ }
33272
33177
  checkAuth() {
33273
33178
  const printService = new EzpPrintService(this.redirecturi, this.clientid);
33274
33179
  let accessToken = authStore.state.accessToken;
@@ -33294,6 +33199,12 @@ let EzpPrinting = class {
33294
33199
  authStore.state.isAuthorized = false;
33295
33200
  });
33296
33201
  }
33202
+ refreshTokensPeriodically(seconds) {
33203
+ const authService = new EzpAuthorizationService(this.redirecturi, this.clientid);
33204
+ setInterval(() => {
33205
+ authService.refreshTokens();
33206
+ }, seconds * 1000);
33207
+ }
33297
33208
  componentWillLoad() {
33298
33209
  const systemAppearanceDark = window.matchMedia('(prefers-color-scheme: dark)');
33299
33210
  this.systemAppearance = systemAppearanceDark.matches ? 'dark' : 'light';
@@ -33319,6 +33230,9 @@ let EzpPrinting = class {
33319
33230
  sendCodeToParentWindow();
33320
33231
  this.checkAuth();
33321
33232
  }
33233
+ componentDidLoad() {
33234
+ this.refreshTokensPeriodically(1800);
33235
+ }
33322
33236
  /**
33323
33237
  *
33324
33238
  * Render method
@@ -33387,6 +33301,8 @@ let EzpSelect = class {
33387
33301
  const delay = this.selected.id === id ? 0 : this.duration * 1000;
33388
33302
  this.selected = this.options.find((option) => option.id === id);
33389
33303
  this.selectSelection.emit(this.selected);
33304
+ // console.log('ezp-select:')
33305
+ // console.log(this.selected)
33390
33306
  window.setTimeout(() => {
33391
33307
  this.toggle();
33392
33308
  }, delay);
@@ -16,7 +16,7 @@ const defineCustomElements = (win, options) => {
16
16
  if (typeof window === 'undefined') return Promise.resolve();
17
17
  return patchEsm().then(() => {
18
18
  appGlobals.globalScripts();
19
- return index.bootstrapLazy([["ezp-auth_14.cjs",[[1,"ezp-printing",{"clientid":[1],"redirecturi":[1],"filename":[1025],"fileurl":[1],"filetype":[1],"custom":[4],"hidelogin":[4],"hidemenu":[4],"authapihosturl":[1],"printapihosturl":[1],"theme":[1],"fileid":[1],"appearance":[1],"trigger":[1],"language":[1],"printOpen":[32],"authOpen":[32],"noDocumentOpen":[32],"systemAppearance":[32],"open":[64],"logOut":[64]},[[0,"printCancel","listenPrintCancel"],[0,"printSubmit","listenPrintSubmit"],[0,"authCancel","listenAuthCancel"],[0,"authSuccess","listenAuthSuccess"],[0,"uploadFile","listenUploadFile"],[0,"dialogClose","listenDialogClose"],[0,"dialogAction","listenDialogAction"]]],[1,"ezp-printer-selection",{"clientID":[1,"client-i-d"],"redirectURI":[1,"redirect-u-r-i"],"filename":[1025],"fileurl":[1],"filetype":[1025],"fileid":[1025],"file":[16],"hidemenu":[4],"loading":[32],"options":[32],"printProcessing":[32],"uploading":[32],"preparingUpload":[32],"printSuccess":[32],"printFailed":[32],"notSupported":[32],"noPrinters":[32],"userMenuOpen":[32],"printStopped":[32],"userName":[32],"printers":[32],"selectedPrinter":[32],"printerConfig":[32],"selectedPrinterConfig":[32],"selectedProperties":[32]},[[0,"selectSelection","listenSelectSelection"],[0,"stepperChanged","listenStepperChanged"],[0,"userMenuClosure","listenUserMenuClosure"],[0,"logoutEmitter","listenLogout"],[0,"statusCancel","listenStatusCancel"],[0,"statusClose","listenStatusClose"],[0,"statusRetry","listenStatusRetry"]]],[1,"ezp-auth",{"clientID":[1025,"client-i-d"],"redirectURI":[1025,"redirect-u-r-i"],"hidelogin":[4],"auth":[32],"authURI":[32],"accessToken":[32]},[[0,"dialogAction","listenDialogAction"],[0,"dialogClose","listenDialogClose"]]],[1,"ezp-upload",{"dragging":[32]},[[1,"dragenter","handleDragEnter"],[0,"dragover","handleDragOver"],[1,"dragleave","handleDragLeave"],[0,"drop","handleDrop"]]],[1,"ezp-dialog",{"heading":[1],"description":[1],"action":[1],"iconName":[1,"icon-name"],"iconSize":[1,"icon-size"],"iconFramed":[4,"icon-framed"],"instance":[1]}],[1,"ezp-user-menu",{"name":[1],"open":[1028]}],[1,"ezp-select",{"icon":[1],"label":[1],"optionFlow":[1,"option-flow"],"options":[16],"placeholder":[1],"preSelected":[8,"pre-selected"],"toggleFlow":[1,"toggle-flow"],"disabled":[4],"expanded":[32],"selected":[32]}],[1,"ezp-stepper",{"icon":[1],"label":[1],"max":[2],"min":[2],"canDecrease":[32],"canIncrease":[32],"focused":[32],"value":[32]}],[1,"ezp-status",{"description":[1],"processing":[4],"instance":[1],"icon":[1],"cancel":[8],"close":[8],"retry":[8]}],[1,"ezp-backdrop",{"visible":[1028]},[[0,"animationend","listenAnimationEnd"]]],[1,"ezp-icon-button",{"blank":[4],"disabled":[4],"href":[1],"icon":[1],"level":[1],"type":[1]}],[1,"ezp-text-button",{"blank":[4],"disabled":[4],"href":[1],"level":[1],"label":[1],"type":[1],"small":[4]}],[1,"ezp-icon",{"name":[1],"size":[1],"framed":[4]}],[1,"ezp-label",{"ellipsis":[4],"level":[1],"noWrap":[4,"no-wrap"],"text":[1],"weight":[1]}]]]], options);
19
+ return index.bootstrapLazy([["ezp-auth_14.cjs",[[1,"ezp-printing",{"clientid":[1],"redirecturi":[1],"filename":[1025],"fileurl":[1],"filetype":[1],"custom":[4],"hidelogin":[4],"hidemenu":[4],"authapihosturl":[1],"printapihosturl":[1],"theme":[1],"fileid":[1],"appearance":[1],"trigger":[1],"language":[1],"printOpen":[32],"authOpen":[32],"noDocumentOpen":[32],"systemAppearance":[32],"open":[64],"logOut":[64],"getSasUri":[64]},[[0,"printCancel","listenPrintCancel"],[0,"printSubmit","listenPrintSubmit"],[0,"authCancel","listenAuthCancel"],[0,"authSuccess","listenAuthSuccess"],[0,"uploadFile","listenUploadFile"],[0,"dialogClose","listenDialogClose"],[0,"dialogAction","listenDialogAction"]]],[1,"ezp-printer-selection",{"clientID":[1,"client-i-d"],"redirectURI":[1,"redirect-u-r-i"],"filename":[1025],"fileurl":[1],"filetype":[1025],"fileid":[1025],"file":[16],"hidemenu":[4],"loading":[32],"printProcessing":[32],"uploading":[32],"preparingUpload":[32],"printSuccess":[32],"printFailed":[32],"notSupported":[32],"noPrinters":[32],"userMenuOpen":[32],"printStopped":[32],"userName":[32],"printers":[32],"selectedPrinter":[32],"printerConfig":[32],"selectedPrinterConfig":[32],"selectedProperties":[32]},[[0,"selectSelection","listenSelectSelection"],[0,"stepperChanged","listenStepperChanged"],[0,"userMenuClosure","listenUserMenuClosure"],[0,"logoutEmitter","listenLogout"],[0,"statusCancel","listenStatusCancel"],[0,"statusClose","listenStatusClose"],[0,"statusRetry","listenStatusRetry"]]],[1,"ezp-auth",{"clientID":[1025,"client-i-d"],"redirectURI":[1025,"redirect-u-r-i"],"hidelogin":[4],"auth":[32],"authURI":[32],"accessToken":[32]},[[0,"dialogAction","listenDialogAction"],[0,"dialogClose","listenDialogClose"],[0,"statusCancel","listenStatusCancel"]]],[1,"ezp-upload",{"dragging":[32]},[[1,"dragenter","handleDragEnter"],[0,"dragover","handleDragOver"],[1,"dragleave","handleDragLeave"],[0,"drop","handleDrop"]]],[1,"ezp-dialog",{"heading":[1],"description":[1],"action":[1],"iconName":[1,"icon-name"],"iconSize":[1,"icon-size"],"iconFramed":[4,"icon-framed"],"instance":[1]}],[1,"ezp-user-menu",{"name":[1],"open":[1028]}],[1,"ezp-select",{"icon":[1],"label":[1],"optionFlow":[1,"option-flow"],"options":[16],"placeholder":[1],"preSelected":[8,"pre-selected"],"toggleFlow":[1,"toggle-flow"],"disabled":[4],"expanded":[32],"selected":[32]}],[1,"ezp-stepper",{"icon":[1],"label":[1],"max":[2],"min":[2],"canDecrease":[32],"canIncrease":[32],"focused":[32],"value":[32]}],[1,"ezp-status",{"description":[1],"processing":[4],"instance":[1],"icon":[1],"cancel":[8],"close":[8],"retry":[8]}],[1,"ezp-backdrop",{"visible":[1028]},[[0,"animationend","listenAnimationEnd"]]],[1,"ezp-icon-button",{"blank":[4],"disabled":[4],"href":[1],"icon":[1],"level":[1],"type":[1]}],[1,"ezp-text-button",{"blank":[4],"disabled":[4],"href":[1],"level":[1],"label":[1],"type":[1],"small":[4]}],[1,"ezp-icon",{"name":[1],"size":[1],"framed":[4]}],[1,"ezp-label",{"ellipsis":[4],"level":[1],"noWrap":[4,"no-wrap"],"text":[1],"weight":[1]}]]]], options);
20
20
  });
21
21
  };
22
22
 
@@ -4,7 +4,7 @@ import authStore from '../../services/auth';
4
4
  import i18next from 'i18next';
5
5
  export class EzpAuth {
6
6
  constructor() {
7
- this.windowObjectReference = null;
7
+ this.oauthPopupWindow = null;
8
8
  this.previousUrl = null;
9
9
  }
10
10
  listenDialogAction() {
@@ -13,38 +13,32 @@ export class EzpAuth {
13
13
  listenDialogClose() {
14
14
  this.authCancel.emit();
15
15
  }
16
+ listenStatusCancel() {
17
+ this.authCancel.emit();
18
+ }
16
19
  openSignInWindow(url, name) {
17
20
  // remove any existing event listeners
18
21
  window.removeEventListener('message', this.receiveMessage);
19
22
  // window features
20
- const strWindowFeatures = 'toolbar=no, menubar=no, width=600, height=7000, top=100, left=100';
21
- if (this.windowObjectReference === null || this.windowObjectReference.closed) {
23
+ const windowFeatures = 'toolbar=no, menubar=no, width=600, height=7000, top=100, left=100';
24
+ if (this.oauthPopupWindow === null || this.oauthPopupWindow.closed) {
22
25
  /* if the pointer to the window object in memory does not exist
23
26
  or if such pointer exists but the window was closed */
24
- this.windowObjectReference = window.open(url, name, strWindowFeatures);
27
+ this.oauthPopupWindow = window.open(url, name, windowFeatures);
25
28
  }
26
29
  else if (this.previousUrl !== this.auth.authURI.toString()) {
27
30
  /* if the resource to load is different,
28
31
  then we load it in the already opened secondary window and then
29
32
  we bring such window back on top/in front of its parent window. */
30
- this.windowObjectReference = window.open(url, name, strWindowFeatures);
31
- this.windowObjectReference.focus();
33
+ this.oauthPopupWindow = window.open(url, name, windowFeatures);
34
+ this.oauthPopupWindow.focus();
32
35
  }
33
36
  else {
34
37
  /* else the window reference must exist and the window
35
38
  is not closed; therefore, we can bring it back on top of any other
36
39
  window with the focus() method. There would be no need to re-create
37
40
  the window or to reload the referenced resource. */
38
- this.windowObjectReference.focus();
39
- }
40
- // check if the window was closed and cancel login accordingly
41
- if (this.hidelogin) {
42
- let checkClosedTimer = setInterval(() => {
43
- if (this.windowObjectReference.closed) {
44
- this.authCancel.emit();
45
- clearInterval(checkClosedTimer);
46
- }
47
- }, 500);
41
+ this.oauthPopupWindow.focus();
48
42
  }
49
43
  // add the listener for receiving a message from the popup
50
44
  window.addEventListener('message', (event) => this.receiveMessage(event), false);
@@ -69,7 +63,7 @@ export class EzpAuth {
69
63
  }
70
64
  }
71
65
  render() {
72
- return this.hidelogin ? (h("ezp-status", { description: i18next.t('login_dialog.action'), processing: true })) : (h(Host, null,
66
+ return this.hidelogin ? (h("ezp-status", { description: i18next.t('login_dialog.action'), processing: true, cancel: true })) : (h(Host, null,
73
67
  h("ezp-dialog", { heading: i18next.t('login_dialog.heading'), description: i18next.t('login_dialog.description'), action: i18next.t('login_dialog.action'), iconName: "logo", iconSize: "huge", iconFramed: false, instance: "login" })));
74
68
  }
75
69
  static get is() { return "ezp-auth"; }
@@ -185,5 +179,11 @@ export class EzpAuth {
185
179
  "target": undefined,
186
180
  "capture": false,
187
181
  "passive": false
182
+ }, {
183
+ "name": "statusCancel",
184
+ "method": "listenStatusCancel",
185
+ "target": undefined,
186
+ "capture": false,
187
+ "passive": false
188
188
  }]; }
189
189
  }