andoncloud-sdk 1.6.44 → 1.7.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.
Files changed (31) hide show
  1. package/dist/andoncloud-sdk.js +25 -25
  2. package/dist/andoncloud-sdk.js.map +1 -1
  3. package/dist/app/components/access/AccessBlocker.d.ts +10 -0
  4. package/dist/app/components/access/AccessBlocker.styles.d.ts +27 -0
  5. package/dist/app/components/access/AccessBlocker.test.d.ts +1 -0
  6. package/dist/app/components/access/AccessGuard.d.ts +8 -0
  7. package/dist/app/components/access/AccessGuard.test.d.ts +1 -0
  8. package/dist/app/components/access/AccessRequestModal.d.ts +7 -0
  9. package/dist/app/components/access/AccessRequestModal.styles.d.ts +31 -0
  10. package/dist/app/components/access/InternalProcedureScreen.d.ts +7 -0
  11. package/dist/app/components/access/InternalProcedureScreen.styles.d.ts +26 -0
  12. package/dist/app/components/access/InternalProcedureScreen.test.d.ts +1 -0
  13. package/dist/app/components/access/index.d.ts +3 -0
  14. package/dist/app/components/access/withAccessGuard.d.ts +6 -0
  15. package/dist/app/components/access/withAccessGuard.test.d.ts +1 -0
  16. package/dist/app/hooks/useAccess.d.ts +10 -0
  17. package/dist/app/hooks/useAccess.test.d.ts +1 -0
  18. package/dist/app/hooks/useFeatures.d.ts +6 -0
  19. package/dist/app/hooks/useFeatures.test.d.ts +1 -0
  20. package/dist/app/hooks/usePackages.d.ts +6 -0
  21. package/dist/app/hooks/usePackages.test.d.ts +1 -0
  22. package/dist/app/hooks/usePermissions.d.ts +13 -0
  23. package/dist/app/hooks/usePermissions.test.d.ts +1 -0
  24. package/dist/app/providers/store.d.ts +20 -2
  25. package/dist/app/stores/sessionStore.d.ts +10 -1
  26. package/dist/app/stores/userStore.d.ts +4 -0
  27. package/dist/app/testing/index.d.ts +1 -0
  28. package/dist/app/utils/stores.d.ts +16 -0
  29. package/dist/index.d.ts +139 -1
  30. package/dist/version.d.ts +1 -1
  31. package/package.json +13 -13
