diff --git a/dev/main.tsx b/dev/main.tsx index 8cd2494..802ef37 100644 --- a/dev/main.tsx +++ b/dev/main.tsx @@ -11,6 +11,7 @@ const HubWrapper: React.FC = () => { const [error, setError] = useState(); const [token, setToken] = useState(); const apiUrl = import.meta.env.VITE_API_URL ?? 'https://api.stackone.com'; + const appUrl = import.meta.env.VITE_APP_URL ?? 'https://app.stackone.com'; const [theme, setTheme] = useState<'light' | 'dark'>('light'); const [accountId, setAccountId] = useState(); @@ -81,6 +82,7 @@ const HubWrapper: React.FC = () => { setMode(undefined); }} accountId={accountId} + appUrl={appUrl} /> ); diff --git a/dev/vite-env.d.ts b/dev/vite-env.d.ts index 5af38cf..4998407 100644 --- a/dev/vite-env.d.ts +++ b/dev/vite-env.d.ts @@ -7,7 +7,7 @@ interface ImportMetaEnv { readonly VITE_ORIGIN_OWNER_NAME: string; readonly VITE_ORIGIN_USERNAME: string; readonly VITE_API_URL: string; - readonly VITE_DASHBOARD_URL: string; + readonly VITE_APP_URL: string; } export interface ImportMeta { diff --git a/src/StackOneHub.tsx b/src/StackOneHub.tsx index d84d31a..054e770 100644 --- a/src/StackOneHub.tsx +++ b/src/StackOneHub.tsx @@ -23,6 +23,7 @@ interface StackOneHubProps { mode?: HubModes; token?: string; baseUrl?: string; + appUrl?: string; height?: string; theme?: 'light' | 'dark' | PartialMalachiteTheme; accountId?: string; @@ -35,6 +36,7 @@ export const StackOneHub: React.FC = ({ mode, token, baseUrl, + appUrl, height = '500px', theme = 'light', accountId, @@ -44,6 +46,8 @@ export const StackOneHub: React.FC = ({ }) => { const defaultBaseUrl = 'https://api.stackone.com'; const apiUrl = baseUrl ?? defaultBaseUrl; + const defaultDashboardUrl = 'https://app.stackone.com'; + const dashboardUrl = appUrl ?? defaultDashboardUrl; useEffect(() => { if (theme === 'dark') { applyDarkTheme(); @@ -119,6 +123,7 @@ export const StackOneHub: React.FC = ({ void; onClose?: () => void; onCancel?: () => void; @@ -20,6 +21,7 @@ export const IntegrationPicker: React.FC = ({ height, accountId, onSuccess, + dashboardUrl, }) => { const { // Data @@ -48,6 +50,7 @@ export const IntegrationPicker: React.FC = ({ baseUrl, accountId, onSuccess, + dashboardUrl, }); return ( @@ -75,7 +78,7 @@ export const IntegrationPicker: React.FC = ({ hasError={hasError} connectionState={connectionState} selectedIntegration={selectedIntegration} - connectorData={connectorData ?? null} + connectorData={connectorData?.config ?? null} hubData={hubData ?? null} fields={fields} guide={guide} diff --git a/src/modules/integration-picker/components/IntegrationFields.tsx b/src/modules/integration-picker/components/IntegrationFields.tsx index 27f608a..8d29cf1 100644 --- a/src/modules/integration-picker/components/IntegrationFields.tsx +++ b/src/modules/integration-picker/components/IntegrationFields.tsx @@ -68,20 +68,21 @@ export const IntegrationForm: React.FC = ({ {error && {error.provider_response}} {fields.map((field) => { + const key = + typeof field.key === 'object' + ? JSON.stringify(field.key) + : String(field.key); return ( -
+
{(field.type === 'text' || field.type === 'number' || field.type === 'password') && ( - handleFieldChange(field.key, value) - } + onChange={(value: string) => handleFieldChange(key, value)} disabled={field.readOnly} label={field.label} tooltip={field.guide?.tooltip} @@ -92,14 +93,11 @@ export const IntegrationForm: React.FC = ({ {field.type === 'text_area' && (