@stackone/hub 0.2.1 → 0.4.1

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 (53) hide show
  1. package/dist/index.d.ts +19 -0
  2. package/dist/index.esm.js +1 -0
  3. package/dist/index.js +1 -0
  4. package/dist/webcomponent.js +11 -0
  5. package/dist/webcomponent.js.map +1 -0
  6. package/package.json +16 -3
  7. package/.github/workflows/node-ci.yml +0 -20
  8. package/.github/workflows/release-please.yml +0 -37
  9. package/.github/workflows/semantic-pull-request.yml +0 -31
  10. package/.nvmrc +0 -1
  11. package/.release-please-manifest.json +0 -1
  12. package/CHANGELOG.md +0 -57
  13. package/biome.json +0 -77
  14. package/dev/index.html +0 -11
  15. package/dev/main.css +0 -80
  16. package/dev/main.tsx +0 -98
  17. package/dev/vite-env.d.ts +0 -15
  18. package/index.html +0 -14
  19. package/release-please-config.json +0 -5
  20. package/rollup.config.mjs +0 -72
  21. package/src/Hub.tsx +0 -50
  22. package/src/StackOneHub.tsx +0 -138
  23. package/src/WebComponentWrapper.tsx +0 -14
  24. package/src/index.ts +0 -1
  25. package/src/modules/csv-importer.tsx/CsvImporter.tsx +0 -35
  26. package/src/modules/integration-picker/IntegrationPicker.tsx +0 -98
  27. package/src/modules/integration-picker/components/IntegrationFields.tsx +0 -129
  28. package/src/modules/integration-picker/components/IntegrationList.tsx +0 -71
  29. package/src/modules/integration-picker/components/IntegrationPickerContent.tsx +0 -107
  30. package/src/modules/integration-picker/components/cardFooter.tsx +0 -92
  31. package/src/modules/integration-picker/components/cardTitle.tsx +0 -53
  32. package/src/modules/integration-picker/components/views/ErrorView.tsx +0 -9
  33. package/src/modules/integration-picker/components/views/IntegrationFormView.tsx +0 -22
  34. package/src/modules/integration-picker/components/views/IntegrationListView.tsx +0 -19
  35. package/src/modules/integration-picker/components/views/LoadingView.tsx +0 -11
  36. package/src/modules/integration-picker/components/views/SuccessView.tsx +0 -10
  37. package/src/modules/integration-picker/components/views/index.ts +0 -5
  38. package/src/modules/integration-picker/hooks/useIntegrationPicker.ts +0 -394
  39. package/src/modules/integration-picker/queries.ts +0 -78
  40. package/src/modules/integration-picker/types.ts +0 -70
  41. package/src/shared/categories.ts +0 -55
  42. package/src/shared/components/error.tsx +0 -32
  43. package/src/shared/components/errorBoundary.tsx +0 -31
  44. package/src/shared/components/loading.tsx +0 -30
  45. package/src/shared/components/success.tsx +0 -40
  46. package/src/shared/contexts/featureFlagContext.tsx +0 -26
  47. package/src/shared/hooks/useFeatureFlags.ts +0 -24
  48. package/src/shared/httpClient.ts +0 -79
  49. package/src/shared/queries.ts +0 -12
  50. package/src/shared/types/featureFlags.ts +0 -1
  51. package/src/types/types.ts +0 -1
  52. package/tsconfig.json +0 -19
  53. package/vite.config.ts +0 -11
