@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
@@ -3163,9 +3163,11 @@ function sendCodeToParentWindow() {
3163
3163
  const params = new URLSearchParams(window.location.search);
3164
3164
  const code = params.get('code');
3165
3165
  if (window.opener) {
3166
- // send them to the opening window
3167
- window.opener.postMessage(code, authStore.state.redirectUri);
3168
- window.close();
3166
+ if (code) {
3167
+ // send them to the opening window
3168
+ window.opener.postMessage(code, authStore.state.redirectUri);
3169
+ window.close();
3170
+ }
3169
3171
  }
3170
3172
  }
3171
3173
 
@@ -3178,7 +3180,7 @@ let EzpAuth$1 = class extends HTMLElement {
3178
3180
  this.__attachShadow();
3179
3181
  this.authCancel = createEvent(this, "authCancel", 7);
3180
3182
  this.authSuccess = createEvent(this, "authSuccess", 7);
3181
- this.windowObjectReference = null;
3183
+ this.oauthPopupWindow = null;
3182
3184
  this.previousUrl = null;
3183
3185
  }
3184
3186
  listenDialogAction() {
@@ -3187,38 +3189,32 @@ let EzpAuth$1 = class extends HTMLElement {
3187
3189
  listenDialogClose() {
3188
3190
  this.authCancel.emit();
3189
3191
  }
3192
+ listenStatusCancel() {
3193
+ this.authCancel.emit();
3194
+ }
3190
3195
  openSignInWindow(url, name) {
3191
3196
  // remove any existing event listeners
3192
3197
  window.removeEventListener('message', this.receiveMessage);
3193
3198
  // window features
3194
- const strWindowFeatures = 'toolbar=no, menubar=no, width=600, height=7000, top=100, left=100';
3195
- if (this.windowObjectReference === null || this.windowObjectReference.closed) {
3199
+ const windowFeatures = 'toolbar=no, menubar=no, width=600, height=7000, top=100, left=100';
3200
+ if (this.oauthPopupWindow === null || this.oauthPopupWindow.closed) {
3196
3201
  /* if the pointer to the window object in memory does not exist
3197
3202
  or if such pointer exists but the window was closed */
3198
- this.windowObjectReference = window.open(url, name, strWindowFeatures);
3203
+ this.oauthPopupWindow = window.open(url, name, windowFeatures);
3199
3204
  }
3200
3205
  else if (this.previousUrl !== this.auth.authURI.toString()) {
3201
3206
  /* if the resource to load is different,
3202
3207
  then we load it in the already opened secondary window and then
3203
3208
  we bring such window back on top/in front of its parent window. */
3204
- this.windowObjectReference = window.open(url, name, strWindowFeatures);
3205
- this.windowObjectReference.focus();
3209
+ this.oauthPopupWindow = window.open(url, name, windowFeatures);
3210
+ this.oauthPopupWindow.focus();
3206
3211
  }
3207
3212
  else {
3208
3213
  /* else the window reference must exist and the window
3209
3214
  is not closed; therefore, we can bring it back on top of any other
3210
3215
  window with the focus() method. There would be no need to re-create
3211
3216
  the window or to reload the referenced resource. */
3212
- this.windowObjectReference.focus();
3213
- }
3214
- // check if the window was closed and cancel login accordingly
3215
- if (this.hidelogin) {
3216
- let checkClosedTimer = setInterval(() => {
3217
- if (this.windowObjectReference.closed) {
3218
- this.authCancel.emit();
3219
- clearInterval(checkClosedTimer);
3220
- }
3221
- }, 500);
3217
+ this.oauthPopupWindow.focus();
3222
3218
  }
3223
3219
  // add the listener for receiving a message from the popup
3224
3220
  window.addEventListener('message', (event) => this.receiveMessage(event), false);
@@ -3243,7 +3239,7 @@ let EzpAuth$1 = class extends HTMLElement {
3243
3239
  }
3244
3240
  }
3245
3241
  render() {
3246
- return this.hidelogin ? (h("ezp-status", { description: i18next.t('login_dialog.action'), processing: true })) : (h(Host, null, 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" })));
3242
+ return this.hidelogin ? (h("ezp-status", { description: i18next.t('login_dialog.action'), processing: true, cancel: true })) : (h(Host, null, 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" })));
3247
3243
  }
3248
3244
  static get style() { return ezpAuthCss; }
3249
3245
  };
@@ -32457,7 +32453,6 @@ class EzpPrintService {
32457
32453
  this.clientID = clientID;
32458
32454
  this.printingApi = printStore.state.printApiHostUrl;
32459
32455
  this.checkStoredRefreshToken();
32460
- this.registerFetchInterceptor();
32461
32456
  }
32462
32457
  checkStoredRefreshToken() {
32463
32458
  if (authStore.state.refreshToken !== '') {
@@ -32634,84 +32629,6 @@ const userStore = createStore({
32634
32629
  appearance: '',
32635
32630
  });
32636
32631
 
32637
- const colors = [
32638
- {
32639
- id: 1,
32640
- name: "Grayscale"
32641
- },
32642
- {
32643
- id: 2,
32644
- name: "Color"
32645
- }
32646
- ];
32647
- const orientations = [
32648
- {
32649
- id: 1,
32650
- name: "Portrait"
32651
- },
32652
- {
32653
- id: 2,
32654
- name: "Landscape"
32655
- }
32656
- ];
32657
- const sizes = [
32658
- {
32659
- id: 1,
32660
- name: "Auto",
32661
- description: "Document size"
32662
- },
32663
- {
32664
- id: 2,
32665
- name: "Letter",
32666
- description: "8.5 x 11 in"
32667
- },
32668
- {
32669
- id: 3,
32670
- name: "Ledger",
32671
- description: "11 x 17 in"
32672
- },
32673
- {
32674
- id: 4,
32675
- name: "Legal",
32676
- description: "8.5 x 14 in"
32677
- },
32678
- {
32679
- id: 5,
32680
- name: "Executive",
32681
- description: "7.25 x 10.5 in"
32682
- },
32683
- {
32684
- id: 6,
32685
- name: "A3",
32686
- description: "11.7 x 16.5 in"
32687
- },
32688
- {
32689
- id: 7,
32690
- name: "A4",
32691
- description: "8.3 x 11.7 in"
32692
- },
32693
- {
32694
- id: 8,
32695
- name: "A5",
32696
- description: "5.8 x 8.3 in"
32697
- },
32698
- {
32699
- id: 9,
32700
- name: "Folio",
32701
- description: "8.5 x 13 in"
32702
- },
32703
- {
32704
- id: 10,
32705
- name: "Com-10",
32706
- description: "4.125 x 9.5 in"
32707
- }
32708
- ];
32709
- const options = {
32710
- colors: colors,
32711
- orientations: orientations,
32712
- sizes: sizes
32713
- };
32714
-
32715
32632
  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}";
32716
32633
 
32717
32634
  let EzpPrinterSelection$1 = class extends HTMLElement {
@@ -32744,7 +32661,6 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
32744
32661
  *
32745
32662
  */
32746
32663
  this.loading = true;
32747
- this.options = options;
32748
32664
  this.printProcessing = false;
32749
32665
  this.uploading = false;
32750
32666
  this.preparingUpload = false;
@@ -32790,12 +32706,13 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
32790
32706
  return false;
32791
32707
  };
32792
32708
  this.POLL_INTERVAL = 2000;
32709
+ this.MAX_POLL_ATTEMPTS = 1000;
32793
32710
  /** Description... */
32794
32711
  this.handlePrint = async () => {
32795
32712
  this.printProcessing = true;
32796
32713
  // we have to initialse this obj with empty strings to display the select component
32797
32714
  // but don't want to send any attributes with empty strings to the API
32798
- this.selectedProperties = removeEmptyStrings(this.selectedProperties);
32715
+ const cleanPrintProperties = removeEmptyStrings(this.selectedProperties);
32799
32716
  // put it in store for further use
32800
32717
  printStore.state.fileUrl = this.fileurl;
32801
32718
  printStore.state.fileID = this.fileid;
@@ -32805,11 +32722,11 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
32805
32722
  printStore.state.fileName = this.filename;
32806
32723
  if (this.fileurl) {
32807
32724
  this.printService
32808
- .printFileByUrl(authStore.state.accessToken, this.fileurl, this.filetype, this.selectedPrinter.id, this.selectedProperties, this.filename)
32725
+ .printFileByUrl(authStore.state.accessToken, this.fileurl, this.filetype, this.selectedPrinter.id, cleanPrintProperties, this.filename)
32809
32726
  .then((response) => {
32810
32727
  if (response.status === 412) {
32811
32728
  response.json().then((data) => (this.fileid = data.fileid));
32812
- this.printService.printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, this.selectedProperties, this.filename);
32729
+ this.printService.printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, cleanPrintProperties, this.filename);
32813
32730
  }
32814
32731
  else {
32815
32732
  return response.json();
@@ -32826,7 +32743,7 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
32826
32743
  fn: this.printService.getPrintStatus,
32827
32744
  validate: this.validateData,
32828
32745
  interval: this.POLL_INTERVAL,
32829
- maxAttempts: 30,
32746
+ maxAttempts: this.MAX_POLL_ATTEMPTS,
32830
32747
  }).catch((err) => {
32831
32748
  console.warn(err);
32832
32749
  this.printFailed = true;
@@ -32845,7 +32762,7 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
32845
32762
  });
32846
32763
  }
32847
32764
  if (this.file) {
32848
- await this.handleFiles(this.file);
32765
+ await this.handleFiles(this.file, cleanPrintProperties);
32849
32766
  }
32850
32767
  localStorage.setItem('properties', JSON.stringify(this.selectedProperties));
32851
32768
  localStorage.setItem('printer', JSON.stringify(this.selectedPrinter));
@@ -32940,16 +32857,24 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
32940
32857
  break;
32941
32858
  case 'color':
32942
32859
  this.selectedProperties.color = !!eventDetails.id;
32860
+ // console.log('color selected:')
32861
+ // console.log(this.selectedProperties.color)
32943
32862
  break;
32944
32863
  case 'orientation':
32945
32864
  this.selectedProperties.orientation = eventDetails.id;
32865
+ // console.log('orientation selected:')
32866
+ // console.log(this.selectedProperties.orientation)
32946
32867
  break;
32947
32868
  case 'format':
32948
32869
  this.selectedProperties.paper = eventDetails.title;
32949
32870
  this.selectedProperties.paperid = eventDetails.id;
32871
+ // console.log('paper selected:')
32872
+ // console.log(this.selectedProperties.paper)
32950
32873
  break;
32951
32874
  case 'quality':
32952
32875
  this.selectedProperties.resolution = eventDetails.title;
32876
+ // console.log('quality selected:')
32877
+ // console.log(this.selectedProperties.resolution)
32953
32878
  break;
32954
32879
  case 'duplex':
32955
32880
  if (eventDetails.title === 'None') {
@@ -32959,10 +32884,12 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
32959
32884
  this.selectedProperties.duplex = true;
32960
32885
  }
32961
32886
  this.selectedProperties.duplexmode = eventDetails.id;
32887
+ // console.log('duplex selected:')
32888
+ // console.log(this.selectedProperties.duplexmode)
32962
32889
  break;
32963
32890
  }
32964
32891
  }
32965
- async handleFiles(file) {
32892
+ async handleFiles(file, printPorperties) {
32966
32893
  this.preparingUpload = true;
32967
32894
  const response = await this.printService.prepareFileUpload(authStore.state.accessToken);
32968
32895
  this.preparingUpload = false;
@@ -32981,7 +32908,7 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
32981
32908
  this.uploading = false;
32982
32909
  if (res._response.status === 201) {
32983
32910
  this.printService
32984
- .printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, this.selectedProperties, this.filename)
32911
+ .printByFileID(authStore.state.accessToken, this.fileid, this.filetype, this.selectedPrinter.id, printPorperties, this.filename)
32985
32912
  .then((data) => {
32986
32913
  if (data.code === 804) {
32987
32914
  this.printFailed = true;
@@ -32993,7 +32920,7 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
32993
32920
  fn: this.printService.getPrintStatus,
32994
32921
  validate: this.validateData,
32995
32922
  interval: this.POLL_INTERVAL,
32996
- maxAttempts: 30,
32923
+ maxAttempts: this.MAX_POLL_ATTEMPTS,
32997
32924
  }).catch((err) => {
32998
32925
  console.log(err);
32999
32926
  this.printFailed = true;
@@ -33028,8 +32955,8 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
33028
32955
  else {
33029
32956
  format = 'A4';
33030
32957
  }
33031
- this.selectedProperties.paper = this.selectedPrinterConfig.PaperFormats.find((el) => el.Name === format).Name;
33032
- this.selectedProperties.paperid = this.selectedPrinterConfig.PaperFormats.find((el) => el.Name === format).Id;
32958
+ this.selectedProperties.paper = this.selectedPrinterConfig.PaperFormats.find((el) => el.Name.includes(format)).Name;
32959
+ this.selectedProperties.paperid = this.selectedPrinterConfig.PaperFormats.find((el) => el.Name.includes(format)).Id;
33033
32960
  }
33034
32961
  /**
33035
32962
  *
@@ -33039,8 +32966,9 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
33039
32966
  /** Description... */
33040
32967
  async connectedCallback() {
33041
32968
  this.getPropertiesFromLocalStorage();
33042
- this.getUserInfo();
33043
32969
  this.printService = new EzpPrintService(this.redirectURI, this.clientID);
32970
+ this.printService.registerFetchInterceptor();
32971
+ await this.getUserInfo();
33044
32972
  // if printer is stored from previous print, get the config to enable property selection
33045
32973
  if (this.selectedPrinter.id != '') {
33046
32974
  await this.printService
@@ -33120,25 +33048,9 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
33120
33048
  },
33121
33049
  ],
33122
33050
  // preSelected={
33123
- // this.selectedProperties.color ?
33124
- // [
33125
- // {
33126
- // id: 1,
33127
- // title: i18next.t('printer_selection.color'),
33128
- // meta: '',
33129
- // type: 'color',
33130
- // },
33131
- // ]
33132
- // : !this.selectedProperties.color ?
33133
- // [
33134
- // {
33135
- // id: 0,
33136
- // title: i18next.t('printer_selection.color_grayscale'),
33137
- // meta: '',
33138
- // type: 'color',
33139
- // },
33140
- // ]
33141
- // : null
33051
+ // this.selectedProperties.color
33052
+ // ? i18next.t('printer_selection.color_color')
33053
+ // : i18next.t('printer_selection.color_grayscale')
33142
33054
  // }
33143
33055
  disabled: !this.selectedPrinterConfig.Color }), 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) => ({
33144
33056
  id: option.id,
@@ -33148,9 +33060,9 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
33148
33060
  })),
33149
33061
  // preSelected={
33150
33062
  // this.selectedProperties.duplex
33151
- // ? this.selectedProperties.duplex
33152
- // // : this.selectedPrinterConfig.DuplexSupported
33153
- // // ? 'None'
33063
+ // ? this.duplexOptions.find(
33064
+ // (option) => option.id === this.selectedProperties.duplexmode
33065
+ // ).id
33154
33066
  // : null
33155
33067
  // }
33156
33068
  disabled: !this.selectedPrinterConfig.DuplexSupported }), h("ezp-select", { label: i18next.t('printer_selection.size'), icon: "size", placeholder: i18next.t('printer_selection.select_size'), toggleFlow: "horizontal", optionFlow: "horizontal", options: this.selectedPrinterConfig.PaperFormats.map((format) => ({
@@ -33159,27 +33071,17 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
33159
33071
  meta: `${format.XRes} x ${format.YRes}`,
33160
33072
  type: 'format',
33161
33073
  })),
33162
- // preSelected={
33163
- // this.selectedProperties.paper
33164
- // ? this.selectedProperties.paper
33165
- // // : this.selectedPrinterConfig.PaperFormats.length > 0
33166
- // // ? this.selectedPrinterConfig.PaperFormats[0].Name
33167
- // : null
33168
- // }
33074
+ // preSelected={this.selectedProperties.paper ? this.selectedProperties.paper : null}
33169
33075
  disabled: !(this.selectedPrinterConfig.PaperFormats.length > 0) }), 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) => ({
33170
- id: index,
33076
+ id: index + 1,
33171
33077
  title: i18next.t(`printer_selection.orientation_${orientation}`),
33172
33078
  meta: '',
33173
33079
  type: 'orientation',
33174
33080
  })),
33175
33081
  // preSelected={
33176
33082
  // this.selectedProperties.orientation
33177
- // ? this.selectedProperties.orientation
33178
- // // : this.selectedPrinterConfig.OrientationsSupported.length > 0
33179
- // // ? i18next.t(
33180
- // // `printer_selection.orientation_${this.selectedPrinterConfig.OrientationsSupported[0]}`
33181
- // // )
33182
- // : null
33083
+ // ? this.selectedProperties.orientation
33084
+ // : null
33183
33085
  // }
33184
33086
  disabled: !(this.selectedPrinterConfig.OrientationsSupported.length > 0) }), 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) => ({
33185
33087
  id: index,
@@ -33188,11 +33090,7 @@ let EzpPrinterSelection$1 = class extends HTMLElement {
33188
33090
  type: 'quality',
33189
33091
  })),