@@ -0,0 +1,10 @@
1
+ export default AccessBlocker;
2
+ declare function AccessBlocker({ accessState, buttons, daysSinceExpiry, featureKey, onTrialRequest, onFeatureRequest, }: {
3
+ accessState: any;
4
+ buttons?: any[] | undefined;
5
+ daysSinceExpiry: any;
6
+ featureKey: any;
7
+ onTrialRequest: any;
8
+ onFeatureRequest: any;
9
+ }): React.JSX.Element;
10
+ import React from "react";
@@ -0,0 +1,27 @@
1
+ export default makeStyles;
2
+ declare function makeStyles(accessState: any): {
3
+ container: {
4
+ display: string;
5
+ flexDirection: string;
6
+ alignItems: string;
7
+ justifyContent: string;
8
+ gap: number;
9
+ width: string;
10
+ height: string;
11
+ padding: number;
12
+ textAlign: string;
13
+ background: (theme: any) => any;
14
+ };
15
+ icon: {
16
+ fontSize: number;
17
+ color: any;
18
+ };
19
+ buttonsContainer: {
20
+ display: string;
21
+ gap: number;
22
+ };
23
+ primaryButton: {
24
+ backgroundColor: any;
25
+ };
26
+ secondaryButton: {};
27
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ export default AccessGuard;
2
+ declare function AccessGuard({ featureKeys, extraPermissions, onTrialRequest, onFeatureRequest, children, }: {
3
+ featureKeys?: any[] | undefined;
4
+ extraPermissions?: any[] | undefined;
5
+ onTrialRequest: any;
6
+ onFeatureRequest: any;
7
+ children: any;
8
+ }): any;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ export default AccessRequestModal;
2
+ declare function AccessRequestModal({ open, onSubmitRequest, onClose }: {
3
+ open: any;
4
+ onSubmitRequest: any;
5
+ onClose: any;
6
+ }): React.JSX.Element;
7
+ import React from "react";
@@ -0,0 +1,31 @@
1
+ export default styles;
2
+ declare namespace styles {
3
+ const dialog: {
4
+ '.MuiPaper-root': {
5
+ borderRadius: string;
6
+ };
7
+ };
8
+ namespace dialogContent {
9
+ const padding: number;
10
+ }
11
+ namespace container {
12
+ export const display: string;
13
+ export const flexDirection: string;
14
+ export const alignItems: string;
15
+ export const gap: number;
16
+ const padding_1: number;
17
+ export { padding_1 as padding };
18
+ export function background(theme: any): any;
19
+ }
20
+ namespace stepper {
21
+ const width: string;
22
+ }
23
+ namespace disclaimer {
24
+ const marginTop: number;
25
+ const color: string;
26
+ }
27
+ namespace actions {
28
+ const marginTop_1: number;
29
+ export { marginTop_1 as marginTop };
30
+ }
31
+ }
@@ -0,0 +1,7 @@
1
+ export default InternalProcedureScreen;
2
+ declare function InternalProcedureScreen({ packageKey, onSubmitRequest, onClose }: {
3
+ packageKey: any;
4
+ onSubmitRequest: any;
5
+ onClose: any;
6
+ }): React.JSX.Element;
7
+ import React from "react";
@@ -0,0 +1,26 @@
1
+ export default styles;
2
+ declare namespace styles {
3
+ namespace container {
4
+ const display: string;
5
+ const flexDirection: string;
6
+ const alignItems: string;
7
+ const gap: number;
8
+ const width: number;
9
+ const maxWidth: string;
10
+ const padding: number;
11
+ const borderRadius: string;
12
+ function background(theme: any): any;
13
+ }
14
+ namespace stepper {
15
+ const width_1: string;
16
+ export { width_1 as width };
17
+ }
18
+ namespace disclaimer {
19
+ const marginTop: number;
20
+ const color: string;
21
+ }
22
+ namespace actions {
23
+ const marginTop_1: number;
24
+ export { marginTop_1 as marginTop };
25
+ }
26
+ }
@@ -0,0 +1,3 @@
1
+ export { default as AccessBlocker } from "./AccessBlocker";
2
+ export { default as AccessGuard } from "./AccessGuard";
3
+ export { default as withAccessGuard } from "./withAccessGuard";
@@ -0,0 +1,6 @@
1
+ export default withAccessGuard;
2
+ declare function withAccessGuard(featureKeys?: any[], options?: {}): (WrappedComponent: any) => {
3
+ (props: any): React.JSX.Element;
4
+ displayName: string;
5
+ };
6
+ import React from "react";
@@ -0,0 +1,10 @@
1
+ export default useAccess;
2
+ /**
3
+ * Hook for checking feature access based on features and permissions
4
+ * @param {string[]} featureKeys - Array of feature keys to check
5
+ * @param {{ extraPermissions?: string[] }} options - Additional options
6
+ * @returns {UseAccessResult}
7
+ */
8
+ declare function useAccess(featureKeys?: string[], options?: {
9
+ extraPermissions?: string[] | undefined;
10
+ }): UseAccessResult;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export default useFeatures;
2
+ declare function useFeatures(): {
3
+ getFeature: (featureKey: any) => null;
4
+ getFeatures: (featureKeys: any) => any;
5
+ featuresMap: null;
6
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export default usePackages;
2
+ declare function usePackages(): {
3
+ getPackage: (packageKey: any) => null;
4
+ getPackages: (packageKeys: any) => any;
5
+ packagesMap: null;
6
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ export default usePermissions;
2
+ declare function usePermissions(): {
3
+ checkPermission: (permissionKey: any) => {
4
+ isAllowed: boolean;
5
+ denyReason: string | null;
6
+ };
7
+ checkPermissions: (permissionKeys: any) => {
8
+ allAllowed: boolean;
9
+ results: any;
10
+ deniedKeys: any;
11
+ };
12
+ permissionsMap: null;
13
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -25,7 +25,16 @@ export const StoreContext: React.Context<{
25
25
  username: any;
26
26
  email: any;
27
27
  name: any;
28
- permissions: any;
28
+ permissionsMap: any;
29
+ featuresMap: {
30
+ [k: string]: {
31
+ status: any;
32
+ entitlementType: any;
33
+ expiresAt: any;
34
+ daysSinceExpiry: any;
35
+ permissions: any;
36
+ } | null;
37
+ } | null;
29
38
  } | null>;
30
39
  signOut(token: any): Promise<void>;
31
40
  };
@@ -79,7 +88,16 @@ export function useStore(): {
79
88
  username: any;
80
89
  email: any;
81
90
  name: any;
82
- permissions: any;
91
+ permissionsMap: any;
92
+ featuresMap: {
93
+ [k: string]: {
94
+ status: any;
95
+ entitlementType: any;
96
+ expiresAt: any;
97
+ daysSinceExpiry: any;
98
+ permissions: any;
99
+ } | null;
100
+ } | null;
83
101
  } | null>;
84
102
  signOut(token: any): Promise<void>;
85
103
  };
@@ -48,7 +48,16 @@ declare class SessionAPI {
48
48
  username: any;
49
49
  email: any;
50
50
  name: any;
51
- permissions: any;
51
+ permissionsMap: any;
52
+ featuresMap: {
53
+ [k: string]: {
54
+ status: any;
55
+ entitlementType: any;
56
+ expiresAt: any;
57
+ daysSinceExpiry: any;
58
+ permissions: any;
59
+ } | null;
60
+ } | null;
52
61
  } | null>;
53
62
  signOut(token: any): Promise<void>;
54
63
  }
@@ -2,7 +2,11 @@ declare const _default: UserStore;
2
2
  export default _default;
3
3
  declare class UserStore {
4
4
  currentUser: null;
5
+ permissionsMap: null;
6
+ featuresMap: null;
5
7
  setCurrentUser(currentUser: any): void;
6
8
  removeCurrentUser(): void;
9
+ setPermissionsMap(permissionsMap: any): void;
10
+ setFeaturesMap(featuresMap: any): void;
7
11
  get getCurrentUserJS(): null;
8
12
  }
@@ -1 +1,2 @@
1
1
  export function render(node: any, options?: {}): import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
2
+ export function renderComponent(node: any, options?: {}): import("@testing-library/react").RenderResult<typeof import("@testing-library/dom/types/queries"), HTMLElement, HTMLElement>;
@@ -0,0 +1,16 @@
1
+ export function convertFeatureInfoToCamelCase(featureInfo: any): {
2
+ status: any;
3
+ entitlementType: any;
4
+ expiresAt: any;
5
+ daysSinceExpiry: any;
6
+ permissions: any;
7
+ } | null;
8
+ export function convertFeaturesMapToCamelCase(featuresMap: any): {
9
+ [k: string]: {
10
+ status: any;
11
+ entitlementType: any;
12
+ expiresAt: any;
13
+ daysSinceExpiry: any;
14
+ permissions: any;
15
+ } | null;
16
+ } | null;
package/dist/index.d.ts CHANGED
@@ -151,6 +151,46 @@ declare module 'andoncloud-sdk' {
151
151
  }
152
152
  export const Container: React.FC<ContainerProps>;
153
153
 
154
+ // =============================================================================
155
+ // Access Control Types
156
+ // =============================================================================
157
+
158
+ type FeatureStatus =
159
+ | 'accessible'
160
+ | 'no_permission'
161
+ | 'not_purchased'
162
+ | 'trial_expired_recent'
163
+ | 'trial_expired_old'
164
+ | 'no_access';
165
+
166
+ type EntitlementType = 'trial' | 'purchased' | null;
167
+
168
+ type AccessState =
169
+ | 'no_permission'
170
+ | 'accessible'
171
+ | 'expired'
172
+ | 'not_purchased';
173
+
174
+ type DenyReason = 'MISSING_ROLE_PERMISSION' | 'EXPIRED_PLAN' | string;
175
+
176
+ type PermissionValue = 'ALLOW' | `DENY:${DenyReason}`;
177
+
178
+ interface PermissionsMap {
179
+ [permissionKey: string]: PermissionValue;
180
+ }
181
+
182
+ interface FeatureInfo {
183
+ status: FeatureStatus;
184
+ entitlementType: EntitlementType;
185
+ expiresAt: string | null;
186
+ daysSinceExpiry: number | null;
187
+ permissions: string[];
188
+ }
189
+
190
+ interface FeaturesMap {
191
+ [featureKey: string]: FeatureInfo;
192
+ }
193
+
154
194
  interface UserData {
155
195
  id: number;
156
196
  companyId: number;
@@ -158,9 +198,107 @@ declare module 'andoncloud-sdk' {
158
198
  username: string;
159
199
  email: string;
160
200
  name: string;
161
- permissions: string[];
201
+ permissionsMap: PermissionsMap | null;
202
+ featuresMap: FeaturesMap | null;
203
+ }
204
+
205
+ // Hook Results
206
+ interface PermissionCheckResult {
207
+ isAllowed: boolean;
208
+ denyReason: DenyReason | null;
209
+ }
210
+
211
+ interface UsePermissionsResult {
212
+ checkPermission: (permissionKey: string) => PermissionCheckResult;
213
+ checkPermissions: (permissionKeys: string[]) => {
214
+ allAllowed: boolean;
215
+ results: Record<string, PermissionCheckResult>;
216
+ deniedKeys: string[];
217
+ };
218
+ permissionsMap: PermissionsMap | null;
219
+ }
220
+
221
+ export const usePermissions: () => UsePermissionsResult;
222
+
223
+ interface UseFeaturesResult {
224
+ getFeature: (featureKey: string) => FeatureInfo | null;
225
+ getFeatures: (featureKeys: string[]) => Record<string, FeatureInfo | null>;
226
+ featuresMap: FeaturesMap | null;
227
+ }
228
+
229
+ export const useFeatures: () => UseFeaturesResult;
230
+
231
+ interface UseAccessOptions {
232
+ extraPermissions?: string[];
233
+ }
234
+
235
+ export type AccessAction = 'start_trial' | 'request_access' | 'renew' | 'buy';
236
+
237
+ export type AccessRequestType = 'feature_access' | 'trial_expired' | 'purchase';
238
+
239
+ export interface AccessButton {
240
+ action: AccessAction;
241
+ requestType: AccessRequestType | null;
162
242
  }
163
243
 
244
+ interface FeatureAccessDetail {
245
+ featureKey: string;
246
+ hasAccess: boolean;
247
+ accessState: AccessState;
248
+ daysSinceExpiry: number | null;
249
+ buttons: AccessButton[];
250
+ }
251
+
252
+ interface UseAccessResult {
253
+ hasAccess: boolean;
254
+ accessState: AccessState;
255
+ features: FeatureAccessDetail[];
256
+ buttons: AccessButton[];
257
+ missingPermissions: string[];
258
+ }
259
+
260
+ export const useAccess: (featureKeys?: string[], options?: UseAccessOptions) => UseAccessResult;
261
+
262
+ export interface FeatureRequestPayload {
263
+ featureKey: string;
264
+ requestType: AccessRequestType;
265
+ }
266
+
267
+ interface AccessBlockerProps {
268
+ accessState: 'no_permission' | 'expired' | 'not_purchased';
269
+ buttons: AccessButton[];
270
+ daysSinceExpiry?: number | null;
271
+ featureKey: string;
272
+ onTrialRequest: (featureKey: string) => void;
273
+ onFeatureRequest: (payload: FeatureRequestPayload) => void;
274
+ }
275
+
276
+ export const AccessBlocker: React.FC<AccessBlockerProps>;
277
+
278
+ interface AccessGuardProps {
279
+ featureKeys?: string[];
280
+ extraPermissions?: string[];
281
+ onTrialRequest: (featureKey: string) => void;
282
+ onFeatureRequest: (payload: FeatureRequestPayload) => void;
283
+ children: React.ReactNode;
284
+ }
285
+
286
+ export const AccessGuard: React.FC<AccessGuardProps>;
287
+
288
+ interface AccessGuardInjectedProps {
289
+ accessState: AccessState;
290
+ hasAccess: boolean;
291
+ missingPermissions: string[];
292
+ }
293
+
294
+ export function withAccessGuard<P extends object>(
295
+ featureKeys?: string[],
296
+ options?: UseAccessOptions
297
+ ): (Component: React.ComponentType<P & AccessGuardInjectedProps>) => React.FC<P & {
298
+ onTrialRequest: (featureKey: string) => void;
299
+ onFeatureRequest: (payload: FeatureRequestPayload) => void;
300
+ }>;
301
+
164
302
  export interface Session {
165
303
  user: UserData;
166
304
  accessToken: string;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const LIBRARY_VERSION = "1.6.44";
1
+ export declare const LIBRARY_VERSION = "1.7.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "andoncloud-sdk",
3
- "version": "1.6.44",
3
+ "version": "1.7.0",
4
4
  "license": "MIT",
5
5
  "private": false,
6
6
  "source": "src/index.js",
@@ -8,10 +8,10 @@
8
8
  "main": "dist/andoncloud-sdk.js",
9
9
  "module": "dist/andoncloud-sdk.js",
10
10
  "dependencies": {
11
- "@sentry/react": "^10.17.0",
11
+ "@sentry/react": "^10.23.0",
12
12
  "@sentry/tracing": "^7.120.4",
13
13
  "classnames": "^2.5.1",
14
- "dayjs": "^1.11.18",
14
+ "dayjs": "^1.11.19",
15
15
  "history": "^5.3.0",
16
16
  "i18next-browser-languagedetector": "^8.2.0",
17
17
  "inter-ui": "^4.1.1",
@@ -48,18 +48,18 @@
48
48
  },
49
49
  "devDependencies": {
50
50
  "@babel/cli": "^7.28.3",
51
- "@babel/eslint-parser": "^7.28.4",
51
+ "@babel/eslint-parser": "^7.28.5",
52
52
  "@emotion/react": "^11.14.0",
53
53
  "@emotion/styled": "^11.14.1",
54
- "@mui/icons-material": "^7.3.4",
55
- "@mui/lab": "^7.0.1-beta.18",
56
- "@mui/material": "^7.3.4",
57
- "@mui/x-date-pickers": "^8.12.0",
54
+ "@mui/icons-material": "^7.3.5",
55
+ "@mui/lab": "^7.0.1-beta.19",
56
+ "@mui/material": "^7.3.5",
57
+ "@mui/x-date-pickers": "^8.17.0",
58
58
  "@testing-library/dom": "^10.4.1",
59
59
  "@testing-library/jest-dom": "^6.9.1",
60
60
  "@testing-library/react": "^16.3.0",
61
- "@types/react": "^19.2.0",
62
- "@types/react-dom": "^19.2.0",
61
+ "@types/react": "^19.2.2",
62
+ "@types/react-dom": "^19.2.2",
63
63
  "@types/react-gtm-module": "^2.0.4",
64
64
  "andoncloud-library-scripts": "^1.0.12",
65
65
  "babel-preset-react-app": "^10.1.0",
@@ -68,14 +68,14 @@
68
68
  "eslint": "8.57.1",
69
69
  "eslint-config-andoncloud": "^1.0.0",
70
70
  "husky": "^9.1.7",
71
- "i18next": "^25.5.3",
71
+ "i18next": "^25.6.1",
72
72
  "mobx": "^6.15.0",
73
73
  "mobx-react-lite": "^4.1.1",
74
- "npm-check-updates": "^19.0.0",
74
+ "npm-check-updates": "^19.1.2",
75
75
  "npm-run-all": "^4.1.5",
76
76
  "react": "^19.2.0",
77
77
  "react-dom": "^19.2.0",
78
- "react-i18next": "^16.0.0",
78
+ "react-i18next": "^16.2.4",
79
79
  "react-router-dom": "^6.30.1",
80
80
  "react-scripts": "^5.0.1"
81
81
  },