@lokalise/harmony 1.6.0 → 1.8.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 (62) hide show
  1. package/README.md +64 -0
  2. package/dist/harmony.cjs +1 -1
  3. package/dist/harmony.mjs +923 -506
  4. package/dist/types/src/components/Sidebar/Sidebar.d.ts +5 -2
  5. package/dist/types/src/components/Sidebar/Widgets/Avatar/Avatar.d.ts +3 -0
  6. package/dist/types/src/components/Sidebar/Widgets/IconLink/IconLink.d.ts +3 -0
  7. package/dist/types/src/components/Sidebar/Widgets/Menu/Menu.d.ts +3 -0
  8. package/dist/types/src/components/Sidebar/Widgets/ProfileMenu/ProfileMenu.d.ts +4 -0
  9. package/dist/types/src/components/Sidebar/Widgets/ProfileMenu/ProfileSettingsMenuItem/ProfileSettingsMenuItem.d.ts +4 -0
  10. package/dist/types/src/components/Sidebar/Widgets/ProfileMenu/TeamMenuItem/TeamMenuItem.d.ts +5 -0
  11. package/dist/types/src/components/Sidebar/Widgets/ProfileMenu/TeamSwitch/TeamSwitch.d.ts +3 -0
  12. package/dist/types/src/components/Sidebar/Widgets/ProfileMenu/UpgradeMenuItem/UpgradeMenuItem.d.ts +5 -0
  13. package/dist/types/src/components/Sidebar/Widgets/ProfileMenu/types.d.ts +1 -0
  14. package/dist/types/src/features/auth/backend/services/getAuthenticatedSessionDetailFromRequest.d.ts +10 -0
  15. package/dist/types/src/features/auth/backend/services/getAuthenticatedSessionPayloadFromRequest.test.d.ts +1 -0
  16. package/dist/types/src/features/auth/core/jwtTokenPayload.d.ts +7 -0
  17. package/dist/types/src/features/auth/core/jwtTokenPayload.test.d.ts +1 -0
  18. package/dist/types/src/features/auth/core/lokaliseAuthAddon.d.ts +14 -0
  19. package/dist/types/src/features/auth/core/middleware/jwtAuthMiddleware.d.ts +13 -0
  20. package/dist/types/src/features/auth/core/middleware/jwtAuthMiddleware.test.d.ts +1 -0
  21. package/dist/types/src/features/auth/core/middleware/publicApiHeadersMiddleware.d.ts +5 -0
  22. package/dist/types/src/features/auth/core/types/jwtTokenPayload.d.ts +42 -0
  23. package/dist/types/src/features/auth/core/types/jwtTokenPayload.fixture.d.ts +27 -0
  24. package/dist/types/src/features/auth/core/utils/makeAuthHeader.d.ts +2 -0
  25. package/dist/types/src/features/auth/core/utils/makeAuthHeader.test.d.ts +1 -0
  26. package/dist/types/src/features/auth/frontend/addon/lokaliseAuthBrowserAddon.d.ts +35 -0
  27. package/dist/types/src/features/auth/frontend/events/NewJwtIssuedEvent.d.ts +20 -0
  28. package/dist/types/src/features/auth/frontend/hooks/useAuthenticatedProjectContributor.d.ts +28 -0
  29. package/dist/types/src/features/auth/frontend/hooks/useAuthenticatedSessionPayload.d.ts +18 -0
  30. package/dist/types/src/features/auth/frontend/hooks/useAuthenticatedUser.d.ts +18 -0
  31. package/dist/types/src/features/auth/frontend/hooks/useGetPromotedClassicSessionJwtQuery.d.ts +12 -0
  32. package/dist/types/src/features/auth/frontend/middleware/promoteClassicSessionToJwtMiddleware.d.ts +14 -0
  33. package/dist/types/src/features/auth/frontend/middleware/promoteClassicSessionToJwtMiddleware.test.d.ts +1 -0
  34. package/dist/types/src/features/auth/frontend/utils/cookieTokenUtils.d.ts +4 -0
  35. package/dist/types/src/features/auth/frontend/utils/cookieTokenUtils.test.d.ts +1 -0
  36. package/dist/types/src/features/auth/node.d.ts +9 -0
  37. package/dist/types/src/features/node.d.ts +2 -0
  38. package/dist/types/src/features/publicApi/contributors.d.ts +111 -0
  39. package/dist/types/src/features/publicApi/hooks/useCreateProjectMutation.d.ts +76 -0
  40. package/dist/types/src/features/publicApi/hooks/useGetTeamUsersQuery.d.ts +26 -0
  41. package/dist/types/src/features/publicApi/hooks/useGetUserTokenQuery.d.ts +20 -0
  42. package/dist/types/src/features/publicApi/hooks/useListProjectsQuery.d.ts +81 -0
  43. package/dist/types/src/features/publicApi/hooks/useRetrieveContributorQuery.d.ts +34 -0
  44. package/dist/types/src/features/publicApi/hooks/useRetrieveProjectQuery.d.ts +72 -0
  45. package/dist/types/src/features/publicApi/node.d.ts +16 -0
  46. package/dist/types/src/features/publicApi/projects.d.ts +1132 -0
  47. package/dist/types/src/features/publicApi/teamUsers.d.ts +61 -0
  48. package/dist/types/src/features/publicApi/types/contributorTypes.d.ts +171 -0
  49. package/dist/types/src/features/publicApi/types/languageTypes.d.ts +29 -0
  50. package/dist/types/src/features/publicApi/types/projectTypes.d.ts +1061 -0
  51. package/dist/types/src/features/publicApi/types/teamRoleTypes.d.ts +3 -0
  52. package/dist/types/src/features/publicApi/types/teamUserTypes.d.ts +70 -0
  53. package/dist/types/src/features/publicApi/types/userTokenTypes.d.ts +26 -0
  54. package/dist/types/src/features/publicApi/userToken.d.ts +35 -0
  55. package/dist/types/src/node.d.ts +3 -1
  56. package/dist/types/src/utils/testing/createMockFactoryWithDefaults.d.ts +2 -0
  57. package/dist/types/src/utils/testing/createMockFactoryWithDefaults.test.d.ts +1 -0
  58. package/dist/types/src/utils/testing/deepOverride.d.ts +4 -0
  59. package/dist/types/src/utils/testing/deepOverride.test.d.ts +1 -0
  60. package/dist/types/src/utils/types/apiMutationOverrides.d.ts +2 -0
  61. package/dist/types/src/utils/types/apiQueryOverrides.d.ts +2 -0
  62. package/package.json +35 -19
