@shipfox/client-integrations 0.2.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.
- package/.storybook/main.ts +1 -0
- package/.storybook/preview.css +4 -0
- package/.storybook/preview.tsx +56 -0
- package/.turbo/turbo-build.log +2 -0
- package/.turbo/turbo-type$colon$emit.log +1 -0
- package/.turbo/turbo-type.log +1 -0
- package/CHANGELOG.md +207 -0
- package/LICENSE +21 -0
- package/dist/components/connection-picker.d.ts +7 -0
- package/dist/components/connection-picker.d.ts.map +1 -0
- package/dist/components/connection-picker.js +98 -0
- package/dist/components/connection-picker.js.map +1 -0
- package/dist/components/installed-integrations-section.d.ts +14 -0
- package/dist/components/installed-integrations-section.d.ts.map +1 -0
- package/dist/components/installed-integrations-section.js +203 -0
- package/dist/components/installed-integrations-section.js.map +1 -0
- package/dist/components/integration-delete-confirm-modal.d.ts +10 -0
- package/dist/components/integration-delete-confirm-modal.d.ts.map +1 -0
- package/dist/components/integration-delete-confirm-modal.js +61 -0
- package/dist/components/integration-delete-confirm-modal.js.map +1 -0
- package/dist/components/integration-gallery-for-workspace.d.ts +9 -0
- package/dist/components/integration-gallery-for-workspace.d.ts.map +1 -0
- package/dist/components/integration-gallery-for-workspace.js +169 -0
- package/dist/components/integration-gallery-for-workspace.js.map +1 -0
- package/dist/components/integration-gallery.d.ts +8 -0
- package/dist/components/integration-gallery.d.ts.map +1 -0
- package/dist/components/integration-gallery.js +26 -0
- package/dist/components/integration-gallery.js.map +1 -0
- package/dist/components/integration-gallery.stories.d.ts +26 -0
- package/dist/components/integration-gallery.stories.d.ts.map +1 -0
- package/dist/components/integration-gallery.stories.js +335 -0
- package/dist/components/integration-gallery.stories.js.map +1 -0
- package/dist/components/integration-usage-events.d.ts +4 -0
- package/dist/components/integration-usage-events.d.ts.map +1 -0
- package/dist/components/integration-usage-events.js +127 -0
- package/dist/components/integration-usage-events.js.map +1 -0
- package/dist/components/integration-usage-modal.d.ts +16 -0
- package/dist/components/integration-usage-modal.d.ts.map +1 -0
- package/dist/components/integration-usage-modal.js +184 -0
- package/dist/components/integration-usage-modal.js.map +1 -0
- package/dist/components/provider-grid.d.ts +14 -0
- package/dist/components/provider-grid.d.ts.map +1 -0
- package/dist/components/provider-grid.js +152 -0
- package/dist/components/provider-grid.js.map +1 -0
- package/dist/components/redirect-install-page.d.ts +19 -0
- package/dist/components/redirect-install-page.d.ts.map +1 -0
- package/dist/components/redirect-install-page.js +68 -0
- package/dist/components/redirect-install-page.js.map +1 -0
- package/dist/components/repository-picker.d.ts +15 -0
- package/dist/components/repository-picker.d.ts.map +1 -0
- package/dist/components/repository-picker.js +78 -0
- package/dist/components/repository-picker.js.map +1 -0
- package/dist/components/webhook/copyable-value.d.ts +10 -0
- package/dist/components/webhook/copyable-value.d.ts.map +1 -0
- package/dist/components/webhook/copyable-value.js +65 -0
- package/dist/components/webhook/copyable-value.js.map +1 -0
- package/dist/components/webhook/webhook-create-modal.d.ts +10 -0
- package/dist/components/webhook/webhook-create-modal.d.ts.map +1 -0
- package/dist/components/webhook/webhook-create-modal.js +233 -0
- package/dist/components/webhook/webhook-create-modal.js.map +1 -0
- package/dist/components/webhook/webhook-form-errors.d.ts +11 -0
- package/dist/components/webhook/webhook-form-errors.d.ts.map +1 -0
- package/dist/components/webhook/webhook-form-errors.js +27 -0
- package/dist/components/webhook/webhook-form-errors.js.map +1 -0
- package/dist/components/webhook/webhook-modals.stories.d.ts +25 -0
- package/dist/components/webhook/webhook-modals.stories.d.ts.map +1 -0
- package/dist/components/webhook/webhook-modals.stories.js +222 -0
- package/dist/components/webhook/webhook-modals.stories.js.map +1 -0
- package/dist/components/webhook/webhook-public-endpoint-alert.d.ts +2 -0
- package/dist/components/webhook/webhook-public-endpoint-alert.d.ts.map +1 -0
- package/dist/components/webhook/webhook-public-endpoint-alert.js +20 -0
- package/dist/components/webhook/webhook-public-endpoint-alert.js.map +1 -0
- package/dist/components/webhook/webhook-usage-details.d.ts +7 -0
- package/dist/components/webhook/webhook-usage-details.d.ts.map +1 -0
- package/dist/components/webhook/webhook-usage-details.js +49 -0
- package/dist/components/webhook/webhook-usage-details.js.map +1 -0
- package/dist/connection-status-badge.d.ts +12 -0
- package/dist/connection-status-badge.d.ts.map +1 -0
- package/dist/connection-status-badge.js +34 -0
- package/dist/connection-status-badge.js.map +1 -0
- package/dist/feature.d.ts +37 -0
- package/dist/feature.d.ts.map +1 -0
- package/dist/feature.js +48 -0
- package/dist/feature.js.map +1 -0
- package/dist/hooks/api/integrations.d.ts +265 -0
- package/dist/hooks/api/integrations.d.ts.map +1 -0
- package/dist/hooks/api/integrations.js +229 -0
- package/dist/hooks/api/integrations.js.map +1 -0
- package/dist/hooks/api/webhook-connections.d.ts +91 -0
- package/dist/hooks/api/webhook-connections.d.ts.map +1 -0
- package/dist/hooks/api/webhook-connections.js +97 -0
- package/dist/hooks/api/webhook-connections.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/integration-icon.d.ts +17 -0
- package/dist/integration-icon.d.ts.map +1 -0
- package/dist/integration-icon.js +22 -0
- package/dist/integration-icon.js.map +1 -0
- package/dist/linear-callback.d.ts +17 -0
- package/dist/linear-callback.d.ts.map +1 -0
- package/dist/linear-callback.js +113 -0
- package/dist/linear-callback.js.map +1 -0
- package/dist/pages/gitea-form-errors.d.ts +11 -0
- package/dist/pages/gitea-form-errors.d.ts.map +1 -0
- package/dist/pages/gitea-form-errors.js +35 -0
- package/dist/pages/gitea-form-errors.js.map +1 -0
- package/dist/pages/gitea-install-page.d.ts +2 -0
- package/dist/pages/gitea-install-page.d.ts.map +1 -0
- package/dist/pages/gitea-install-page.js +139 -0
- package/dist/pages/gitea-install-page.js.map +1 -0
- package/dist/pages/github-install-page.d.ts +2 -0
- package/dist/pages/github-install-page.d.ts.map +1 -0
- package/dist/pages/github-install-page.js +11 -0
- package/dist/pages/github-install-page.js.map +1 -0
- package/dist/pages/linear-callback-page.d.ts +2 -0
- package/dist/pages/linear-callback-page.d.ts.map +1 -0
- package/dist/pages/linear-callback-page.js +192 -0
- package/dist/pages/linear-callback-page.js.map +1 -0
- package/dist/pages/linear-install-page.d.ts +2 -0
- package/dist/pages/linear-install-page.d.ts.map +1 -0
- package/dist/pages/linear-install-page.js +24 -0
- package/dist/pages/linear-install-page.js.map +1 -0
- package/dist/pages/sentry-callback-page.d.ts +2 -0
- package/dist/pages/sentry-callback-page.d.ts.map +1 -0
- package/dist/pages/sentry-callback-page.js +256 -0
- package/dist/pages/sentry-callback-page.js.map +1 -0
- package/dist/pages/sentry-install-page.d.ts +2 -0
- package/dist/pages/sentry-install-page.d.ts.map +1 -0
- package/dist/pages/sentry-install-page.js +17 -0
- package/dist/pages/sentry-install-page.js.map +1 -0
- package/dist/pages/source-control-onboarding-page.d.ts +2 -0
- package/dist/pages/source-control-onboarding-page.d.ts.map +1 -0
- package/dist/pages/source-control-onboarding-page.js +37 -0
- package/dist/pages/source-control-onboarding-page.js.map +1 -0
- package/dist/provider-catalog.d.ts +15 -0
- package/dist/provider-catalog.d.ts.map +1 -0
- package/dist/provider-catalog.js +28 -0
- package/dist/provider-catalog.js.map +1 -0
- package/dist/routes/gitea.d.ts +6 -0
- package/dist/routes/gitea.d.ts.map +1 -0
- package/dist/routes/gitea.js +7 -0
- package/dist/routes/gitea.js.map +1 -0
- package/dist/routes/github-callback.d.ts +6 -0
- package/dist/routes/github-callback.d.ts.map +1 -0
- package/dist/routes/github-callback.js +129 -0
- package/dist/routes/github-callback.js.map +1 -0
- package/dist/routes/github.d.ts +6 -0
- package/dist/routes/github.d.ts.map +1 -0
- package/dist/routes/github.js +7 -0
- package/dist/routes/github.js.map +1 -0
- package/dist/routes/integrations.d.ts +6 -0
- package/dist/routes/integrations.d.ts.map +1 -0
- package/dist/routes/integrations.js +7 -0
- package/dist/routes/integrations.js.map +1 -0
- package/dist/routes/linear-callback.d.ts +6 -0
- package/dist/routes/linear-callback.d.ts.map +1 -0
- package/dist/routes/linear-callback.js +7 -0
- package/dist/routes/linear-callback.js.map +1 -0
- package/dist/routes/linear.d.ts +6 -0
- package/dist/routes/linear.d.ts.map +1 -0
- package/dist/routes/linear.js +7 -0
- package/dist/routes/linear.js.map +1 -0
- package/dist/routes/sentry-callback.d.ts +6 -0
- package/dist/routes/sentry-callback.d.ts.map +1 -0
- package/dist/routes/sentry-callback.js +7 -0
- package/dist/routes/sentry-callback.js.map +1 -0
- package/dist/routes/sentry.d.ts +6 -0
- package/dist/routes/sentry.d.ts.map +1 -0
- package/dist/routes/sentry.js +7 -0
- package/dist/routes/sentry.js.map +1 -0
- package/dist/sentry-callback.d.ts +35 -0
- package/dist/sentry-callback.d.ts.map +1 -0
- package/dist/sentry-callback.js +132 -0
- package/dist/sentry-callback.js.map +1 -0
- package/dist/tsconfig.test.tsbuildinfo +1 -0
- package/package.json +120 -0
- package/src/components/connection-picker.tsx +89 -0
- package/src/components/installed-integrations-section.tsx +198 -0
- package/src/components/integration-delete-confirm-modal.tsx +62 -0
- package/src/components/integration-gallery-for-workspace.tsx +193 -0
- package/src/components/integration-gallery.stories.tsx +302 -0
- package/src/components/integration-gallery.test.tsx +692 -0
- package/src/components/integration-gallery.tsx +49 -0
- package/src/components/integration-usage-events.test.ts +80 -0
- package/src/components/integration-usage-events.ts +116 -0
- package/src/components/integration-usage-modal.tsx +178 -0
- package/src/components/provider-grid.tsx +163 -0
- package/src/components/redirect-install-page.test.tsx +98 -0
- package/src/components/redirect-install-page.tsx +68 -0
- package/src/components/repository-picker.tsx +102 -0
- package/src/components/webhook/copyable-value.test.tsx +41 -0
- package/src/components/webhook/copyable-value.tsx +72 -0
- package/src/components/webhook/webhook-create-modal.tsx +247 -0
- package/src/components/webhook/webhook-form-errors.test.ts +45 -0
- package/src/components/webhook/webhook-form-errors.ts +32 -0
- package/src/components/webhook/webhook-modals.stories.tsx +225 -0
- package/src/components/webhook/webhook-public-endpoint-alert.tsx +15 -0
- package/src/components/webhook/webhook-usage-details.tsx +44 -0
- package/src/connection-status-badge.tsx +38 -0
- package/src/feature.ts +47 -0
- package/src/hooks/api/integrations.test.ts +105 -0
- package/src/hooks/api/integrations.ts +287 -0
- package/src/hooks/api/webhook-connections.ts +115 -0
- package/src/index.ts +16 -0
- package/src/integration-icon.react.test.tsx +40 -0
- package/src/integration-icon.test.ts +19 -0
- package/src/integration-icon.tsx +26 -0
- package/src/linear-callback.test.ts +227 -0
- package/src/linear-callback.ts +136 -0
- package/src/pages/gitea-form-errors.test.ts +55 -0
- package/src/pages/gitea-form-errors.ts +36 -0
- package/src/pages/gitea-install-page.tsx +108 -0
- package/src/pages/github-install-page.tsx +11 -0
- package/src/pages/linear-callback-page.test.tsx +157 -0
- package/src/pages/linear-callback-page.tsx +175 -0
- package/src/pages/linear-install-page.tsx +26 -0
- package/src/pages/sentry-callback-page.test.tsx +205 -0
- package/src/pages/sentry-callback-page.tsx +238 -0
- package/src/pages/sentry-install-page.tsx +17 -0
- package/src/pages/source-control-onboarding-page.test.tsx +46 -0
- package/src/pages/source-control-onboarding-page.tsx +26 -0
- package/src/provider-catalog.test.ts +42 -0
- package/src/provider-catalog.ts +49 -0
- package/src/routes/gitea.tsx +4 -0
- package/src/routes/github-callback.tsx +114 -0
- package/src/routes/github.tsx +4 -0
- package/src/routes/integrations.tsx +4 -0
- package/src/routes/linear-callback.tsx +4 -0
- package/src/routes/linear.tsx +4 -0
- package/src/routes/sentry-callback.tsx +4 -0
- package/src/routes/sentry.tsx +4 -0
- package/src/sentry-callback.test.ts +239 -0
- package/src/sentry-callback.ts +142 -0
- package/test/render.tsx +111 -0
- package/test/setup.ts +3 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +3 -0
- package/tsconfig.test.json +8 -0
- package/vercel.json +8 -0
- package/vitest.config.ts +75 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { WEBHOOK_RECEIVED_EVENT } from '@shipfox/api-integration-webhook-dto';
|
|
3
|
+
import { configureApiClient } from '@shipfox/client-api';
|
|
4
|
+
import { Toaster } from '@shipfox/react-ui/toast';
|
|
5
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
6
|
+
import { createMemoryHistory, createRootRoute, createRoute, createRouter, Outlet, RouterProvider } from '@tanstack/react-router';
|
|
7
|
+
import { useMemo } from 'react';
|
|
8
|
+
import { IntegrationDeleteConfirmModal } from '../integration-delete-confirm-modal.js';
|
|
9
|
+
import { IntegrationUsageModal } from '../integration-usage-modal.js';
|
|
10
|
+
import { CopyableValue } from './copyable-value.js';
|
|
11
|
+
import { WebhookCreateModal } from './webhook-create-modal.js';
|
|
12
|
+
import { WebhookPublicEndpointAlert } from './webhook-public-endpoint-alert.js';
|
|
13
|
+
import { WebhookUsageDetails } from './webhook-usage-details.js';
|
|
14
|
+
const WORKSPACE_ID = '11111111-1111-4111-8111-111111111111';
|
|
15
|
+
const CONNECTION_ID = '77777777-7777-4777-8777-777777777777';
|
|
16
|
+
const activeConnection = {
|
|
17
|
+
id: CONNECTION_ID,
|
|
18
|
+
workspace_id: WORKSPACE_ID,
|
|
19
|
+
name: 'Stripe production',
|
|
20
|
+
slug: 'stripe-prod',
|
|
21
|
+
lifecycle_status: 'active',
|
|
22
|
+
inbound_url: 'https://api.example.test/webhook/77777777-7777-4777-8777-777777777777',
|
|
23
|
+
created_at: '2026-04-12T00:00:00.000Z',
|
|
24
|
+
updated_at: '2026-04-12T00:00:00.000Z'
|
|
25
|
+
};
|
|
26
|
+
const disabledConnection = {
|
|
27
|
+
...activeConnection,
|
|
28
|
+
lifecycle_status: 'disabled'
|
|
29
|
+
};
|
|
30
|
+
const activeIntegrationConnection = {
|
|
31
|
+
id: CONNECTION_ID,
|
|
32
|
+
workspace_id: WORKSPACE_ID,
|
|
33
|
+
provider: 'webhook',
|
|
34
|
+
external_account_id: activeConnection.slug,
|
|
35
|
+
slug: activeConnection.slug,
|
|
36
|
+
display_name: activeConnection.name,
|
|
37
|
+
lifecycle_status: activeConnection.lifecycle_status,
|
|
38
|
+
capabilities: [],
|
|
39
|
+
created_at: activeConnection.created_at,
|
|
40
|
+
updated_at: activeConnection.updated_at
|
|
41
|
+
};
|
|
42
|
+
const disabledIntegrationConnection = {
|
|
43
|
+
...activeIntegrationConnection,
|
|
44
|
+
lifecycle_status: 'disabled'
|
|
45
|
+
};
|
|
46
|
+
function WebhookModalStory({ scenario }) {
|
|
47
|
+
const connection = scenario === 'usage-disabled' ? disabledConnection : activeConnection;
|
|
48
|
+
configureApiClient({
|
|
49
|
+
baseUrl: 'https://api.example.test',
|
|
50
|
+
fetchImpl: fetchForConnection(connection)
|
|
51
|
+
});
|
|
52
|
+
const queryClient = useMemo(()=>new QueryClient({
|
|
53
|
+
defaultOptions: {
|
|
54
|
+
queries: {
|
|
55
|
+
retry: false
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}), []);
|
|
59
|
+
const router = useMemo(()=>createStoryRouter(scenario), [
|
|
60
|
+
scenario
|
|
61
|
+
]);
|
|
62
|
+
return /*#__PURE__*/ _jsxs(QueryClientProvider, {
|
|
63
|
+
client: queryClient,
|
|
64
|
+
children: [
|
|
65
|
+
/*#__PURE__*/ _jsx(RouterProvider, {
|
|
66
|
+
router: router
|
|
67
|
+
}),
|
|
68
|
+
/*#__PURE__*/ _jsx(Toaster, {})
|
|
69
|
+
]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
const meta = {
|
|
73
|
+
title: 'Integrations/WebhookModals',
|
|
74
|
+
component: WebhookModalStory,
|
|
75
|
+
parameters: {
|
|
76
|
+
layout: 'fullscreen'
|
|
77
|
+
},
|
|
78
|
+
args: {
|
|
79
|
+
scenario: 'create-form'
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
export default meta;
|
|
83
|
+
export const Playground = {};
|
|
84
|
+
export const CreateSuccess = {
|
|
85
|
+
args: {
|
|
86
|
+
scenario: 'create-success'
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
export const UsageActive = {
|
|
90
|
+
args: {
|
|
91
|
+
scenario: 'usage-active'
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
export const UsageDisabled = {
|
|
95
|
+
args: {
|
|
96
|
+
scenario: 'usage-disabled'
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
export const DeleteConfirm = {
|
|
100
|
+
args: {
|
|
101
|
+
scenario: 'delete-confirm'
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
export const CopyableValueState = {
|
|
105
|
+
args: {
|
|
106
|
+
scenario: 'copyable-value'
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
function StorySurface({ scenario }) {
|
|
110
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
111
|
+
className: "min-h-screen bg-background-neutral-background p-24",
|
|
112
|
+
children: [
|
|
113
|
+
scenario === 'create-form' ? /*#__PURE__*/ _jsx(WebhookCreateModal, {
|
|
114
|
+
workspaceId: WORKSPACE_ID,
|
|
115
|
+
open: true,
|
|
116
|
+
onOpenChange: ()=>undefined,
|
|
117
|
+
onCreated: ()=>undefined
|
|
118
|
+
}) : null,
|
|
119
|
+
scenario === 'create-success' || scenario === 'usage-active' || scenario === 'usage-disabled' ? /*#__PURE__*/ _jsx(IntegrationUsageModal, {
|
|
120
|
+
connection: scenario === 'usage-disabled' ? disabledIntegrationConnection : activeIntegrationConnection,
|
|
121
|
+
events: [
|
|
122
|
+
{
|
|
123
|
+
value: WEBHOOK_RECEIVED_EVENT,
|
|
124
|
+
label: WEBHOOK_RECEIVED_EVENT
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
open: true,
|
|
128
|
+
onOpenChange: ()=>undefined,
|
|
129
|
+
children: /*#__PURE__*/ _jsx(WebhookUsageDetails, {
|
|
130
|
+
workspaceId: WORKSPACE_ID,
|
|
131
|
+
connectionId: CONNECTION_ID
|
|
132
|
+
})
|
|
133
|
+
}) : null,
|
|
134
|
+
scenario === 'delete-confirm' ? /*#__PURE__*/ _jsx(IntegrationDeleteConfirmModal, {
|
|
135
|
+
connectionName: activeConnection.name,
|
|
136
|
+
open: true,
|
|
137
|
+
isPending: false,
|
|
138
|
+
onOpenChange: ()=>undefined,
|
|
139
|
+
onConfirm: ()=>undefined
|
|
140
|
+
}) : null,
|
|
141
|
+
scenario === 'copyable-value' ? /*#__PURE__*/ _jsx("div", {
|
|
142
|
+
className: "mx-auto max-w-[560px] rounded-8 border border-border-neutral-base bg-background-neutral-base p-24",
|
|
143
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
144
|
+
className: "flex flex-col gap-12",
|
|
145
|
+
children: [
|
|
146
|
+
/*#__PURE__*/ _jsx(CopyableValue, {
|
|
147
|
+
label: "inbound URL",
|
|
148
|
+
value: activeConnection.inbound_url
|
|
149
|
+
}),
|
|
150
|
+
/*#__PURE__*/ _jsx(WebhookPublicEndpointAlert, {})
|
|
151
|
+
]
|
|
152
|
+
})
|
|
153
|
+
}) : null
|
|
154
|
+
]
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function createStoryRouter(scenario) {
|
|
158
|
+
const rootRoute = createRootRoute({
|
|
159
|
+
component: Outlet
|
|
160
|
+
});
|
|
161
|
+
const workspaceRoute = createRoute({
|
|
162
|
+
getParentRoute: ()=>rootRoute,
|
|
163
|
+
path: '/workspaces/$wid',
|
|
164
|
+
component: Outlet
|
|
165
|
+
});
|
|
166
|
+
const integrationsRoute = createRoute({
|
|
167
|
+
getParentRoute: ()=>workspaceRoute,
|
|
168
|
+
path: 'settings/integrations',
|
|
169
|
+
component: ()=>/*#__PURE__*/ _jsx(StorySurface, {
|
|
170
|
+
scenario: scenario
|
|
171
|
+
})
|
|
172
|
+
});
|
|
173
|
+
const eventsRoute = createRoute({
|
|
174
|
+
getParentRoute: ()=>workspaceRoute,
|
|
175
|
+
path: 'settings/events',
|
|
176
|
+
component: ()=>/*#__PURE__*/ _jsx("div", {})
|
|
177
|
+
});
|
|
178
|
+
return createRouter({
|
|
179
|
+
history: createMemoryHistory({
|
|
180
|
+
initialEntries: [
|
|
181
|
+
`/workspaces/${WORKSPACE_ID}/settings/integrations`
|
|
182
|
+
]
|
|
183
|
+
}),
|
|
184
|
+
routeTree: rootRoute.addChildren([
|
|
185
|
+
workspaceRoute.addChildren([
|
|
186
|
+
integrationsRoute,
|
|
187
|
+
eventsRoute
|
|
188
|
+
])
|
|
189
|
+
])
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function fetchForConnection(connection) {
|
|
193
|
+
return (input)=>{
|
|
194
|
+
const url = requestUrl(input);
|
|
195
|
+
if (url.pathname === '/integrations/webhook/connections') {
|
|
196
|
+
return Promise.resolve(jsonResponse({
|
|
197
|
+
connections: [
|
|
198
|
+
connection
|
|
199
|
+
]
|
|
200
|
+
}));
|
|
201
|
+
}
|
|
202
|
+
return Promise.resolve(jsonResponse({}, {
|
|
203
|
+
status: 404
|
|
204
|
+
}));
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
function requestUrl(input) {
|
|
208
|
+
if (typeof input === 'string') return new URL(input);
|
|
209
|
+
if (input instanceof URL) return input;
|
|
210
|
+
return new URL(input.url);
|
|
211
|
+
}
|
|
212
|
+
function jsonResponse(body, init = {}) {
|
|
213
|
+
return new Response(JSON.stringify(body), {
|
|
214
|
+
status: 200,
|
|
215
|
+
headers: {
|
|
216
|
+
'content-type': 'application/json'
|
|
217
|
+
},
|
|
218
|
+
...init
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
//# sourceMappingURL=webhook-modals.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/webhook/webhook-modals.stories.tsx"],"sourcesContent":["import type {IntegrationConnectionDto} from '@shipfox/api-integration-core-dto';\nimport type {WebhookConnectionDto} from '@shipfox/api-integration-webhook-dto';\nimport {WEBHOOK_RECEIVED_EVENT} from '@shipfox/api-integration-webhook-dto';\nimport {configureApiClient} from '@shipfox/client-api';\nimport {Toaster} from '@shipfox/react-ui/toast';\nimport type {Meta, StoryObj} from '@storybook/react';\nimport {QueryClient, QueryClientProvider} from '@tanstack/react-query';\nimport {\n createMemoryHistory,\n createRootRoute,\n createRoute,\n createRouter,\n Outlet,\n RouterProvider,\n} from '@tanstack/react-router';\nimport {useMemo} from 'react';\nimport {IntegrationDeleteConfirmModal} from '../integration-delete-confirm-modal.js';\nimport {IntegrationUsageModal} from '../integration-usage-modal.js';\nimport {CopyableValue} from './copyable-value.js';\nimport {WebhookCreateModal} from './webhook-create-modal.js';\nimport {WebhookPublicEndpointAlert} from './webhook-public-endpoint-alert.js';\nimport {WebhookUsageDetails} from './webhook-usage-details.js';\n\nconst WORKSPACE_ID = '11111111-1111-4111-8111-111111111111';\nconst CONNECTION_ID = '77777777-7777-4777-8777-777777777777';\n\ntype Scenario =\n | 'create-form'\n | 'create-success'\n | 'usage-active'\n | 'usage-disabled'\n | 'delete-confirm'\n | 'copyable-value';\n\ninterface WebhookModalStoryProps {\n scenario: Scenario;\n}\n\nconst activeConnection: WebhookConnectionDto = {\n id: CONNECTION_ID,\n workspace_id: WORKSPACE_ID,\n name: 'Stripe production',\n slug: 'stripe-prod',\n lifecycle_status: 'active',\n inbound_url: 'https://api.example.test/webhook/77777777-7777-4777-8777-777777777777',\n created_at: '2026-04-12T00:00:00.000Z',\n updated_at: '2026-04-12T00:00:00.000Z',\n};\n\nconst disabledConnection: WebhookConnectionDto = {\n ...activeConnection,\n lifecycle_status: 'disabled',\n};\n\nconst activeIntegrationConnection: IntegrationConnectionDto = {\n id: CONNECTION_ID,\n workspace_id: WORKSPACE_ID,\n provider: 'webhook',\n external_account_id: activeConnection.slug,\n slug: activeConnection.slug,\n display_name: activeConnection.name,\n lifecycle_status: activeConnection.lifecycle_status,\n capabilities: [],\n created_at: activeConnection.created_at,\n updated_at: activeConnection.updated_at,\n};\n\nconst disabledIntegrationConnection: IntegrationConnectionDto = {\n ...activeIntegrationConnection,\n lifecycle_status: 'disabled',\n};\n\nfunction WebhookModalStory({scenario}: WebhookModalStoryProps) {\n const connection = scenario === 'usage-disabled' ? disabledConnection : activeConnection;\n\n configureApiClient({\n baseUrl: 'https://api.example.test',\n fetchImpl: fetchForConnection(connection),\n });\n\n const queryClient = useMemo(\n () => new QueryClient({defaultOptions: {queries: {retry: false}}}),\n [],\n );\n const router = useMemo(() => createStoryRouter(scenario), [scenario]);\n\n return (\n <QueryClientProvider client={queryClient}>\n <RouterProvider router={router} />\n <Toaster />\n </QueryClientProvider>\n );\n}\n\nconst meta = {\n title: 'Integrations/WebhookModals',\n component: WebhookModalStory,\n parameters: {layout: 'fullscreen'},\n args: {scenario: 'create-form'},\n} satisfies Meta<typeof WebhookModalStory>;\n\nexport default meta;\ntype Story = StoryObj<typeof meta>;\n\nexport const Playground: Story = {};\n\nexport const CreateSuccess: Story = {\n args: {scenario: 'create-success'},\n};\n\nexport const UsageActive: Story = {\n args: {scenario: 'usage-active'},\n};\n\nexport const UsageDisabled: Story = {\n args: {scenario: 'usage-disabled'},\n};\n\nexport const DeleteConfirm: Story = {\n args: {scenario: 'delete-confirm'},\n};\n\nexport const CopyableValueState: Story = {\n args: {scenario: 'copyable-value'},\n};\n\nfunction StorySurface({scenario}: {scenario: Scenario}) {\n return (\n <div className=\"min-h-screen bg-background-neutral-background p-24\">\n {scenario === 'create-form' ? (\n <WebhookCreateModal\n workspaceId={WORKSPACE_ID}\n open\n onOpenChange={() => undefined}\n onCreated={() => undefined}\n />\n ) : null}\n {scenario === 'create-success' ||\n scenario === 'usage-active' ||\n scenario === 'usage-disabled' ? (\n <IntegrationUsageModal\n connection={\n scenario === 'usage-disabled'\n ? disabledIntegrationConnection\n : activeIntegrationConnection\n }\n events={[{value: WEBHOOK_RECEIVED_EVENT, label: WEBHOOK_RECEIVED_EVENT}]}\n open\n onOpenChange={() => undefined}\n >\n <WebhookUsageDetails workspaceId={WORKSPACE_ID} connectionId={CONNECTION_ID} />\n </IntegrationUsageModal>\n ) : null}\n {scenario === 'delete-confirm' ? (\n <IntegrationDeleteConfirmModal\n connectionName={activeConnection.name}\n open\n isPending={false}\n onOpenChange={() => undefined}\n onConfirm={() => undefined}\n />\n ) : null}\n {scenario === 'copyable-value' ? (\n <div className=\"mx-auto max-w-[560px] rounded-8 border border-border-neutral-base bg-background-neutral-base p-24\">\n <div className=\"flex flex-col gap-12\">\n <CopyableValue label=\"inbound URL\" value={activeConnection.inbound_url} />\n <WebhookPublicEndpointAlert />\n </div>\n </div>\n ) : null}\n </div>\n );\n}\n\nfunction createStoryRouter(scenario: Scenario) {\n const rootRoute = createRootRoute({component: Outlet});\n const workspaceRoute = createRoute({\n getParentRoute: () => rootRoute,\n path: '/workspaces/$wid',\n component: Outlet,\n });\n const integrationsRoute = createRoute({\n getParentRoute: () => workspaceRoute,\n path: 'settings/integrations',\n component: () => <StorySurface scenario={scenario} />,\n });\n const eventsRoute = createRoute({\n getParentRoute: () => workspaceRoute,\n path: 'settings/events',\n component: () => <div />,\n });\n\n return createRouter({\n history: createMemoryHistory({\n initialEntries: [`/workspaces/${WORKSPACE_ID}/settings/integrations`],\n }),\n routeTree: rootRoute.addChildren([\n workspaceRoute.addChildren([integrationsRoute, eventsRoute]),\n ]),\n });\n}\n\nfunction fetchForConnection(connection: WebhookConnectionDto): typeof fetch {\n return (input) => {\n const url = requestUrl(input);\n if (url.pathname === '/integrations/webhook/connections') {\n return Promise.resolve(jsonResponse({connections: [connection]}));\n }\n return Promise.resolve(jsonResponse({}, {status: 404}));\n };\n}\n\nfunction requestUrl(input: RequestInfo | URL): URL {\n if (typeof input === 'string') return new URL(input);\n if (input instanceof URL) return input;\n return new URL(input.url);\n}\n\nfunction jsonResponse(body: unknown, init: ResponseInit = {}) {\n return new Response(JSON.stringify(body), {\n status: 200,\n headers: {'content-type': 'application/json'},\n ...init,\n });\n}\n"],"names":["WEBHOOK_RECEIVED_EVENT","configureApiClient","Toaster","QueryClient","QueryClientProvider","createMemoryHistory","createRootRoute","createRoute","createRouter","Outlet","RouterProvider","useMemo","IntegrationDeleteConfirmModal","IntegrationUsageModal","CopyableValue","WebhookCreateModal","WebhookPublicEndpointAlert","WebhookUsageDetails","WORKSPACE_ID","CONNECTION_ID","activeConnection","id","workspace_id","name","slug","lifecycle_status","inbound_url","created_at","updated_at","disabledConnection","activeIntegrationConnection","provider","external_account_id","display_name","capabilities","disabledIntegrationConnection","WebhookModalStory","scenario","connection","baseUrl","fetchImpl","fetchForConnection","queryClient","defaultOptions","queries","retry","router","createStoryRouter","client","meta","title","component","parameters","layout","args","Playground","CreateSuccess","UsageActive","UsageDisabled","DeleteConfirm","CopyableValueState","StorySurface","div","className","workspaceId","open","onOpenChange","undefined","onCreated","events","value","label","connectionId","connectionName","isPending","onConfirm","rootRoute","workspaceRoute","getParentRoute","path","integrationsRoute","eventsRoute","history","initialEntries","routeTree","addChildren","input","url","requestUrl","pathname","Promise","resolve","jsonResponse","connections","status","URL","body","init","Response","JSON","stringify","headers"],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-public-endpoint-alert.d.ts","sourceRoot":"","sources":["../../../src/components/webhook/webhook-public-endpoint-alert.tsx"],"names":[],"mappings":"AAEA,wBAAgB,0BAA0B,gCAYzC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Callout, CalloutContent, CalloutDescription, CalloutTitle } from '@shipfox/react-ui/callout';
|
|
3
|
+
export function WebhookPublicEndpointAlert() {
|
|
4
|
+
return /*#__PURE__*/ _jsx(Callout, {
|
|
5
|
+
role: "alert",
|
|
6
|
+
type: "default",
|
|
7
|
+
children: /*#__PURE__*/ _jsxs(CalloutContent, {
|
|
8
|
+
children: [
|
|
9
|
+
/*#__PURE__*/ _jsx(CalloutTitle, {
|
|
10
|
+
children: "Public webhook endpoint"
|
|
11
|
+
}),
|
|
12
|
+
/*#__PURE__*/ _jsx(CalloutDescription, {
|
|
13
|
+
children: "Anyone with this URL can send webhook events to this source. You are responsible for verifying the received webhook in your workflow before trusting its payload."
|
|
14
|
+
})
|
|
15
|
+
]
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=webhook-public-endpoint-alert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/webhook/webhook-public-endpoint-alert.tsx"],"sourcesContent":["import {Callout, CalloutContent, CalloutDescription, CalloutTitle} from '@shipfox/react-ui/callout';\n\nexport function WebhookPublicEndpointAlert() {\n return (\n <Callout role=\"alert\" type=\"default\">\n <CalloutContent>\n <CalloutTitle>Public webhook endpoint</CalloutTitle>\n <CalloutDescription>\n Anyone with this URL can send webhook events to this source. You are responsible for\n verifying the received webhook in your workflow before trusting its payload.\n </CalloutDescription>\n </CalloutContent>\n </Callout>\n );\n}\n"],"names":["Callout","CalloutContent","CalloutDescription","CalloutTitle","WebhookPublicEndpointAlert","role","type"],"mappings":";AAAA,SAAQA,OAAO,EAAEC,cAAc,EAAEC,kBAAkB,EAAEC,YAAY,QAAO,4BAA4B;AAEpG,OAAO,SAASC;IACd,qBACE,KAACJ;QAAQK,MAAK;QAAQC,MAAK;kBACzB,cAAA,MAACL;;8BACC,KAACE;8BAAa;;8BACd,KAACD;8BAAmB;;;;;AAO5B"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface WebhookUsageDetailsProps {
|
|
2
|
+
workspaceId: string;
|
|
3
|
+
connectionId: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function WebhookUsageDetails({ workspaceId, connectionId }: WebhookUsageDetailsProps): import("react").JSX.Element | null;
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=webhook-usage-details.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhook-usage-details.d.ts","sourceRoot":"","sources":["../../../src/components/webhook/webhook-usage-details.tsx"],"names":[],"mappings":"AAOA,UAAU,wBAAwB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,mBAAmB,CAAC,EAAC,WAAW,EAAE,YAAY,EAAC,EAAE,wBAAwB,sCA+BxF"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { QueryLoadError } from '@shipfox/client-ui';
|
|
3
|
+
import { ShipfoxLoader } from '@shipfox/react-ui/loader';
|
|
4
|
+
import { Text } from '@shipfox/react-ui/typography';
|
|
5
|
+
import { useWebhookConnectionsQuery } from '#hooks/api/webhook-connections.js';
|
|
6
|
+
import { CopyableValue } from './copyable-value.js';
|
|
7
|
+
import { WebhookPublicEndpointAlert } from './webhook-public-endpoint-alert.js';
|
|
8
|
+
export function WebhookUsageDetails({ workspaceId, connectionId }) {
|
|
9
|
+
const connectionsQuery = useWebhookConnectionsQuery(workspaceId);
|
|
10
|
+
const connection = connectionsQuery.data?.connections.find((candidate)=>candidate.id === connectionId);
|
|
11
|
+
if (connectionsQuery.isPending) {
|
|
12
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
13
|
+
className: "flex min-h-80 items-center justify-center",
|
|
14
|
+
children: /*#__PURE__*/ _jsx(ShipfoxLoader, {
|
|
15
|
+
size: 32,
|
|
16
|
+
animation: "circular",
|
|
17
|
+
color: "orange",
|
|
18
|
+
background: "light"
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
if (connectionsQuery.isError && connectionsQuery.data === undefined) {
|
|
23
|
+
return /*#__PURE__*/ _jsx(QueryLoadError, {
|
|
24
|
+
query: connectionsQuery,
|
|
25
|
+
subject: "webhook details"
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
if (!connection) return null;
|
|
29
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
30
|
+
className: "flex w-full flex-col gap-16",
|
|
31
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
32
|
+
className: "flex w-full min-w-0 flex-col gap-8",
|
|
33
|
+
children: [
|
|
34
|
+
/*#__PURE__*/ _jsx(Text, {
|
|
35
|
+
size: "sm",
|
|
36
|
+
bold: true,
|
|
37
|
+
children: "Inbound URL"
|
|
38
|
+
}),
|
|
39
|
+
/*#__PURE__*/ _jsx(CopyableValue, {
|
|
40
|
+
label: "inbound URL",
|
|
41
|
+
value: connection.inbound_url
|
|
42
|
+
}),
|
|
43
|
+
/*#__PURE__*/ _jsx(WebhookPublicEndpointAlert, {})
|
|
44
|
+
]
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=webhook-usage-details.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/webhook/webhook-usage-details.tsx"],"sourcesContent":["import {QueryLoadError} from '@shipfox/client-ui';\nimport {ShipfoxLoader} from '@shipfox/react-ui/loader';\nimport {Text} from '@shipfox/react-ui/typography';\nimport {useWebhookConnectionsQuery} from '#hooks/api/webhook-connections.js';\nimport {CopyableValue} from './copyable-value.js';\nimport {WebhookPublicEndpointAlert} from './webhook-public-endpoint-alert.js';\n\ninterface WebhookUsageDetailsProps {\n workspaceId: string;\n connectionId: string;\n}\n\nexport function WebhookUsageDetails({workspaceId, connectionId}: WebhookUsageDetailsProps) {\n const connectionsQuery = useWebhookConnectionsQuery(workspaceId);\n const connection = connectionsQuery.data?.connections.find(\n (candidate) => candidate.id === connectionId,\n );\n\n if (connectionsQuery.isPending) {\n return (\n <div className=\"flex min-h-80 items-center justify-center\">\n <ShipfoxLoader size={32} animation=\"circular\" color=\"orange\" background=\"light\" />\n </div>\n );\n }\n\n if (connectionsQuery.isError && connectionsQuery.data === undefined) {\n return <QueryLoadError query={connectionsQuery} subject=\"webhook details\" />;\n }\n\n if (!connection) return null;\n\n return (\n <div className=\"flex w-full flex-col gap-16\">\n <div className=\"flex w-full min-w-0 flex-col gap-8\">\n <Text size=\"sm\" bold>\n Inbound URL\n </Text>\n <CopyableValue label=\"inbound URL\" value={connection.inbound_url} />\n <WebhookPublicEndpointAlert />\n </div>\n </div>\n );\n}\n"],"names":["QueryLoadError","ShipfoxLoader","Text","useWebhookConnectionsQuery","CopyableValue","WebhookPublicEndpointAlert","WebhookUsageDetails","workspaceId","connectionId","connectionsQuery","connection","data","connections","find","candidate","id","isPending","div","className","size","animation","color","background","isError","undefined","query","subject","bold","label","value","inbound_url"],"mappings":";AAAA,SAAQA,cAAc,QAAO,qBAAqB;AAClD,SAAQC,aAAa,QAAO,2BAA2B;AACvD,SAAQC,IAAI,QAAO,+BAA+B;AAClD,SAAQC,0BAA0B,QAAO,oCAAoC;AAC7E,SAAQC,aAAa,QAAO,sBAAsB;AAClD,SAAQC,0BAA0B,QAAO,qCAAqC;AAO9E,OAAO,SAASC,oBAAoB,EAACC,WAAW,EAAEC,YAAY,EAA2B;IACvF,MAAMC,mBAAmBN,2BAA2BI;IACpD,MAAMG,aAAaD,iBAAiBE,IAAI,EAAEC,YAAYC,KACpD,CAACC,YAAcA,UAAUC,EAAE,KAAKP;IAGlC,IAAIC,iBAAiBO,SAAS,EAAE;QAC9B,qBACE,KAACC;YAAIC,WAAU;sBACb,cAAA,KAACjB;gBAAckB,MAAM;gBAAIC,WAAU;gBAAWC,OAAM;gBAASC,YAAW;;;IAG9E;IAEA,IAAIb,iBAAiBc,OAAO,IAAId,iBAAiBE,IAAI,KAAKa,WAAW;QACnE,qBAAO,KAACxB;YAAeyB,OAAOhB;YAAkBiB,SAAQ;;IAC1D;IAEA,IAAI,CAAChB,YAAY,OAAO;IAExB,qBACE,KAACO;QAAIC,WAAU;kBACb,cAAA,MAACD;YAAIC,WAAU;;8BACb,KAAChB;oBAAKiB,MAAK;oBAAKQ,IAAI;8BAAC;;8BAGrB,KAACvB;oBAAcwB,OAAM;oBAAcC,OAAOnB,WAAWoB,WAAW;;8BAChE,KAACzB;;;;AAIT"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IntegrationConnectionLifecycleStatusDto } from '@shipfox/api-integration-core-dto';
|
|
2
|
+
export interface ConnectionStatusBadgeProps {
|
|
3
|
+
status: IntegrationConnectionLifecycleStatusDto;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Single source of truth for a connection's lifecycle pill, shared by the
|
|
8
|
+
* integration gallery and any surface that reflects source health. Renders
|
|
9
|
+
* nothing for the expected `active` state.
|
|
10
|
+
*/
|
|
11
|
+
export declare function ConnectionStatusBadge({ status, className }: ConnectionStatusBadgeProps): import("react").JSX.Element | null;
|
|
12
|
+
//# sourceMappingURL=connection-status-badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection-status-badge.d.ts","sourceRoot":"","sources":["../src/connection-status-badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,uCAAuC,EAAC,MAAM,mCAAmC,CAAC;AAc/F,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,uCAAuC,CAAC;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EAAC,MAAM,EAAE,SAAS,EAAC,EAAE,0BAA0B,sCAapF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Badge } from '@shipfox/react-ui/badge';
|
|
3
|
+
const lifecyclePills = {
|
|
4
|
+
// `active` is the expected state and carries no badge.
|
|
5
|
+
active: undefined,
|
|
6
|
+
disabled: {
|
|
7
|
+
variant: 'warning',
|
|
8
|
+
label: 'Disabled',
|
|
9
|
+
iconLeft: 'errorWarningLine'
|
|
10
|
+
},
|
|
11
|
+
error: {
|
|
12
|
+
variant: 'error',
|
|
13
|
+
label: 'Error'
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Single source of truth for a connection's lifecycle pill, shared by the
|
|
18
|
+
* integration gallery and any surface that reflects source health. Renders
|
|
19
|
+
* nothing for the expected `active` state.
|
|
20
|
+
*/ export function ConnectionStatusBadge({ status, className }) {
|
|
21
|
+
const pill = lifecyclePills[status];
|
|
22
|
+
if (!pill) return null;
|
|
23
|
+
return /*#__PURE__*/ _jsx(Badge, {
|
|
24
|
+
variant: pill.variant,
|
|
25
|
+
radius: "rounded",
|
|
26
|
+
className: className,
|
|
27
|
+
...pill.iconLeft ? {
|
|
28
|
+
iconLeft: pill.iconLeft
|
|
29
|
+
} : {},
|
|
30
|
+
children: pill.label
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=connection-status-badge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/connection-status-badge.tsx"],"sourcesContent":["import type {IntegrationConnectionLifecycleStatusDto} from '@shipfox/api-integration-core-dto';\nimport {Badge} from '@shipfox/react-ui/badge';\nimport type {IconName} from '@shipfox/react-ui/icon';\n\nconst lifecyclePills: Record<\n IntegrationConnectionLifecycleStatusDto,\n {variant: 'warning' | 'error'; label: string; iconLeft?: IconName} | undefined\n> = {\n // `active` is the expected state and carries no badge.\n active: undefined,\n disabled: {variant: 'warning', label: 'Disabled', iconLeft: 'errorWarningLine'},\n error: {variant: 'error', label: 'Error'},\n};\n\nexport interface ConnectionStatusBadgeProps {\n status: IntegrationConnectionLifecycleStatusDto;\n className?: string;\n}\n\n/**\n * Single source of truth for a connection's lifecycle pill, shared by the\n * integration gallery and any surface that reflects source health. Renders\n * nothing for the expected `active` state.\n */\nexport function ConnectionStatusBadge({status, className}: ConnectionStatusBadgeProps) {\n const pill = lifecyclePills[status];\n if (!pill) return null;\n return (\n <Badge\n variant={pill.variant}\n radius=\"rounded\"\n className={className}\n {...(pill.iconLeft ? {iconLeft: pill.iconLeft} : {})}\n >\n {pill.label}\n </Badge>\n );\n}\n"],"names":["Badge","lifecyclePills","active","undefined","disabled","variant","label","iconLeft","error","ConnectionStatusBadge","status","className","pill","radius"],"mappings":";AACA,SAAQA,KAAK,QAAO,0BAA0B;AAG9C,MAAMC,iBAGF;IACF,uDAAuD;IACvDC,QAAQC;IACRC,UAAU;QAACC,SAAS;QAAWC,OAAO;QAAYC,UAAU;IAAkB;IAC9EC,OAAO;QAACH,SAAS;QAASC,OAAO;IAAO;AAC1C;AAOA;;;;CAIC,GACD,OAAO,SAASG,sBAAsB,EAACC,MAAM,EAAEC,SAAS,EAA6B;IACnF,MAAMC,OAAOX,cAAc,CAACS,OAAO;IACnC,IAAI,CAACE,MAAM,OAAO;IAClB,qBACE,KAACZ;QACCK,SAASO,KAAKP,OAAO;QACrBQ,QAAO;QACPF,WAAWA;QACV,GAAIC,KAAKL,QAAQ,GAAG;YAACA,UAAUK,KAAKL,QAAQ;QAAA,IAAI,CAAC,CAAC;kBAElDK,KAAKN,KAAK;;AAGjB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const integrationsFeature: {
|
|
2
|
+
readonly id: "shipfox.integrations";
|
|
3
|
+
readonly routes: readonly [{
|
|
4
|
+
readonly path: "/integrations/github/callback";
|
|
5
|
+
readonly parent: "root";
|
|
6
|
+
readonly impl: "@shipfox/client-integrations/routes/github-callback";
|
|
7
|
+
}, {
|
|
8
|
+
readonly path: "/integrations/linear/callback";
|
|
9
|
+
readonly parent: "root";
|
|
10
|
+
readonly impl: "@shipfox/client-integrations/routes/linear-callback";
|
|
11
|
+
}, {
|
|
12
|
+
readonly path: "/integrations/sentry/callback";
|
|
13
|
+
readonly parent: "root";
|
|
14
|
+
readonly impl: "@shipfox/client-integrations/routes/sentry-callback";
|
|
15
|
+
}, {
|
|
16
|
+
readonly path: "/workspaces/$wid/integrations";
|
|
17
|
+
readonly parent: "workspaceLayout";
|
|
18
|
+
readonly impl: "@shipfox/client-integrations/routes/integrations";
|
|
19
|
+
}, {
|
|
20
|
+
readonly path: "/workspaces/$wid/integrations/gitea";
|
|
21
|
+
readonly parent: "workspaceLayout";
|
|
22
|
+
readonly impl: "@shipfox/client-integrations/routes/gitea";
|
|
23
|
+
}, {
|
|
24
|
+
readonly path: "/workspaces/$wid/integrations/github";
|
|
25
|
+
readonly parent: "workspaceLayout";
|
|
26
|
+
readonly impl: "@shipfox/client-integrations/routes/github";
|
|
27
|
+
}, {
|
|
28
|
+
readonly path: "/workspaces/$wid/integrations/linear";
|
|
29
|
+
readonly parent: "workspaceLayout";
|
|
30
|
+
readonly impl: "@shipfox/client-integrations/routes/linear";
|
|
31
|
+
}, {
|
|
32
|
+
readonly path: "/workspaces/$wid/integrations/sentry";
|
|
33
|
+
readonly parent: "workspaceLayout";
|
|
34
|
+
readonly impl: "@shipfox/client-integrations/routes/sentry";
|
|
35
|
+
}];
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=feature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../src/feature.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4C9B,CAAC"}
|
package/dist/feature.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { defineClientFeature } from '@shipfox/client-shell';
|
|
2
|
+
export const integrationsFeature = defineClientFeature({
|
|
3
|
+
id: 'shipfox.integrations',
|
|
4
|
+
routes: [
|
|
5
|
+
{
|
|
6
|
+
path: '/integrations/github/callback',
|
|
7
|
+
parent: 'root',
|
|
8
|
+
impl: '@shipfox/client-integrations/routes/github-callback'
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
path: '/integrations/linear/callback',
|
|
12
|
+
parent: 'root',
|
|
13
|
+
impl: '@shipfox/client-integrations/routes/linear-callback'
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
path: '/integrations/sentry/callback',
|
|
17
|
+
parent: 'root',
|
|
18
|
+
impl: '@shipfox/client-integrations/routes/sentry-callback'
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
path: '/workspaces/$wid/integrations',
|
|
22
|
+
parent: 'workspaceLayout',
|
|
23
|
+
impl: '@shipfox/client-integrations/routes/integrations'
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
path: '/workspaces/$wid/integrations/gitea',
|
|
27
|
+
parent: 'workspaceLayout',
|
|
28
|
+
impl: '@shipfox/client-integrations/routes/gitea'
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
path: '/workspaces/$wid/integrations/github',
|
|
32
|
+
parent: 'workspaceLayout',
|
|
33
|
+
impl: '@shipfox/client-integrations/routes/github'
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
path: '/workspaces/$wid/integrations/linear',
|
|
37
|
+
parent: 'workspaceLayout',
|
|
38
|
+
impl: '@shipfox/client-integrations/routes/linear'
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
path: '/workspaces/$wid/integrations/sentry',
|
|
42
|
+
parent: 'workspaceLayout',
|
|
43
|
+
impl: '@shipfox/client-integrations/routes/sentry'
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/feature.ts"],"sourcesContent":["import {defineClientFeature} from '@shipfox/client-shell';\n\nexport const integrationsFeature = defineClientFeature({\n id: 'shipfox.integrations',\n routes: [\n {\n path: '/integrations/github/callback',\n parent: 'root',\n impl: '@shipfox/client-integrations/routes/github-callback',\n },\n {\n path: '/integrations/linear/callback',\n parent: 'root',\n impl: '@shipfox/client-integrations/routes/linear-callback',\n },\n {\n path: '/integrations/sentry/callback',\n parent: 'root',\n impl: '@shipfox/client-integrations/routes/sentry-callback',\n },\n {\n path: '/workspaces/$wid/integrations',\n parent: 'workspaceLayout',\n impl: '@shipfox/client-integrations/routes/integrations',\n },\n {\n path: '/workspaces/$wid/integrations/gitea',\n parent: 'workspaceLayout',\n impl: '@shipfox/client-integrations/routes/gitea',\n },\n {\n path: '/workspaces/$wid/integrations/github',\n parent: 'workspaceLayout',\n impl: '@shipfox/client-integrations/routes/github',\n },\n {\n path: '/workspaces/$wid/integrations/linear',\n parent: 'workspaceLayout',\n impl: '@shipfox/client-integrations/routes/linear',\n },\n {\n path: '/workspaces/$wid/integrations/sentry',\n parent: 'workspaceLayout',\n impl: '@shipfox/client-integrations/routes/sentry',\n },\n ],\n});\n"],"names":["defineClientFeature","integrationsFeature","id","routes","path","parent","impl"],"mappings":"AAAA,SAAQA,mBAAmB,QAAO,wBAAwB;AAE1D,OAAO,MAAMC,sBAAsBD,oBAAoB;IACrDE,IAAI;IACJC,QAAQ;QACN;YACEC,MAAM;YACNC,QAAQ;YACRC,MAAM;QACR;QACA;YACEF,MAAM;YACNC,QAAQ;YACRC,MAAM;QACR;QACA;YACEF,MAAM;YACNC,QAAQ;YACRC,MAAM;QACR;QACA;YACEF,MAAM;YACNC,QAAQ;YACRC,MAAM;QACR;QACA;YACEF,MAAM;YACNC,QAAQ;YACRC,MAAM;QACR;QACA;YACEF,MAAM;YACNC,QAAQ;YACRC,MAAM;QACR;QACA;YACEF,MAAM;YACNC,QAAQ;YACRC,MAAM;QACR;QACA;YACEF,MAAM;YACNC,QAAQ;YACRC,MAAM;QACR;KACD;AACH,GAAG"}
|