33190
33092
  // preSelected={
33191
- // this.selectedProperties.resolution
33192
- // ? this.selectedProperties.resolution
33193
- // // : this.selectedPrinterConfig.Resolutions.length > 0
33194
- // // ? this.selectedPrinterConfig.Resolutions[0]
33195
- // : null
33093
+ // this.selectedProperties.resolution ? this.selectedProperties.resolution : null
33196
33094
  // }
33197
33095
  disabled: !(this.selectedPrinterConfig.Resolutions.length > 0) })), h("ezp-stepper", { label: i18next.t('printer_selection.copies'), max: 10, icon: "copies" })), h("div", { id: "footer" }, h("ezp-text-button", { type: "button", level: "secondary", onClick: this.handleCancel, label: i18next.t('button_actions.cancel') }), h("ezp-text-button", { disabled: this.selectedPrinter.id === '', type: "button", onClick: this.handlePrint, label: i18next.t('button_actions.print') })), !this.hidemenu && h("ezp-user-menu", { open: this.userMenuOpen, name: this.userName }))));
33198
33096
  }
@@ -33294,6 +33192,13 @@ let EzpPrinting$1 = class extends HTMLElement {
33294
33192
  localStorage.removeItem('isAuthorized');
33295
33193
  this.printOpen = false;
33296
33194
  }