@@ -0,0 +1,3 @@
1
+ import { z } from 'zod';
2
+ export declare const TEAM_ROLE_SCHEMA: z.ZodUnion<[z.ZodLiteral<"owner">, z.ZodLiteral<"admin">, z.ZodLiteral<"biller">, z.ZodLiteral<"member">]>;
3
+ export type TeamRole = z.infer<typeof TEAM_ROLE_SCHEMA>;
@@ -0,0 +1,70 @@
1
+ import { z } from 'zod';
2
+ export declare const TEAM_USER_SCHEMA: z.ZodObject<{
3
+ user_id: z.ZodNumber;
4
+ email: z.ZodString;
5
+ fullname: z.ZodString;
6
+ created_at: z.ZodString;
7
+ created_at_timestamp: z.ZodNumber;
8
+ role: z.ZodUnion<[z.ZodLiteral<"owner">, z.ZodLiteral<"admin">, z.ZodLiteral<"biller">, z.ZodLiteral<"member">]>;
9
+ }, "strip", z.ZodTypeAny, {
10
+ role: "member" | "admin" | "biller" | "owner";
11
+ email: string;
12
+ user_id: number;
13
+ fullname: string;
14
+ created_at: string;
15
+ created_at_timestamp: number;
16
+ }, {
17
+ role: "member" | "admin" | "biller" | "owner";
18
+ email: string;
19
+ user_id: number;
20
+ fullname: string;
21
+ created_at: string;
22
+ created_at_timestamp: number;
23
+ }>;
24
+ export type TeamUser = z.infer<typeof TEAM_USER_SCHEMA>;
25
+ export declare const TEAM_USER_RESPONSE_SCHEMA: z.ZodObject<{
26
+ team_id: z.ZodNumber;
27
+ team_user: z.ZodObject<{
28
+ user_id: z.ZodNumber;
29
+ email: z.ZodString;
30
+ fullname: z.ZodString;
31
+ created_at: z.ZodString;
32
+ created_at_timestamp: z.ZodNumber;
33
+ role: z.ZodUnion<[z.ZodLiteral<"owner">, z.ZodLiteral<"admin">, z.ZodLiteral<"biller">, z.ZodLiteral<"member">]>;
34
+ }, "strip", z.ZodTypeAny, {
35
+ role: "member" | "admin" | "biller" | "owner";
36
+ email: string;
37
+ user_id: number;
38
+ fullname: string;
39
+ created_at: string;
40
+ created_at_timestamp: number;
41
+ }, {
42
+ role: "member" | "admin" | "biller" | "owner";
43
+ email: string;
44
+ user_id: number;
45
+ fullname: string;
46
+ created_at: string;
47
+ created_at_timestamp: number;
48
+ }>;
49
+ }, "strip", z.ZodTypeAny, {
50
+ team_id: number;
51
+ team_user: {
52
+ role: "member" | "admin" | "biller" | "owner";
53
+ email: string;
54
+ user_id: number;
55
+ fullname: string;
56
+ created_at: string;
57
+ created_at_timestamp: number;
58
+ };
59
+ }, {
60
+ team_id: number;
61
+ team_user: {
62
+ role: "member" | "admin" | "biller" | "owner";
63
+ email: string;
64
+ user_id: number;
65
+ fullname: string;
66
+ created_at: string;
67
+ created_at_timestamp: number;
68
+ };
69
+ }>;
70
+ export type TeamUserResponse = z.infer<typeof TEAM_USER_RESPONSE_SCHEMA>;
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ export declare const JWT_TOKEN_SCHEMA: z.ZodObject<{
3
+ accessToken: z.ZodString;
4
+ refreshToken: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ accessToken: string;
7
+ refreshToken: string;
8
+ }, {
9
+ accessToken: string;
10
+ refreshToken: string;
11
+ }>;
12
+ export type JwtToken = z.infer<typeof JWT_TOKEN_SCHEMA>;
13
+ export declare const AUTHENTICATED_REQUEST_HEADER: z.ZodUnion<[z.ZodObject<{
14
+ Authorization: z.ZodString;
15
+ }, "strip", z.ZodTypeAny, {
16
+ Authorization: string;
17
+ }, {
18
+ Authorization: string;
19
+ }>, z.ZodObject<{
20
+ 'x-csrf-token': z.ZodString;
21
+ }, "strip", z.ZodTypeAny, {
22
+ 'x-csrf-token': string;
23
+ }, {
24
+ 'x-csrf-token': string;
25
+ }>]>;
26
+ export type AuthenticatedRequestHeader = z.infer<typeof AUTHENTICATED_REQUEST_HEADER>;
@@ -0,0 +1,35 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * A method of getting a JWT token for a user.
4
+ * You can call this with either a refresh token or from within the scope of a classic CSRF cookie session.
5
+ */
6
+ export declare const getUserToken: import('@lokalise/universal-ts-utils/node').PayloadRouteDefinition<{
7
+ teamId: number;
8
+ }, z.ZodUndefined, z.ZodObject<{
9
+ accessToken: z.ZodString;
10
+ refreshToken: z.ZodString;
11
+ }, "strip", z.ZodTypeAny, {
12
+ accessToken: string;
13
+ refreshToken: string;
14
+ }, {
15
+ accessToken: string;
16
+ refreshToken: string;
17
+ }>, z.ZodObject<{
18
+ teamId: z.ZodNumber;
19
+ }, "strip", z.ZodTypeAny, {
20
+ teamId: number;
21
+ }, {
22
+ teamId: number;
23
+ }>, undefined, z.ZodUnion<[z.ZodObject<{
24
+ Authorization: z.ZodString;
25
+ }, "strip", z.ZodTypeAny, {
26
+ Authorization: string;
27
+ }, {
28
+ Authorization: string;
29
+ }>, z.ZodObject<{
30
+ 'x-csrf-token': z.ZodString;
31
+ }, "strip", z.ZodTypeAny, {
32
+ 'x-csrf-token': string;
33
+ }, {
34
+ 'x-csrf-token': string;
35
+ }>]>, false, false>;
@@ -1,8 +1,10 @@
1
1
  /**
2
2
  * COMPONENTS EXPORTS
3
3
  */
