@monorise/react 1.0.9 → 1.0.10

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
@@ -1,4 +1,5 @@
1
1
  import type { Entity, MonoriseEntityConfig } from '@monorise/base';
2
+ import type { AxiosResponse } from 'axios';
2
3
  import { Mutual, MutualData, MutualDataMapping, MutualDataWithIndex } from './types/mutual.type';
3
4
  type Options<T extends Record<string, React.ComponentType<any>>> = {
4
5
  authBaseUrl?: string;
@@ -8,6 +9,7 @@ type Options<T extends Record<string, React.ComponentType<any>>> = {
8
9
  tagBaseUrl?: string;
9
10
  modals?: T;
10
11
  entityConfig: Record<Entity, MonoriseEntityConfig>;
12
+ onApiSuccess?: <T>(response: AxiosResponse<T>, feedbackSuccess: ((data: AxiosResponse<T>['data']) => React.ReactNode) | string | boolean) => void;
11
13
  };
12
14
  declare const Monorise: {
13
15
  listMoreEntities: <T extends Entity>(entityType: T, opts?: import("./services/core.service").CommonOptions) => Promise<void>;
@@ -268,11 +270,11 @@ declare const Monorise: {
268
270
  }>), replace?: boolean | undefined, action?: A | undefined): void;
269
271
  }>;