33195
+ async getSasUri() {
33196
+ const printService = new EzpPrintService(this.redirecturi, this.clientid);
33197
+ const response = await printService.prepareFileUpload(authStore.state.accessToken)
33198
+ .catch(() => this.open());
33199
+ const sasUri = response.sasUri;
33200
+ return sasUri;
33201
+ }
33297
33202
  checkAuth() {
33298
33203
  const printService = new EzpPrintService(this.redirecturi, this.clientid);
33299
33204
  let accessToken = authStore.state.accessToken;
@@ -33319,6 +33224,12 @@ let EzpPrinting$1 = class extends HTMLElement {
33319
33224
  authStore.state.isAuthorized = false;
33320
33225
  });
33321
33226
  }
33227
+ refreshTokensPeriodically(seconds) {
33228
+ const authService = new EzpAuthorizationService(this.redirecturi, this.clientid);
33229
+ setInterval(() => {
33230
+ authService.refreshTokens();
33231
+ }, seconds * 1000);
33232
+ }
33322
33233
  componentWillLoad() {
33323
33234
  const systemAppearanceDark = window.matchMedia('(prefers-color-scheme: dark)');
33324
33235
  this.systemAppearance = systemAppearanceDark.matches ? 'dark' : 'light';
@@ -33344,6 +33255,9 @@ let EzpPrinting$1 = class extends HTMLElement {
33344
33255
  sendCodeToParentWindow();
33345
33256
  this.checkAuth();
33346
33257
  }
33258
+ componentDidLoad() {
33259
+ this.refreshTokensPeriodically(1800);
33260
+ }
33347
33261
  /**
33348
33262
  *
33349
33263
  * Render method
@@ -33414,6 +33328,8 @@ let EzpSelect$1 = class extends HTMLElement {
33414
33328
  const delay = this.selected.id === id ? 0 : this.duration * 1000;
33415
33329
  this.selected = this.options.find((option) => option.id === id);
33416
33330
  this.selectSelection.emit(this.selected);
33331
+ // console.log('ezp-select:')
33332
+ // console.log(this.selected)
33417
33333
  window.setTimeout(() => {
33418
33334
  this.toggle();
33419
33335
  }, delay);
@@ -33840,13 +33756,13 @@ let EzpUserMenu$1 = class extends HTMLElement {
33840
33756
  };
33841
33757
 
33842
33758
  globalScripts();
33843
- const EzpAuth = /*@__PURE__*/proxyCustomElement(EzpAuth$1, [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"]]]);
33759
+ const EzpAuth = /*@__PURE__*/proxyCustomElement(EzpAuth$1, [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"]]]);
33844
33760
  const EzpBackdrop = /*@__PURE__*/proxyCustomElement(EzpBackdrop$1, [1,"ezp-backdrop",{"visible":[1028]},[[0,"animationend","listenAnimationEnd"]]]);
33845
33761
  const EzpDialog = /*@__PURE__*/proxyCustomElement(EzpDialog$1, [1,"ezp-dialog",{"heading":[1],"description":[1],"action":[1],"iconName":[1,"icon-name"],"iconSize":[1,"icon-size"],"iconFramed":[4,"icon-framed"],"instance":[1]}]);
33846
33762
  const EzpIcon = /*@__PURE__*/proxyCustomElement(EzpIcon$1, [1,"ezp-icon",{"name":[1],"size":[1],"framed":[4]}]);
33847
33763
  const EzpIconButton = /*@__PURE__*/proxyCustomElement(EzpIconButton$1, [1,"ezp-icon-button",{"blank":[4],"disabled":[4],"href":[1],"icon":[1],"level":[1],"type":[1]}]);
33848
33764
  const EzpLabel = /*@__PURE__*/proxyCustomElement(EzpLabel$1, [1,"ezp-label",{"ellipsis":[4],"level":[1],"noWrap":[4,"no-wrap"],"text":[1],"weight":[1]}]);
33849
- const EzpPrinterSelection = /*@__PURE__*/proxyCustomElement(EzpPrinterSelection$1, [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"]]]);
33765
+ const EzpPrinterSelection = /*@__PURE__*/proxyCustomElement(EzpPrinterSelection$1, [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"]]]);
33850
33766
  const EzpPrinting = /*@__PURE__*/proxyCustomElement(EzpPrinting$1, [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]},[[0,"printCancel","listenPrintCancel"],[0,"printSubmit","listenPrintSubmit"],[0,"authCancel","listenAuthCancel"],[0,"authSuccess","listenAuthSuccess"],[0,"uploadFile","listenUploadFile"],[0,"dialogClose","listenDialogClose"],[0,"dialogAction","listenDialogAction"]]]);
33851
33767
  const EzpSelect = /*@__PURE__*/proxyCustomElement(EzpSelect$1, [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]}]);
33852
33768
  const EzpStatus = /*@__PURE__*/proxyCustomElement(EzpStatus$1, [1,"ezp-status",{"description":[1],"processing":[4],"instance":[1],"icon":[1],"cancel":[8],"close":[8],"retry":[8]}]);
@@ -167,7 +167,7 @@ export class EzpPrinterSelection {
167
167
  export declare interface EzpPrinting extends Components.EzpPrinting {}
168
168
  @ProxyCmp({
169
169
  inputs: ['appearance', 'authapihosturl', 'clientid', 'custom', 'fileid', 'filename', 'filetype', 'fileurl', 'hidelogin', 'hidemenu', 'language', 'printapihosturl', 'redirecturi', 'theme', 'trigger'],
170
- methods: ['open', 'logOut']
170
+ methods: ['open', 'logOut', 'getSasUri']
171
171
  })
172
172
  @Component({
173
173
  selector: 'ezp-printing',
package/dist/esm/ezeep.js CHANGED
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
 
16
16
  patchBrowser().then(options => {
17
17
  globalScripts();
18
- return bootstrapLazy([["ezp-auth_14",[[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);
18
+ return bootstrapLazy([["ezp-auth_14",[[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);
19
19
  });