@asgardeo/javascript 0.14.0 → 0.16.0

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.
package/dist/index.d.ts CHANGED
@@ -112,3 +112,5 @@ export { default as transformBrandingPreferenceToTheme } from './utils/transform
112
112
  export { default as logger, createLogger, createComponentLogger, createPackageLogger, createPackageComponentLogger, LogLevel, configure as configureLogger, debug, info, warn, error, } from './utils/logger';
113
113
  export type { LoggerConfig } from './utils/logger';
114
114
  export { default as StorageManager } from './StorageManager';
115
+ export { HttpClient } from './HttpClient';
116
+ export { HttpError, HttpRequestConfig, HttpResponse } from './models/http';
package/dist/index.js CHANGED
@@ -3759,11 +3759,13 @@ var lightTheme = {
3759
3759
  error: {
3760
3760
  contrastText: "#d52828",
3761
3761
  dark: "#b71c1c",
3762
+ light: "#fef2f2",
3762
3763
  main: "#d32f2f"
3763
3764
  },
3764
3765
  info: {
3765
3766
  contrastText: "#43aeda",
3766
3767
  dark: "#01579b",
3768
+ light: "#eff6ff",
3767
3769
  main: "#bbebff"
3768
3770
  },
3769
3771
  primary: {
@@ -3774,11 +3776,13 @@ var lightTheme = {
3774
3776
  secondary: {
3775
3777
  contrastText: "#ffffff",
3776
3778
  dark: "#212121",
3779
+ light: "#f3f4f6",
3777
3780
  main: "#424242"
3778
3781
  },
3779
3782
  success: {
3780
3783
  contrastText: "#00a807",
3781
3784
  dark: "#388e3c",
3785
+ light: "#f0fdf4",
3782
3786
  main: "#4caf50"
3783
3787
  },
3784
3788
  text: {
@@ -3789,6 +3793,7 @@ var lightTheme = {
3789
3793
  warning: {
3790
3794
  contrastText: "#be7100",
3791
3795
  dark: "#f57c00",
3796
+ light: "#fffbeb",
3792
3797
  main: "#ff9800"
3793
3798
  }
3794
3799
  },
@@ -3868,11 +3873,13 @@ var darkTheme = {
3868
3873
  error: {
3869
3874
  contrastText: "#d52828",
3870
3875
  dark: "#b71c1c",
3876
+ light: "#2d1515",
3871
3877
  main: "#d32f2f"
3872
3878
  },
3873
3879
  info: {
3874
3880
  contrastText: "#43aeda",
3875
3881
  dark: "#01579b",
3882
+ light: "#0f1f35",
3876
3883
  main: "#bbebff"
3877
3884
  },
3878
3885
  primary: {
@@ -3883,11 +3890,13 @@ var darkTheme = {
3883
3890
  secondary: {
3884
3891
  contrastText: "#ffffff",
3885
3892
  dark: "#212121",
3893
+ light: "#2a2a2a",
3886
3894
  main: "#8b8b8b"
3887
3895
  },
3888
3896
  success: {
3889
3897
  contrastText: "#00a807",
3890
3898
  dark: "#388e3c",
3899
+ light: "#132d1a",
3891
3900
  main: "#4caf50"
3892
3901
  },
3893
3902
  text: {
@@ -3898,6 +3907,7 @@ var darkTheme = {
3898
3907
  warning: {
3899
3908
  contrastText: "#be7100",
3900
3909
  dark: "#f57c00",
3910
+ light: "#2d2310",
3901
3911
  main: "#ff9800"
3902
3912
  }
3903
3913
  },
@@ -3992,6 +4002,9 @@ var toCssVariables = (theme) => {
3992
4002
  if (theme.colors?.secondary?.contrastText) {
3993
4003
  cssVars[`--${prefix}-color-secondary-contrastText`] = theme.colors.secondary.contrastText;
3994
4004
  }
4005
+ if (theme.colors?.secondary?.light) {
4006
+ cssVars[`--${prefix}-color-secondary-light`] = theme.colors.secondary.light;
4007
+ }
3995
4008
  if (theme.colors?.background?.surface) {
3996
4009
  cssVars[`--${prefix}-color-background-surface`] = theme.colors.background.surface;
3997
4010
  }
@@ -4007,24 +4020,36 @@ var toCssVariables = (theme) => {
4007
4020
  if (theme.colors?.error?.contrastText) {
4008
4021
  cssVars[`--${prefix}-color-error-contrastText`] = theme.colors.error.contrastText;
4009
4022
  }
4023
+ if (theme.colors?.error?.light) {
4024
+ cssVars[`--${prefix}-color-error-light`] = theme.colors.error.light;
4025
+ }
4010
4026
  if (theme.colors?.success?.main) {
4011
4027
  cssVars[`--${prefix}-color-success-main`] = theme.colors.success.main;
4012
4028
  }
4013
4029
  if (theme.colors?.success?.contrastText) {
4014
4030
  cssVars[`--${prefix}-color-success-contrastText`] = theme.colors.success.contrastText;
4015
4031
  }
4032
+ if (theme.colors?.success?.light) {
4033
+ cssVars[`--${prefix}-color-success-light`] = theme.colors.success.light;
4034
+ }
4016
4035
  if (theme.colors?.warning?.main) {
4017
4036
  cssVars[`--${prefix}-color-warning-main`] = theme.colors.warning.main;
4018
4037
  }
4019
4038
  if (theme.colors?.warning?.contrastText) {
4020
4039
  cssVars[`--${prefix}-color-warning-contrastText`] = theme.colors.warning.contrastText;
4021
4040
  }
4041
+ if (theme.colors?.warning?.light) {
4042
+ cssVars[`--${prefix}-color-warning-light`] = theme.colors.warning.light;
4043
+ }
4022
4044
  if (theme.colors?.info?.main) {
4023
4045
  cssVars[`--${prefix}-color-info-main`] = theme.colors.info.main;
4024
4046
  }
4025
4047
  if (theme.colors?.info?.contrastText) {
4026
4048
  cssVars[`--${prefix}-color-info-contrastText`] = theme.colors.info.contrastText;
4027
4049
  }
4050
+ if (theme.colors?.info?.light) {
4051
+ cssVars[`--${prefix}-color-info-light`] = theme.colors.info.light;
4052
+ }
4028
4053
  if (theme.colors?.text?.primary) {
4029
4054
  cssVars[`--${prefix}-color-text-primary`] = theme.colors.text.primary;
4030
4055
  }
@@ -5261,6 +5286,103 @@ var transformBrandingPreferenceToTheme = (brandingPreference, forceTheme) => {
5261
5286
  return createTheme_default(transformedConfig, activeThemeKey === "DARK");
5262
5287
  };
5263
5288
  var transformBrandingPreferenceToTheme_default = transformBrandingPreferenceToTheme;
5289
+
5290
+ // src/HttpClient.ts
5291
+ var _HttpClient = class _HttpClient {
5292
+ constructor(isHandlerEnabled = true, attachToken = () => Promise.resolve()) {
5293
+ this.isHandlerEnabled = isHandlerEnabled;
5294
+ this.attachToken = attachToken;
5295
+ // eslint-disable-next-line class-methods-use-this
5296
+ __publicField(this, "requestStartCallback", () => null);
5297
+ // eslint-disable-next-line class-methods-use-this
5298
+ __publicField(this, "requestSuccessCallback", () => null);
5299
+ // eslint-disable-next-line class-methods-use-this
5300
+ __publicField(this, "requestErrorCallback", () => null);
5301
+ // eslint-disable-next-line class-methods-use-this
5302
+ __publicField(this, "requestFinishCallback", () => null);
5303
+ }
5304
+ /**
5305
+ * Public HTTP request entry point. Applies pre/post processing around `transport()`.
5306
+ */
5307
+ async request(config) {
5308
+ const processedConfig = await this.requestHandler(config);
5309
+ try {
5310
+ const response = await this.transport(processedConfig);
5311
+ return this.successHandler(response);
5312
+ } catch (error2) {
5313
+ this.errorHandler(error2);
5314
+ throw error2;
5315
+ }
5316
+ }
5317
+ enableHandler() {
5318
+ this.isHandlerEnabled = true;
5319
+ }
5320
+ disableHandler() {
5321
+ this.isHandlerEnabled = false;
5322
+ }
5323
+ disableHandlerWithTimeout(timeout = _HttpClient.DEFAULT_HANDLER_DISABLE_TIMEOUT) {
5324
+ this.isHandlerEnabled = false;
5325
+ setTimeout(() => {
5326
+ this.isHandlerEnabled = true;
5327
+ }, timeout);
5328
+ }
5329
+ setHttpRequestStartCallback(cb) {
5330
+ this.requestStartCallback = cb;
5331
+ }
5332
+ setHttpRequestSuccessCallback(cb) {
5333
+ this.requestSuccessCallback = cb;
5334
+ }
5335
+ setHttpRequestErrorCallback(cb) {
5336
+ this.requestErrorCallback = cb;
5337
+ }
5338
+ setHttpRequestFinishCallback(cb) {
5339
+ this.requestFinishCallback = cb;
5340
+ }
5341
+ // eslint-disable-next-line class-methods-use-this
5342
+ all(values) {
5343
+ return Promise.all(values);
5344
+ }
5345
+ // eslint-disable-next-line class-methods-use-this
5346
+ spread(callback) {
5347
+ return (array) => callback(...array);
5348
+ }
5349
+ async requestHandler(config) {
5350
+ await this.attachToken(config);
5351
+ if (config.shouldEncodeToFormData && config.data) {
5352
+ const formData = new FormData();
5353
+ Object.keys(config.data).forEach((key) => formData.append(key, config.data[key]));
5354
+ config.data = formData;
5355
+ }
5356
+ config.startTimeInMs = Date.now();
5357
+ if (this.isHandlerEnabled && typeof this.requestStartCallback === "function") {
5358
+ this.requestStartCallback(config);
5359
+ }
5360
+ return config;
5361
+ }
5362
+ successHandler(response) {
5363
+ if (this.isHandlerEnabled) {
5364
+ if (typeof this.requestSuccessCallback === "function") {
5365
+ this.requestSuccessCallback(response);
5366
+ }
5367
+ if (typeof this.requestFinishCallback === "function") {
5368
+ this.requestFinishCallback();
5369
+ }
5370
+ }
5371
+ return response;
5372
+ }
5373
+ errorHandler(error2) {
5374
+ if (this.isHandlerEnabled) {
5375
+ if (typeof this.requestErrorCallback === "function") {
5376
+ this.requestErrorCallback(error2);
5377
+ }
5378
+ if (typeof this.requestFinishCallback === "function") {
5379
+ this.requestFinishCallback();
5380
+ }
5381
+ }
5382
+ }
5383
+ };
5384
+ __publicField(_HttpClient, "DEFAULT_HANDLER_DISABLE_TIMEOUT", 1e3);
5385
+ var HttpClient = _HttpClient;
5264
5386
  export {
5265
5387
  AgentConfig,
5266
5388
  ApplicationNativeAuthenticationConstants_default as ApplicationNativeAuthenticationConstants,
@@ -5293,6 +5415,7 @@ export {
5293
5415
  FieldType,
5294
5416
  FlowMetaType,
5295
5417
  FlowMode,
5418
+ HttpClient,
5296
5419
  IsomorphicCrypto,
5297
5420
  OIDCRequestConstants_default as OIDCRequestConstants,
5298
5421
  Platform,