@monorise/react 1.0.12 → 3.0.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/actions/auth.action.d.ts +4 -1
- package/dist/actions/auth.action.d.ts.map +1 -1
- package/dist/actions/auth.action.js +7 -6
- package/dist/actions/auth.action.js.map +1 -1
- package/dist/actions/core.action.d.ts +163 -12
- package/dist/actions/core.action.d.ts.map +1 -1
- package/dist/actions/core.action.js +592 -168
- package/dist/actions/core.action.js.map +1 -1
- package/dist/index.d.ts +456 -30
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/api.d.ts +15 -5
- package/dist/lib/api.d.ts.map +1 -1
- package/dist/lib/api.js +12 -6
- package/dist/lib/api.js.map +1 -1
- package/dist/lib/utils.d.ts +8 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +24 -0
- package/dist/lib/utils.js.map +1 -1
- package/dist/services/core.service.d.ts +9 -1
- package/dist/services/core.service.d.ts.map +1 -1
- package/dist/services/core.service.js +32 -20
- package/dist/services/core.service.js.map +1 -1
- package/dist/services/filestore.service.d.ts +4 -1
- package/dist/services/filestore.service.d.ts.map +1 -1
- package/dist/services/filestore.service.js +49 -4
- package/dist/services/filestore.service.js.map +1 -1
- package/dist/store/monorise.store.d.ts +6 -0
- package/dist/store/monorise.store.d.ts.map +1 -1
- package/dist/store/monorise.store.js +1 -0
- package/dist/store/monorise.store.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/api.type.d.ts +2 -0
- package/dist/types/api.type.d.ts.map +1 -1
- package/dist/types/api.type.js.map +1 -1
- package/package.json +20 -10
- package/actions/app.action.ts +0 -218
- package/actions/auth.action.ts +0 -94
- package/actions/config.action.ts +0 -51
- package/actions/core.action.ts +0 -940
- package/dist/index.esm.js +0 -1601
- package/dist/index.jsx +0 -48
- package/dist/index.jsx.map +0 -1
- package/dist/lib/api.jsx +0 -70
- package/dist/lib/api.jsx.map +0 -1
- package/dist/lib/config.d.ts +0 -5
- package/dist/lib/config.d.ts.map +0 -1
- package/dist/lib/config.js +0 -24
- package/dist/lib/config.js.map +0 -1
- package/index.ts +0 -194
- package/lib/api.ts +0 -150
- package/lib/constant.ts +0 -1
- package/lib/entity.ts +0 -76
- package/lib/utils.ts +0 -12
- package/services/auth.service.ts +0 -65
- package/services/core.service.ts +0 -415
- package/services/filestore.service.ts +0 -136
- package/store/monorise.store.ts +0 -105
- package/tsconfig.json +0 -118
- package/types/api.type.ts +0 -57
- package/types/axios.type.ts +0 -14
- package/types/monorise.type.ts +0 -8
- package/types/mutual.type.ts +0 -32
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filestore.service.js","sourceRoot":"","sources":["../../services/filestore.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"filestore.service.js","sourceRoot":"","sources":["../../services/filestore.service.ts"],"names":[],"mappings":"AAeA,MAAM,oBAAoB,GAAG,CAAC,KAAuB,EAAE,EAAE;IACvD,IAAI,OAAO,GAAY,EAAE,CAAC;IAC1B,MAAM,EAAE,UAAU,GAAG,WAAW,EAAE,GAAG,OAAO,CAAC;IAE7C,MAAM,UAAU,GAAG,KAAK,EAAE,EACxB,IAAI,EACJ,KAAK,EACL,SAAS,EACT,IAAI,EACJ,cAAc,EACd,UAAU,GACM,EAAE,EAAE;QACpB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,UAAU,SAAS,EAAE;YACvD,UAAU,EAAE,0BAA0B,IAAI,EAAE;YAC5C,cAAc,EAAE,CAAC,cAAc;YAC/B,QAAQ,EAAE;gBACR,OAAO,EAAE,kBAAkB;aAC5B;YACD,MAAM,EAAE;gBACN,KAAK;gBACL,SAAS;gBACT,QAAQ,EAAE,IAAI;aACf;SACF,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CA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E;gBACP,cAAc,EAAE,IAAI,CAAC,IAAI;aAC1B;SACF,CAAC,CAAC;QAEH,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,KAAK,CAAC,IAAI,CAC/B,GAAG,UAAU,gBAAgB,EAC7B;YACE,KAAK;YACL,SAAS;YACT,QAAQ,EAAE,IAAI;SACf,EACD;YACE,UAAU,EAAE,yBAAyB;YACrC,cAAc,EAAE,IAAI;YACpB,QAAQ,EAAE;gBACR,OAAO,EAAE,6BAA6B;aACvC;SACF,CACF,CAAC;QAEF,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,KAAK,EAAE,EAAU,EAAE,EAAE;QACxC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,UAAU,QAAQ,EAAE,EAAE,EAAE;YAC1D,UAAU,EAAE,qBAAqB,EAAE,EAAE;SACtC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IAEF,MAAM,UAAU,GAAG,CAAC,IAAa,EAAE,EAAE;QACnC,OAAO,mCACF,OAAO,GACP,IAAI,CACR,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO;QACL,UAAU;QACV,WAAW;QACX,WAAW;QACX,WAAW;QACX,YAAY;QACZ,UAAU;KACX,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -31,6 +31,7 @@ declare const initMonoriseStore: () => {
|
|
|
31
31
|
email: string;
|
|
32
32
|
accountId: string;
|
|
33
33
|
};
|
|
34
|
+
isLoading: boolean;
|
|
34
35
|
};
|
|
35
36
|
}>, "setState"> & {
|
|
36
37
|
setState<A extends string | {
|
|
@@ -58,6 +59,7 @@ declare const initMonoriseStore: () => {
|
|
|
58
59
|
email: string;
|
|
59
60
|
accountId: string;
|
|
60
61
|
};
|
|
62
|
+
isLoading: boolean;
|
|
61
63
|
};
|
|
62
64
|
} | Partial<{
|
|
63
65
|
app: {
|
|
@@ -82,6 +84,7 @@ declare const initMonoriseStore: () => {
|
|
|
82
84
|
email: string;
|
|
83
85
|
accountId: string;
|
|
84
86
|
};
|
|
87
|
+
isLoading: boolean;
|
|
85
88
|
};
|
|
86
89
|
}> | ((state: {
|
|
87
90
|
app: {
|
|
@@ -106,6 +109,7 @@ declare const initMonoriseStore: () => {
|
|
|
106
109
|
email: string;
|
|
107
110
|
accountId: string;
|
|
108
111
|
};
|
|
112
|
+
isLoading: boolean;
|
|
109
113
|
};
|
|
110
114
|
}) => {
|
|
111
115
|
app: {
|
|
@@ -130,6 +134,7 @@ declare const initMonoriseStore: () => {
|
|
|
130
134
|
email: string;
|
|
131
135
|
accountId: string;
|
|
132
136
|
};
|
|
137
|
+
isLoading: boolean;
|
|
133
138
|
};
|
|
134
139
|
} | Partial<{
|
|
135
140
|
app: {
|
|
@@ -154,6 +159,7 @@ declare const initMonoriseStore: () => {
|
|
|
154
159
|
email: string;
|
|
155
160
|
accountId: string;
|
|
156
161
|
};
|
|
162
|
+
isLoading: boolean;
|
|
157
163
|
};
|
|
158
164
|
}>), replace?: boolean | undefined, action?: A | undefined): void;
|
|
159
165
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monorise.store.d.ts","sourceRoot":"","sources":["../../store/monorise.store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,MAAM,EACN,oBAAoB,EACrB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,uBAAuB,EAAc,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAenD,KAAK,OAAO,GAAG;IACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,OAAO,C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AI,EAAE,CAAC;QAC7E,SAAS,EAAE;YACT,OAAO,EAAE;gBACP,GAAG,EAAE,IAAI;aACV;SACF;KACF,CAAC,CAAA;CAAA,CAAC;AAMH,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAC7B,IAAI,OAAO,GAAY,EAAE,CAAC;IAC1B,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;IAIhC,MAAM,aAAa,GAAG,MAAM,CAC1B,QAAQ,CACN,GAyBE,EAAE,CAAC,CAAC;QACJ,GAAG,EAAE;YACH,eAAe,EAAE,IAAI,GAAG,EAAE;YAC1B,SAAS,EAAE,IAAI,GAAG,EAAE;YACpB,YAAY,EAAE,IAAI,GAAG,EAAE;YACvB,cAAc,EAAE,EAAE;YAClB,UAAU,EAAE,IAAI,GAAG,EAAE;YACrB,KAAK,EAAE;gBACL,IAAI,EAAE,IAAI;aACX;SACF;QACD,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,EAAE;QACV,MAAM,EAAE,EAAE;QACV,GAAG,EAAE,EAAE;QACP,IAAI,EAAE;YACJ,cAAc,EAAE,KAAK;YACrB,OAAO,EAAE;gBACP,WAAW,EAAE,EAAE;gBACf,KAAK,EAAE,EAAE;gBACT,SAAS,EAAE,EAAE;aACd;YACD,SAAS,EAAE,IAAI;SAChB;KACF,CAAC,EACF,iBAAiB,CAAC,UAAU,CAAC,CAC9B,CACF,CAAC;IAEF,MAAM,UAAU,GAAG,CAAC,IAAa,EAAE,EAAE;QACnC,OAAO,mCACF,OAAO,GACP,IAAI,CACR,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC;AACvC,CAAC,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["../index.ts","../actions/app.action.ts","../actions/auth.action.ts","../actions/config.action.ts","../actions/core.action.ts","../lib/api.ts","../lib/constant.ts","../lib/entity.ts","../lib/utils.ts","../services/auth.service.ts","../services/core.service.ts","../services/filestore.service.ts","../store/monorise.store.ts","../types/api.type.ts","../types/axios.type.ts","../types/monorise.type.ts","../types/mutual.type.ts"],"version":"5.8.3"}
|
package/dist/types/api.type.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type AxiosRequestConfig, type AxiosResponse } from 'axios';
|
|
2
2
|
export type ApplicationRequestError = {
|
|
3
|
+
status: number;
|
|
3
4
|
code: string;
|
|
4
5
|
message: string;
|
|
5
6
|
};
|
|
@@ -13,6 +14,7 @@ declare const axios: {
|
|
|
13
14
|
patch: <T = any, R = AxiosResponse<T, any>, D = any>(url: string, data: D, config: AxiosRequestConfig<D>) => Promise<R>;
|
|
14
15
|
delete: <T = any, R = AxiosResponse<T, any>, D = any>(url: string, config: AxiosRequestConfig<D>) => Promise<R>;
|
|
15
16
|
get: <T = any, R = AxiosResponse<T, any>, D = any>(url: string, config: AxiosRequestConfig<D>) => Promise<R>;
|
|
17
|
+
create(config?: import("axios").CreateAxiosDefaults): import("axios").AxiosInstance;
|
|
16
18
|
defaults: Omit<import("axios").AxiosDefaults, "headers"> & {
|
|
17
19
|
headers: import("axios").HeadersDefaults & {
|
|
18
20
|
[key: string]: import("axios").AxiosHeaderValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.type.d.ts","sourceRoot":"","sources":["../../types/api.type.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,KAAK,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAE7E,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,iBAAiB,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;AAG9E,MAAM,MAAM,UAAU,CA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CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACxC,CAAC;AAiBF,QAAA,MAAM,KAAK;WAEF,CAAC,QAAQ,CAAC,0BAA0B,CAAC,aACrC,MAAM,QACL,CAAC,UACC,kBAAkB,CAAC,CAAC,CAAC,KAC5B,OAAO,CAAC,CAAC,CAAC;UACP,CAAC,QAAQ,CAAC,0BAA0B,CAAC,aACpC,MAAM,QACL,CAAC,UACC,kBAAkB,CAAC,CAAC,CAAC,KAC5B,OAAO,CAAC,CAAC,CAAC;YACL,CAAC,QAAQ,CAAC,0BAA0B,CAAC,aACtC,MAAM,QACL,CAAC,UACC,kBAAkB,CAAC,CAAC,CAAC,KAC5B,OAAO,CAAC,CAAC,CAAC;aACJ,CAAC,QAAQ,CAAC,0BAA0B,CAAC,aACvC,MAAM,UACH,kBAAkB,CAAC,CAAC,CAAC,KAC5B,OAAO,CAAC,CAAC,CAAC;UACP,CAAC,QAAQ,CAAC,0BAA0B,CAAC,aACpC,MAAM,UACH,kBAAkB,CAAC,CAAC,CAAC,KAC5B,OAAO,CAAC,CAAC,CAAC;;;;;;;;;;;CACd,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,OAAO,KAAK,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.type.js","sourceRoot":"","sources":["../../types/api.type.ts"],"names":[],"mappings":"AAAA,OAAO,OAAwD,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"api.type.js","sourceRoot":"","sources":["../../types/api.type.ts"],"names":[],"mappings":"AAAA,OAAO,OAAwD,MAAM,OAAO,CAAC;AAe7E,gEAAgE;AAChE,6CAA6C;AAC7C,+BAA+B;AAE/B,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAEvC,SAAS,WAAW,CAClB,GAAW,EACX,MAA6B,EAC7B,IAAQ;IAER,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,iCAAe,MAAM,KAAE,GAAG,EAAE,IAAI,IAAG,CAAC;IACzE,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,KAAK,mCACN,aAAa,KAChB,IAAI,EAAE,CACJ,GAAW,EACX,IAAO,EACP,MAA6B,EACjB,EAAE,CAAC,WAAW,CAAC,GAAG,kCAAO,MAAM,KAAE,MAAM,EAAE,MAAM,KAAI,IAAI,CAAC,EACtE,GAAG,EAAE,CACH,GAAW,EACX,IAAO,EACP,MAA6B,EACjB,EAAE,CAAC,WAAW,CAAC,GAAG,kCAAO,MAAM,KAAE,MAAM,EAAE,KAAK,KAAI,IAAI,CAAC,EACrE,KAAK,EAAE,CACL,GAAW,EACX,IAAO,EACP,MAA6B,EACjB,EAAE,CAAC,WAAW,CAAC,GAAG,kCAAO,MAAM,KAAE,MAAM,EAAE,OAAO,KAAI,IAAI,CAAC,EACvE,MAAM,EAAE,CACN,GAAW,EACX,MAA6B,EACjB,EAAE,CAAC,WAAW,CAAC,GAAG,kCAAO,MAAM,KAAE,MAAM,EAAE,QAAQ,IAAG,EAClE,GAAG,EAAE,CACH,GAAW,EACX,MAA6B,EACjB,EAAE,CAAC,WAAW,CAAC,GAAG,kCAAO,MAAM,KAAE,MAAM,EAAE,KAAK,IAAG,GAChE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,31 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monorise/react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
6
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
7
14
|
"directories": {
|
|
8
15
|
"lib": "lib"
|
|
9
16
|
},
|
|
10
17
|
"scripts": {
|
|
11
|
-
"build": "tsc"
|
|
18
|
+
"build": "tsc -b",
|
|
19
|
+
"dev": "tsc -b --watch"
|
|
12
20
|
},
|
|
13
21
|
"keywords": [],
|
|
14
22
|
"author": "",
|
|
15
23
|
"license": "ISC",
|
|
16
24
|
"dependencies": {
|
|
17
|
-
"@monorise/base": "^1.0.3",
|
|
18
25
|
"@tabler/icons-react": "^3.30.0",
|
|
19
26
|
"axios": "^1.8.1",
|
|
20
|
-
"immer": "^10.1.1"
|
|
21
|
-
"zustand": "^4.5.2"
|
|
27
|
+
"immer": "^10.1.1"
|
|
22
28
|
},
|
|
23
29
|
"devDependencies": {
|
|
24
|
-
"@types/react": "^
|
|
25
|
-
"@types/react-dom": "^
|
|
30
|
+
"@types/react": "^19",
|
|
31
|
+
"@types/react-dom": "^19"
|
|
26
32
|
},
|
|
27
33
|
"peerDependencies": {
|
|
28
|
-
"
|
|
29
|
-
"react
|
|
30
|
-
|
|
34
|
+
"@monorise/base": "^3.0.0",
|
|
35
|
+
"react": "^18 || ^19",
|
|
36
|
+
"react-dom": "^18 || ^19"
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"dist"
|
|
40
|
+
]
|
|
31
41
|
}
|
package/actions/app.action.ts
DELETED
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import { produce } from 'immer';
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
import type { ApplicationRequestError, ModalProps } from '../types/api.type';
|
|
4
|
-
import type { MonoriseStore } from '../store/monorise.store';
|
|
5
|
-
|
|
6
|
-
type StartLoadingPayload<T> = {
|
|
7
|
-
requestKey: string;
|
|
8
|
-
isInterruptive?: boolean;
|
|
9
|
-
message?: string | boolean;
|
|
10
|
-
request: Promise<T>;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
type EndLoadingPayload = {
|
|
14
|
-
requestKey: string;
|
|
15
|
-
isInterruptive?: boolean;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
type SetErrorPayload = {
|
|
19
|
-
requestKey: string;
|
|
20
|
-
error: ApplicationRequestError;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
type Options = {
|
|
24
|
-
modals?: Record<string, React.ComponentType<unknown>>;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const initAppActions = (store: MonoriseStore) => {
|
|
28
|
-
let options: Options = {};
|
|
29
|
-
|
|
30
|
-
const { modals = {} } = options;
|
|
31
|
-
type AppModalProps = ModalProps<typeof modals>;
|
|
32
|
-
|
|
33
|
-
const startLoading = <T>({
|
|
34
|
-
requestKey,
|
|
35
|
-
isInterruptive,
|
|
36
|
-
message,
|
|
37
|
-
request,
|
|
38
|
-
}: StartLoadingPayload<T>) => {
|
|
39
|
-
store.setState(
|
|
40
|
-
produce((state) => {
|
|
41
|
-
const stackType = isInterruptive ? 'intLoadStack' : 'loadStack';
|
|
42
|
-
const requestKeyCount = state.app[stackType].get(requestKey);
|
|
43
|
-
|
|
44
|
-
state.app.loadingMessage =
|
|
45
|
-
typeof message === 'string' ? message : 'Loading';
|
|
46
|
-
state.app.ongoingRequests.set(requestKey, request);
|
|
47
|
-
state.app[stackType].set(
|
|
48
|
-
requestKey,
|
|
49
|
-
requestKeyCount ? requestKeyCount + 1 : 1,
|
|
50
|
-
);
|
|
51
|
-
}),
|
|
52
|
-
undefined,
|
|
53
|
-
`mr/start-loading/${requestKey}`,
|
|
54
|
-
);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
const endLoading = ({ requestKey, isInterruptive }: EndLoadingPayload) => {
|
|
58
|
-
setTimeout(() => {
|
|
59
|
-
store.setState(
|
|
60
|
-
produce((state) => {
|
|
61
|
-
const stackType = isInterruptive ? 'intLoadStack' : 'loadStack';
|
|
62
|
-
const requestKeyCount = state.app[stackType].get(requestKey);
|
|
63
|
-
|
|
64
|
-
if (state.app.ongoingRequests.has(requestKey)) {
|
|
65
|
-
state.app.ongoingRequests.delete(requestKey);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (typeof requestKeyCount === 'number' && requestKeyCount > 1) {
|
|
69
|
-
state.app[stackType].set(requestKey, requestKeyCount - 1);
|
|
70
|
-
} else {
|
|
71
|
-
state.app[stackType].delete(requestKey);
|
|
72
|
-
}
|
|
73
|
-
}),
|
|
74
|
-
undefined,
|
|
75
|
-
`mr/end-loading/${requestKey}`,
|
|
76
|
-
);
|
|
77
|
-
}, 500);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const checkIsLoading = (requestKey?: string) => {
|
|
81
|
-
const { intLoadStack, loadStack } = store.getState().app;
|
|
82
|
-
if (!requestKey) {
|
|
83
|
-
return intLoadStack.size > 0 || loadStack.size > 0;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const activeIntLoadingCount = intLoadStack.get(requestKey);
|
|
87
|
-
const isIntLoading =
|
|
88
|
-
typeof activeIntLoadingCount === 'number' && activeIntLoadingCount > 0;
|
|
89
|
-
|
|
90
|
-
const activeLoadingCount = loadStack.get(requestKey);
|
|
91
|
-
const isLoading =
|
|
92
|
-
typeof activeLoadingCount === 'number' && activeLoadingCount > 0;
|
|
93
|
-
|
|
94
|
-
return isIntLoading || isLoading;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const setError = ({ requestKey, error }: SetErrorPayload) =>
|
|
98
|
-
store.setState(
|
|
99
|
-
produce((state) => {
|
|
100
|
-
state.app.errorStack.set(requestKey, error);
|
|
101
|
-
}),
|
|
102
|
-
undefined,
|
|
103
|
-
`mr/set-error/${requestKey}`,
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
const getError = (requestKey: string) => {
|
|
107
|
-
const { errorStack } = store.getState().app;
|
|
108
|
-
return errorStack.get(requestKey);
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
const clearError = (requestKey: string) => {
|
|
112
|
-
const { errorStack } = store.getState().app;
|
|
113
|
-
|
|
114
|
-
if (errorStack.has(requestKey)) {
|
|
115
|
-
store.setState(
|
|
116
|
-
produce((state) => {
|
|
117
|
-
state.app.errorStack.delete(requestKey);
|
|
118
|
-
}),
|
|
119
|
-
undefined,
|
|
120
|
-
`mr/clear-error/${requestKey}`,
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
const openModal = (modal: {
|
|
126
|
-
name: keyof AppModalProps;
|
|
127
|
-
context?: AppModalProps[keyof AppModalProps];
|
|
128
|
-
}) =>
|
|
129
|
-
store.setState(
|
|
130
|
-
produce((state) => {
|
|
131
|
-
state.app.modal = modal;
|
|
132
|
-
}),
|
|
133
|
-
undefined,
|
|
134
|
-
`mr/open-modal/${modal.name}`,
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
const closeModal = () =>
|
|
138
|
-
store.setState(
|
|
139
|
-
produce((state) => {
|
|
140
|
-
state.app.modal = { name: null };
|
|
141
|
-
}),
|
|
142
|
-
undefined,
|
|
143
|
-
'mr/close-modal',
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
const useLoadStore = (requestKey?: string) => {
|
|
147
|
-
const { loadStack, intLoadStack } = store((state) => ({
|
|
148
|
-
loadStack: state.app.loadStack,
|
|
149
|
-
intLoadStack: state.app.intLoadStack,
|
|
150
|
-
}));
|
|
151
|
-
const [isLoading, setIsLoading] = useState(false);
|
|
152
|
-
|
|
153
|
-
useEffect(() => {
|
|
154
|
-
if (loadStack && intLoadStack && requestKey) {
|
|
155
|
-
setIsLoading(checkIsLoading(requestKey));
|
|
156
|
-
}
|
|
157
|
-
}, [loadStack, intLoadStack, requestKey]);
|
|
158
|
-
|
|
159
|
-
return isLoading;
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
const useInterruptiveLoadStore = () => {
|
|
163
|
-
const { intLoadStack, loadingMessage } = store((state) => ({
|
|
164
|
-
intLoadStack: state.app.intLoadStack,
|
|
165
|
-
loadingMessage: state.app.loadingMessage,
|
|
166
|
-
}));
|
|
167
|
-
|
|
168
|
-
return {
|
|
169
|
-
isLoading: intLoadStack.size > 0,
|
|
170
|
-
message: loadingMessage,
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
const useErrorStore = (requestKey: string) => {
|
|
175
|
-
const error = store((state) => state.app.errorStack.get(requestKey));
|
|
176
|
-
|
|
177
|
-
useEffect(() => {
|
|
178
|
-
if (error) {
|
|
179
|
-
return () => {
|
|
180
|
-
clearError(requestKey);
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
}, [error, requestKey]);
|
|
184
|
-
|
|
185
|
-
return error;
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
const useModalStore = () => {
|
|
189
|
-
return store((state) => state.app.modal);
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
const setOptions = (opts: Options) => {
|
|
193
|
-
options = {
|
|
194
|
-
...options,
|
|
195
|
-
...opts,
|
|
196
|
-
};
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
return {
|
|
200
|
-
startLoading,
|
|
201
|
-
endLoading,
|
|
202
|
-
setError,
|
|
203
|
-
getError,
|
|
204
|
-
clearError,
|
|
205
|
-
openModal,
|
|
206
|
-
closeModal,
|
|
207
|
-
checkIsLoading,
|
|
208
|
-
useLoadStore,
|
|
209
|
-
useInterruptiveLoadStore,
|
|
210
|
-
useErrorStore,
|
|
211
|
-
useModalStore,
|
|
212
|
-
setOptions,
|
|
213
|
-
};
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
export { initAppActions };
|
|
217
|
-
|
|
218
|
-
export type AppActions = ReturnType<typeof initAppActions>;
|
package/actions/auth.action.ts
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import type { Entity } from '@monorise/base';
|
|
2
|
-
import { produce } from 'immer';
|
|
3
|
-
import type { AuthService } from '../services/auth.service';
|
|
4
|
-
import type { MonoriseStore } from '../store/monorise.store';
|
|
5
|
-
|
|
6
|
-
const initAuthActions = (store: MonoriseStore, authService: AuthService) => {
|
|
7
|
-
const requestLogin = async (
|
|
8
|
-
entityType: Entity,
|
|
9
|
-
payload: { email: string },
|
|
10
|
-
) => {
|
|
11
|
-
const { data } = await authService.requestLoginMagicLink(
|
|
12
|
-
entityType,
|
|
13
|
-
payload,
|
|
14
|
-
);
|
|
15
|
-
|
|
16
|
-
return data;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const useProfile = <T extends Record<string, unknown>>(): T & {
|
|
20
|
-
displayName: string;
|
|
21
|
-
email: string;
|
|
22
|
-
accountId: string;
|
|
23
|
-
impersonatorId?: string;
|
|
24
|
-
} => {
|
|
25
|
-
const profile = store((state) => state.auth.profile);
|
|
26
|
-
|
|
27
|
-
return profile as T & typeof profile;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const getProfile = async () => {
|
|
31
|
-
try {
|
|
32
|
-
const {
|
|
33
|
-
data: { displayName, email, accountId, ...rest },
|
|
34
|
-
} = await authService.getSessionProfile();
|
|
35
|
-
|
|
36
|
-
store.setState(
|
|
37
|
-
produce((state) => {
|
|
38
|
-
state.auth.isUnauthorized = false;
|
|
39
|
-
state.auth.profile = {
|
|
40
|
-
displayName,
|
|
41
|
-
email,
|
|
42
|
-
accountId,
|
|
43
|
-
...rest,
|
|
44
|
-
};
|
|
45
|
-
}),
|
|
46
|
-
undefined,
|
|
47
|
-
'mr/auth/get-profile',
|
|
48
|
-
);
|
|
49
|
-
} catch (err) {
|
|
50
|
-
store.setState(
|
|
51
|
-
produce((state) => {
|
|
52
|
-
state.auth.isUnauthorized = true;
|
|
53
|
-
state.auth.profile = {};
|
|
54
|
-
}),
|
|
55
|
-
undefined,
|
|
56
|
-
'mr/auth/get-profile',
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const useIsUnauthorized = () => {
|
|
62
|
-
return store((state) => state.auth.isUnauthorized);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const setIsUnauthorized = (isUnauthorized: boolean) =>
|
|
66
|
-
store.setState(
|
|
67
|
-
produce((state) => {
|
|
68
|
-
state.auth.isUnauthorized = isUnauthorized;
|
|
69
|
-
}),
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
const logout = () => {
|
|
73
|
-
authService.logout();
|
|
74
|
-
store.setState(
|
|
75
|
-
produce((state) => {
|
|
76
|
-
state.auth.isUnauthorized = true;
|
|
77
|
-
state.auth.profile = {};
|
|
78
|
-
}),
|
|
79
|
-
);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
return {
|
|
83
|
-
requestLogin,
|
|
84
|
-
useProfile,
|
|
85
|
-
getProfile,
|
|
86
|
-
useIsUnauthorized,
|
|
87
|
-
setIsUnauthorized,
|
|
88
|
-
logout,
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
export { initAuthActions };
|
|
93
|
-
|
|
94
|
-
export type AuthActions = ReturnType<typeof initAuthActions>;
|
package/actions/config.action.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
CreatedEntity,
|
|
3
|
-
Entity,
|
|
4
|
-
MonoriseEntityConfig,
|
|
5
|
-
} from '@monorise/base';
|
|
6
|
-
import { produce } from 'immer';
|
|
7
|
-
import type { MonoriseStore } from '../store/monorise.store';
|
|
8
|
-
import type { CommonStore } from '../types/monorise.type';
|
|
9
|
-
|
|
10
|
-
const initConfigActions = (store: MonoriseStore) => {
|
|
11
|
-
const setConfig = (config: Record<Entity, MonoriseEntityConfig>) => {
|
|
12
|
-
const entityMaps = Object.keys(config).reduce(
|
|
13
|
-
(acc, entity) => {
|
|
14
|
-
acc[entity as any] = {
|
|
15
|
-
dataMap: new Map<string, CreatedEntity<Entity>>(),
|
|
16
|
-
isFirstFetched: false,
|
|
17
|
-
lastKey: '',
|
|
18
|
-
} as CommonStore<CreatedEntity<Entity>>;
|
|
19
|
-
return acc;
|
|
20
|
-
},
|
|
21
|
-
{} as Record<Entity, CommonStore<CreatedEntity<Entity>>>,
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
store.setState(
|
|
25
|
-
produce((state) => {
|
|
26
|
-
state.config = config;
|
|
27
|
-
state.entity = entityMaps;
|
|
28
|
-
}),
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const getConfig = () => {
|
|
33
|
-
return store.getState().config;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const useConfig = () => {
|
|
37
|
-
const config = store((state) => state.config);
|
|
38
|
-
|
|
39
|
-
return config;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
setConfig,
|
|
44
|
-
getConfig,
|
|
45
|
-
useConfig,
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export { initConfigActions };
|
|
50
|
-
|
|
51
|
-
export type ConfigActions = ReturnType<typeof initConfigActions>;
|