@smartbooks-ai/layout 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/dist/components/PageHeader/PageHeader.d.ts +6 -0
  2. package/dist/components/PageHeader/PageHeader.d.ts.map +1 -0
  3. package/dist/components/PageHeader/PageHeader.js +4 -0
  4. package/dist/components/PageHeader/index.d.ts +2 -0
  5. package/dist/components/PageHeader/index.d.ts.map +1 -0
  6. package/dist/components/PageHeader/index.js +1 -0
  7. package/dist/components/PageHeader/styles.d.ts +9 -0
  8. package/dist/components/PageHeader/styles.d.ts.map +1 -0
  9. package/dist/components/PageHeader/styles.js +28 -0
  10. package/dist/components/PageWithMenuLayout/AppSelect/index.d.ts +12 -0
  11. package/dist/components/PageWithMenuLayout/AppSelect/index.d.ts.map +1 -0
  12. package/dist/components/PageWithMenuLayout/AppSelect/index.js +27 -0
  13. package/dist/components/PageWithMenuLayout/AppSelect/styles.d.ts +10 -0
  14. package/dist/components/PageWithMenuLayout/AppSelect/styles.d.ts.map +1 -0
  15. package/dist/components/PageWithMenuLayout/AppSelect/styles.js +27 -0
  16. package/dist/components/PageWithMenuLayout/LogoHeaderImage.d.ts +4 -0
  17. package/dist/components/PageWithMenuLayout/LogoHeaderImage.d.ts.map +1 -0
  18. package/dist/components/PageWithMenuLayout/LogoHeaderImage.js +3 -0
  19. package/dist/components/PageWithMenuLayout/LogoHeaderText.d.ts +4 -0
  20. package/dist/components/PageWithMenuLayout/LogoHeaderText.d.ts.map +1 -0
  21. package/dist/components/PageWithMenuLayout/LogoHeaderText.js +3 -0
  22. package/dist/components/PageWithMenuLayout/MenuItemWithChildren/MenuItemWithChildren.d.ts +13 -0
  23. package/dist/components/PageWithMenuLayout/MenuItemWithChildren/MenuItemWithChildren.d.ts.map +1 -0
  24. package/dist/components/PageWithMenuLayout/MenuItemWithChildren/MenuItemWithChildren.js +49 -0
  25. package/dist/components/PageWithMenuLayout/MenuItemWithChildren/styles.d.ts +53 -0
  26. package/dist/components/PageWithMenuLayout/MenuItemWithChildren/styles.d.ts.map +1 -0
  27. package/dist/components/PageWithMenuLayout/MenuItemWithChildren/styles.js +127 -0
  28. package/dist/components/PageWithMenuLayout/MenuSelect/index.d.ts +12 -0
  29. package/dist/components/PageWithMenuLayout/MenuSelect/index.d.ts.map +1 -0
  30. package/dist/components/PageWithMenuLayout/MenuSelect/index.js +24 -0
  31. package/dist/components/PageWithMenuLayout/MenuSelect/styles.d.ts +22 -0
  32. package/dist/components/PageWithMenuLayout/MenuSelect/styles.d.ts.map +1 -0
  33. package/dist/components/PageWithMenuLayout/MenuSelect/styles.js +84 -0
  34. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/ConsolidationIcon.d.ts +3 -0
  35. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/ConsolidationIcon.d.ts.map +1 -0
  36. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/ConsolidationIcon.js +3 -0
  37. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/MultiSubscriptionsMenuItems.d.ts +10 -0
  38. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/MultiSubscriptionsMenuItems.d.ts.map +1 -0
  39. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/MultiSubscriptionsMenuItems.js +40 -0
  40. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/index.d.ts +2 -0
  41. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/index.d.ts.map +1 -0
  42. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/index.js +1 -0
  43. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/styles.d.ts +5 -0
  44. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/styles.d.ts.map +1 -0
  45. package/dist/components/PageWithMenuLayout/MultiSubscriptionsMenuItems/styles.js +9 -0
  46. package/dist/components/PageWithMenuLayout/PageWithMenuLayout.d.ts +15 -0
  47. package/dist/components/PageWithMenuLayout/PageWithMenuLayout.d.ts.map +1 -0
  48. package/dist/components/PageWithMenuLayout/PageWithMenuLayout.js +15 -0
  49. package/dist/components/PageWithMenuLayout/UserProfileSelect/index.d.ts +9 -0
  50. package/dist/components/PageWithMenuLayout/UserProfileSelect/index.d.ts.map +1 -0
  51. package/dist/components/PageWithMenuLayout/UserProfileSelect/index.js +16 -0
  52. package/dist/components/PageWithMenuLayout/UserProfileSelect/styles.d.ts +4 -0
  53. package/dist/components/PageWithMenuLayout/UserProfileSelect/styles.d.ts.map +1 -0
  54. package/dist/components/PageWithMenuLayout/UserProfileSelect/styles.js +7 -0
  55. package/dist/components/PageWithMenuLayout/index.d.ts +9 -0
  56. package/dist/components/PageWithMenuLayout/index.d.ts.map +1 -0
  57. package/dist/components/PageWithMenuLayout/index.js +8 -0
  58. package/dist/components/PageWithMenuLayout/styles.d.ts +33 -0
  59. package/dist/components/PageWithMenuLayout/styles.d.ts.map +1 -0
  60. package/dist/components/PageWithMenuLayout/styles.js +91 -0
  61. package/dist/components/PageWithMenuLayout/types.d.ts +13 -0
  62. package/dist/components/PageWithMenuLayout/types.d.ts.map +1 -0
  63. package/dist/components/PageWithMenuLayout/types.js +1 -0
  64. package/dist/components/PageWithMenuLayout/useMenuToggle.d.ts +6 -0
  65. package/dist/components/PageWithMenuLayout/useMenuToggle.d.ts.map +1 -0
  66. package/dist/components/PageWithMenuLayout/useMenuToggle.js +13 -0
  67. package/dist/components/index.d.ts +4 -0
  68. package/dist/components/index.d.ts.map +1 -0
  69. package/dist/components/index.js +3 -0
  70. package/dist/hooks/index.d.ts +3 -0
  71. package/dist/hooks/index.d.ts.map +1 -0
  72. package/dist/hooks/index.js +2 -0
  73. package/dist/hooks/useIsAuthorized.d.ts +13 -0
  74. package/dist/hooks/useIsAuthorized.d.ts.map +1 -0
  75. package/dist/hooks/useIsAuthorized.js +15 -0
  76. package/dist/hooks/useToggle.d.ts +10 -0
  77. package/dist/hooks/useToggle.d.ts.map +1 -0
  78. package/dist/hooks/useToggle.js +17 -0
  79. package/dist/index.d.ts +7 -0
  80. package/dist/index.d.ts.map +1 -0
  81. package/dist/index.js +6 -0
  82. package/dist/package-isolation.test.d.ts +2 -0
  83. package/dist/package-isolation.test.d.ts.map +1 -0
  84. package/dist/package-isolation.test.js +47 -0
  85. package/dist/security/AuthorizedContent/index.d.ts +18 -0
  86. package/dist/security/AuthorizedContent/index.d.ts.map +1 -0
  87. package/dist/security/AuthorizedContent/index.js +41 -0
  88. package/dist/security/AuthorizedContent/state.d.ts +9 -0
  89. package/dist/security/AuthorizedContent/state.d.ts.map +1 -0
  90. package/dist/security/AuthorizedContent/state.js +9 -0
  91. package/dist/security/AuthorizedContent/useAuthorizationState.d.ts +12 -0
  92. package/dist/security/AuthorizedContent/useAuthorizationState.d.ts.map +1 -0
  93. package/dist/security/AuthorizedContent/useAuthorizationState.js +22 -0
  94. package/dist/security/ProfileContext/ProfileContext.d.ts +22 -0
  95. package/dist/security/ProfileContext/ProfileContext.d.ts.map +1 -0
  96. package/dist/security/ProfileContext/ProfileContext.js +11 -0
  97. package/dist/security/ProfileContext/index.d.ts +5 -0
  98. package/dist/security/ProfileContext/index.d.ts.map +1 -0
  99. package/dist/security/ProfileContext/index.js +4 -0
  100. package/dist/security/ProfileContext/types.d.ts +8 -0
  101. package/dist/security/ProfileContext/types.d.ts.map +1 -0
  102. package/dist/security/ProfileContext/types.js +8 -0
  103. package/dist/security/ProfileContext/useProfile.d.ts +2 -0
  104. package/dist/security/ProfileContext/useProfile.d.ts.map +1 -0
  105. package/dist/security/ProfileContext/useProfile.js +5 -0
  106. package/dist/security/UserProfile.d.ts +12 -0
  107. package/dist/security/UserProfile.d.ts.map +1 -0
  108. package/dist/security/UserProfile.js +25 -0
  109. package/dist/security/index.d.ts +3 -0
  110. package/dist/security/index.d.ts.map +1 -0
  111. package/dist/security/index.js +2 -0
  112. package/dist/theme/colorPrimitives.d.ts +3 -0
  113. package/dist/theme/colorPrimitives.d.ts.map +1 -0
  114. package/dist/theme/colorPrimitives.js +105 -0
  115. package/dist/theme/colors.d.ts +3 -0
  116. package/dist/theme/colors.d.ts.map +1 -0
  117. package/dist/theme/colors.js +75 -0
  118. package/dist/theme/font.d.ts +4 -0
  119. package/dist/theme/font.d.ts.map +1 -0
  120. package/dist/theme/font.js +24 -0
  121. package/dist/theme/globalStyles.d.ts +2 -0
  122. package/dist/theme/globalStyles.d.ts.map +1 -0
  123. package/dist/theme/globalStyles.js +50 -0
  124. package/dist/theme/index.d.ts +2 -0
  125. package/dist/theme/index.d.ts.map +1 -0
  126. package/dist/theme/index.js +197 -0
  127. package/dist/theme/radius.d.ts +3 -0
  128. package/dist/theme/radius.d.ts.map +1 -0
  129. package/dist/theme/radius.js +10 -0
  130. package/dist/theme/spacing.d.ts +3 -0
  131. package/dist/theme/spacing.d.ts.map +1 -0
  132. package/dist/theme/spacing.js +10 -0
  133. package/dist/theme/typography.d.ts +4 -0
  134. package/dist/theme/typography.d.ts.map +1 -0
  135. package/dist/theme/typography.js +32 -0
  136. package/dist/utils/assertNever.d.ts +15 -0
  137. package/dist/utils/assertNever.d.ts.map +1 -0
  138. package/dist/utils/assertNever.js +14 -0
  139. package/dist/utils/index.d.ts +3 -0
  140. package/dist/utils/index.d.ts.map +1 -0
  141. package/dist/utils/index.js +2 -0
  142. package/dist/utils/shouldNotForwardPropsWithKeys.d.ts +3 -0
  143. package/dist/utils/shouldNotForwardPropsWithKeys.d.ts.map +1 -0
  144. package/dist/utils/shouldNotForwardPropsWithKeys.js +3 -0
  145. package/package.json +13 -11
  146. package/src/components/PageWithMenuLayout/PageWithMenuLayout.tsx +3 -6
  147. package/src/components/PageWithMenuLayout/useMenuToggle.ts +19 -0
  148. package/tsconfig.layout.tsbuildinfo +1 -1
