woodsportal-client-sdk 4.0.4-dev.2 → 4.0.4-dev.20
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/README.md +2 -0
- package/dist/adapters/angular/index.d.ts +2 -1
- package/dist/adapters/angular/index.js +4 -4
- package/dist/adapters/react/index.d.ts +2 -1
- package/dist/adapters/react/index.js +4 -4
- package/dist/adapters/vue/index.d.ts +2 -1
- package/dist/adapters/vue/index.js +4 -4
- package/dist/auth-error-codes-D7CXVBEN.js +3 -0
- package/dist/auth-error-codes-D7CXVBEN.js.map +1 -0
- package/dist/auth-interceptor-policy-F7JIJWSQ.js +4 -0
- package/dist/auth-interceptor-policy-F7JIJWSQ.js.map +1 -0
- package/dist/auth-utils-VTD5TFYE.js +3 -0
- package/dist/{auth-utils-MNMC2QGX.js.map → auth-utils-VTD5TFYE.js.map} +1 -1
- package/dist/{cache-purge-G5WkHckd.d.ts → cache-purge-Ca4idzyy.d.ts} +1 -1
- package/dist/{chunk-D7XKR2O7.js → chunk-BWZAX23E.js} +11 -10
- package/dist/chunk-BWZAX23E.js.map +1 -0
- package/dist/chunk-COHBSTHF.js +82 -0
- package/dist/chunk-COHBSTHF.js.map +1 -0
- package/dist/{chunk-YEUFUGGT.js → chunk-GLATNYVU.js} +159 -46
- package/dist/chunk-GLATNYVU.js.map +1 -0
- package/dist/{chunk-GO35W5PN.js → chunk-IUVL2E7K.js} +175 -17
- package/dist/chunk-IUVL2E7K.js.map +1 -0
- package/dist/{chunk-FDZNMZS4.js → chunk-LSRSCZBI.js} +507 -166
- package/dist/chunk-LSRSCZBI.js.map +1 -0
- package/dist/{chunk-VEJKNXUE.js → chunk-LYPJXG74.js} +4 -4
- package/dist/{chunk-VEJKNXUE.js.map → chunk-LYPJXG74.js.map} +1 -1
- package/dist/chunk-MFIGS74G.js +140 -0
- package/dist/chunk-MFIGS74G.js.map +1 -0
- package/dist/{chunk-6KKVGCXG.js → chunk-ND7HCTXC.js} +3 -3
- package/dist/{chunk-6KKVGCXG.js.map → chunk-ND7HCTXC.js.map} +1 -1
- package/dist/{chunk-QPSCMK4W.js → chunk-TVUBMDXX.js} +74 -13
- package/dist/chunk-TVUBMDXX.js.map +1 -0
- package/dist/entries/auth.d.ts +17 -4
- package/dist/entries/auth.js +7 -4
- package/dist/entries/auth.js.map +1 -1
- package/dist/entries/crm.d.ts +4 -3
- package/dist/entries/crm.js +5 -5
- package/dist/{http-errors-hlKcIsXD.d.ts → http-errors-B41BMjip.d.ts} +252 -15
- package/dist/{index-CCwMopD8.d.ts → index-Bh9eY8sA.d.ts} +5 -1
- package/dist/index.d.ts +36 -10
- package/dist/index.js +11 -8
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/dist/auth-utils-MNMC2QGX.js +0 -3
- package/dist/chunk-D7XKR2O7.js.map +0 -1
- package/dist/chunk-FDZNMZS4.js.map +0 -1
- package/dist/chunk-GO35W5PN.js.map +0 -1
- package/dist/chunk-QPSCMK4W.js.map +0 -1
- package/dist/chunk-YEUFUGGT.js.map +0 -1
package/README.md
CHANGED
|
@@ -27,6 +27,8 @@ See [`src/test/README.md`](src/test/README.md). Run tests with `npm test`.
|
|
|
27
27
|
|
|
28
28
|
**Contributors:** [docs/DEVELOPER-GUIDE.md](./docs/DEVELOPER-GUIDE.md) · [CONTRIBUTING.md](./CONTRIBUTING.md)
|
|
29
29
|
|
|
30
|
+
Monorepo watch rebuild: `yarn local` (or `npm run local`) in this repo — same script name as client/admin, but **library watch only** (no Vite dev server). See the developer guide for the two-terminal workflow.
|
|
31
|
+
|
|
30
32
|
---
|
|
31
33
|
|
|
32
34
|
## Production checklist
|
|
@@ -11,6 +11,7 @@ declare const useTable: () => TableState & {
|
|
|
11
11
|
modifiedObjectsData(results: any): void;
|
|
12
12
|
clearTablePrependData(): void;
|
|
13
13
|
setTablePrependData(response: any, props?: any): Promise<void>;
|
|
14
|
+
updateTablePrependData(response: any, payload?: any): any;
|
|
14
15
|
};
|
|
15
16
|
declare const useTableUi: () => TableUiState & {
|
|
16
17
|
setTableUniqueId(v: string | null): void;
|
|
@@ -89,7 +90,7 @@ declare const useUploader: () => UploaderState & {
|
|
|
89
90
|
declare const useFile: () => FileState & {
|
|
90
91
|
setListQueryParams(params: any): void;
|
|
91
92
|
setFiles(response: any, payload: any): void;
|
|
92
|
-
updateTreeWithCreate(parentFolderId: string, response: "loading" | any,
|
|
93
|
+
updateTreeWithCreate(parentFolderId: string, response: "loading" | any, _createKind?: "file" | "folder"): Promise<void>;
|
|
93
94
|
clearFiles(): void;
|
|
94
95
|
};
|
|
95
96
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { bindStoreWithActions } from '../../chunk-AYTO6ND7.js';
|
|
2
|
-
import { createAdapterHooks } from '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
2
|
+
import { createAdapterHooks } from '../../chunk-LYPJXG74.js';
|
|
3
|
+
import '../../chunk-ND7HCTXC.js';
|
|
4
|
+
import '../../chunk-GLATNYVU.js';
|
|
5
|
+
import '../../chunk-TVUBMDXX.js';
|
|
6
6
|
import { inject, DestroyRef, signal } from '@angular/core';
|
|
7
7
|
|
|
8
8
|
function createAngularStoreComposable(store, actions) {
|
|
@@ -11,6 +11,7 @@ declare const useTable: () => TableState & {
|
|
|
11
11
|
modifiedObjectsData(results: any): void;
|
|
12
12
|
clearTablePrependData(): void;
|
|
13
13
|
setTablePrependData(response: any, props?: any): Promise<void>;
|
|
14
|
+
updateTablePrependData(response: any, payload?: any): any;
|
|
14
15
|
};
|
|
15
16
|
declare const useTableUi: () => TableUiState & {
|
|
16
17
|
setTableUniqueId(v: string | null): void;
|
|
@@ -89,7 +90,7 @@ declare const useUploader: () => UploaderState & {
|
|
|
89
90
|
declare const useFile: () => FileState & {
|
|
90
91
|
setListQueryParams(params: any): void;
|
|
91
92
|
setFiles(response: any, payload: any): void;
|
|
92
|
-
updateTreeWithCreate(parentFolderId: string, response: "loading" | any,
|
|
93
|
+
updateTreeWithCreate(parentFolderId: string, response: "loading" | any, _createKind?: "file" | "folder"): Promise<void>;
|
|
93
94
|
clearFiles(): void;
|
|
94
95
|
};
|
|
95
96
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createAdapterHooks } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
1
|
+
import { createAdapterHooks } from '../../chunk-LYPJXG74.js';
|
|
2
|
+
import '../../chunk-ND7HCTXC.js';
|
|
3
|
+
import '../../chunk-GLATNYVU.js';
|
|
4
|
+
import '../../chunk-TVUBMDXX.js';
|
|
5
5
|
import { useSyncExternalStore } from 'react';
|
|
6
6
|
|
|
7
7
|
function createReactStoreComposable(store, actions) {
|
|
@@ -11,6 +11,7 @@ declare const useTable: () => TableState & {
|
|
|
11
11
|
modifiedObjectsData(results: any): void;
|
|
12
12
|
clearTablePrependData(): void;
|
|
13
13
|
setTablePrependData(response: any, props?: any): Promise<void>;
|
|
14
|
+
updateTablePrependData(response: any, payload?: any): any;
|
|
14
15
|
};
|
|
15
16
|
declare const useTableUi: () => TableUiState & {
|
|
16
17
|
setTableUniqueId(v: string | null): void;
|
|
@@ -89,7 +90,7 @@ declare const useUploader: () => UploaderState & {
|
|
|
89
90
|
declare const useFile: () => FileState & {
|
|
90
91
|
setListQueryParams(params: any): void;
|
|
91
92
|
setFiles(response: any, payload: any): void;
|
|
92
|
-
updateTreeWithCreate(parentFolderId: string, response: "loading" | any,
|
|
93
|
+
updateTreeWithCreate(parentFolderId: string, response: "loading" | any, _createKind?: "file" | "folder"): Promise<void>;
|
|
93
94
|
clearFiles(): void;
|
|
94
95
|
};
|
|
95
96
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { bindStoreWithActions } from '../../chunk-AYTO6ND7.js';
|
|
2
|
-
import { createAdapterHooks } from '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
2
|
+
import { createAdapterHooks } from '../../chunk-LYPJXG74.js';
|
|
3
|
+
import '../../chunk-ND7HCTXC.js';
|
|
4
|
+
import '../../chunk-GLATNYVU.js';
|
|
5
|
+
import '../../chunk-TVUBMDXX.js';
|
|
6
6
|
import { reactive, onScopeDispose } from 'vue';
|
|
7
7
|
|
|
8
8
|
function createVueStoreComposable(store, actions) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"auth-error-codes-D7CXVBEN.js"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { isOptionalAuthFailureUrl, isSessionProbeUrl, persistAuthError, resolveAuthErrorAction } from './chunk-MFIGS74G.js';
|
|
2
|
+
import './chunk-COHBSTHF.js';
|
|
3
|
+
//# sourceMappingURL=auth-interceptor-policy-F7JIJWSQ.js.map
|
|
4
|
+
//# sourceMappingURL=auth-interceptor-policy-F7JIJWSQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"auth-interceptor-policy-F7JIJWSQ.js"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { getPortal, getProfile, getRefreshToken, getSubscriptionType, setAccessToken, setLoggedInDetails, setPortal, setProfileDetails, setRefreshToken, setSubscriptionType } from './chunk-TVUBMDXX.js';
|
|
2
|
+
//# sourceMappingURL=auth-utils-VTD5TFYE.js.map
|
|
3
|
+
//# sourceMappingURL=auth-utils-VTD5TFYE.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"auth-utils-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"auth-utils-VTD5TFYE.js"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as MutationOptions } from './index-
|
|
1
|
+
import { M as MutationOptions } from './index-Bh9eY8sA.js';
|
|
2
2
|
|
|
3
3
|
declare function purge(options?: MutationOptions<unknown, unknown>): {
|
|
4
4
|
mutate: (payload?: Record<string, unknown> | undefined) => Promise<unknown>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { createMutation, resolveListTableParams, Client } from './chunk-
|
|
2
|
-
import { actions } from './chunk-
|
|
3
|
-
import { actions2, actions as actions$1, actions4, actions5, actions3, actions6 } from './chunk-
|
|
1
|
+
import { createMutation, resolveListTableParams, Client } from './chunk-LSRSCZBI.js';
|
|
2
|
+
import { actions } from './chunk-ND7HCTXC.js';
|
|
3
|
+
import { actions2, actions as actions$1, actions4, actions5, actions3, actions6 } from './chunk-GLATNYVU.js';
|
|
4
4
|
|
|
5
5
|
// src/main/features/crm/api/pipeline.ts
|
|
6
6
|
function list(options) {
|
|
@@ -95,10 +95,10 @@ function create(options) {
|
|
|
95
95
|
const { setMultiObjectPrependData } = actions;
|
|
96
96
|
const { mutate, isLoading } = createMutation(async (props) => {
|
|
97
97
|
if (props?.componentName === "sidebarTable") await setMultiObjectPrependData("loading", props);
|
|
98
|
-
if (props?.componentName != "sidebarTable") await setTablePrependData("loading", props);
|
|
98
|
+
if (props?.componentName != "sidebarTable" && props?.componentName != "sidebarAssociation") await setTablePrependData("loading", props);
|
|
99
99
|
const response = await Client.object.create(props);
|
|
100
100
|
if (props?.componentName === "sidebarTable") await setMultiObjectPrependData(response, props);
|
|
101
|
-
if (props?.componentName != "sidebarTable") await setTablePrependData(response, props);
|
|
101
|
+
if (props?.componentName != "sidebarTable" && props?.componentName != "sidebarAssociation") await setTablePrependData(response, props);
|
|
102
102
|
return response;
|
|
103
103
|
}, options);
|
|
104
104
|
return {
|
|
@@ -145,9 +145,10 @@ function details(options) {
|
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
147
|
function update(options) {
|
|
148
|
+
const { updateTablePrependData } = actions2;
|
|
148
149
|
const { mutate, isLoading } = createMutation(async (payload) => {
|
|
149
150
|
const response = await Client.object.update(payload);
|
|
150
|
-
return response;
|
|
151
|
+
return updateTablePrependData(response, payload);
|
|
151
152
|
}, options);
|
|
152
153
|
return {
|
|
153
154
|
mutate,
|
|
@@ -302,7 +303,7 @@ function details2(options) {
|
|
|
302
303
|
function addFolder(options) {
|
|
303
304
|
const { updateTreeWithCreate } = actions6;
|
|
304
305
|
const { mutate, isLoading } = createMutation(async (props) => {
|
|
305
|
-
const parentFolderId = props?.
|
|
306
|
+
const parentFolderId = props?.queryParams?.parentFolderId;
|
|
306
307
|
await updateTreeWithCreate(parentFolderId, "loading");
|
|
307
308
|
const response = await Client.file.addFolder(props);
|
|
308
309
|
await updateTreeWithCreate(parentFolderId, response, "folder");
|
|
@@ -317,7 +318,7 @@ function addFolder(options) {
|
|
|
317
318
|
function addFile(options) {
|
|
318
319
|
const { updateTreeWithCreate } = actions6;
|
|
319
320
|
const { mutate, isLoading } = createMutation(async (props) => {
|
|
320
|
-
const parentFolderId = props?.
|
|
321
|
+
const parentFolderId = props?.queryParams?.parentFolderId;
|
|
321
322
|
await updateTreeWithCreate(parentFolderId, "loading");
|
|
322
323
|
const response = await Client.file.addFile(props);
|
|
323
324
|
await updateTreeWithCreate(parentFolderId, response, "file");
|
|
@@ -405,5 +406,5 @@ var crmApi = {
|
|
|
405
406
|
};
|
|
406
407
|
|
|
407
408
|
export { crmApi };
|
|
408
|
-
//# sourceMappingURL=chunk-
|
|
409
|
-
//# sourceMappingURL=chunk-
|
|
409
|
+
//# sourceMappingURL=chunk-BWZAX23E.js.map
|
|
410
|
+
//# sourceMappingURL=chunk-BWZAX23E.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/main/features/crm/api/pipeline.ts","../src/main/features/crm/api/stage.ts","../src/main/features/crm/api/object.ts","../src/main/features/crm/api/note.ts","../src/main/features/crm/api/email.ts","../src/main/features/crm/api/uploader.ts","../src/main/features/crm/api/file.ts","../src/main/features/crm/api/cache.ts","../src/main/api/nested-crm-api.ts"],"names":["list","actions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EAAA,OAAO;AAAA,IACH,MAAA;AAAA,IACA,cAAA,EAAgB,MAAA;AAAA,IAChB;AAAA,GACJ;AACJ;;;ACLO,IAAM,MAAA,GAAS;AAAA,EAClB,SAAA,EAAW,EAAE,IAAA,EAAoB;AAAA,EACjC,MAAA,EAAQ,EAAE,IAAA,EAAMD,KAAAA,EAAW;AAAA,EAC3B,OAAA,EAAS;AAAA,IACL,IAAA,EAAMA,KAAAA;AAAA,IACN,WAAA,EAAa,WAAA;AAAA,IACb,OAAA,EAAS,IAAA;AAAA,IACT,cAAA,EAAgB,iBAAA;AAAA,IAChB,UAAA,EAAY,OAAA;AAAA,IACZ,aAAA,EAAe,MAAA;AAAA,IACf,MAAA;AAAA,IACA,cAAA;AAAA,IACA;AAAA,GACJ;AAAA,EACA,KAAA,EAAO;AAAA,IACH,IAAA,EAAMA,KAAAA;AAAA,IACN,MAAA,EAAQE,OAAAA;AAAA,IACR,MAAA,EAAQC;AAAA,GACZ;AAAA,EACA,MAAA,EAAQ;AAAA,IACJ,IAAA,EAAMH,KAAAA;AAAA,IACN,MAAA,EAAQE,OAAAA;AAAA,IACR,MAAA,EAAQC;AAAA,GACZ;AAAA,EACA,KAAA,EAAO;AAAA,IACH,IAAA,EAAMH,KAAAA;AAAA,IACN,UAAA,EAAYI,QAAAA;AAAA,IACZ,QAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,GACJ;AAAA,EACA,OAAA,EAAS;AAAA,IACL,WAAA,EAAa,WAAA;AAAA,IACb,gBAAA,EAAkB;AAAA,GACtB;AAAA,EACA,KAAA,EAAO;AAAA,IACH,KAAA;AAAA,IACA,cAAA,EAAgB;AAAA;AAExB","file":"chunk-BWZAX23E.js","sourcesContent":["import { Client } from '../../../core/http/client-assembler'\nimport type { MutationOptions } from '../../../core/types'\nimport { createMutation } from '../../../core/mutation/createMutation'\nimport { resolveListTableParams } from '../helpers/normalize-table-list-params'\n\nexport function list(options?: MutationOptions<any, any>) {\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const param = resolveListTableParams(payload)\n\n const response: any = await Client.pipeline.list(payload, param)\n return response\n }, options)\n\n return {\n mutate,\n list: mutate,\n getPipelines: mutate,\n isLoading\n }\n}\n","import { Client } from '../../../core/http/client-assembler'\nimport type { MutationOptions } from '../../../core/types'\nimport { createMutation } from '../../../core/mutation/createMutation'\n\nexport function list(options?: MutationOptions<any, any>) {\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.stage.list(payload)\n return response\n }, options)\n\n return {\n mutate,\n list: mutate,\n getStages: mutate,\n isLoading\n }\n}\n","import { Client } from '../../../core/http/client-assembler'\nimport type { MutationOptions } from '../../../core/types'\nimport { createMutation } from '../../../core/mutation/createMutation'\nimport { resolveListTableParams } from '../helpers/normalize-table-list-params'\nimport { actions as tableActions } from '../../../state/crm/use-table'\nimport { actions as multiObjectActions } from '../../../state/crm/use-multi-object'\nimport { actions as formActions } from '../../../state/crm/use-form'\n\nexport function list(options?: MutationOptions<any, any>) {\n const { setObjectsData, setTableData } = tableActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const param = resolveListTableParams(payload)\n\n const response: any = await Client.object.list(payload, param)\n\n await setObjectsData(response, {\n stageId: param.stageId as string | number | undefined\n })\n await setTableData(response, payload)\n\n return response\n }, options)\n\n return {\n mutate,\n list: mutate,\n getObjects: mutate,\n isLoading\n }\n}\n\nexport function sideBarList(options?: MutationOptions<any, any>) {\n const { setMultiObjectData } = multiObjectActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.object.sideBarList(payload)\n setMultiObjectData(response, payload)\n return response\n }, options)\n\n return {\n mutate,\n listSidebar: mutate,\n getSideBarObjects: mutate,\n isLoading\n }\n}\n\nexport function form(options?: MutationOptions<any, any>) {\n const { setFormData } = formActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.object.form(payload)\n\n setFormData(response)\n\n return response\n }, options)\n\n return {\n mutate,\n getForm: mutate,\n getObjectsForm: mutate,\n isLoading\n }\n}\n\nexport function objectFormOptions(options?: MutationOptions<any, any>) {\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.object.objectFormOptions(payload)\n\n return response\n }, options)\n\n return {\n mutate,\n getFormOptions: mutate,\n objectFormOptions: mutate,\n isLoading\n }\n}\n\nexport function create(options?: MutationOptions<any, any>) {\n const { setTablePrependData } = tableActions\n const { setMultiObjectPrependData } = multiObjectActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (props: any) => {\n if (props?.componentName === 'sidebarTable') await setMultiObjectPrependData('loading', props)\n if (props?.componentName != 'sidebarTable' && props?.componentName != 'sidebarAssociation') await setTablePrependData('loading', props)\n\n const response: any = await Client.object.create(props)\n\n if (props?.componentName === 'sidebarTable') await setMultiObjectPrependData(response, props)\n if (props?.componentName != 'sidebarTable' && props?.componentName != 'sidebarAssociation') await setTablePrependData(response, props)\n\n return response\n }, options)\n\n return {\n mutate,\n create: mutate,\n createObject: mutate,\n isLoading\n }\n}\n\nexport function createExisting(options?: MutationOptions<any, any>) {\n const { mutate, isLoading } = createMutation<any, any>(async (props: any) => {\n const response: any = await Client.object.createExisting(props)\n\n return response\n }, options)\n\n return {\n mutate,\n createExisting: mutate,\n createExistingObject: mutate,\n isLoading\n }\n}\n\nexport function removeExisting(options?: MutationOptions<any, any>) {\n const { mutate, isLoading } = createMutation<any, any>(async (props: any) => {\n const response: any = await Client.object.removeExisting(props)\n\n return response\n }, options)\n\n return {\n mutate,\n removeExisting: mutate,\n removeExistingObject: mutate,\n isLoading\n }\n}\n\nexport function details(options?: MutationOptions<any, any>) {\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.object.details(payload)\n\n return response\n }, options)\n\n return {\n mutate,\n getDetails: mutate,\n getObjectsDetails: mutate,\n isLoading\n }\n}\n\nexport function update(options?: MutationOptions<any, any>) {\n const { updateTablePrependData } = tableActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.object.update(payload)\n\n return updateTablePrependData(response, payload)\n }, options)\n\n return {\n mutate,\n updateDetails: mutate,\n updateObjectsDetails: mutate,\n isLoading\n }\n}\n","import { Client } from '../../../core/http/client-assembler'\nimport type { MutationOptions } from '../../../core/types'\nimport { createMutation } from '../../../core/mutation/createMutation'\nimport { actions as noteActions } from '../../../state/crm/use-note'\n\nexport function list(options?: MutationOptions<any, any>) {\n const { setNotes } = noteActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.note.list(payload)\n\n setNotes(response, payload)\n\n return response\n }, options)\n\n return {\n mutate,\n list: mutate,\n getNotes: mutate,\n isLoading\n }\n}\n\nexport function create(options?: MutationOptions<any, any>) {\n const { setPrependNote } = noteActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (props: any) => {\n await setPrependNote('loading')\n const response: any = await Client.note.create(props)\n await setPrependNote(response)\n return response\n }, options)\n\n return {\n mutate,\n create: mutate,\n createNote: mutate,\n isLoading\n }\n}\n\nexport function update(options?: MutationOptions<any, any>) {\n const { updatePrependNote } = noteActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n // let params: any = makeParam()\n // let mParams: any = { cache: !!params?.cache, isPrimaryCompany: params?.isPrimaryCompany, limit: params?.limit || 5 }\n\n // if (getAuthSubscriptionType() === 'FREE') {\n // mParams.after = params?.after || \"\";\n // } else {\n // mParams.limit = params?.limit || \"\";\n // mParams.page = params?.page || \"\";\n // }\n\n const response: any = await Client.note.update(payload)\n\n return updatePrependNote(response)\n }, options)\n\n return {\n mutate,\n update: mutate,\n updateNote: mutate,\n isLoading\n }\n}\n\n// const makeParam = () => {\n// let params: any = {};\n// const tab = filterParams(\"tabs.notes\")\n// const baseParams: any = {\n// objectId: objectId,\n// id: id,\n// portalId: portalId,\n// cache: (sync || apiSync) ? false : true,\n// isPrimaryCompany: tab?.isPrimaryCompany ? true : false,\n// };\n\n// if (getAuthSubscriptionType() === \"FREE\") {\n// params = {\n// ...baseParams,\n// ...({ after: isFristTimeLoadData && tab?.page ? tab?.page : page }),\n// };\n// } else {\n// params = {\n// ...baseParams,\n// ...({\n// limit: limit,\n// page: isFristTimeLoadData && tab?.page ? tab?.page : page,\n// }),\n// };\n// }\n// return params\n// }\n","import { Client } from '../../../core/http/client-assembler'\nimport type { MutationOptions } from '../../../core/types'\nimport { createMutation } from '../../../core/mutation/createMutation'\nimport { actions as emailActions } from '../../../state/crm/use-email'\n\nexport function list(options?: MutationOptions<any, any>) {\n const { setEmails } = emailActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.email.list(payload)\n\n setEmails(response, payload)\n\n return response\n }, options)\n\n return {\n mutate,\n list: mutate,\n getEmails: mutate,\n isLoading\n }\n}\n\nexport function create(options?: MutationOptions<any, any>) {\n const { setPrependEmail } = emailActions\n const { mutate, isLoading } = createMutation<any, any>(async (props: any) => {\n await setPrependEmail('loading')\n const response: any = await Client.email.create(props)\n await setPrependEmail(response)\n return response\n }, options)\n\n return {\n mutate,\n create: mutate,\n createEmail: mutate,\n isLoading\n }\n}\n\nexport function update(options?: MutationOptions<any, any>) {\n const { updatePrependEmail } = emailActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.email.update(payload)\n\n return updatePrependEmail(response)\n }, options)\n\n return {\n mutate,\n update: mutate,\n updateEmail: mutate,\n isLoading\n }\n}\n\n// const makeParam = () => {\n// let params: any = {};\n// const tab = filterParams(\"tabs.notes\")\n// const baseParams: any = {\n// objectId: objectId,\n// id: id,\n// portalId: portalId,\n// cache: (sync || apiSync) ? false : true,\n// isPrimaryCompany: tab?.isPrimaryCompany ? true : false,\n// };\n\n// if (getAuthSubscriptionType() === \"FREE\") {\n// params = {\n// ...baseParams,\n// ...({ after: isFristTimeLoadData && tab?.page ? tab?.page : page }),\n// };\n// } else {\n// params = {\n// ...baseParams,\n// ...({\n// limit: limit,\n// page: isFristTimeLoadData && tab?.page ? tab?.page : page,\n// }),\n// };\n// }\n// return params\n// }\n","import { Client } from '../../../core/http/client-assembler'\nimport type { MutationOptions } from '../../../core/types'\nimport { createMutation } from '../../../core/mutation/createMutation'\nimport { actions as uploaderActions } from '../../../state/crm/use-uploader'\n\nexport function imageUpload(options?: MutationOptions<any, any>) {\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = payload?.type === 'email' ? await Client.email.image(payload) : await Client.note.image(payload)\n\n return response\n }, options)\n\n return {\n mutate,\n uploadImage: mutate,\n imageUpload: mutate,\n isLoading\n }\n}\n\nexport function attachmentUpload(options?: MutationOptions<any, any>) {\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = payload?.type === 'email' ? await Client.email.attachment(payload) : await Client.note.attachment(payload)\n\n uploaderActions.setAttachment(response)\n\n return response\n }, options)\n\n return {\n mutate,\n uploadAttachment: mutate,\n attachmentUpload: mutate,\n isLoading\n }\n}\n","import { Client } from '../../../core/http/client-assembler'\nimport type { MutationOptions } from '../../../core/types'\nimport { createMutation } from '../../../core/mutation/createMutation'\nimport { actions as fileActions } from '../../../state/crm/use-file'\n\nexport function list(options?: MutationOptions<any, any>) {\n const { setFiles } = fileActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.file.list(payload)\n\n setFiles(response, payload)\n\n return response\n }, options)\n\n return {\n mutate,\n list: mutate,\n getFiles: mutate,\n isLoading\n }\n}\n\nexport function details(options?: MutationOptions<any, any>) {\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.file.details(payload)\n\n return response\n }, options)\n\n return {\n mutate,\n getDetails: mutate,\n getFile: mutate,\n isLoading\n }\n}\n\nexport function addFolder(options?: MutationOptions<any, any>) {\n const { updateTreeWithCreate } = fileActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (props: any) => {\n const parentFolderId = props?.queryParams?.parentFolderId\n await updateTreeWithCreate(parentFolderId, 'loading')\n const response: any = await Client.file.addFolder(props)\n await updateTreeWithCreate(parentFolderId, response, 'folder')\n return response\n }, options)\n\n return {\n mutate,\n addFolder: mutate,\n isLoading\n }\n}\n\nexport function addFile(options?: MutationOptions<any, any>) {\n const { updateTreeWithCreate } = fileActions\n\n const { mutate, isLoading } = createMutation<any, any>(async (props: any) => {\n const parentFolderId = props?.queryParams?.parentFolderId\n await updateTreeWithCreate(parentFolderId, 'loading')\n const response: any = await Client.file.addFile(props)\n await updateTreeWithCreate(parentFolderId, response, 'file')\n return response\n }, options)\n\n return {\n mutate,\n addFile: mutate,\n isLoading\n }\n}\n\nexport function download(options?: MutationOptions<any, any>) {\n const { mutate, isLoading } = createMutation<any, any>(async (payload: any) => {\n const response: any = await Client.file.download(payload)\n return response\n }, options)\n\n return {\n mutate,\n download: mutate,\n downloadFile: mutate,\n isLoading\n }\n}\n","import { Client } from '../../../core/http/client-assembler'\nimport type { MutationOptions } from '../../../core/types'\nimport { createMutation } from '../../../core/mutation/createMutation'\n\n/** Soft refresh CRM list cache (prefer over GET cache=false when purge API is enabled). */\nexport function purge(options?: MutationOptions<unknown, unknown>) {\n const { mutate, isLoading } = createMutation<Record<string, unknown>, unknown>(async (payload?: Record<string, unknown>) => {\n const safePayload = payload ?? {}\n const idempotencyKey = typeof safePayload.idempotencyKey === 'string' ? safePayload.idempotencyKey : undefined\n const headers = idempotencyKey ? { 'Idempotency-Key': idempotencyKey } : undefined\n const { idempotencyKey: _ignored, ...body } = safePayload\n return Client.cache.purge(body, headers)\n }, options)\n\n return { mutate, purge: mutate, purgeCache: mutate, isLoading }\n}\n\nexport function purgeStatus(purgeJobId: string, options?: MutationOptions<unknown, unknown>) {\n const { mutate, isLoading } = createMutation<string, unknown>(async (jobId?: string) => Client.cache.purgeStatus(jobId ?? purgeJobId), options)\n\n return {\n mutate,\n getPurgeStatus: mutate,\n isLoading\n }\n}\n","import { list as pipelinesList } from '../features/crm/api/pipeline'\nimport { list as stagesList } from '../features/crm/api/stage'\nimport {\n list as objectsList,\n sideBarList as objectsListSidebar,\n form as objectsGetForm,\n create as objectsCreate,\n createExisting as objectsCreateExisting,\n removeExisting as objectsRemoveExisting,\n details as objectsGetDetails,\n update as objectsUpdateDetails,\n objectFormOptions as objectsGetFormOptions\n} from '../features/crm/api/object'\nimport { list as notesList, create as notesCreate, update as notesUpdate } from '../features/crm/api/note'\nimport { list as emailsList, create as emailsCreate, update as emailsUpdate } from '../features/crm/api/email'\nimport { imageUpload, attachmentUpload } from '../features/crm/api/uploader'\nimport { list as filesList, addFolder, addFile, details as filesGetDetails, download as filesDownload } from '../features/crm/api/file'\nimport { purge as cachePurge, purgeStatus as cacheGetPurgeStatus } from '../features/crm/api/cache'\n\n/** Canonical nested CRM API (SDK 3.0). */\nexport const crmApi = {\n pipelines: { list: pipelinesList },\n stages: { list: stagesList },\n objects: {\n list: objectsList,\n listSidebar: objectsListSidebar,\n getForm: objectsGetForm,\n getFormOptions: objectsGetFormOptions,\n getDetails: objectsGetDetails,\n updateDetails: objectsUpdateDetails,\n create: objectsCreate,\n createExisting: objectsCreateExisting,\n removeExisting: objectsRemoveExisting\n },\n notes: {\n list: notesList,\n create: notesCreate,\n update: notesUpdate\n },\n emails: {\n list: emailsList,\n create: emailsCreate,\n update: emailsUpdate\n },\n files: {\n list: filesList,\n getDetails: filesGetDetails,\n download: filesDownload,\n addFolder,\n addFile\n },\n uploads: {\n uploadImage: imageUpload,\n uploadAttachment: attachmentUpload\n },\n cache: {\n purge: cachePurge,\n getPurgeStatus: cacheGetPurgeStatus\n }\n}\n"]}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// src/main/core/auth/auth-error-codes.ts
|
|
2
|
+
var AuthErrorCode = {
|
|
3
|
+
AUTHENTICATION_FAILED: "AUTHENTICATION_FAILED",
|
|
4
|
+
TOKEN_INVALID: "AUTH_TOKEN_INVALID",
|
|
5
|
+
TOKEN_EXPIRED: "AUTH_TOKEN_EXPIRED",
|
|
6
|
+
ACCOUNT_LOCKED: "AUTH_ACCOUNT_LOCKED",
|
|
7
|
+
ACCOUNT_DISABLED: "AUTH_ACCOUNT_DISABLED",
|
|
8
|
+
LOGIN_FAILED: "LOGIN_FAILED",
|
|
9
|
+
INVALID_CREDENTIALS: "AUTH_INVALID_CREDENTIALS",
|
|
10
|
+
TWO_FACTOR_REQUIRED: "AUTH_2FA_REQUIRED",
|
|
11
|
+
EMAIL_NOT_VERIFIED: "AUTH_EMAIL_NOT_VERIFIED",
|
|
12
|
+
ACCESS_DENIED: "ACCESS_DENIED",
|
|
13
|
+
ACCESS_FORBIDDEN: "ACCESS_FORBIDDEN",
|
|
14
|
+
ACCESS_UNAUTHORIZED: "ACCESS_UNAUTHORIZED",
|
|
15
|
+
MISSING_REFRESH_TOKEN: "MISSING_REFRESH_TOKEN",
|
|
16
|
+
MISSING_HEADERS: "MISSING_HEADERS",
|
|
17
|
+
OAUTH_PROCESSING_ERROR: "OAUTH_PROCESSING_ERROR",
|
|
18
|
+
HUBSPOT_REAUTH_REQUIRED: "HUBSPOT_REAUTH_REQUIRED",
|
|
19
|
+
PORTAL_INACTIVE: "PORTAL_INACTIVE",
|
|
20
|
+
AMBIGUOUS_HUB_ID: "AMBIGUOUS_HUB_ID",
|
|
21
|
+
COMMERCIAL_ACCESS_EXPIRED: "COMMERCIAL_ACCESS_EXPIRED"
|
|
22
|
+
};
|
|
23
|
+
function parseApiErrorPayload(data) {
|
|
24
|
+
if (!data || typeof data !== "object") {
|
|
25
|
+
return {};
|
|
26
|
+
}
|
|
27
|
+
const payload = data;
|
|
28
|
+
return {
|
|
29
|
+
errorCode: typeof payload.errorCode === "string" ? payload.errorCode : void 0,
|
|
30
|
+
errorMessage: typeof payload.errorMessage === "string" ? payload.errorMessage : typeof payload.message === "string" ? payload.message : void 0,
|
|
31
|
+
detailedMessage: typeof payload.detailedMessage === "string" ? payload.detailedMessage : void 0,
|
|
32
|
+
correlationId: typeof payload.correlationId === "string" ? payload.correlationId : void 0,
|
|
33
|
+
statusCode: typeof payload.statusCode === "number" ? payload.statusCode : void 0,
|
|
34
|
+
category: typeof payload.category === "string" ? payload.category : void 0
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function getUnauthorizedPageCopy(errorCode, fallbackMessage) {
|
|
38
|
+
switch (errorCode) {
|
|
39
|
+
case AuthErrorCode.HUBSPOT_REAUTH_REQUIRED:
|
|
40
|
+
return {
|
|
41
|
+
title: "HubSpot re-authorization required",
|
|
42
|
+
message: fallbackMessage ?? "Reconnect your HubSpot account to continue using WoodsPortal.",
|
|
43
|
+
buttonLabel: "Go to HubSpot Accounts",
|
|
44
|
+
clearSessionOnMount: false
|
|
45
|
+
};
|
|
46
|
+
case AuthErrorCode.ACCOUNT_LOCKED:
|
|
47
|
+
case AuthErrorCode.ACCOUNT_DISABLED:
|
|
48
|
+
return {
|
|
49
|
+
title: "Account unavailable",
|
|
50
|
+
message: fallbackMessage ?? "Your account is locked or disabled. Contact support if you need access.",
|
|
51
|
+
buttonLabel: "Go to Login",
|
|
52
|
+
clearSessionOnMount: true
|
|
53
|
+
};
|
|
54
|
+
case AuthErrorCode.ACCESS_DENIED:
|
|
55
|
+
case AuthErrorCode.ACCESS_FORBIDDEN:
|
|
56
|
+
return {
|
|
57
|
+
title: "Access denied",
|
|
58
|
+
message: fallbackMessage ?? "You do not have permission to perform this action.",
|
|
59
|
+
buttonLabel: "Go to Login",
|
|
60
|
+
clearSessionOnMount: false
|
|
61
|
+
};
|
|
62
|
+
case AuthErrorCode.TOKEN_EXPIRED:
|
|
63
|
+
case AuthErrorCode.TOKEN_INVALID:
|
|
64
|
+
return {
|
|
65
|
+
title: "Session expired",
|
|
66
|
+
message: fallbackMessage ?? "Your session has expired. Please log in again to continue.",
|
|
67
|
+
buttonLabel: "Go to Login",
|
|
68
|
+
clearSessionOnMount: true
|
|
69
|
+
};
|
|
70
|
+
default:
|
|
71
|
+
return {
|
|
72
|
+
title: "Unauthorized",
|
|
73
|
+
message: fallbackMessage ?? "Your session may have expired or you do not have the required permissions. Please log in again to continue.",
|
|
74
|
+
buttonLabel: "Go to Login",
|
|
75
|
+
clearSessionOnMount: true
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export { AuthErrorCode, getUnauthorizedPageCopy, parseApiErrorPayload };
|
|
81
|
+
//# sourceMappingURL=chunk-COHBSTHF.js.map
|
|
82
|
+
//# sourceMappingURL=chunk-COHBSTHF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/main/core/auth/auth-error-codes.ts"],"names":[],"mappings":";AACO,IAAM,aAAA,GAAgB;AAAA,EACzB,qBAAA,EAAuB,uBAAA;AAAA,EACvB,aAAA,EAAe,oBAAA;AAAA,EACf,aAAA,EAAe,oBAAA;AAAA,EACf,cAAA,EAAgB,qBAAA;AAAA,EAChB,gBAAA,EAAkB,uBAAA;AAAA,EAClB,YAAA,EAAc,cAAA;AAAA,EACd,mBAAA,EAAqB,0BAAA;AAAA,EACrB,mBAAA,EAAqB,mBAAA;AAAA,EACrB,kBAAA,EAAoB,yBAAA;AAAA,EACpB,aAAA,EAAe,eAAA;AAAA,EACf,gBAAA,EAAkB,kBAAA;AAAA,EAClB,mBAAA,EAAqB,qBAAA;AAAA,EACrB,qBAAA,EAAuB,uBAAA;AAAA,EACvB,eAAA,EAAiB,iBAAA;AAAA,EACjB,sBAAA,EAAwB,wBAAA;AAAA,EACxB,uBAAA,EAAyB,yBAAA;AAAA,EACzB,eAAA,EAAiB,iBAAA;AAAA,EACjB,gBAAA,EAAkB,kBAAA;AAAA,EAClB,yBAAA,EAA2B;AAC/B;AAeO,SAAS,qBAAqB,IAAA,EAAgC;AACjE,EAAA,IAAI,CAAC,IAAA,IAAQ,OAAO,IAAA,KAAS,QAAA,EAAU;AACnC,IAAA,OAAO,EAAC;AAAA,EACZ;AACA,EAAA,MAAM,OAAA,GAAU,IAAA;AAChB,EAAA,OAAO;AAAA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,SAAS,eAAA,IAAmB,oDAAA;AAAA,QAC5B,WAAA,EAAa,aAAA;AAAA,QACb,mBAAA,EAAqB;AAAA,OACzB;AAAA,IACJ,KAAK,aAAA,CAAc,aAAA;AAAA,IACnB,KAAK,aAAA,CAAc,aAAA;AACf,MAAA,OAAO;AAAA,QACH,KAAA,EAAO,iBAAA;AAAA,QACP,SAAS,eAAA,IAAmB,4DAAA;AAAA,QAC5B,WAAA,EAAa,aAAA;AAAA,QACb,mBAAA,EAAqB;AAAA,OACzB;AAAA,IACJ;AACI,MAAA,OAAO;AAAA,QACH,KAAA,EAAO,cAAA;AAAA,QACP,SACI,eAAA,IAAmB,6GAAA;AAAA,QACvB,WAAA,EAAa,aAAA;AAAA,QACb,mBAAA,EAAqB;AAAA,OACzB;AAAA;AAEZ","file":"chunk-COHBSTHF.js","sourcesContent":["/** Auth-related API error codes (woodsportal-api ErrorCode.java + API-ERROR-CODES.md). */\nexport const AuthErrorCode = {\n AUTHENTICATION_FAILED: 'AUTHENTICATION_FAILED',\n TOKEN_INVALID: 'AUTH_TOKEN_INVALID',\n TOKEN_EXPIRED: 'AUTH_TOKEN_EXPIRED',\n ACCOUNT_LOCKED: 'AUTH_ACCOUNT_LOCKED',\n ACCOUNT_DISABLED: 'AUTH_ACCOUNT_DISABLED',\n LOGIN_FAILED: 'LOGIN_FAILED',\n INVALID_CREDENTIALS: 'AUTH_INVALID_CREDENTIALS',\n TWO_FACTOR_REQUIRED: 'AUTH_2FA_REQUIRED',\n EMAIL_NOT_VERIFIED: 'AUTH_EMAIL_NOT_VERIFIED',\n ACCESS_DENIED: 'ACCESS_DENIED',\n ACCESS_FORBIDDEN: 'ACCESS_FORBIDDEN',\n ACCESS_UNAUTHORIZED: 'ACCESS_UNAUTHORIZED',\n MISSING_REFRESH_TOKEN: 'MISSING_REFRESH_TOKEN',\n MISSING_HEADERS: 'MISSING_HEADERS',\n OAUTH_PROCESSING_ERROR: 'OAUTH_PROCESSING_ERROR',\n HUBSPOT_REAUTH_REQUIRED: 'HUBSPOT_REAUTH_REQUIRED',\n PORTAL_INACTIVE: 'PORTAL_INACTIVE',\n AMBIGUOUS_HUB_ID: 'AMBIGUOUS_HUB_ID',\n COMMERCIAL_ACCESS_EXPIRED: 'COMMERCIAL_ACCESS_EXPIRED'\n} as const\n\nexport type AuthErrorCodeValue = (typeof AuthErrorCode)[keyof typeof AuthErrorCode]\n\nexport type ApiErrorPayload = {\n errorCode?: string\n errorMessage?: string\n detailedMessage?: string\n correlationId?: string\n statusCode?: number\n category?: string\n}\n\nexport type StoredAuthError = ApiErrorPayload & { ts?: number }\n\nexport function parseApiErrorPayload(data: unknown): ApiErrorPayload {\n if (!data || typeof data !== 'object') {\n return {}\n }\n const payload = data as Record<string, unknown>\n return {\n errorCode: typeof payload.errorCode === 'string' ? payload.errorCode : undefined,\n errorMessage:\n typeof payload.errorMessage === 'string' ? payload.errorMessage : typeof payload.message === 'string' ? payload.message : undefined,\n detailedMessage: typeof payload.detailedMessage === 'string' ? payload.detailedMessage : undefined,\n correlationId: typeof payload.correlationId === 'string' ? payload.correlationId : undefined,\n statusCode: typeof payload.statusCode === 'number' ? payload.statusCode : undefined,\n category: typeof payload.category === 'string' ? payload.category : undefined\n }\n}\n\nexport type UnauthorizedPageCopy = {\n title: string\n message: string\n buttonLabel: string\n clearSessionOnMount: boolean\n}\n\nexport function getUnauthorizedPageCopy(errorCode?: string, fallbackMessage?: string): UnauthorizedPageCopy {\n switch (errorCode) {\n case AuthErrorCode.HUBSPOT_REAUTH_REQUIRED:\n return {\n title: 'HubSpot re-authorization required',\n message: fallbackMessage ?? 'Reconnect your HubSpot account to continue using WoodsPortal.',\n buttonLabel: 'Go to HubSpot Accounts',\n clearSessionOnMount: false\n }\n case AuthErrorCode.ACCOUNT_LOCKED:\n case AuthErrorCode.ACCOUNT_DISABLED:\n return {\n title: 'Account unavailable',\n message: fallbackMessage ?? 'Your account is locked or disabled. Contact support if you need access.',\n buttonLabel: 'Go to Login',\n clearSessionOnMount: true\n }\n case AuthErrorCode.ACCESS_DENIED:\n case AuthErrorCode.ACCESS_FORBIDDEN:\n return {\n title: 'Access denied',\n message: fallbackMessage ?? 'You do not have permission to perform this action.',\n buttonLabel: 'Go to Login',\n clearSessionOnMount: false\n }\n case AuthErrorCode.TOKEN_EXPIRED:\n case AuthErrorCode.TOKEN_INVALID:\n return {\n title: 'Session expired',\n message: fallbackMessage ?? 'Your session has expired. Please log in again to continue.',\n buttonLabel: 'Go to Login',\n clearSessionOnMount: true\n }\n default:\n return {\n title: 'Unauthorized',\n message:\n fallbackMessage ?? 'Your session may have expired or you do not have the required permissions. Please log in again to continue.',\n buttonLabel: 'Go to Login',\n clearSessionOnMount: true\n }\n }\n}\n"]}
|