@juv/codego-react-ui 3.3.5 → 3.3.6

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.cjs CHANGED
@@ -12842,6 +12842,7 @@ var request = async (config) => {
12842
12842
  };
12843
12843
 
12844
12844
  // src/lib/codego/interceptors.ts
12845
+ var toastFn = null;
12845
12846
  var setupInterceptors = () => {
12846
12847
  axiosInstance.interceptors.request.use(
12847
12848
  (config) => {
@@ -12854,8 +12855,26 @@ var setupInterceptors = () => {
12854
12855
  (error) => Promise.reject(error)
12855
12856
  );
12856
12857
  axiosInstance.interceptors.response.use(
12857
- (response) => response,
12858
+ (response) => {
12859
+ const config = response.config;
12860
+ if (config.onSuccessNotification && toastFn) {
12861
+ toastFn.toast({
12862
+ variant: "success",
12863
+ title: config.successNotifTitle || "Success",
12864
+ description: config.successNotifContent || "Operation completed successfully"
12865
+ });
12866
+ }
12867
+ return response;
12868
+ },
12858
12869
  (error) => {
12870
+ const config = error.config;
12871
+ if (config?.onErrorNotification && toastFn) {
12872
+ toastFn.toast({
12873
+ variant: "error",
12874
+ title: config.errorNotifTitle || "Error",
12875
+ description: config.errorNotifContent || error.response?.data?.message || "Something went wrong"
12876
+ });
12877
+ }
12859
12878
  if (error.response?.status === 401) {
12860
12879
  console.warn("Unauthorized - redirect login");
12861
12880
  }
package/dist/index.d.cts CHANGED
@@ -2376,7 +2376,21 @@ interface WizardProps {
2376
2376
  }
2377
2377
  declare function Wizard({ steps, step: controlledStep, defaultStep, onStepChange, onFinish, onClose, layout, variant, size, isOpen, showClose, unchange, title, description, hideHeader, footer, renderActions, backLabel, nextLabel, finishLabel, cancelLabel, showCancel, showBackOnFirst, loading, clickableSteps, className, contentClassName, }: WizardProps): react_jsx_runtime.JSX.Element;
2378
2378
 
2379
- interface RequestConfig<T = any> extends AxiosRequestConfig {
2379
+ interface NotificationConfig {
2380
+ /** Show success notification */
2381
+ onSuccessNotification?: boolean;
2382
+ /** Success notification title */
2383
+ successNotifTitle?: string;
2384
+ /** Success notification content/message */
2385
+ successNotifContent?: string;
2386
+ /** Show error notification */
2387
+ onErrorNotification?: boolean;
2388
+ /** Error notification title */
2389
+ errorNotifTitle?: string;
2390
+ /** Error notification content/message */
2391
+ errorNotifContent?: string;
2392
+ }
2393
+ interface RequestConfig<T = any> extends AxiosRequestConfig, NotificationConfig {
2380
2394
  data?: T;
2381
2395
  skipAuth?: boolean;
2382
2396
  }
package/dist/index.d.ts CHANGED
@@ -2376,7 +2376,21 @@ interface WizardProps {
2376
2376
  }
2377
2377
  declare function Wizard({ steps, step: controlledStep, defaultStep, onStepChange, onFinish, onClose, layout, variant, size, isOpen, showClose, unchange, title, description, hideHeader, footer, renderActions, backLabel, nextLabel, finishLabel, cancelLabel, showCancel, showBackOnFirst, loading, clickableSteps, className, contentClassName, }: WizardProps): react_jsx_runtime.JSX.Element;
2378
2378
 
2379
- interface RequestConfig<T = any> extends AxiosRequestConfig {
2379
+ interface NotificationConfig {
2380
+ /** Show success notification */
2381
+ onSuccessNotification?: boolean;
2382
+ /** Success notification title */
2383
+ successNotifTitle?: string;
2384
+ /** Success notification content/message */
2385
+ successNotifContent?: string;
2386
+ /** Show error notification */
2387
+ onErrorNotification?: boolean;
2388
+ /** Error notification title */
2389
+ errorNotifTitle?: string;
2390
+ /** Error notification content/message */
2391
+ errorNotifContent?: string;
2392
+ }
2393
+ interface RequestConfig<T = any> extends AxiosRequestConfig, NotificationConfig {
2380
2394
  data?: T;
2381
2395
  skipAuth?: boolean;
2382
2396
  }
@@ -76398,6 +76398,7 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
76398
76398
  };
76399
76399
 
76400
76400
  // src/lib/codego/interceptors.ts
76401
+ var toastFn = null;
76401
76402
  var setupInterceptors = () => {
76402
76403
  axiosInstance.interceptors.request.use(
76403
76404
  (config) => {
@@ -76410,8 +76411,26 @@ ${n2.shaderPreludeCode.vertexSource}`, define: n2.shaderDefine }, defaultProject
76410
76411
  (error) => Promise.reject(error)
76411
76412
  );
76412
76413
  axiosInstance.interceptors.response.use(
76413
- (response) => response,
76414
+ (response) => {
76415
+ const config = response.config;
76416
+ if (config.onSuccessNotification && toastFn) {
76417
+ toastFn.toast({
76418
+ variant: "success",
76419
+ title: config.successNotifTitle || "Success",
76420
+ description: config.successNotifContent || "Operation completed successfully"
76421
+ });
76422
+ }
76423
+ return response;
76424
+ },
76414
76425
  (error) => {
76426
+ const config = error.config;
76427
+ if (config?.onErrorNotification && toastFn) {
76428
+ toastFn.toast({
76429
+ variant: "error",
76430
+ title: config.errorNotifTitle || "Error",
76431
+ description: config.errorNotifContent || error.response?.data?.message || "Something went wrong"
76432
+ });
76433
+ }
76415
76434
  if (error.response?.status === 401) {
76416
76435
  console.warn("Unauthorized - redirect login");
76417
76436
  }
package/dist/index.js CHANGED
@@ -12722,6 +12722,7 @@ var request = async (config) => {
12722
12722
  };
12723
12723
 
12724
12724
  // src/lib/codego/interceptors.ts
12725
+ var toastFn = null;
12725
12726
  var setupInterceptors = () => {
12726
12727
  axiosInstance.interceptors.request.use(
12727
12728
  (config) => {
@@ -12734,8 +12735,26 @@ var setupInterceptors = () => {
12734
12735
  (error) => Promise.reject(error)
12735
12736
  );
12736
12737
  axiosInstance.interceptors.response.use(
12737
- (response) => response,
12738
+ (response) => {
12739
+ const config = response.config;
12740
+ if (config.onSuccessNotification && toastFn) {
12741
+ toastFn.toast({
12742
+ variant: "success",
12743
+ title: config.successNotifTitle || "Success",
12744
+ description: config.successNotifContent || "Operation completed successfully"
12745
+ });
12746
+ }
12747
+ return response;
12748
+ },
12738
12749
  (error) => {
12750
+ const config = error.config;
12751
+ if (config?.onErrorNotification && toastFn) {
12752
+ toastFn.toast({
12753
+ variant: "error",
12754
+ title: config.errorNotifTitle || "Error",
12755
+ description: config.errorNotifContent || error.response?.data?.message || "Something went wrong"
12756
+ });
12757
+ }
12739
12758
  if (error.response?.status === 401) {
12740
12759
  console.warn("Unauthorized - redirect login");
12741
12760
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "registry": "https://registry.npmjs.org/",
5
5
  "access": "public"
6
6
  },
7
- "version": "3.3.5",
7
+ "version": "3.3.6",
8
8
  "description": "Reusable React UI components",
9
9
  "license": "MIT",
10
10
  "main": "dist/index.js",