@@ -0,0 +1,47 @@
1
+ import { glob } from 'glob';
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import { describe, expect, it } from 'vitest';
5
+ describe('package isolation', () => {
6
+ it('should not reference files outside of src folder', async () => {
7
+ expect.assertions(1);
8
+ // Find all TypeScript files in src directory
9
+ const srcFiles = await glob('src/**/*.{ts,tsx}', {
10
+ cwd: path.resolve(__dirname, '..'),
11
+ });
12
+ const violations = [];
13
+ for (const file of srcFiles) {
14
+ const filePath = path.resolve(__dirname, '..', file);
15
+ const content = fs.readFileSync(filePath, 'utf8');
16
+ // Extract import statements using regex
17
+ const importRegex = /^import\s+.*?from\s+['"]([^'"]+)['"]/gm;
18
+ let match;
19
+ while ((match = importRegex.exec(content)) !== null) {
20
+ const importPath = match[1];
21
+ // Check for relative imports that go outside the src folder
22
+ if (importPath.startsWith('../')) {
23
+ const resolvedPath = path.resolve(path.dirname(filePath), importPath);
24
+ const srcRoot = path.resolve(__dirname, '..', 'src');
25
+ // Only flag as violation if the resolved path is outside the src folder
26
+ if (!resolvedPath.startsWith(srcRoot + path.sep) && resolvedPath !== srcRoot) {
27
+ violations.push(`${file}: ${importPath}`);
28
+ }
29
+ }
30
+ }
31
+ // Also check for dynamic imports that go outside the src folder
32
+ const dynamicImportRegex = /import\s*\(\s*['"]([^'"]+)['"]\s*\)/g;
33
+ while ((match = dynamicImportRegex.exec(content)) !== null) {
34
+ const importPath = match[1];
35
+ if (importPath.startsWith('../')) {
36
+ const resolvedPath = path.resolve(path.dirname(filePath), importPath);
37
+ const srcRoot = path.resolve(__dirname, '..', 'src');
38
+ if (!resolvedPath.startsWith(srcRoot + path.sep) && resolvedPath !== srcRoot) {
39
+ violations.push(`${file}: ${importPath} (dynamic import)`);
40
+ }
41
+ }
42
+ }
43
+ }
44
+ console.log(violations);
45
+ expect(violations).toHaveLength(0);
46
+ });
47
+ });
@@ -0,0 +1,18 @@
1
+ import { JSX } from 'react';
2
+ import { CompanyRole, GlobalRole, TenantRole } from '@smartbooks-ai/api-client';
3
+ type Props = {
4
+ requireCompanyRole?: CompanyRole;
5
+ requireTenantRole?: TenantRole;
6
+ requireGlobalRole?: GlobalRole;
7
+ companyCode?: string;
8
+ tenantCode?: string;
9
+ children?: React.ReactNode;
10
+ errorElement?: JSX.Element;
11
+ loadingElement?: JSX.Element;
12
+ notLoggedInElement?: JSX.Element;
13
+ unauthorizedElement?: React.ReactNode;
14
+ shouldInitiateLogin?: boolean;
15
+ };
16
+ declare const AuthorizedContent: React.FC<Props>;
17
+ export { AuthorizedContent };
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/security/AuthorizedContent/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAa,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAQhF,KAAK,KAAK,GAAG;IACX,kBAAkB,CAAC,EAAE,WAAW,CAAC;IACjC,iBAAiB,CAAC,EAAE,UAAU,CAAC;IAC/B,iBAAiB,CAAC,EAAE,UAAU,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,YAAY,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IAC7B,kBAAkB,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACjC,mBAAmB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACtC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAkDtC,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { useEffect } from 'react';
2
+ import { State } from './state';
3
+ import { useAuthorizationState } from './useAuthorizationState';
4
+ import { ProfileState, useProfile } from '../../security/ProfileContext';
5
+ import { assertNever } from '../../utils/assertNever';
6
+ const AuthorizedContent = ({ children, companyCode, errorElement, shouldInitiateLogin, loadingElement, notLoggedInElement, requireCompanyRole, requireGlobalRole, requireTenantRole, tenantCode, unauthorizedElement, }) => {
7
+ const { state, initiateLogin } = useProfile();
8
+ const authorizationState = useAuthorizationState({
9
+ companyCode,
10
+ companyRole: requireCompanyRole,
11
+ globalRole: requireGlobalRole,
12
+ tenantCode,
13
+ tenantRole: requireTenantRole,
14
+ });
15
+ useEffect(() => {
16
+ if (state === ProfileState.notLoggedIn && shouldInitiateLogin) {
17
+ initiateLogin();
18
+ }
19
+ }, [initiateLogin, shouldInitiateLogin, state]);
20
+ useEffect(() => {
21
+ if (authorizationState === State.needsProfileLinking) {
22
+ window.location.href = '/link-identities'; // Cannot use navigate outside of a RouterContext
23
+ }
24
+ }, [authorizationState]);
25
+ switch (authorizationState) {
26
+ case State.loading:
27
+ case State.needsProfileLinking:
28
+ return loadingElement;
29
+ case State.authorized:
30
+ return children;
31
+ case State.notLoggedIn:
32
+ return notLoggedInElement;
33
+ case State.unauthorized:
34
+ return unauthorizedElement;
35
+ case State.error:
36
+ return errorElement;
37
+ default:
38
+ return assertNever(authorizationState);
39
+ }
40
+ };
41
+ export { AuthorizedContent };
@@ -0,0 +1,9 @@
1
+ export declare enum State {
2
+ loading = 0,
3
+ authorized = 1,
4
+ unauthorized = 2,
5
+ error = 3,
6
+ notLoggedIn = 4,
7
+ needsProfileLinking = 5
8
+ }
9
+ //# sourceMappingURL=state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/security/AuthorizedContent/state.ts"],"names":[],"mappings":"AAAA,oBAAY,KAAK;IACf,OAAO,IAAA;IACP,UAAU,IAAA;IACV,YAAY,IAAA;IACZ,KAAK,IAAA;IACL,WAAW,IAAA;IACX,mBAAmB,IAAA;CACpB"}
@@ -0,0 +1,9 @@
1
+ export var State;
2
+ (function (State) {
3
+ State[State["loading"] = 0] = "loading";
4
+ State[State["authorized"] = 1] = "authorized";
5
+ State[State["unauthorized"] = 2] = "unauthorized";
6
+ State[State["error"] = 3] = "error";
7
+ State[State["notLoggedIn"] = 4] = "notLoggedIn";
8
+ State[State["needsProfileLinking"] = 5] = "needsProfileLinking";
9
+ })(State || (State = {}));
@@ -0,0 +1,12 @@
1
+ import { CompanyRole, GlobalRole, TenantRole } from '@smartbooks-ai/api-client';
2
+ import { State } from './state';
3
+ type Input = {
4
+ companyRole?: CompanyRole;
5
+ tenantCode?: string;
6
+ companyCode?: string;
7
+ tenantRole?: TenantRole;
8
+ globalRole?: GlobalRole;
9
+ };
10
+ export declare const useAuthorizationState: ({ companyCode, companyRole, globalRole, tenantCode, tenantRole, }: Input) => State;
11
+ export {};
12
+ //# sourceMappingURL=useAuthorizationState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useAuthorizationState.d.ts","sourceRoot":"","sources":["../../../src/security/AuthorizedContent/useAuthorizationState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEhF,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAKhC,KAAK,KAAK,GAAG;IACX,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,mEAMnC,KAAK,KAAG,KAoBV,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { State } from './state';
2
+ import { useIsAuthorized } from '../../hooks/useIsAuthorized';
3
+ import { ProfileState, useProfile } from '../../security/ProfileContext';
4
+ export const useAuthorizationState = ({ companyCode, companyRole, globalRole, tenantCode, tenantRole, }) => {
5
+ const { profile, state } = useProfile();
6
+ const getIsAuthorized = useIsAuthorized();
7
+ if (profile) {
8
+ return getIsAuthorized({ companyCode, companyRole, globalRole, tenantCode, tenantRole })
9
+ ? State.authorized
10
+ : State.unauthorized;
11
+ }
12
+ switch (state) {
13
+ case ProfileState.notLoggedIn:
14
+ return State.notLoggedIn;
15
+ case ProfileState.loading:
16
+ return State.loading;
17
+ case ProfileState.needsLinking:
18
+ return State.needsProfileLinking;
19
+ default:
20
+ return State.error;
21
+ }
22
+ };
@@ -0,0 +1,22 @@
1
+ import { ProfileState } from './types';
2
+ import { UserProfile } from '../UserProfile';
3
+ export type InitiateLoginArgs = {
4
+ forceSignUp?: boolean;
5
+ forceSignIn?: boolean;
6
+ returnTo?: string;
7
+ loginHint?: string;
8
+ connection?: string;
9
+ };
10
+ export type PrimaryProfileInformation = {
11
+ connection: string;
12
+ canUseLoginHint: boolean;
13
+ };
14
+ export type ProfileContextValue = {
15
+ profile: UserProfile | null;
16
+ state: ProfileState;
17
+ primaryProfileInformation?: PrimaryProfileInformation;
18
+ initiateLogin: (args?: InitiateLoginArgs) => void;
19
+ reload: () => void;
20
+ };
21
+ export declare const ProfileContext: import("react").Context<ProfileContextValue>;
22
+ //# sourceMappingURL=ProfileContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProfileContext.d.ts","sourceRoot":"","sources":["../../../src/security/ProfileContext/ProfileContext.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IAC5B,KAAK,EAAE,YAAY,CAAC;IACpB,yBAAyB,CAAC,EAAE,yBAAyB,CAAC;IACtD,aAAa,EAAE,CAAC,IAAI,CAAC,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAClD,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAMF,eAAO,MAAM,cAAc,8CAKzB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { createContext } from 'react';
2
+ import { ProfileState } from './types';
3
+ const unsetFn = () => {
4
+ throw new Error('Unable interact before initializing the profile provider');
5
+ };
6
+ export const ProfileContext = createContext({
7
+ profile: null,
8
+ state: ProfileState.loading,
9
+ initiateLogin: unsetFn,
10
+ reload: unsetFn,
11
+ });
@@ -0,0 +1,5 @@
1
+ export { UserProfile } from '../UserProfile';
2
+ export { useProfile } from './useProfile';
3
+ export { ProfileState } from './types';
4
+ export * from './ProfileContext';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/security/ProfileContext/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { UserProfile } from '../UserProfile';
2
+ export { useProfile } from './useProfile';
3
+ export { ProfileState } from './types';
4
+ export * from './ProfileContext';
@@ -0,0 +1,8 @@
1
+ export declare enum ProfileState {
2
+ loading = 0,
3
+ loaded = 1,
4
+ notLoggedIn = 2,
5
+ error = 3,
6
+ needsLinking = 4
7
+ }
8
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/security/ProfileContext/types.ts"],"names":[],"mappings":"AAAA,oBAAY,YAAY;IACtB,OAAO,IAAA;IACP,MAAM,IAAA;IACN,WAAW,IAAA;IACX,KAAK,IAAA;IACL,YAAY,IAAA;CACb"}
@@ -0,0 +1,8 @@
1
+ export var ProfileState;
2
+ (function (ProfileState) {
3
+ ProfileState[ProfileState["loading"] = 0] = "loading";
4
+ ProfileState[ProfileState["loaded"] = 1] = "loaded";
5
+ ProfileState[ProfileState["notLoggedIn"] = 2] = "notLoggedIn";
6
+ ProfileState[ProfileState["error"] = 3] = "error";
7
+ ProfileState[ProfileState["needsLinking"] = 4] = "needsLinking";
8
+ })(ProfileState || (ProfileState = {}));
@@ -0,0 +1,2 @@
1
+ export declare function useProfile(): import("./ProfileContext").ProfileContextValue;
2
+ //# sourceMappingURL=useProfile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useProfile.d.ts","sourceRoot":"","sources":["../../../src/security/ProfileContext/useProfile.tsx"],"names":[],"mappings":"AAIA,wBAAgB,UAAU,mDAEzB"}
@@ -0,0 +1,5 @@
1
+ import { useContext } from 'react';
2
+ import { ProfileContext } from './ProfileContext';
3
+ export function useProfile() {
4
+ return useContext(ProfileContext);
5
+ }
@@ -0,0 +1,12 @@
1
+ import { AvailableCompany, AvailableTenant, GlobalRole, Profile } from '@smartbooks-ai/api-client';
2
+ export declare class UserProfile {
3
+ displayName: string;
4
+ email: string;
5
+ allowedTenants: AvailableTenant[];
6
+ allowedCompanies: AvailableCompany[];
7
+ globalRoles: GlobalRole[];
8
+ userId: string;
9
+ constructor(userId: string, displayName: string, email: string, allowedTenants: AvailableTenant[], globalRoles: GlobalRole[]);
10
+ static create(given_name: string | undefined, family_name: string | undefined, email_address: string | undefined, profileResponse: Profile): UserProfile;
11
+ }
12
+ //# sourceMappingURL=UserProfile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserProfile.d.ts","sourceRoot":"","sources":["../../src/security/UserProfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAEnG,qBAAa,WAAW;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,eAAe,EAAE,CAAC;IAClC,gBAAgB,EAAE,gBAAgB,EAAE,CAAC;IACrC,WAAW,EAAE,UAAU,EAAE,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;gBAGb,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,cAAc,EAAE,eAAe,EAAE,EACjC,WAAW,EAAE,UAAU,EAAE;WAYb,MAAM,CAClB,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,eAAe,EAAE,OAAO;CAgB3B"}
@@ -0,0 +1,25 @@
1
+ export class UserProfile {
2
+ displayName;
3
+ email;
4
+ allowedTenants;
5
+ allowedCompanies;
6
+ globalRoles;
7
+ userId;
8
+ constructor(userId, displayName, email, allowedTenants, globalRoles) {
9
+ this.userId = userId;
10
+ this.displayName = displayName;
11
+ this.email = email;
12
+ this.allowedTenants = allowedTenants;
13
+ this.globalRoles = globalRoles;
14
+ this.allowedCompanies = allowedTenants
15
+ .flatMap((t) => t.companies)
16
+ .sort((a, b) => a.description.localeCompare(b.description));
17
+ }
18
+ static create(given_name, family_name, email_address, profileResponse) {
19
+ const firstName = given_name;
20
+ const lastName = family_name;
21
+ const email = email_address || 'Email Unknown';
22
+ const displayName = firstName || lastName ? `${firstName} ${lastName}`.trim() : email;
23
+ return new UserProfile(profileResponse.userId, displayName, email, profileResponse.tenants, profileResponse.globalRoles);
24
+ }
25
+ }
@@ -0,0 +1,3 @@
1
+ export * from './ProfileContext';
2
+ export * from './AuthorizedContent';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './ProfileContext';
2
+ export * from './AuthorizedContent';
@@ -0,0 +1,3 @@
1
+ import { ColorPrimitives } from '../emotion';
2
+ export declare const colorPrimitives: ColorPrimitives;
3
+ //# sourceMappingURL=colorPrimitives.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colorPrimitives.d.ts","sourceRoot":"","sources":["../../src/theme/colorPrimitives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,eAAO,MAAM,eAAe,EAAE,eAwG7B,CAAC"}
@@ -0,0 +1,105 @@
1
+ export const colorPrimitives = {
2
+ darkNavy: {
3
+ '50': '#E6E8EC',
4
+ '100': '#CBCCD9',
5
+ '200': '#B2B5C6',
6
+ '300': '#989BB2',
7
+ '400': '#7E82A0',
8
+ '500': '#65698B',
9
+ '600': '#4E5376',
10
+ '700': '#373B60',
11
+ '800': '#20244A',
12
+ '900': '#120A32',
13
+ '950': '#0E0828',
14
+ },
15
+ coolMint: {
16
+ '50': '#ECF7F7',
17
+ '100': '#DAEEEF',
18
+ '200': '#C7E6E7',
19
+ '300': '#B5DEDF',
20
+ '400': '#A2D6D7',
21
+ '500': '#8FCDCF',
22
+ '600': '#7DC5C7',
23
+ '700': '#6ABDBF',
24
+ '800': '#58B4B7',
25
+ '900': '#45ACAF',
26
+ '950': '#3E9B9E',
27
+ },
28
+ coral: {
29
+ '50': '#FFF2ED',
30
+ '100': '#FEE5DB',
31
+ '200': '#FED8C9',
32
+ '300': '#FDCBB7',
33
+ '400': '#FDBEA6',
34
+ '500': '#FCB194',
35
+ '600': '#FCA482',
36
+ '700': '#FB9770',
37
+ '800': '#FB8A5E',
38
+ '900': '#FA7D4C',
39
+ '950': '#E17144',
40
+ },
41
+ navy: {
42
+ '50': '#E8EDF9',
43
+ '100': '#D0DCF3',
44
+ '200': '#B9CAEC',
45
+ '300': '#A1B9E6',
46
+ '400': '#8AA7E0',
47
+ '500': '#7395DA',
48
+ '600': '#5B84D4',
49
+ '700': '#4472CD',
50
+ '800': '#2C61C7',
51
+ '900': '#154FC1',
52
+ '950': '#1347AE',
53
+ },
54
+ skyBlue: {
55
+ '50': '#ECF9FB',
56
+ '100': '#D9F2F8',
57
+ '200': '#C6ECF4',
58
+ '300': '#B3E5F1',
59
+ '400': '#A0DFED',
60
+ '500': '#8CD9E9',
61
+ '600': '#79D2E6',
62
+ '700': '#66CCE2',
63
+ '800': '#53C5DF',
64
+ '900': '#40BFDB',
65
+ '950': '#3AACC5',
66
+ },
67
+ grey: {
68
+ '50': '#FAFAFA',
69
+ '100': '#FAF9F9',
70
+ '200': '#F0EFEF',
71
+ '300': '#E1E0E0',
72
+ '400': '#C8C7C7',
73
+ '500': '#AFAEAE',
74
+ '600': '#969595',
75
+ '700': '#7D7D7D',
76
+ '800': '#4E4E4E',
77
+ '900': '#383838',
78
+ '950': '#222222',
79
+ },
80
+ common: {
81
+ black: '#000000',
82
+ white: '#ffffff',
83
+ },
84
+ warning: {
85
+ '100': '#FEF7F0',
86
+ '300': '#FCE6CF',
87
+ '600': '#F7B46E',
88
+ '900': '#DF770C',
89
+ '950': '#B25F0A',
90
+ },
91
+ error: {
92
+ '100': '#FDF2F1',
93
+ '300': '#F9D2D2',
94
+ '600': '#EE7877',
95
+ '900': '#D11C1A',
96
+ '950': '#A71615',
97
+ },
98
+ success: {
99
+ '100': '#F1F8F6',
100
+ '300': '#D9F2E8',
101
+ '600': '#88DDBC',
102
+ '900': '#26A675',
103
+ '950': '#1E855E',
104
+ },
105
+ };
@@ -0,0 +1,3 @@
1
+ import { Theme } from '@emotion/react';
2
+ export declare const colors: Theme['my']['colors'];
3
+ //# sourceMappingURL=colors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/theme/colors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAIvC,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,CAyExC,CAAC"}
@@ -0,0 +1,75 @@
1
+ import { colorPrimitives } from './colorPrimitives';
2
+ export const colors = {
3
+ primitives: colorPrimitives,
4
+ text: {
5
+ main: colorPrimitives.darkNavy[800],
6
+ light: colorPrimitives.darkNavy[600],
7
+ lighter: colorPrimitives.darkNavy[400],
8
+ disabled: colorPrimitives.grey[600],
9
+ placeholder: colorPrimitives.grey[400],
10
+ white: colorPrimitives.common.white,
11
+ },
12
+ primary: {
13
+ main: colorPrimitives.darkNavy[900],
14
+ light: colorPrimitives.darkNavy[600],
15
+ dark: colorPrimitives.darkNavy[950],
16
+ contrast: colorPrimitives.common.white,
17
+ },
18
+ secondary: {
19
+ main: colorPrimitives.coolMint[900],
20
+ light: colorPrimitives.coolMint[600],
21
+ dark: colorPrimitives.coolMint[950],
22
+ contrast: colorPrimitives.common.white,
23
+ },
24
+ tertiary: {
25
+ main: colorPrimitives.coral[900],
26
+ light: colorPrimitives.coral[600],
27
+ dark: colorPrimitives.coral[950],
28
+ contrast: colorPrimitives.common.white,
29
+ },
30
+ quaternary: {
31
+ main: colorPrimitives.navy[900],
32
+ light: colorPrimitives.navy[600],
33
+ dark: colorPrimitives.navy[950],
34
+ contrast: colorPrimitives.common.white,
35
+ },
36
+ quinary: {
37
+ main: colorPrimitives.skyBlue[900],
38
+ light: colorPrimitives.skyBlue[600],
39
+ dark: colorPrimitives.skyBlue[950],
40
+ contrast: colorPrimitives.common.white,
41
+ },
42
+ neutral: {
43
+ main: colorPrimitives.grey[900],
44
+ light: colorPrimitives.grey[500],
45
+ dark: colorPrimitives.grey[950],
46
+ contrast: colorPrimitives.common.white,
47
+ },
48
+ warning: {
49
+ main: colorPrimitives.warning[900],
50
+ light: colorPrimitives.warning[600],
51
+ dark: colorPrimitives.warning[950],
52
+ contrast: colorPrimitives.common.white,
53
+ },
54
+ error: {
55
+ main: colorPrimitives.error[900],
56
+ light: colorPrimitives.error[600],
57
+ dark: colorPrimitives.error[950],
58
+ contrast: colorPrimitives.common.white,
59
+ },
60
+ success: {
61
+ main: colorPrimitives.success[900],
62
+ light: colorPrimitives.success[600],
63
+ dark: colorPrimitives.success[950],
64
+ contrast: colorPrimitives.common.white,
65
+ },
66
+ background: {
67
+ white: colorPrimitives.common.white,
68
+ lightGrey: colorPrimitives.grey[50],
69
+ transparent: 'transparent',
70
+ light: colorPrimitives.darkNavy[50],
71
+ hover: 'rgb(255 255 255 / 8%)',
72
+ hoverDark: 'rgb(0 0 0 / 8%)',
73
+ hoverDarkNonTransparent: '#ebebeb',
74
+ },
75
+ };
@@ -0,0 +1,4 @@
1
+ import { Theme } from '@emotion/react';
2
+ export declare const FONT_FAMILY = "Arial, sans-serif";
3
+ export declare const font: Theme['my']['font'];
4
+ //# sourceMappingURL=font.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"font.d.ts","sourceRoot":"","sources":["../../src/theme/font.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAE/C,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAsBpC,CAAC"}
@@ -0,0 +1,24 @@
1
+ export const FONT_FAMILY = 'Arial, sans-serif';
2
+ export const font = {
3
+ h1: ` 600 1.5rem/2 ${FONT_FAMILY}`,
4
+ h2: ` 700 1.25rem/1.75 ${FONT_FAMILY}`,
5
+ h3: ` 700 1.125rem/1.5 ${FONT_FAMILY}`,
6
+ h4: ` 700 1rem/1.25 ${FONT_FAMILY}`,
7
+ h5: ` 700 0.875rem/1.25 ${FONT_FAMILY}`,
8
+ h6: ` 700 0.8125rem/1 ${FONT_FAMILY}`,
9
+ subtitle1: ` 500 1.25rem/1.75 ${FONT_FAMILY}`,
10
+ subtitle2: ` 500 1rem/1.5 ${FONT_FAMILY}`,
11
+ body1: ` 400 1rem/1.5 ${FONT_FAMILY}`,
12
+ body2: ` 400 0.875rem/1.25 ${FONT_FAMILY}`,
13
+ body3: ` 400 0.8125rem/1 ${FONT_FAMILY}`,
14
+ highlight1: `700 1rem/1.5 ${FONT_FAMILY}`,
15
+ highlight2: `700 0.875rem/1.25 ${FONT_FAMILY}`,
16
+ highlight3: `500 0.8125rem/1 ${FONT_FAMILY}`,
17
+ button1: ` 500 0.875rem/1.5 ${FONT_FAMILY}`,
18
+ button2: ` 500 0.875rem/1.25 ${FONT_FAMILY}`,
19
+ caption: ` 400 1rem/1.5 ${FONT_FAMILY}`,
20
+ overline: ` 500 1rem/1.5 ${FONT_FAMILY}`,
21
+ label: ` 500 0.875rem/1.25 ${FONT_FAMILY}`,
22
+ nav1: ` 400 0.8125rem/1.25 ${FONT_FAMILY}`,
23
+ nav2: ` 700 0.8125rem/1.25 ${FONT_FAMILY}`,
24
+ };
@@ -0,0 +1,2 @@
1
+ export default function GlobalStyles(): import("@emotion/react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=globalStyles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globalStyles.d.ts","sourceRoot":"","sources":["../../src/theme/globalStyles.tsx"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,YAAY,qDAoDnC"}
@@ -0,0 +1,50 @@
1
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
+ import { GlobalStyles as MUIGlobalStyles } from '@mui/material';
3
+ export default function GlobalStyles() {
4
+ const inputGlobalStyles = (_jsx(MUIGlobalStyles, { styles: {
5
+ '@keyframes mui-auto-fill': { from: { display: 'block' } },
6
+ '@keyframes mui-auto-fill-cancel': { from: { display: 'block' } },
7
+ '*': {
8
+ boxSizing: 'border-box',
9
+ },
10
+ html: {
11
+ margin: 0,
12
+ padding: 0,
13
+ width: '100%',
14
+ height: '100%',
15
+ WebkitOverflowScrolling: 'touch',
16
+ },
17
+ body: {
18
+ margin: 0,
19
+ padding: 0,
20
+ width: '100%',
21
+ height: '100%',
22
+ },
23
+ '#root': {
24
+ width: '100%',
25
+ height: '100%',
26
+ },
27
+ input: {
28
+ '&[type=number]': {
29
+ MozAppearance: 'textfield',
30
+ '&::-webkit-outer-spin-button': {
31
+ margin: 0,
32
+ WebkitAppearance: 'none',
33
+ },
34
+ '&::-webkit-inner-spin-button': {
35
+ margin: 0,
36
+ WebkitAppearance: 'none',
37
+ },
38
+ },
39
+ },
40
+ img: {
41
+ display: 'block',
42
+ maxWidth: '100%',
43
+ },
44
+ ul: {
45
+ margin: 0,
46
+ padding: 0,
47
+ },
48
+ } }));
49
+ return inputGlobalStyles;
50
+ }
@@ -0,0 +1,2 @@
1
+ export declare function ThemeProvider(props: React.PropsWithChildren): import("@emotion/react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.tsx"],"names":[],"mappings":"AAqNA,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,iBAAiB,oDAc3D"}