@ezeep/ezeep-js 1.0.250 → 1.0.251

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.
@@ -33816,6 +33816,28 @@ let EzpPrinting = class {
33816
33816
  localStorage.setItem('isAuthorized', authStore.state.isAuthorized.toString());
33817
33817
  return authStore.state.isAuthorized;
33818
33818
  }
33819
+ /**
33820
+ * Normalizes a URL or hostname to just the hostname without protocol
33821
+ * Accepts both "hostname" and "https://hostname" formats
33822
+ */
33823
+ normalizeHostUrl(hostUrl) {
33824
+ if (!hostUrl) {
33825
+ return hostUrl;
33826
+ }
33827
+ // If it starts with http:// or https://, extract just the hostname
33828
+ try {
33829
+ if (hostUrl.startsWith('http://') || hostUrl.startsWith('https://')) {
33830
+ const url = new URL(hostUrl);
33831
+ return url.host;
33832
+ }
33833
+ }
33834
+ catch (e) {
33835
+ // If URL parsing fails, return the original value
33836
+ console.warn('Failed to parse URL:', hostUrl, e);
33837
+ }
33838
+ // Return as-is if it's already just a hostname
33839
+ return hostUrl;
33840
+ }
33819
33841
  refreshTokensPeriodically(seconds) {
33820
33842
  const authService = new EzpAuthorizationService(this.redirecturi, this.clientid);
33821
33843
  setInterval(() => {
@@ -33832,13 +33854,13 @@ let EzpPrinting = class {
33832
33854
  userStore.state.theme = this.theme;
33833
33855
  userStore.state.appearance = this.appearance;
33834
33856
  if (this.authapihosturl) {
33835
- authStore.state.authApiHostUrl = this.authapihosturl;
33857
+ authStore.state.authApiHostUrl = this.normalizeHostUrl(this.authapihosturl);
33836
33858
  }
33837
33859
  else {
33838
33860
  authStore.state.authApiHostUrl = config.authApiHostUrl;
33839
33861
  }
33840
33862
  if (this.printapihosturl) {
33841
- printStore.state.printApiHostUrl = this.printapihosturl;
33863
+ printStore.state.printApiHostUrl = this.normalizeHostUrl(this.printapihosturl);
33842
33864
  }
33843
33865
  else {
33844
33866
  printStore.state.printApiHostUrl = config.printingApiHostUrl;
@@ -197,6 +197,28 @@ export class EzpPrinting {
197
197
  localStorage.setItem('isAuthorized', authStore.state.isAuthorized.toString());
198
198
  return authStore.state.isAuthorized;
199
199
  }
200
+ /**
201
+ * Normalizes a URL or hostname to just the hostname without protocol
202
+ * Accepts both "hostname" and "https://hostname" formats
203
+ */
204
+ normalizeHostUrl(hostUrl) {
205
+ if (!hostUrl) {
206
+ return hostUrl;
207
+ }
208
+ // If it starts with http:// or https://, extract just the hostname
209
+ try {
210
+ if (hostUrl.startsWith('http://') || hostUrl.startsWith('https://')) {
211
+ const url = new URL(hostUrl);
212
+ return url.host;
213
+ }
214
+ }
215
+ catch (e) {
216
+ // If URL parsing fails, return the original value
217
+ console.warn('Failed to parse URL:', hostUrl, e);
218
+ }
219
+ // Return as-is if it's already just a hostname
220
+ return hostUrl;
221
+ }
200
222
  refreshTokensPeriodically(seconds) {
201
223
  const authService = new EzpAuthorizationService(this.redirecturi, this.clientid);
202
224
  setInterval(() => {
@@ -213,13 +235,13 @@ export class EzpPrinting {
213
235
  userStore.state.theme = this.theme;
214
236
  userStore.state.appearance = this.appearance;
215
237
  if (this.authapihosturl) {
216
- authStore.state.authApiHostUrl = this.authapihosturl;
238
+ authStore.state.authApiHostUrl = this.normalizeHostUrl(this.authapihosturl);
217
239
  }
218
240
  else {
219
241
  authStore.state.authApiHostUrl = config.authApiHostUrl;
220
242
  }
221
243
  if (this.printapihosturl) {
222
- printStore.state.printApiHostUrl = this.printapihosturl;
244
+ printStore.state.printApiHostUrl = this.normalizeHostUrl(this.printapihosturl);
223
245
  }
224
246
  else {
225
247
  printStore.state.printApiHostUrl = config.printingApiHostUrl;
@@ -33843,6 +33843,28 @@ let EzpPrinting$1 = class extends HTMLElement {
33843
33843
  localStorage.setItem('isAuthorized', authStore.state.isAuthorized.toString());
33844
33844
  return authStore.state.isAuthorized;
33845
33845
  }
33846
+ /**
33847
+ * Normalizes a URL or hostname to just the hostname without protocol
33848
+ * Accepts both "hostname" and "https://hostname" formats
33849
+ */
33850
+ normalizeHostUrl(hostUrl) {
33851
+ if (!hostUrl) {
33852
+ return hostUrl;
33853
+ }
33854
+ // If it starts with http:// or https://, extract just the hostname
33855
+ try {
33856
+ if (hostUrl.startsWith('http://') || hostUrl.startsWith('https://')) {
33857
+ const url = new URL(hostUrl);
33858
+ return url.host;
33859
+ }
33860
+ }
33861
+ catch (e) {
33862
+ // If URL parsing fails, return the original value
33863
+ console.warn('Failed to parse URL:', hostUrl, e);
33864
+ }
33865
+ // Return as-is if it's already just a hostname
33866
+ return hostUrl;
33867
+ }
33846
33868
  refreshTokensPeriodically(seconds) {
33847
33869
  const authService = new EzpAuthorizationService(this.redirecturi, this.clientid);
33848
33870
  setInterval(() => {
@@ -33859,13 +33881,13 @@ let EzpPrinting$1 = class extends HTMLElement {
33859
33881
  userStore.state.theme = this.theme;
33860
33882
  userStore.state.appearance = this.appearance;
33861
33883
  if (this.authapihosturl) {
33862
- authStore.state.authApiHostUrl = this.authapihosturl;
33884
+ authStore.state.authApiHostUrl = this.normalizeHostUrl(this.authapihosturl);
33863
33885
  }
33864
33886
  else {
33865
33887
  authStore.state.authApiHostUrl = config.authApiHostUrl;
33866
33888
  }
33867
33889
  if (this.printapihosturl) {
33868
- printStore.state.printApiHostUrl = this.printapihosturl;
33890
+ printStore.state.printApiHostUrl = this.normalizeHostUrl(this.printapihosturl);
33869
33891
  }
33870
33892
  else {
33871
33893
  printStore.state.printApiHostUrl = config.printingApiHostUrl;
@@ -33812,6 +33812,28 @@ let EzpPrinting = class {
33812
33812
  localStorage.setItem('isAuthorized', authStore.state.isAuthorized.toString());
33813
33813
  return authStore.state.isAuthorized;
33814
33814
  }
33815
+ /**
33816
+ * Normalizes a URL or hostname to just the hostname without protocol
33817
+ * Accepts both "hostname" and "https://hostname" formats
33818
+ */
33819
+ normalizeHostUrl(hostUrl) {
33820
+ if (!hostUrl) {
33821
+ return hostUrl;
33822
+ }
33823
+ // If it starts with http:// or https://, extract just the hostname
33824
+ try {
33825
+ if (hostUrl.startsWith('http://') || hostUrl.startsWith('https://')) {
33826
+ const url = new URL(hostUrl);
33827
+ return url.host;
33828
+ }
33829
+ }
33830
+ catch (e) {
33831
+ // If URL parsing fails, return the original value
33832
+ console.warn('Failed to parse URL:', hostUrl, e);
33833
+ }
33834
+ // Return as-is if it's already just a hostname
33835
+ return hostUrl;
33836
+ }
33815
33837
  refreshTokensPeriodically(seconds) {
33816
33838
  const authService = new EzpAuthorizationService(this.redirecturi, this.clientid);
33817
33839
  setInterval(() => {
@@ -33828,13 +33850,13 @@ let EzpPrinting = class {
33828
33850
  userStore.state.theme = this.theme;
33829
33851
  userStore.state.appearance = this.appearance;
33830
33852
  if (this.authapihosturl) {
33831
- authStore.state.authApiHostUrl = this.authapihosturl;
33853
+ authStore.state.authApiHostUrl = this.normalizeHostUrl(this.authapihosturl);
33832
33854
  }
33833
33855
  else {
33834
33856
  authStore.state.authApiHostUrl = config.authApiHostUrl;
33835
33857
  }
33836
33858
  if (this.printapihosturl) {
33837
- printStore.state.printApiHostUrl = this.printapihosturl;
33859
+ printStore.state.printApiHostUrl = this.normalizeHostUrl(this.printapihosturl);
33838
33860
  }
33839
33861
  else {
33840
33862
  printStore.state.printApiHostUrl = config.printingApiHostUrl;