@@ -1,55 +0,0 @@
1
- export const CATEGORIES = [
2
- 'ats',
3
- 'crm',
4
- 'hris',
5
- 'marketing',
6
- 'iam',
7
- 'lms',
8
- 'documents',
9
- 'ticketing',
10
- 'screening',
11
- 'messaging',
12
- ];
13
-
14
- export const CATEGORIES_WITH_LABELS = [
15
- {
16
- label: 'HRIS',
17
- value: 'hris',
18
- },
19
- {
20
- label: 'ATS',
21
- value: 'ats',
22
- },
23
- {
24
- label: 'CRM',
25
- value: 'crm',
26
- },
27
- {
28
- label: 'Marketing',
29
- value: 'marketing',
30
- },
31
- {
32
- label: 'IAM',
33
- value: 'iam',
34
- },
35
- {
36
- label: 'LMS',
37
- value: 'lms',
38
- },
39
- {
40
- label: 'Documents',
41
- value: 'documents',
42
- },
43
- {
44
- label: 'Ticketing',
45
- value: 'ticketing',
46
- },
47
- {
48
- label: 'Screening',
49
- value: 'screening',
50
- },
51
- {
52
- label: 'Messaging',
53
- value: 'messaging',
54
- },
55
- ];
@@ -1,32 +0,0 @@
1
- import {
2
- CustomIcons,
3
- Flex,
4
- FlexAlign,
5
- FlexDirection,
6
- FlexGapSize,
7
- FlexJustify,
8
- Typography,
9
- } from '@stackone/malachite';
10
-
11
- const ErrorContainer: React.FC = () => {
12
- return (
13
- <Flex
14
- justify={FlexJustify.Center}
15
- align={FlexAlign.Center}
16
- direction={FlexDirection.Vertical}
17
- gapSize={FlexGapSize.Small}
18
- fullHeight
19
- >
20
- {/* TODO: fix */}
21
- <CustomIcons.RejectIcon style={{ color: 'red' }} />
22
- <Typography.Text fontWeight="bold" size="large">
23
- Error
24
- </Typography.Text>
25
- <Typography.SecondaryText>
26
- Something went wrong, our team has been notified.
27
- </Typography.SecondaryText>
28
- </Flex>
29
- );
30
- };
31
-
32
- export default ErrorContainer;
@@ -1,31 +0,0 @@
1
- import React from 'react';
2
-
3
- class ErrorBoundary extends React.Component<
4
- { fallback: React.ReactNode; children: React.ReactNode },
5
- { hasError: boolean }
6
- > {
7
- constructor(props: { fallback: React.ReactNode; children: React.ReactNode }) {
8
- super(props);
9
- this.state = { hasError: false };
10
- }
11
-
12
- static getDerivedStateFromError(_error: Error) {
13
- // Update state so the next render will show the fallback UI.
14
- return { hasError: true };
15
- }
16
-
17
- componentDidCatch(_error: Error, _info: React.ErrorInfo) {
18
- // TODO: Log error to Sentry
19
- }
20
-
21
- render() {
22
- if (this.state.hasError) {
23
- // You can render any custom fallback UI
24
- return this.props.fallback;
25
- }
26
-
27
- return this.props.children;
28
- }
29
- }
30
-
31
- export default ErrorBoundary;
@@ -1,30 +0,0 @@
1
- import {
2
- Flex,
3
- FlexAlign,
4
- FlexDirection,
5
- FlexGapSize,
6
- FlexJustify,
7
- Spinner,
8
- Typography,
9
- } from '@stackone/malachite';
10
-
11
- export const Loading: React.FC<{
12
- title: string;
13
- description: string;
14
- }> = ({ title, description }) => {
15
- return (
16
- <Flex
17
- justify={FlexJustify.Center}
18
- align={FlexAlign.Center}
19
- direction={FlexDirection.Vertical}
20
- gapSize={FlexGapSize.Small}
21
- fullHeight
22
- >
23
- <Spinner size="xxxsmall" />
24
- <Typography.Text fontWeight="bold" size="large">
25
- {title}
26
- </Typography.Text>
27
- <Typography.SecondaryText>{description}</Typography.SecondaryText>
28
- </Flex>
29
- );
30
- };
@@ -1,40 +0,0 @@
1
- import {
2
- CustomIcons,
3
- Flex,
4
- FlexAlign,
5
- FlexDirection,
6
- FlexGapSize,
7
- FlexJustify,
8
- Typography,
9
- getCurrentTheme,
10
- } from '@stackone/malachite';
11
-
12
- interface SuccessProps {
13
- integrationName: string;
14
- }
15
-
16
- const Success: React.FC<SuccessProps> = ({ integrationName }) => {
17
- const theme = getCurrentTheme();
18
- return (
19
- <Flex
20
- justify={FlexJustify.Center}
21
- align={FlexAlign.Center}
22
- direction={FlexDirection.Vertical}
23
- gapSize={FlexGapSize.Small}
24
- fullHeight
25
- >
26
- <CustomIcons.CheckCircleFilled
27
- size={16}
28
- style={{ color: theme.colors.success.foreground }}
29
- />
30
- <Typography.Text fontWeight="bold" size="large">
31
- Connection Successful
32
- </Typography.Text>
33
- <Typography.SecondaryText>
34
- Account successfully connected to {integrationName}
35
- </Typography.SecondaryText>
36
- </Flex>
37
- );
38
- };
39
-
40
- export default Success;
@@ -1,26 +0,0 @@
1
- import { createContext, useMemo } from 'react';
2
- import { FeatureFlag } from '../types/featureFlags';
3
-
4
- export const FeatureFlagContext = createContext<{ featureFlags: FeatureFlag[] }>({
5
- featureFlags: [],
6
- });
7
-
8
- export const FeatureFlagProvider = ({
9
- featureFlags,
10
- children,
11
- }: {
12
- featureFlags: FeatureFlag[];
13
- children: React.ReactNode;
14
- }) => {
15
- const memoizedContextValue = useMemo(
16
- () => ({
17
- featureFlags,
18
- }),
19
- [featureFlags],
20
- );
21
- return (
22
- <FeatureFlagContext.Provider value={memoizedContextValue}>
23
- {children}
24
- </FeatureFlagContext.Provider>
25
- );
26
- };
@@ -1,24 +0,0 @@
1
- import { useContext } from 'react';
2
- import { FeatureFlagContext } from '../contexts/featureFlagContext';
3
- import { FeatureFlag } from '../types/featureFlags';
4
-
5
- const isFeatureEnabled = ({
6
- featureFlags,
7
- featureFlag,
8
- }: { featureFlags: FeatureFlag[]; featureFlag: FeatureFlag }): boolean => {
9
- return featureFlags.includes(featureFlag);
10
- };
11
-
12
- export const useFeatureFlags = (featureFlag: FeatureFlag): boolean => {
13
- const { featureFlags } = useContext(FeatureFlagContext);
14
- if (!featureFlags) {
15
- throw new Error('useFeatureFlags must be used within a FeatureFlagProvider');
16
- }
17
-
18
- return isFeatureEnabled({
19
- featureFlags,
20
- featureFlag,
21
- });
22
- };
23
-
24
- export default useFeatureFlags;
@@ -1,79 +0,0 @@
1
- export interface ErrorDetails {
2
- message: string;
3
- statusCode: number;
4
- }
5
-
6
- export const isErrorsDetails = (error: unknown): error is ErrorDetails => {
7
- return (error as ErrorDetails).statusCode !== undefined;
8
- };
9
-
10
- export interface RequestParams {
11
- url: string;
12
- body?: Record<string, unknown>;
13
- headers?: Record<string, string>;
14
- requestFn?: typeof fetch;
15
- logger?: Console;
16
- }
17
-
18
- const isTokenExpired = (response: Response): boolean => {
19
- if (response?.status === 401 || response?.status === 403) {
20
- return true;
21
- }
22
- return false;
23
- };
24
-
25
- export async function request<T>({
26
- url,
27
- body,
28
- headers,
29
- method,
30
- requestFn = fetch,
31
- logger = console,
32
- }: RequestParams & { method: 'PATCH' | 'POST' | 'DELETE' | 'GET' }): Promise<T | null> {
33
- try {
34
- const response = await requestFn(url, {
35
- method,
36
- headers,
37
- body: JSON.stringify(body),
38
- });
39
-
40
- if (isTokenExpired(response)) {
41
- logger.warn('Token expired');
42
- return null;
43
- } else {
44
- if (!response.ok) {
45
- const errorResponse = (await response.json()) as ErrorDetails;
46
- if (errorResponse && isErrorsDetails(errorResponse)) {
47
- throw new Error(
48
- JSON.stringify({
49
- status: errorResponse.statusCode,
50
- message: errorResponse.message,
51
- }),
52
- );
53
- }
54
- }
55
-
56
- return (await response.json()) as T;
57
- }
58
- } catch (error) {
59
- logger.error(`Error making request to ${url}`, error);
60
-
61
- throw error;
62
- }
63
- }
64
-
65
- export async function postRequest<T>(params: RequestParams): Promise<T | null> {
66
- return request<T>({ ...params, method: 'POST' });
67
- }
68
-
69
- export async function patchRequest<T>(params: RequestParams): Promise<T | null> {
70
- return request<T>({ ...params, method: 'PATCH' });
71
- }
72
-
73
- export async function deleteRequest<T>(params: RequestParams): Promise<T | null> {
74
- return request<T>({ ...params, method: 'DELETE' });
75
- }
76
-
77
- export async function getRequest<T>(params: RequestParams): Promise<T | null> {
78
- return request<T>({ ...params, method: 'GET' });
79
- }
@@ -1,12 +0,0 @@
1
- import { getRequest } from './httpClient';
2
- import { FeatureFlag } from './types/featureFlags';
3
-
4
- export const getSettings = async (baseUrl: string, token: string) => {
5
- return await getRequest<{ enabled_features: FeatureFlag[] }>({
6
- url: `${baseUrl}/hub/settings`,
7
- headers: {
8
- 'Content-Type': 'application/json',
9
- 'x-hub-session-token': token,
10
- },
11
- });
12
- };
@@ -1 +0,0 @@
1
- export type FeatureFlag = 'hub_link_account_release';
@@ -1 +0,0 @@
1
- export type HubModes = 'integration-picker' | 'csv-importer';
package/tsconfig.json DELETED
@@ -1,19 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES6",
4
- "module": "ESNext",
5
- "jsx": "react-jsx",
6
- "strict": true,
7
- "esModuleInterop": true,
8
- "skipLibCheck": true,
9
- "moduleResolution": "Node",
10
- "declaration": false,
11
- "outDir": "dist",
12
- "sourceMap": true,
13
- "jsxImportSource": "react",
14
- "forceConsistentCasingInFileNames": true
15
- },
16
- "include": ["src"],
17
- "exclude": ["**/*.d.ts"],
18
- "files": ["src/index.ts"]
19
- }
package/vite.config.ts DELETED
@@ -1,11 +0,0 @@
1
- import react from '@vitejs/plugin-react-swc';
2
- import { defineConfig } from 'vite';
3
-
4
- export default defineConfig({
5
- plugins: [react()],
6
- server: {
7
- port: 3000,
8
- // hmr: true,
9
- },
10
- root: 'dev',
11
- });