4
+ export * from './components/Sidebar/Widgets/ProfileMenu/types';
4
5
  export { NavigationPanel } from './components/NavigationPanel/NavigationPanel';
5
6
  export { Sidebar } from './components/Sidebar/Sidebar';
6
7
  export { Breadcrumbs } from './components/NavigationPanel/components/Breadcrumbs/Breadcrumbs';
7
8
  export { NavigationTabs } from './components/NavigationPanel/components/NavigationTabs/NavigationTabs';
8
- export * from './utils/node';
9
+ export * from './features/node';
10
+ export * from './utils/node.ts';
@@ -0,0 +1,2 @@
1
+ import { DeepPartial } from './deepOverride';
2
+ export declare const createMockFactoryWithDefaults: <T extends object>(defaults: T) => (overrides?: DeepPartial<T>, removeProperties?: (keyof T)[]) => T;
@@ -0,0 +1,4 @@
1
+ export type DeepPartial<T> = T extends object ? {
2
+ [K in keyof T]?: DeepPartial<T[K]>;
3
+ } : T;
4
+ export declare const deepOverride: <T extends object>(defaults: T, overrides: DeepPartial<T> | undefined, removeProperties?: (keyof T)[]) => T;
@@ -0,0 +1,2 @@
1
+ import { UseMutationOptions } from '@tanstack/react-query';
2
+ export type ApiMutationOverrides<Data, Variables, Error = undefined, Context = undefined> = Omit<UseMutationOptions<Data, Error, Variables, Context>, 'mutationFn'>;
@@ -0,0 +1,2 @@
1
+ import { QueryKey, UseQueryOptions } from '@tanstack/react-query';
2
+ export type ApiQueryOverrides<Data, QueryKeyFactory extends Record<string, (...args: any[]) => QueryKey>, SelectedData = Data, Error = undefined> = Omit<UseQueryOptions<Data, Error, SelectedData, ReturnType<QueryKeyFactory[keyof QueryKeyFactory]>>, 'queryFn'>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lokalise/harmony",
3
- "version": "1.6.0",
3
+ "version": "1.8.0",
4
4
  "author": {
5
5
  "name": "Lokalise",
6
6
  "url": "https://lokalise.com/"
@@ -8,9 +8,12 @@
8
8
  "homepage": "https://github.com/lokalise/harmony",
9
9
  "repository": {
10
10
  "type": "git",
11
- "url": "https://github.com/lokalise/harmony.git"
11
+ "url": "git+https://github.com/lokalise/harmony.git"
12
12
  },
13
- "files": ["dist/**", "README.md"],
13
+ "files": [
14
+ "dist/**",
15
+ "README.md"
16
+ ],
14
17
  "type": "module",
15
18
  "publishConfig": {
16
19
  "access": "public"
@@ -30,17 +33,22 @@
30
33
  "storybook:build": "storybook build"
31
34
  },
32
35
  "peerDependencies": {
36
+ "@lokalise/frontend-http-client": ">=3.2.1",
33
37
  "@lokalise/louis": ">=26.0.0",
34
38
  "@lokalise/token-dictionary": ">=2.42.1",
39
+ "@lokalise/universal-ts-utils": ">=3.4.0",
40
+ "@tanstack/react-query": ">=5.66.9",
35
41
  "date-fns": ">=4.1",
36
42
  "date-fns-tz": ">=3.2",
37
43
  "react": "^18.0.0 || ^19.0.0",
38
- "react-dom": "^18.0.0 || ^19.0.0"
44
+ "react-dom": "^18.0.0 || ^19.0.0",
45
+ "wretch": ">=2.11.0",
46
+ "zod": ">=3.23.8"
39
47
  },
40
48
  "devDependencies": {
41
49
  "@biomejs/biome": "^1.9.4",
42
- "@chromatic-com/storybook": "^3.2.4",
43
- "@faker-js/faker": "^9.5.0",
50
+ "@chromatic-com/storybook": "^3.2.5",
51
+ "@faker-js/faker": "^9.6.0",
44
52
  "@lokalise/biome-config": "^1.6.1",
45
53
  "@semantic-release/changelog": "^6.0.3",
46
54
  "@semantic-release/commit-analyzer": "^13.0.1",
@@ -48,13 +56,13 @@
48
56
  "@semantic-release/github": "^11.0.1",
49
57
  "@semantic-release/npm": "^12.0.1",
50
58
  "@semantic-release/release-notes-generator": "^14.0.3",
51
- "@storybook/addon-essentials": "^8.6.0-alpha.4",
52
- "@storybook/addon-interactions": "^8.6.0-alpha.4",
53
- "@storybook/addon-onboarding": "^8.6.0-alpha.4",
54
- "@storybook/addon-themes": "^8.6.1",
59
+ "@storybook/addon-essentials": "^8.6.4",
60
+ "@storybook/addon-interactions": "^8.6.4",
61
+ "@storybook/addon-onboarding": "^8.6.4",
62
+ "@storybook/addon-themes": "^8.6.4",
55
63
  "@storybook/blocks": "^8.6.0-alpha.1",
56
- "@storybook/react": "^8.6.0-alpha.4",
57
- "@storybook/react-vite": "^8.6.0-alpha.4",
64
+ "@storybook/react": "^8.6.4",
65
+ "@storybook/react-vite": "^8.6.4",
58
66
  "@storybook/test": "^8.6.0-alpha.1",
59
67
  "@testing-library/jest-dom": "^6.4.6",
60
68
  "@testing-library/react": "^16.2.0",
@@ -62,28 +70,32 @@
62
70
  "@types/node": "^22.13.1",
63
71
  "@types/react": "^18.3.18",
64
72
  "@types/react-dom": "18.3.0",
65
- "@typescript-eslint/parser": "^8.23.0",
73
+ "@typescript-eslint/parser": "^8.26.1",
66
74
  "@vitejs/plugin-react": "^4.3.4",
67
- "@vitest/coverage-v8": "^3.0.5",
75
+ "@vitest/coverage-v8": "^3.0.8",
68
76
  "bundlesize2": "^0.0.34",
69
77
  "conventional-changelog-conventionalcommits": "^8.0.0",
70
78
  "eslint-plugin-i18next": "^6.0.9",
71
- "eslint-plugin-storybook": "^0.11.2",
79
+ "eslint-plugin-storybook": "^0.11.4",
72
80
  "eslint-plugin-testing-library": "^7.1.1",
81
+ "vitest-fail-on-console": "^0.7.1",
73
82
  "jsdom": "26.0.0",
83
+ "mockttp": "^3.16.0",
74
84
  "rimraf": "^6.0.1",
75
- "semantic-release": "^24.2.1",
85
+ "semantic-release": "^24.2.3",
76
86
  "storybook": "^8.6.0-alpha.1",
77
87
  "typescript": "^5.7.3",
78
- "vite": "^6.0.11",
79
- "vite-plugin-dts": "^4.5.0",
88
+ "vite": "^6.2.1",
89
+ "vite-plugin-dts": "^4.5.3",
80
90
  "vite-plugin-tsconfig-paths": "^1.4.1",
81
91
  "vitest": "^3.0.3"
82
92
  },
83
93
  "main": "dist/harmony.cjs",
84
94
  "module": "dist/harmony.mjs",
85
95
  "types": "dist/types/index.d.ts",
86
- "sideEffects": ["*.css"],
96
+ "sideEffects": [
97
+ "*.css"
98
+ ],
87
99
  "exports": {
88
100
  ".": {
89
101
  "types": "./dist/types/index.d.ts",
@@ -95,5 +107,9 @@
95
107
  "dependencies": {
96
108
  "clsx": "^2.1.1",
97
109
  "react-resize-detector": "^12.0.2"
110
+ },
111
+ "optionalDependencies": {
112
+ "@biomejs/cli-linux-x64": "^1.9.4",
113
+ "@rollup/rollup-linux-x64-gnu": "^4.34.9"
98
114
  }
99
115
  }