270
272
  axios: {
271
- post: <T = any, R = import("axios").AxiosResponse<T, any>, D = any>(url: string, data: D, config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
272
- put: <T = any, R = import("axios").AxiosResponse<T, any>, D = any>(url: string, data: D, config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
273
- patch: <T = any, R = import("axios").AxiosResponse<T, any>, D = any>(url: string, data: D, config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
274
- delete: <T = any, R = import("axios").AxiosResponse<T, any>, D = any>(url: string, config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
275
- get: <T = any, R = import("axios").AxiosResponse<T, any>, D = any>(url: string, config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
273
+ post: <T = any, R = AxiosResponse<T, any>, D = any>(url: string, data: D, config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
274
+ put: <T = any, R = AxiosResponse<T, any>, D = any>(url: string, data: D, config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
275
+ patch: <T = any, R = AxiosResponse<T, any>, D = any>(url: string, data: D, config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
276
+ delete: <T = any, R = AxiosResponse<T, any>, D = any>(url: string, config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
277
+ get: <T = any, R = AxiosResponse<T, any>, D = any>(url: string, config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
276
278
  defaults: Omit<import("axios").AxiosDefaults, "headers"> & {
277
279
  headers: import("axios").HeadersDefaults & {
278
280
  [key: string]: import("axios").AxiosHeaderValue;
@@ -280,19 +282,19 @@ declare const Monorise: {
280
282
  };
281
283
  interceptors: {
282
284
  request: import("axios").AxiosInterceptorManager<import("axios").InternalAxiosRequestConfig>;
283
- response: import("axios").AxiosInterceptorManager<import("axios").AxiosResponse>;
285
+ response: import("axios").AxiosInterceptorManager<AxiosResponse>;
284
286
  };
285
287
  };
286
288
  authService: {
287
289
  requestLoginMagicLink: (entityType: Entity, payload: {
288
290
  email: string;
289
- }) => Promise<import("axios").AxiosResponse<any, any>>;
290
- getSessionProfile: <T extends Record<string, unknown>>() => Promise<import("axios").AxiosResponse<T & {
291
+ }) => Promise<AxiosResponse<any, any>>;
292
+ getSessionProfile: <T extends Record<string, unknown>>() => Promise<AxiosResponse<T & {
291
293
  displayName: string;
292
294
  email: string;
293
295
  accountId: string;
294
296
  }, any>>;
295
- logout: () => Promise<import("axios").AxiosResponse<any, any>>;
297
+ logout: () => Promise<AxiosResponse<any, any>>;
296
298
  setOptions: (opts: {
297
299
  apiBaseUrl?: string;
298
300
  }) => void;
@@ -303,7 +305,7 @@ declare const Monorise: {
303
305
  scope: string;
304
306
  directory: string;
305
307
  name: string;
306
- }) => Promise<import("axios").AxiosResponse<any, any>>;
308
+ }) => Promise<AxiosResponse<any, any>>;
307
309
  deleteFiles: (keys: string[]) => Promise<any>;
308
310
  uploadVideo: ({ file, scope, directory, name, }: {
309
311
  file: File;
@@ -323,34 +325,34 @@ declare const Monorise: {
323
325
  lastKey?: string;
324
326
  start?: string;
325
327
  end?: string;
326
- }, opts?: import("./services/core.service").CommonOptions) => Promise<import("axios").AxiosResponse<{
328
+ }, opts?: import("./services/core.service").CommonOptions) => Promise<AxiosResponse<{
327
329
  data: import("@monorise/base").CreatedEntity<T>[];
328
330
  lastKey?: string;
329
331
  totalCount: number;
330
332
  }, any>>;
331
- searchEntities: (query: string, opts?: import("./services/core.service").CommonOptions) => Promise<import("axios").AxiosResponse<{
333
+ searchEntities: (query: string, opts?: import("./services/core.service").CommonOptions) => Promise<AxiosResponse<{
332
334
  data: import("@monorise/base").CreatedEntity<T>[];
333
335
  }, any>>;
334
- listEntitiesByTag: (tagName: string, opts?: import("./services/core.service").CommonOptions) => Promise<import("axios").AxiosResponse<{
336
+ listEntitiesByTag: (tagName: string, opts?: import("./services/core.service").CommonOptions) => Promise<AxiosResponse<{
335
337
  entities: import("@monorise/base").CreatedEntity<T>[];
336
338
  lastKey: string;
337
339
  }, any>>;
338
- getEntity: (id: string, opts?: import("./services/core.service").CommonOptions) => Promise<import("axios").AxiosResponse<import("@monorise/base").CreatedEntity<T>, any>>;
339
- createEntity: (values: import("@monorise/base").DraftEntity<T>, opts?: import("./services/core.service").CommonOptions) => Promise<import("axios").AxiosResponse<import("@monorise/base").CreatedEntity<T>, any>>;
340
- upsertEntity: (id: string, values: import("@monorise/base").DraftEntity<T>, opts?: import("./services/core.service").CommonOptions) => Promise<import("axios").AxiosResponse<import("@monorise/base").CreatedEntity<T>, any>>;
341
- editEntity: (id: string, values: Partial<import("@monorise/base").DraftEntity<T>>, opts?: import("./services/core.service").CommonOptions) => Promise<import("axios").AxiosResponse<import("@monorise/base").CreatedEntity<T>, any>>;
342
- updateEntity: (id: string, values: import("@monorise/base").DraftEntity<T>, opts?: import("./services/core.service").CommonOptions) => Promise<import("axios").AxiosResponse<import("@monorise/base").CreatedEntity<T>, any>>;
343
- deleteEntity: (id: string, opts?: import("./services/core.service").CommonOptions) => Promise<import("axios").AxiosResponse<any, any>>;
340
+ getEntity: (id: string, opts?: import("./services/core.service").CommonOptions) => Promise<AxiosResponse<import("@monorise/base").CreatedEntity<T>, any>>;
341
+ createEntity: (values: import("@monorise/base").DraftEntity<T>, opts?: import("./services/core.service").CommonOptions) => Promise<AxiosResponse<import("@monorise/base").CreatedEntity<T>, any>>;
342
+ upsertEntity: (id: string, values: import("@monorise/base").DraftEntity<T>, opts?: import("./services/core.service").CommonOptions) => Promise<AxiosResponse<import("@monorise/base").CreatedEntity<T>, any>>;
343
+ editEntity: (id: string, values: Partial<import("@monorise/base").DraftEntity<T>>, opts?: import("./services/core.service").CommonOptions) => Promise<AxiosResponse<import("@monorise/base").CreatedEntity<T>, any>>;
344
+ updateEntity: (id: string, values: import("@monorise/base").DraftEntity<T>, opts?: import("./services/core.service").CommonOptions) => Promise<AxiosResponse<import("@monorise/base").CreatedEntity<T>, any>>;
345
+ deleteEntity: (id: string, opts?: import("./services/core.service").CommonOptions) => Promise<AxiosResponse<any, any>>;
344
346
  };
345
347
  makeMutualService: <B extends Entity, T extends Entity>(byEntityType: B, entityType: T) => {
346
- listEntitiesByEntity: (byEntityId: string, opts?: import("./services/core.service").CommonOptions, chainEntityQuery?: string) => Promise<import("axios").AxiosResponse<{
348
+ listEntitiesByEntity: (byEntityId: string, opts?: import("./services/core.service").CommonOptions, chainEntityQuery?: string) => Promise<AxiosResponse<{
347
349
  entities: Mutual<B, T>[];
348
350
  lastKey: string;
349
351
  }, any>>;
350
- getMutual: (byEntityId: string, entityId: string, opts?: import("./services/core.service").CommonOptions) => Promise<import("axios").AxiosResponse<Mutual<B, T>, any>>;
351
- createMutual: (byEntityId: string, entityId: string, payload: MutualData<B, T> | Record<string, unknown>, opts?: {}) => Promise<import("axios").AxiosResponse<Mutual<B, T>, any>>;
352
- editMutual: (byEntityId: string, entityId: string, payload: MutualData<B, T> | Record<string, unknown>, opts?: {}) => Promise<import("axios").AxiosResponse<Mutual<B, T>, any>>;
353
- deleteMutual: (byEntityId: string, entityId: string, opts?: import("./services/core.service").CommonOptions) => Promise<import("axios").AxiosResponse<any, any>>;
352
+ getMutual: (byEntityId: string, entityId: string, opts?: import("./services/core.service").CommonOptions) => Promise<AxiosResponse<Mutual<B, T>, any>>;
353
+ createMutual: (byEntityId: string, entityId: string, payload: MutualData<B, T> | Record<string, unknown>, opts?: {}) => Promise<AxiosResponse<Mutual<B, T>, any>>;
354
+ editMutual: (byEntityId: string, entityId: string, payload: MutualData<B, T> | Record<string, unknown>, opts?: {}) => Promise<AxiosResponse<Mutual<B, T>, any>>;
355
+ deleteMutual: (byEntityId: string, entityId: string, opts?: import("./services/core.service").CommonOptions) => Promise<AxiosResponse<any, any>>;
354
356
  };
355
357
  setOptions: (opts: {
356
358
  entityApiBaseUrl?: string;
@@ -508,11 +510,11 @@ declare const store: import("zustand").UseBoundStore<Omit<import("zustand").Stor
508
510
  };
509
511
  }>), replace?: boolean | undefined, action?: A | undefined): void;
510
512
  }>, axios: {
511
- post: <T = any, R = import("axios").AxiosResponse<T, any>, D = any>(url: string, data: D, config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
512
- put: <T = any, R = import("axios").AxiosResponse<T, any>, D = any>(url: string, data: D, config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
513
- patch: <T = any, R = import("axios").AxiosResponse<T, any>, D = any>(url: string, data: D, config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
514
- delete: <T = any, R = import("axios").AxiosResponse<T, any>, D = any>(url: string, config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
515
- get: <T = any, R = import("axios").AxiosResponse<T, any>, D = any>(url: string, config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
513
+ post: <T = any, R = AxiosResponse<T, any>, D = any>(url: string, data: D, config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
514
+ put: <T = any, R = AxiosResponse<T, any>, D = any>(url: string, data: D, config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
515
+ patch: <T = any, R = AxiosResponse<T, any>, D = any>(url: string, data: D, config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
516
+ delete: <T = any, R = AxiosResponse<T, any>, D = any>(url: string, config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
517
+ get: <T = any, R = AxiosResponse<T, any>, D = any>(url: string, config: import("axios").AxiosRequestConfig<D>) => Promise<R>;
516
518
  defaults: Omit<import("axios").AxiosDefaults, "headers"> & {
517
519
  headers: import("axios").HeadersDefaults & {
518
520
  [key: string]: import("axios").AxiosHeaderValue;
@@ -520,18 +522,18 @@ declare const store: import("zustand").UseBoundStore<Omit<import("zustand").Stor
520
522
  };
521
523
  interceptors: {
522
524
  request: import("axios").AxiosInterceptorManager<import("axios").InternalAxiosRequestConfig>;
523
- response: import("axios").AxiosInterceptorManager<import("axios").AxiosResponse>;
525
+ response: import("axios").AxiosInterceptorManager<AxiosResponse>;
524
526
  };
525
527
  }, authService: {
526
528
  requestLoginMagicLink: (entityType: Entity, payload: {
527
529
  email: string;
528
- }) => Promise<import("axios").AxiosResponse<any, any>>;
529
- getSessionProfile: <T extends Record<string, unknown>>() => Promise<import("axios").AxiosResponse<T & {
530
+ }) => Promise<AxiosResponse<any, any>>;
531
+ getSessionProfile: <T extends Record<string, unknown>>() => Promise<AxiosResponse<T & {
530
532
  displayName: string;
531
533
  email: string;
532
534
  accountId: string;
533
535
  }, any>>;
534
- logout: () => Promise<import("axios").AxiosResponse<any, any>>;
536
+ logout: () => Promise<AxiosResponse<any, any>>;
535
537
  setOptions: (opts: {
536
538
  apiBaseUrl?: string;
537
539
  }) => void;
@@ -541,7 +543,7 @@ declare const store: import("zustand").UseBoundStore<Omit<import("zustand").Stor
541
543
  scope: string;
542
544
  directory: string;
543
545
  name: string;
544
- }) => Promise<import("axios").AxiosResponse<any, any>>;
546
+ }) => Promise<AxiosResponse<any, any>>;
545
547
  deleteFiles: (keys: string[]) => Promise<any>;
546
548
  uploadVideo: ({ file, scope, directory, name, }: {
547
549
  file: File;
@@ -560,34 +562,34 @@ declare const store: import("zustand").UseBoundStore<Omit<import("zustand").Stor
560
562
  lastKey?: string;
561
563
  start?: string;
562
564
  end?: string;
563
- }, opts?: import("./services/core.service").CommonOptions) => Promise<import("axios").AxiosResponse<{
565
+ }, opts?: import("./services/core.service").CommonOptions) => Promise<AxiosResponse<{
564
566
  data: import("@monorise/base").CreatedEntity<T>[];
565
567
  lastKey?: string;
566
568
  totalCount: number;
567
569
  }, any>>;
568
- searchEntities: (query: string, opts?: import("./services/core.service").CommonOptions) => Promise<import("axios").AxiosResponse<{
570
+ searchEntities: (query: string, opts?: import("./services/core.service").CommonOptions) => Promise<AxiosResponse<{
569
571
  data: import("@monorise/base").CreatedEntity<T>[];
570
572
  }, any>>;
571
- listEntitiesByTag: (tagName: string, opts?: import("./services/core.service").CommonOptions) => Promise<import("axios").AxiosResponse<{
573
+ listEntitiesByTag: (tagName: string, opts?: import("./services/core.service").CommonOptions) => Promise<AxiosResponse<{
572
574
  entities: import("@monorise/base").CreatedEntity<T>[];
573
575
  lastKey: string;
574
576
  }, any>>;
575
- getEntity: (id: string, opts?: import("./services/core.service").CommonOptions) => Promise<import("axios").AxiosResponse<import("@monorise/base").CreatedEntity<T>, any>>;
576
- createEntity: (values: import("@monorise/base").DraftEntity<T>, opts?: import("./services/core.service").CommonOptions) => Promise<import("axios").AxiosResponse<import("@monorise/base").CreatedEntity<T>, any>>;
577
- upsertEntity: (id: string, values: import("@monorise/base").DraftEntity<T>, opts?: import("./services/core.service").CommonOptions) => Promise<import("axios").AxiosResponse<import("@monorise/base").CreatedEntity<T>, any>>;
578
- editEntity: (id: string, values: Partial<import("@monorise/base").DraftEntity<T>>, opts?: import("./services/core.service").CommonOptions) => Promise<import("axios").AxiosResponse<import("@monorise/base").CreatedEntity<T>, any>>;
579
- updateEntity: (id: string, values: import("@monorise/base").DraftEntity<T>, opts?: import("./services/core.service").CommonOptions) => Promise<import("axios").AxiosResponse<import("@monorise/base").CreatedEntity<T>, any>>;
580
- deleteEntity: (id: string, opts?: import("./services/core.service").CommonOptions) => Promise<import("axios").AxiosResponse<any, any>>;
577
+ getEntity: (id: string, opts?: import("./services/core.service").CommonOptions) => Promise<AxiosResponse<import("@monorise/base").CreatedEntity<T>, any>>;
578
+ createEntity: (values: import("@monorise/base").DraftEntity<T>, opts?: import("./services/core.service").CommonOptions) => Promise<AxiosResponse<import("@monorise/base").CreatedEntity<T>, any>>;
579
+ upsertEntity: (id: string, values: import("@monorise/base").DraftEntity<T>, opts?: import("./services/core.service").CommonOptions) => Promise<AxiosResponse<import("@monorise/base").CreatedEntity<T>, any>>;
580
+ editEntity: (id: string, values: Partial<import("@monorise/base").DraftEntity<T>>, opts?: import("./services/core.service").CommonOptions) => Promise<AxiosResponse<import("@monorise/base").CreatedEntity<T>, any>>;
581
+ updateEntity: (id: string, values: import("@monorise/base").DraftEntity<T>, opts?: import("./services/core.service").CommonOptions) => Promise<AxiosResponse<import("@monorise/base").CreatedEntity<T>, any>>;
582
+ deleteEntity: (id: string, opts?: import("./services/core.service").CommonOptions) => Promise<AxiosResponse<any, any>>;
581
583
  };
582
584
  makeMutualService: <B extends Entity, T extends Entity>(byEntityType: B, entityType: T) => {
583
- listEntitiesByEntity: (byEntityId: string, opts?: import("./services/core.service").CommonOptions, chainEntityQuery?: string) => Promise<import("axios").AxiosResponse<{
585
+ listEntitiesByEntity: (byEntityId: string, opts?: import("./services/core.service").CommonOptions, chainEntityQuery?: string) => Promise<AxiosResponse<{
584
586
  entities: Mutual<B, T>[];
585
587
  lastKey: string;
586
588
  }, any>>;
587
- getMutual: (byEntityId: string, entityId: string, opts?: import("./services/core.service").CommonOptions) => Promise<import("axios").AxiosResponse<Mutual<B, T>, any>>;
588
- createMutual: (byEntityId: string, entityId: string, payload: MutualData<B, T> | Record<string, unknown>, opts?: {}) => Promise<import("axios").AxiosResponse<Mutual<B, T>, any>>;
589
- editMutual: (byEntityId: string, entityId: string, payload: MutualData<B, T> | Record<string, unknown>, opts?: {}) => Promise<import("axios").AxiosResponse<Mutual<B, T>, any>>;
590
- deleteMutual: (byEntityId: string, entityId: string, opts?: import("./services/core.service").CommonOptions) => Promise<import("axios").AxiosResponse<any, any>>;
589
+ getMutual: (byEntityId: string, entityId: string, opts?: import("./services/core.service").CommonOptions) => Promise<AxiosResponse<Mutual<B, T>, any>>;
590
+ createMutual: (byEntityId: string, entityId: string, payload: MutualData<B, T> | Record<string, unknown>, opts?: {}) => Promise<AxiosResponse<Mutual<B, T>, any>>;
591
+ editMutual: (byEntityId: string, entityId: string, payload: MutualData<B, T> | Record<string, unknown>, opts?: {}) => Promise<AxiosResponse<Mutual<B, T>, any>>;
592
+ deleteMutual: (byEntityId: string, entityId: string, opts?: import("./services/core.service").CommonOptions) => Promise<AxiosResponse<any, any>>;
591
593
  };
592
594
  setOptions: (opts: {
593
595
  entityApiBaseUrl?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAUnE,OAAO,EACL,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,qBAAqB,CAAC;AAE7B,KAAK,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,CAAC,CAAC;IACX,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,C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AAS,EACT,WAAW,EACX,SAAS,EACT,UAAU,EACV,cAAc,GACf,CAAC;AAEF,eAAe,QAAQ,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;AAEtE,YAAY,EACV,aAAa,EACb,WAAW,EACX,MAAM,EACN,eAAe,GAChB,MAAM,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ const initMonorise = () => {
17
17
  const coreService = initCoreService(store, axios);
18
18
  const authActions = initAuthActions(store, authService);
19
19
  const coreActions = initCoreActions(store, appActions, coreService);
20
- injectAxiosInterceptor(appActions, authActions, axios);
20
+ const axiosInterceptor = injectAxiosInterceptor(appActions, authActions, axios);
21
21
  const config = (opts) => {
22
22
  setMonoriseOptions({
23
23
  modals: opts.modals,
@@ -34,6 +34,9 @@ const initMonorise = () => {
34
34
  mutualApiBaseUrl: opts.mutualBaseUrl,
35
35
  tagApiBaseUrl: opts.tagBaseUrl,
36
36
  });
37
+ axiosInterceptor.setOptions({
38
+ onApiSuccess: opts.onApiSuccess,
39
+ });
37
40
  };
38
41
  return Object.assign(Object.assign(Object.assign(Object.assign({ config,
39
42
  store,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACzE,OAAO,eAAe,MAAM,yBAAyB,CAAC;AACtD,OAAO,eAAe,MAAM,yBAAyB,CAAC;AACtD,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AACh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EACZ,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,SAAS,EACT,UAAU,EACV,cAAc,GACf,GAAG,QAAQ,CAAC;AAEb,OAAO,EACL,KAAK,EACL,KAAK,EACL,WAAW,EACX,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,SAAS,EACT,SAAS,EACT,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,SAAS,EACT,UAAU,EACV,YAAY,EACZ,wBAAwB,EACxB,aAAa,EACb,aAAa,EACb,YAAY,EACZ,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,iBAAiB,EACjB,MAAM,EACN,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,SAAS,EACT,UAAU,EACV,cAAc,GACf,CAAC;AAEF,eAAe,QAAQ,CAAC"}
package/dist/lib/api.d.ts CHANGED
@@ -18,6 +18,11 @@ declare const initAxiosInterceptor: (store: MonoriseStore, appActions: AppAction
18
18
  response: import("axios").AxiosInterceptorManager<AxiosResponse>;
19
19
  };
20
20
  };
21
- declare const injectAxiosInterceptor: (appActions: AppActions, authActions: AuthActions, axios: ReturnType<typeof initAxiosInterceptor>) => void;
21
+ type ConfigOptions = {
22
+ onApiSuccess?: <T>(response: AxiosResponse<T>, feedbackSuccess: ((data: AxiosResponse<T>['data']) => React.ReactNode) | string | boolean) => void;
23
+ };
24
+ declare const injectAxiosInterceptor: (appActions: AppActions, authActions: AuthActions, axios: ReturnType<typeof initAxiosInterceptor>, opts?: ConfigOptions) => {
25
+ setOptions: (opts: ConfigOptions) => void;
26
+ };
22
27
  export { initAxiosInterceptor, inject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,MAAM,GACN,OAAO,KACR,IAAI,CAAC;CACX,CAAC;AAEF,QAAA,MAAM,sBAAsB,GAC1B,YAAY,UAAU,EACtB,aAAa,WAAW,EACxB,OAAO,UAAU,CAAC,OAAO,oBAAoB,CAAC,EAC9C,OAAO,aAAa;uBAkDM,aAAa;CAQxC,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,CAAC"}
package/dist/lib/api.js CHANGED
@@ -1,8 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { IconCircleCheckFilled } from '@tabler/icons-react';
3
1
  import request from 'axios';
4
- import { Fragment } from 'react';
5
- import { toast } from 'sonner';
6
2
  const initAxiosInterceptor = (store, appActions) => {
7
3
  const { startLoading } = appActions;
8
4
  const axiosInstance = request.create();
@@ -27,7 +23,8 @@ const initAxiosInterceptor = (store, appActions) => {
27
23
  const axios = Object.assign(Object.assign({}, axiosInstance), { post: (url, data, config) => makeRequest(url, Object.assign(Object.assign({}, config), { method: 'POST' }), data), put: (url, data, config) => makeRequest(url, Object.assign(Object.assign({}, config), { method: 'PUT' }), data), patch: (url, data, config) => makeRequest(url, Object.assign(Object.assign({}, config), { method: 'PATCH' }), data), delete: (url, config) => makeRequest(url, Object.assign(Object.assign({}, config), { method: 'DELETE' })), get: (url, config) => makeRequest(url, Object.assign(Object.assign({}, config), { method: 'GET' })) });
28
24
  return axios;
29
25
  };
30
- const injectAxiosInterceptor = (appActions, authActions, axios) => {
26
+ const injectAxiosInterceptor = (appActions, authActions, axios, opts) => {
27
+ let options = opts || {};
31
28
  const { endLoading, setError, clearError } = appActions;
32
29
  const { setIsUnauthorized } = authActions;
33
30
  const unknownError = {
@@ -35,23 +32,29 @@ const injectAxiosInterceptor = (appActions, authActions, axios) => {
35
32
  message: "Ops, something doesn't seems right",
36
33
  };
37
34
  axios.interceptors.response.use((response) => {
35
+ var _a;
38
36
  const { requestKey, isInterruptive, feedback } = response.config;
39
37
  endLoading({ requestKey, isInterruptive });
40
38
  clearError(requestKey);
41
- if (!(feedback === null || feedback === void 0 ? void 0 : feedback.success)) {
42
- return Promise.resolve(response);
43
- }
44
- switch (typeof feedback.success) {
45
- case 'function':
46
- toast(feedback.success(response.data));
47
- break;
48
- case 'string':
49
- toast(_jsxs(Fragment, { children: [_jsx(IconCircleCheckFilled, { color: 'rgb(34 197 94)' }), feedback.success] }));
50
- break;
51
- case 'boolean':
52
- toast('Request success');
53
- break;
39
+ if (feedback === null || feedback === void 0 ? void 0 : feedback.success) {
40
+ (_a = options.onApiSuccess) === null || _a === void 0 ? void 0 : _a.call(options, response, feedback.success);
54
41
  }
42
+ // switch (typeof feedback.success) {
43
+ // case 'function':
44
+ // toast(feedback.success(response.data));
45
+ // break;
46
+ // case 'string':
47
+ // toast(
48
+ // <Fragment>
49
+ // <IconCircleCheckFilled color='rgb(34 197 94)' />
50
+ // {feedback.success}
51
+ // </Fragment>,
52
+ // );
53
+ // break;
54
+ // case 'boolean':
55
+ // toast('Request success');
56
+ // break;
57
+ // }
55
58
  return Promise.resolve(response);
56
59
  }, (error) => {
57
60
  var _a, _b;
@@ -63,6 +66,10 @@ const injectAxiosInterceptor = (appActions, authActions, axios) => {
63
66
  }
64
67
  return Promise.reject(error);
65
68
  });
69
+ const setOptions = (opts) => {
70
+ options = Object.assign(Object.assign({}, options), opts);
71
+ };
72
+ return { setOptions };
66
73
  };
67
74
  export { initAxiosInterceptor, injectAxiosInterceptor };
68
75
  //# sourceMappingURL=api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../../lib/api.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,OAIN,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAM/B,MAAM,oBAAoB,GAAG,CAAC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MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC,MAA4B,CAAC;QAC1E,UAAU,CAAC,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC,CAAC;QAC3C,QAAQ,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,IAAI,KAAI,YAAY,EAAE,CAAC,CAAC;QACtE,IAAI,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,MAAK,GAAG,EAAE,CAAC;YACnC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC,CACF,CAAC;IAEF,MAAM,UAAU,GAAG,CAAC,IAAmB,EAAE,EAAE;QACzC,OAAO,mCACF,OAAO,GACP,IAAI,CACR,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,EAAE,UAAU,EAAE,CAAC;AACxB,CAAC,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,CAAC"}
package/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { Entity, MonoriseEntityConfig } from '@monorise/base';
2
+ import type { AxiosResponse } from 'axios';
2
3
  import { initAppActions } from './actions/app.action';
3
4
  import { initAuthActions } from './actions/auth.action';
4
5
  import { initConfigActions } from './actions/config.action';
@@ -23,6 +24,13 @@ type Options<T extends Record<string, React.ComponentType<any>>> = {
23
24
  tagBaseUrl?: string;
24
25
  modals?: T;
25
26
  entityConfig: Record<Entity, MonoriseEntityConfig>;
27
+ onApiSuccess?: <T>(
28
+ response: AxiosResponse<T>,
29
+ feedbackSuccess:
30
+ | ((data: AxiosResponse<T>['data']) => React.ReactNode)
31
+ | string
32
+ | boolean,
33
+ ) => void;
26
34
  };
27
35
 
28
36
  const initMonorise = () => {
@@ -39,7 +47,11 @@ const initMonorise = () => {
39
47
  const authActions = initAuthActions(store, authService);
40
48
  const coreActions = initCoreActions(store, appActions, coreService);
41
49
 
42
- injectAxiosInterceptor(appActions, authActions, axios);
50
+ const axiosInterceptor = injectAxiosInterceptor(
51
+ appActions,
52
+ authActions,
53
+ axios,
54
+ );
43
55
 
44
56
  const config = <T extends Record<string, React.ComponentType<any>>>(
45
57
  opts: Options<T>,
@@ -59,6 +71,9 @@ const initMonorise = () => {
59
71
  mutualApiBaseUrl: opts.mutualBaseUrl,
60
72
  tagApiBaseUrl: opts.tagBaseUrl,
61
73
  });
74
+ axiosInterceptor.setOptions({
75
+ onApiSuccess: opts.onApiSuccess,
76
+ });
62
77
  };
63
78
 
64
79
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monorise/react",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,7 +18,6 @@
18
18
  "@tabler/icons-react": "^3.30.0",
19
19
  "axios": "^1.8.1",
20
20
  "immer": "^10.1.1",
21
- "sonner": "^2.0.1",
22
21
  "zustand": "^4.5.2"
23
22
  },
24
23
  "devDependencies": {