@shipfox/client-integrations 5.0.0 → 6.0.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.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +64 -0
- package/dist/application/complete-integration-callback.d.ts +13 -0
- package/dist/application/complete-integration-callback.d.ts.map +1 -0
- package/dist/application/complete-integration-callback.js +26 -0
- package/dist/application/complete-integration-callback.js.map +1 -0
- package/dist/components/connection-picker.d.ts +2 -2
- package/dist/components/connection-picker.d.ts.map +1 -1
- package/dist/components/connection-picker.js +4 -4
- package/dist/components/connection-picker.js.map +1 -1
- package/dist/components/installed-integrations-section.d.ts +8 -6
- package/dist/components/installed-integrations-section.d.ts.map +1 -1
- package/dist/components/installed-integrations-section.js +22 -15
- package/dist/components/installed-integrations-section.js.map +1 -1
- package/dist/components/integration-gallery-for-workspace.d.ts +2 -2
- package/dist/components/integration-gallery-for-workspace.d.ts.map +1 -1
- package/dist/components/integration-gallery-for-workspace.js +14 -7
- package/dist/components/integration-gallery-for-workspace.js.map +1 -1
- package/dist/components/integration-gallery.d.ts +2 -2
- package/dist/components/integration-gallery.d.ts.map +1 -1
- package/dist/components/integration-gallery.js.map +1 -1
- package/dist/components/integration-usage-events.d.ts +1 -3
- package/dist/components/integration-usage-events.d.ts.map +1 -1
- package/dist/components/integration-usage-events.js +1 -125
- package/dist/components/integration-usage-events.js.map +1 -1
- package/dist/components/integration-usage-modal.d.ts +2 -2
- package/dist/components/integration-usage-modal.d.ts.map +1 -1
- package/dist/components/integration-usage-modal.js +2 -2
- package/dist/components/integration-usage-modal.js.map +1 -1
- package/dist/components/provider-grid.d.ts +7 -4
- package/dist/components/provider-grid.d.ts.map +1 -1
- package/dist/components/provider-grid.js +15 -10
- package/dist/components/provider-grid.js.map +1 -1
- package/dist/components/redirect-install-page.d.ts +2 -3
- package/dist/components/redirect-install-page.d.ts.map +1 -1
- package/dist/components/redirect-install-page.js +1 -1
- package/dist/components/redirect-install-page.js.map +1 -1
- package/dist/components/repository-picker.d.ts +2 -2
- package/dist/components/repository-picker.d.ts.map +1 -1
- package/dist/components/repository-picker.js +4 -4
- package/dist/components/repository-picker.js.map +1 -1
- package/dist/components/webhook/webhook-create-modal.d.ts +2 -2
- package/dist/components/webhook/webhook-create-modal.d.ts.map +1 -1
- package/dist/components/webhook/webhook-create-modal.js +8 -8
- package/dist/components/webhook/webhook-create-modal.js.map +1 -1
- package/dist/components/webhook/webhook-modals.stories.d.ts.map +1 -1
- package/dist/components/webhook/webhook-modals.stories.js +7 -7
- package/dist/components/webhook/webhook-modals.stories.js.map +1 -1
- package/dist/components/webhook/webhook-usage-details.d.ts.map +1 -1
- package/dist/components/webhook/webhook-usage-details.js +2 -2
- package/dist/components/webhook/webhook-usage-details.js.map +1 -1
- package/dist/connection-status-badge.d.ts +2 -2
- package/dist/connection-status-badge.d.ts.map +1 -1
- package/dist/connection-status-badge.js +11 -15
- package/dist/connection-status-badge.js.map +1 -1
- package/dist/core/models.d.ts +66 -0
- package/dist/core/models.d.ts.map +1 -0
- package/dist/core/models.js +156 -0
- package/dist/core/models.js.map +1 -0
- package/dist/feature.d.ts +7 -0
- package/dist/feature.d.ts.map +1 -1
- package/dist/feature.js +10 -9
- package/dist/feature.js.map +1 -1
- package/dist/hooks/api/integration-mapper.d.ts +11 -0
- package/dist/hooks/api/integration-mapper.d.ts.map +1 -0
- package/dist/hooks/api/integration-mapper.js +54 -0
- package/dist/hooks/api/integration-mapper.js.map +1 -0
- package/dist/hooks/api/integrations.d.ts +45 -240
- package/dist/hooks/api/integrations.d.ts.map +1 -1
- package/dist/hooks/api/integrations.js +78 -31
- package/dist/hooks/api/integrations.js.map +1 -1
- package/dist/hooks/api/webhook-connections.d.ts +12 -64
- package/dist/hooks/api/webhook-connections.d.ts.map +1 -1
- package/dist/hooks/api/webhook-connections.js +17 -9
- package/dist/hooks/api/webhook-connections.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/linear-callback.d.ts +2 -1
- package/dist/linear-callback.d.ts.map +1 -1
- package/dist/linear-callback.js +14 -15
- package/dist/linear-callback.js.map +1 -1
- package/dist/pages/gitea-install-page.d.ts.map +1 -1
- package/dist/pages/gitea-install-page.js +1 -10
- package/dist/pages/gitea-install-page.js.map +1 -1
- package/dist/pages/linear-callback-page.d.ts.map +1 -1
- package/dist/pages/linear-callback-page.js +19 -32
- package/dist/pages/linear-callback-page.js.map +1 -1
- package/dist/pages/linear-install-page.d.ts.map +1 -1
- package/dist/pages/linear-install-page.js +2 -1
- package/dist/pages/linear-install-page.js.map +1 -1
- package/dist/pages/sentry-callback-page.d.ts.map +1 -1
- package/dist/pages/sentry-callback-page.js +22 -25
- package/dist/pages/sentry-callback-page.js.map +1 -1
- package/dist/pages/sentry-install-page.d.ts.map +1 -1
- package/dist/pages/sentry-install-page.js +2 -1
- package/dist/pages/sentry-install-page.js.map +1 -1
- package/dist/pages/slack-callback-page.d.ts.map +1 -1
- package/dist/pages/slack-callback-page.js +21 -28
- package/dist/pages/slack-callback-page.js.map +1 -1
- package/dist/pages/slack-install-page.d.ts.map +1 -1
- package/dist/pages/slack-install-page.js +2 -1
- package/dist/pages/slack-install-page.js.map +1 -1
- package/dist/pages/source-control-onboarding-page.d.ts.map +1 -1
- package/dist/pages/source-control-onboarding-page.js +5 -1
- package/dist/pages/source-control-onboarding-page.js.map +1 -1
- package/dist/provider-catalog.d.ts.map +1 -1
- package/dist/provider-catalog.js +7 -6
- package/dist/provider-catalog.js.map +1 -1
- package/dist/routes/github-callback.d.ts +16 -0
- package/dist/routes/github-callback.d.ts.map +1 -1
- package/dist/routes/github-callback.js +43 -21
- package/dist/routes/github-callback.js.map +1 -1
- package/dist/routes/linear-callback.d.ts +2 -0
- package/dist/routes/linear-callback.d.ts.map +1 -1
- package/dist/routes/linear-callback.js +2 -0
- package/dist/routes/linear-callback.js.map +1 -1
- package/dist/routes/sentry-callback.d.ts +2 -0
- package/dist/routes/sentry-callback.d.ts.map +1 -1
- package/dist/routes/sentry-callback.js +2 -0
- package/dist/routes/sentry-callback.js.map +1 -1
- package/dist/routes/slack-callback.d.ts +2 -0
- package/dist/routes/slack-callback.d.ts.map +1 -1
- package/dist/routes/slack-callback.js +2 -0
- package/dist/routes/slack-callback.js.map +1 -1
- package/dist/sentry-callback.d.ts +2 -1
- package/dist/sentry-callback.d.ts.map +1 -1
- package/dist/sentry-callback.js +16 -19
- package/dist/sentry-callback.js.map +1 -1
- package/dist/slack-callback.d.ts +2 -1
- package/dist/slack-callback.d.ts.map +1 -1
- package/dist/slack-callback.js +14 -15
- package/dist/slack-callback.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +17 -17
- package/src/application/complete-integration-callback.test.ts +41 -0
- package/src/application/complete-integration-callback.ts +39 -0
- package/src/components/connection-picker.tsx +7 -7
- package/src/components/installed-integrations-section.tsx +29 -24
- package/src/components/integration-gallery-for-workspace.tsx +23 -16
- package/src/components/integration-gallery.tsx +3 -3
- package/src/components/integration-usage-events.ts +1 -116
- package/src/components/integration-usage-modal.tsx +4 -4
- package/src/components/provider-grid.tsx +30 -18
- package/src/components/redirect-install-page.test.tsx +2 -6
- package/src/components/redirect-install-page.tsx +3 -2
- package/src/components/repository-picker.tsx +6 -6
- package/src/components/webhook/webhook-create-modal.tsx +12 -11
- package/src/components/webhook/webhook-modals.stories.tsx +10 -10
- package/src/components/webhook/webhook-usage-details.tsx +2 -4
- package/src/connection-status-badge.tsx +8 -14
- package/src/core/models.ts +200 -0
- package/src/feature.ts +12 -10
- package/src/hooks/api/integration-mapper.ts +64 -0
- package/src/hooks/api/integrations.test.ts +44 -22
- package/src/hooks/api/integrations.ts +229 -84
- package/src/hooks/api/webhook-connections.ts +58 -17
- package/src/index.ts +2 -1
- package/src/linear-callback.ts +21 -16
- package/src/pages/gitea-install-page.tsx +1 -10
- package/src/pages/linear-callback-page.tsx +18 -30
- package/src/pages/linear-install-page.tsx +2 -1
- package/src/pages/sentry-callback-page.test.tsx +5 -1
- package/src/pages/sentry-callback-page.tsx +28 -25
- package/src/pages/sentry-install-page.tsx +2 -1
- package/src/pages/slack-callback-page.tsx +20 -26
- package/src/pages/slack-install-page.tsx +2 -1
- package/src/pages/source-control-onboarding-page.tsx +5 -1
- package/src/provider-catalog.ts +7 -6
- package/src/routes/github-callback.test.ts +35 -1
- package/src/routes/github-callback.tsx +47 -21
- package/src/routes/linear-callback.tsx +5 -1
- package/src/routes/sentry-callback.tsx +5 -1
- package/src/routes/slack-callback.tsx +6 -1
- package/src/sentry-callback.test.ts +2 -1
- package/src/sentry-callback.ts +28 -20
- package/src/slack-callback.ts +21 -16
- package/tsconfig.build.tsbuildinfo +1 -1
- package/vercel.json +5 -0
- package/dist/integration-icon.d.ts +0 -17
- package/dist/integration-icon.d.ts.map +0 -1
- package/dist/integration-icon.js +0 -22
- package/dist/integration-icon.js.map +0 -1
- package/src/integration-icon.react.test.tsx +0 -40
- package/src/integration-icon.test.ts +0 -19
- package/src/integration-icon.tsx +0 -26
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/webhook/webhook-create-modal.tsx"],"sourcesContent":["import type {IntegrationConnectionDto} from '@shipfox/api-integration-core-dto';\nimport {\n createWebhookConnectionBodySchema,\n WEBHOOK_RESERVED_SLUGS,\n type WebhookConnectionDto,\n webhookSlugSchema,\n} from '@shipfox/api-integration-webhook-dto';\nimport {displayNameFieldError} from '@shipfox/client-ui';\nimport {Button} from '@shipfox/react-ui/button';\nimport {Callout} from '@shipfox/react-ui/callout';\nimport {FormField, FormFieldInput, fieldError} from '@shipfox/react-ui/form-field';\nimport {\n Modal,\n ModalBody,\n ModalContent,\n ModalFooter,\n ModalHeader,\n ModalTitle,\n} from '@shipfox/react-ui/modal';\nimport {toast} from '@shipfox/react-ui/toast';\nimport {Code, Text} from '@shipfox/react-ui/typography';\nimport {useForm} from '@tanstack/react-form';\nimport {useEffect, useRef, useState} from 'react';\nimport {useCreateWebhookConnectionMutation} from '#hooks/api/webhook-connections.js';\nimport {webhookCreateErrorToFormError} from './webhook-form-errors.js';\n\ninterface WebhookCreateModalProps {\n workspaceId: string;\n open: boolean;\n onOpenChange: (open: boolean) => void;\n onCreated: (connection: IntegrationConnectionDto) => void;\n}\n\nexport function WebhookCreateModal({\n workspaceId,\n open,\n onOpenChange,\n onCreated,\n}: WebhookCreateModalProps) {\n const createWebhook = useCreateWebhookConnectionMutation();\n const [formError, setFormError] = useState<string | undefined>();\n const [hasManualSlug, setHasManualSlug] = useState(false);\n const nameInputRef = useRef<HTMLInputElement | null>(null);\n\n const form = useForm({\n defaultValues: {name: '', slug: ''},\n onSubmit: async ({value}) => {\n setFormError(undefined);\n try {\n const body = createWebhookConnectionBodySchema.parse({\n workspace_id: workspaceId,\n name: value.name.trim(),\n slug: value.slug.trim(),\n });\n const connection = await createWebhook.mutateAsync(body);\n onCreated(toIntegrationConnection(connection));\n toast.success('Webhook created.');\n onOpenChange(false);\n } catch (error) {\n const mapped = webhookCreateErrorToFormError(error);\n if (mapped.kind === 'field') {\n form.setFieldMeta(mapped.field, (prev) => ({\n ...prev,\n errorMap: {...prev.errorMap, onServer: mapped.message},\n }));\n } else {\n setFormError(mapped.message);\n }\n }\n },\n });\n\n useEffect(() => {\n if (!open) {\n setFormError(undefined);\n setHasManualSlug(false);\n form.reset();\n return;\n }\n requestAnimationFrame(() => nameInputRef.current?.focus());\n }, [form, open]);\n\n const handleOpenChange = (nextOpen: boolean) => {\n if (createWebhook.isPending && !nextOpen) return;\n onOpenChange(nextOpen);\n };\n\n return (\n <Modal open={open} onOpenChange={handleOpenChange}>\n <ModalContent aria-describedby={undefined}>\n <ModalTitle className=\"sr-only\">Add webhook</ModalTitle>\n <ModalHeader title=\"Add webhook\" showClose={!createWebhook.isPending} />\n <form\n noValidate\n onSubmit={(event) => {\n event.preventDefault();\n event.stopPropagation();\n void form.handleSubmit();\n }}\n >\n <ModalBody className=\"gap-16\">\n <Text size=\"sm\" className=\"text-foreground-neutral-muted\">\n Create a named inbound webhook URL for this workspace.\n </Text>\n {formError ? (\n <Callout role=\"alert\" type=\"error\">\n {formError}\n </Callout>\n ) : null}\n <form.Field\n name=\"name\"\n validators={{\n onBlur: ({value}) => webhookNameFieldError(value),\n onSubmit: ({value}) => webhookNameFieldError(value),\n }}\n >\n {(field) => (\n <FormField\n label=\"Name\"\n id=\"webhook-name\"\n error={fieldError(field)}\n className=\"w-full\"\n >\n <FormFieldInput\n ref={nameInputRef}\n name=\"name\"\n value={field.state.value}\n onChange={(event) => {\n const nextName = event.target.value;\n field.handleChange(nextName);\n if (!hasManualSlug) {\n form.setFieldValue(\n 'slug',\n nextName.trim() ? suggestWebhookSlug(nextName) : '',\n );\n }\n }}\n onBlur={field.handleBlur}\n placeholder=\"Stripe production\"\n disabled={createWebhook.isPending}\n />\n </FormField>\n )}\n </form.Field>\n <form.Field\n name=\"slug\"\n validators={{\n onBlur: ({value}) => webhookSlugFieldError(value),\n onSubmit: ({value}) => webhookSlugFieldError(value),\n }}\n >\n {(field) => (\n <FormField\n label=\"Slug\"\n id=\"webhook-slug\"\n error={fieldError(field)}\n className=\"w-full\"\n >\n <FormFieldInput\n name=\"slug\"\n value={field.state.value}\n onChange={(event) => {\n const nextSlug = event.target.value;\n setHasManualSlug(nextSlug.trim().length > 0);\n field.handleChange(nextSlug);\n if (nextSlug.trim().length === 0 && form.state.values.name.trim()) {\n form.setFieldValue('slug', suggestWebhookSlug(form.state.values.name));\n }\n }}\n onBlur={field.handleBlur}\n placeholder=\"webhook-stripe-production\"\n disabled={createWebhook.isPending}\n />\n <Text size=\"sm\" className=\"text-foreground-neutral-muted\">\n Reference in workflows with{' '}\n <Code as=\"span\">\n source: {field.state.value || 'webhook-stripe-production'}\n </Code>\n .\n </Text>\n </FormField>\n )}\n </form.Field>\n </ModalBody>\n <ModalFooter>\n <Button\n type=\"button\"\n variant=\"secondary\"\n disabled={createWebhook.isPending}\n onClick={() => onOpenChange(false)}\n >\n Cancel\n </Button>\n <Button type=\"submit\" isLoading={createWebhook.isPending}>\n Create\n </Button>\n </ModalFooter>\n </form>\n </ModalContent>\n </Modal>\n );\n}\n\nfunction webhookNameFieldError(value: string): string | undefined {\n return displayNameFieldError(\n value.trim(),\n 'Webhook name',\n createWebhookConnectionBodySchema.shape.name,\n );\n}\n\nfunction webhookSlugFieldError(value: string): string | undefined {\n const trimmed = value.trim();\n if (trimmed.length === 0) return 'Slug is required.';\n if (WEBHOOK_RESERVED_SLUGS.includes(trimmed as (typeof WEBHOOK_RESERVED_SLUGS)[number])) {\n return 'That slug is reserved.';\n }\n if (webhookSlugSchema.safeParse(trimmed).success) return undefined;\n return 'Use lowercase letters, numbers, hyphens, or underscores.';\n}\n\nfunction suggestWebhookSlug(name: string): string {\n const prefix = 'webhook';\n const suffix = name\n .toLowerCase()\n .replaceAll(/[^a-z0-9]+/g, '-')\n .replaceAll(/^-+|-+$/g, '')\n .slice(0, 100 - prefix.length - 1)\n .replaceAll(/-+$/g, '');\n\n return suffix ? `${prefix}-${suffix}` : prefix;\n}\n\nfunction toIntegrationConnection(connection: WebhookConnectionDto): IntegrationConnectionDto {\n return {\n id: connection.id,\n workspace_id: connection.workspace_id,\n provider: 'webhook',\n external_account_id: connection.slug,\n slug: connection.slug,\n display_name: connection.name,\n lifecycle_status: connection.lifecycle_status,\n capabilities: [],\n created_at: connection.created_at,\n updated_at: connection.updated_at,\n };\n}\n"],"names":["createWebhookConnectionBodySchema","WEBHOOK_RESERVED_SLUGS","webhookSlugSchema","displayNameFieldError","Button","Callout","FormField","FormFieldInput","fieldError","Modal","ModalBody","ModalContent","ModalFooter","ModalHeader","ModalTitle","toast","Code","Text","useForm","useEffect","useRef","useState","useCreateWebhookConnectionMutation","webhookCreateErrorToFormError","WebhookCreateModal","workspaceId","open","onOpenChange","onCreated","createWebhook","formError","setFormError","hasManualSlug","setHasManualSlug","nameInputRef","form","defaultValues","name","slug","onSubmit","value","undefined","body","parse","workspace_id","trim","connection","mutateAsync","toIntegrationConnection","success","error","mapped","kind","setFieldMeta","field","prev","errorMap","onServer","message","reset","requestAnimationFrame","current","focus","handleOpenChange","nextOpen","isPending","aria-describedby","className","title","showClose","noValidate","event","preventDefault","stopPropagation","handleSubmit","size","role","type","Field","validators","onBlur","webhookNameFieldError","label","id","ref","state","onChange","nextName","target","handleChange","setFieldValue","suggestWebhookSlug","handleBlur","placeholder","disabled","webhookSlugFieldError","nextSlug","length","values","as","variant","onClick","isLoading","shape","trimmed","includes","safeParse","prefix","suffix","toLowerCase","replaceAll","slice","provider","external_account_id","display_name","lifecycle_status","capabilities","created_at","updated_at"],"mappings":";AACA,SACEA,iCAAiC,EACjCC,sBAAsB,EAEtBC,iBAAiB,QACZ,uCAAuC;AAC9C,SAAQC,qBAAqB,QAAO,qBAAqB;AACzD,SAAQC,MAAM,QAAO,2BAA2B;AAChD,SAAQC,OAAO,QAAO,4BAA4B;AAClD,SAAQC,SAAS,EAAEC,cAAc,EAAEC,UAAU,QAAO,+BAA+B;AACnF,SACEC,KAAK,EACLC,SAAS,EACTC,YAAY,EACZC,WAAW,EACXC,WAAW,EACXC,UAAU,QACL,0BAA0B;AACjC,SAAQC,KAAK,QAAO,0BAA0B;AAC9C,SAAQC,IAAI,EAAEC,IAAI,QAAO,+BAA+B;AACxD,SAAQC,OAAO,QAAO,uBAAuB;AAC7C,SAAQC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAO,QAAQ;AAClD,SAAQC,kCAAkC,QAAO,oCAAoC;AACrF,SAAQC,6BAA6B,QAAO,2BAA2B;AASvE,OAAO,SAASC,mBAAmB,EACjCC,WAAW,EACXC,IAAI,EACJC,YAAY,EACZC,SAAS,EACe;IACxB,MAAMC,gBAAgBP;IACtB,MAAM,CAACQ,WAAWC,aAAa,GAAGV;IAClC,MAAM,CAACW,eAAeC,iBAAiB,GAAGZ,SAAS;IACnD,MAAMa,eAAed,OAAgC;IA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OAAO,EAAE,OAAOR;IACzD,OAAO;AACT;AAEA,SAASkD,mBAAmBtD,IAAY;IACtC,MAAMsE,SAAS;IACf,MAAMC,SAASvE,KACZwE,WAAW,GACXC,UAAU,CAAC,eAAe,KAC1BA,UAAU,CAAC,YAAY,IACvBC,KAAK,CAAC,GAAG,MAAMJ,OAAOV,MAAM,GAAG,GAC/Ba,UAAU,CAAC,QAAQ;IAEtB,OAAOF,SAAS,GAAGD,OAAO,CAAC,EAAEC,QAAQ,GAAGD;AAC1C;AAEA,SAAS3D,wBAAwBF,UAAgC;IAC/D,OAAO;QACLqC,IAAIrC,WAAWqC,EAAE;QACjBvC,cAAcE,WAAWF,YAAY;QACrCoE,UAAU;QACVC,qBAAqBnE,WAAWR,IAAI;QACpCA,MAAMQ,WAAWR,IAAI;QACrB4E,cAAcpE,WAAWT,IAAI;QAC7B8E,kBAAkBrE,WAAWqE,gBAAgB;QAC7CC,cAAc,EAAE;QAChBC,YAAYvE,WAAWuE,UAAU;QACjCC,YAAYxE,WAAWwE,UAAU;IACnC;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/webhook/webhook-create-modal.tsx"],"sourcesContent":["import {\n createWebhookConnectionBodySchema,\n WEBHOOK_RESERVED_SLUGS,\n webhookSlugSchema,\n} from '@shipfox/api-integration-webhook-dto';\nimport {displayNameFieldError} from '@shipfox/client-ui';\nimport {Button} from '@shipfox/react-ui/button';\nimport {Callout} from '@shipfox/react-ui/callout';\nimport {FormField, FormFieldInput, fieldError} from '@shipfox/react-ui/form-field';\nimport {\n Modal,\n ModalBody,\n ModalContent,\n ModalFooter,\n ModalHeader,\n ModalTitle,\n} from '@shipfox/react-ui/modal';\nimport {toast} from '@shipfox/react-ui/toast';\nimport {Code, Text} from '@shipfox/react-ui/typography';\nimport {useForm} from '@tanstack/react-form';\nimport {useEffect, useRef, useState} from 'react';\nimport type {IntegrationConnection, WebhookConnection} from '#core/models.js';\nimport {useCreateWebhookConnectionMutation} from '#hooks/api/webhook-connections.js';\nimport {webhookCreateErrorToFormError} from './webhook-form-errors.js';\n\ninterface WebhookCreateModalProps {\n workspaceId: string;\n open: boolean;\n onOpenChange: (open: boolean) => void;\n onCreated: (connection: IntegrationConnection) => void;\n}\n\nexport function WebhookCreateModal({\n workspaceId,\n open,\n onOpenChange,\n onCreated,\n}: WebhookCreateModalProps) {\n const createWebhook = useCreateWebhookConnectionMutation();\n const [formError, setFormError] = useState<string | undefined>();\n const [hasManualSlug, setHasManualSlug] = useState(false);\n const nameInputRef = useRef<HTMLInputElement | null>(null);\n\n const form = useForm({\n defaultValues: {name: '', slug: ''},\n onSubmit: async ({value}) => {\n setFormError(undefined);\n try {\n const body = createWebhookConnectionBodySchema.parse({\n workspace_id: workspaceId,\n name: value.name.trim(),\n slug: value.slug.trim(),\n });\n const connection = await createWebhook.mutateAsync(body);\n onCreated(webhookConnectionToIntegrationConnection(connection));\n toast.success('Webhook created.');\n onOpenChange(false);\n } catch (error) {\n const mapped = webhookCreateErrorToFormError(error);\n if (mapped.kind === 'field') {\n form.setFieldMeta(mapped.field, (prev) => ({\n ...prev,\n errorMap: {...prev.errorMap, onServer: mapped.message},\n }));\n } else {\n setFormError(mapped.message);\n }\n }\n },\n });\n\n useEffect(() => {\n if (!open) {\n setFormError(undefined);\n setHasManualSlug(false);\n form.reset();\n return;\n }\n requestAnimationFrame(() => nameInputRef.current?.focus());\n }, [form, open]);\n\n const handleOpenChange = (nextOpen: boolean) => {\n if (createWebhook.isPending && !nextOpen) return;\n onOpenChange(nextOpen);\n };\n\n return (\n <Modal open={open} onOpenChange={handleOpenChange}>\n <ModalContent aria-describedby={undefined}>\n <ModalTitle className=\"sr-only\">Add webhook</ModalTitle>\n <ModalHeader title=\"Add webhook\" showClose={!createWebhook.isPending} />\n <form\n noValidate\n onSubmit={(event) => {\n event.preventDefault();\n event.stopPropagation();\n void form.handleSubmit();\n }}\n >\n <ModalBody className=\"gap-16\">\n <Text size=\"sm\" className=\"text-foreground-neutral-muted\">\n Create a named inbound webhook URL for this workspace.\n </Text>\n {formError ? (\n <Callout role=\"alert\" type=\"error\">\n {formError}\n </Callout>\n ) : null}\n <form.Field\n name=\"name\"\n validators={{\n onBlur: ({value}) => webhookNameFieldError(value),\n onSubmit: ({value}) => webhookNameFieldError(value),\n }}\n >\n {(field) => (\n <FormField\n label=\"Name\"\n id=\"webhook-name\"\n error={fieldError(field)}\n className=\"w-full\"\n >\n <FormFieldInput\n ref={nameInputRef}\n name=\"name\"\n value={field.state.value}\n onChange={(event) => {\n const nextName = event.target.value;\n field.handleChange(nextName);\n if (!hasManualSlug) {\n form.setFieldValue(\n 'slug',\n nextName.trim() ? suggestWebhookSlug(nextName) : '',\n );\n }\n }}\n onBlur={field.handleBlur}\n placeholder=\"Stripe production\"\n disabled={createWebhook.isPending}\n />\n </FormField>\n )}\n </form.Field>\n <form.Field\n name=\"slug\"\n validators={{\n onBlur: ({value}) => webhookSlugFieldError(value),\n onSubmit: ({value}) => webhookSlugFieldError(value),\n }}\n >\n {(field) => (\n <FormField\n label=\"Slug\"\n id=\"webhook-slug\"\n error={fieldError(field)}\n className=\"w-full\"\n >\n <FormFieldInput\n name=\"slug\"\n value={field.state.value}\n onChange={(event) => {\n const nextSlug = event.target.value;\n setHasManualSlug(nextSlug.trim().length > 0);\n field.handleChange(nextSlug);\n if (nextSlug.trim().length === 0 && form.state.values.name.trim()) {\n form.setFieldValue('slug', suggestWebhookSlug(form.state.values.name));\n }\n }}\n onBlur={field.handleBlur}\n placeholder=\"webhook-stripe-production\"\n disabled={createWebhook.isPending}\n />\n <Text size=\"sm\" className=\"text-foreground-neutral-muted\">\n Reference in workflows with{' '}\n <Code as=\"span\">\n source: {field.state.value || 'webhook-stripe-production'}\n </Code>\n .\n </Text>\n </FormField>\n )}\n </form.Field>\n </ModalBody>\n <ModalFooter>\n <Button\n type=\"button\"\n variant=\"secondary\"\n disabled={createWebhook.isPending}\n onClick={() => onOpenChange(false)}\n >\n Cancel\n </Button>\n <Button type=\"submit\" isLoading={createWebhook.isPending}>\n Create\n </Button>\n </ModalFooter>\n </form>\n </ModalContent>\n </Modal>\n );\n}\n\nfunction webhookNameFieldError(value: string): string | undefined {\n return displayNameFieldError(\n value.trim(),\n 'Webhook name',\n createWebhookConnectionBodySchema.shape.name,\n );\n}\n\nfunction webhookSlugFieldError(value: string): string | undefined {\n const trimmed = value.trim();\n if (trimmed.length === 0) return 'Slug is required.';\n if (WEBHOOK_RESERVED_SLUGS.includes(trimmed as (typeof WEBHOOK_RESERVED_SLUGS)[number])) {\n return 'That slug is reserved.';\n }\n if (webhookSlugSchema.safeParse(trimmed).success) return undefined;\n return 'Use lowercase letters, numbers, hyphens, or underscores.';\n}\n\nfunction suggestWebhookSlug(name: string): string {\n const prefix = 'webhook';\n const suffix = name\n .toLowerCase()\n .replaceAll(/[^a-z0-9]+/g, '-')\n .replaceAll(/^-+|-+$/g, '')\n .slice(0, 100 - prefix.length - 1)\n .replaceAll(/-+$/g, '');\n\n return suffix ? `${prefix}-${suffix}` : prefix;\n}\n\nfunction webhookConnectionToIntegrationConnection(\n connection: WebhookConnection,\n): IntegrationConnection {\n return {\n id: connection.id,\n workspaceId: connection.workspaceId,\n provider: 'webhook',\n externalAccountId: connection.slug,\n slug: connection.slug,\n displayName: connection.name,\n lifecycleStatus: connection.lifecycleStatus,\n capabilities: [],\n createdAt: connection.createdAt,\n updatedAt: connection.updatedAt,\n };\n}\n"],"names":["createWebhookConnectionBodySchema","WEBHOOK_RESERVED_SLUGS","webhookSlugSchema","displayNameFieldError","Button","Callout","FormField","FormFieldInput","fieldError","Modal","ModalBody","ModalContent","ModalFooter","ModalHeader","ModalTitle","toast","Code","Text","useForm","useEffect","useRef","useState","useCreateWebhookConnectionMutation","webhookCreateErrorToFormError","WebhookCreateModal","workspaceId","open","onOpenChange","onCreated","createWebhook","formError","setFormError","hasManualSlug","setHasManualSlug","nameInputRef","form","defaultValues","name","slug","onSubmit","value","undefined","body","parse","workspace_id","trim","connection","mutateAsync","webhookConnectionToIntegrationConnection","success","error","mapped","kind","setFieldMeta","field","prev","errorMap","onServer","message","reset","requestAnimationFrame","current","focus","handleOpenChange","nextOpen","isPending","aria-describedby","className","title","showClose","noValidate","event","preventDefault","stopPropagation","handleSubmit","size","role","type","Field","validators","onBlur","webhookNameFieldError","label","id","ref","state","onChange","nextName","target","handleChange","setFieldValue","suggestWebhookSlug","handleBlur","placeholder","disabled","webhookSlugFieldError","nextSlug","length","values","as","variant","onClick","isLoading","shape","trimmed","includes","safeParse","prefix","suffix","toLowerCase","replaceAll","slice","provider","externalAccountId","displayName","lifecycleStatus","capabilities","createdAt","updatedAt"],"mappings":";AAAA,SACEA,iCAAiC,EACjCC,sBAAsB,EACtBC,iBAAiB,QACZ,uCAAuC;AAC9C,SAAQC,qBAAqB,QAAO,qBAAqB;AACzD,SAAQC,MAAM,QAAO,2BAA2B;AAChD,SAAQC,OAAO,QAAO,4BAA4B;AAClD,SAAQC,SAAS,EAAEC,cAAc,EAAEC,UAAU,QAAO,+BAA+B;AACnF,SACEC,KAAK,EACLC,SAAS,EACTC,YAAY,EACZC,WAAW,EACXC,WAAW,EACXC,UAAU,QACL,0BAA0B;AACjC,SAAQC,KAAK,QAAO,0BAA0B;AAC9C,SAAQC,IAAI,EAAEC,IAAI,QAAO,+BAA+B;AACxD,SAAQC,OAAO,QAAO,uBAAuB;AAC7C,SAAQC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAO,QAAQ;AAElD,SAAQC,kCAAkC,QAAO,oCAAoC;AACrF,SAAQC,6BAA6B,QAAO,2BAA2B;AASvE,OAAO,SAASC,mBAAmB,EACjCC,WAAW,EACXC,IAAI,EACJC,YAAY,EACZC,SAAS,EACe;IACxB,MAAMC,gBAAgBP;IACtB,MAAM,CAACQ,WAAWC,aAAa,GAAGV;IAClC,MAAM,CAACW,eAAeC,iBAAiB,GAAGZ,SAAS;IACnD,MAAMa,eAAed,OAAgC;IAErD,MAAMe,OAAOjB,QAAQ;QACnBkB,eAAe;Y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SAASkD,mBAAmBtD,IAAY;IACtC,MAAMsE,SAAS;IACf,MAAMC,SAASvE,KACZwE,WAAW,GACXC,UAAU,CAAC,eAAe,KAC1BA,UAAU,CAAC,YAAY,IACvBC,KAAK,CAAC,GAAG,MAAMJ,OAAOV,MAAM,GAAG,GAC/Ba,UAAU,CAAC,QAAQ;IAEtB,OAAOF,SAAS,GAAGD,OAAO,CAAC,EAAEC,QAAQ,GAAGD;AAC1C;AAEA,SAAS3D,yCACPF,UAA6B;IAE7B,OAAO;QACLqC,IAAIrC,WAAWqC,EAAE;QACjB1D,aAAaqB,WAAWrB,WAAW;QACnCuF,UAAU;QACVC,mBAAmBnE,WAAWR,IAAI;QAClCA,MAAMQ,WAAWR,IAAI;QACrB4E,aAAapE,WAAWT,IAAI;QAC5B8E,iBAAiBrE,WAAWqE,eAAe;QAC3CC,cAAc,EAAE;QAChBC,WAAWvE,WAAWuE,SAAS;QAC/BC,WAAWxE,WAAWwE,SAAS;IACjC;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook-modals.stories.d.ts","sourceRoot":"","sources":["../../../src/components/webhook/webhook-modals.stories.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webhook-modals.stories.d.ts","sourceRoot":"","sources":["../../../src/components/webhook/webhook-modals.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAO,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAsBrD,KAAK,QAAQ,GACT,aAAa,GACb,gBAAgB,GAChB,cAAc,GACd,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,CAAC;AAErB,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAoCD,iBAAS,iBAAiB,CAAC,EAAC,QAAQ,EAAC,EAAE,sBAAsB,+BAoB5D;AAED,QAAA,MAAM,IAAI;;;;;;;;;CAKgC,CAAC;AAE3C,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,UAAU,EAAE,KAAU,CAAC;AAEpC,eAAO,MAAM,aAAa,EAAE,KAE3B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAEzB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAE3B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAE3B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,KAEhC,CAAC"}
|
|
@@ -29,19 +29,19 @@ const disabledConnection = {
|
|
|
29
29
|
};
|
|
30
30
|
const activeIntegrationConnection = {
|
|
31
31
|
id: CONNECTION_ID,
|
|
32
|
-
|
|
32
|
+
workspaceId: WORKSPACE_ID,
|
|
33
33
|
provider: 'webhook',
|
|
34
|
-
|
|
34
|
+
externalAccountId: activeConnection.slug,
|
|
35
35
|
slug: activeConnection.slug,
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
displayName: activeConnection.name,
|
|
37
|
+
lifecycleStatus: activeConnection.lifecycle_status,
|
|
38
38
|
capabilities: [],
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
createdAt: activeConnection.created_at,
|
|
40
|
+
updatedAt: activeConnection.updated_at
|
|
41
41
|
};
|
|
42
42
|
const disabledIntegrationConnection = {
|
|
43
43
|
...activeIntegrationConnection,
|
|
44
|
-
|
|
44
|
+
lifecycleStatus: 'disabled'
|
|
45
45
|
};
|
|
46
46
|
function WebhookModalStory({ scenario }) {
|
|
47
47
|
const connection = scenario === 'usage-disabled' ? disabledConnection : activeConnection;
|
|
@@ -1 +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":";AAEA,SAAQA,sBAAsB,QAAO,uCAAuC;AAC5E,SAAQC,kBAAkB,QAAO,sBAAsB;AACvD,SAAQC,OAAO,QAAO,0BAA0B;AAEhD,SAAQC,WAAW,EAAEC,mBAAmB,QAAO,wBAAwB;AACvE,SACEC,mBAAmB,EACnBC,eAAe,EACfC,WAAW,EACXC,YAAY,EACZC,MAAM,EACNC,cAAc,QACT,yBAAyB;AAChC,SAAQC,OAAO,QAAO,QAAQ;AAC9B,SAAQC,6BAA6B,QAAO,yCAAyC;AACrF,SAAQC,qBAAqB,QAAO,gCAAgC;AACpE,SAAQC,aAAa,QAAO,sBAAsB;AAClD,SAAQC,kBAAkB,QAAO,4BAA4B;AAC7D,SAAQC,0BAA0B,QAAO,qCAAqC;AAC9E,SAAQC,mBAAmB,QAAO,6BAA6B;AAE/D,MAAMC,eAAe;AACrB,MAAMC,gBAAgB;AActB,MAAMC,mBAAyC;IAC7CC,IAAIF;IACJG,cAAcJ;IACdK,MAAM;IACNC,MAAM;IACNC,kBAAkB;IA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BAAaxB,UAAUA;;IAC3C;IACA,MAAM4C,cAAc1E,YAAY;QAC9BuE,gBAAgB,IAAMD;QACtBE,MAAM;QACN5B,WAAW,kBAAM,KAACW;IACpB;IAEA,OAAOtD,aAAa;QAClB0E,SAAS7E,oBAAoB;YAC3B8E,gBAAgB;gBAAC,CAAC,YAAY,EAAEjE,aAAa,sBAAsB,CAAC;aAAC;QACvE;QACAkE,WAAWR,UAAUS,WAAW,CAAC;YAC/BR,eAAeQ,WAAW,CAAC;gBAACL;gBAAmBC;aAAY;SAC5D;IACH;AACF;AAEA,SAASxC,mBAAmBH,UAAgC;IAC1D,OAAO,CAACgD;QACN,MAAMC,MAAMC,WAAWF;QACvB,IAAIC,IAAIE,QAAQ,KAAK,qCAAqC;YACxD,OAAOC,QAAQC,OAAO,CAACC,aAAa;gBAACC,aAAa;oBAACvD;iBAAW;YAAA;QAChE;QACA,OAAOoD,QAAQC,OAAO,CAACC,aAAa,CAAC,GAAG;YAACE,QAAQ;QAAG;IACtD;AACF;AAEA,SAASN,WAAWF,KAAwB;IAC1C,IAAI,OAAOA,UAAU,UAAU,OAAO,IAAIS,IAAIT;IAC9C,IAAIA,iBAAiBS,KAAK,OAAOT;IACjC,OAAO,IAAIS,IAAIT,MAAMC,GAAG;AAC1B;AAEA,SAASK,aAAaI,IAAa,EAAEC,OAAqB,CAAC,CAAC;IAC1D,OAAO,IAAIC,SAASC,KAAKC,SAAS,CAACJ,OAAO;QACxCF,QAAQ;QACRO,SAAS;YAAC,gBAAgB;QAAkB;QAC5C,GAAGJ,IAAI;IACT;AACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/webhook/webhook-modals.stories.tsx"],"sourcesContent":["import 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 type {IntegrationConnection} from '#core/models.js';\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: IntegrationConnection = {\n id: CONNECTION_ID,\n workspaceId: WORKSPACE_ID,\n provider: 'webhook',\n externalAccountId: activeConnection.slug,\n slug: activeConnection.slug,\n displayName: activeConnection.name,\n lifecycleStatus: activeConnection.lifecycle_status,\n capabilities: [],\n createdAt: activeConnection.created_at,\n updatedAt: activeConnection.updated_at,\n};\n\nconst disabledIntegrationConnection: IntegrationConnection = {\n ...activeIntegrationConnection,\n lifecycleStatus: '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","workspaceId","provider","externalAccountId","displayName","lifecycleStatus","capabilities","createdAt","updatedAt","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","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":";AACA,SAAQA,sBAAsB,QAAO,uCAAuC;AAC5E,SAAQC,kBAAkB,QAAO,sBAAsB;AACvD,SAAQC,OAAO,QAAO,0BAA0B;AAEhD,SAAQC,WAAW,EAAEC,mBAAmB,QAAO,wBAAwB;AACvE,SACEC,mBAAmB,EACnBC,eAAe,EACfC,WAAW,EACXC,YAAY,EACZC,MAAM,EACNC,cAAc,QACT,yBAAyB;AAChC,SAAQC,OAAO,QAAO,QAAQ;AAE9B,SAAQC,6BAA6B,QAAO,yCAAyC;AACrF,SAAQC,qBAAqB,QAAO,gCAAgC;AACpE,SAAQC,aAAa,QAAO,sBAAsB;AAClD,SAAQC,kBAAkB,QAAO,4BAA4B;AAC7D,SAAQC,0BAA0B,QAAO,qCAAqC;AAC9E,SAAQC,mBAAmB,QAAO,6BAA6B;AAE/D,MAAMC,eAAe;AACrB,MAAMC,gBAAgB;AActB,MAAMC,mBAAyC;IAC7CC,IAAIF;IACJG,cAAcJ;IACdK,MAAM;IACNC,MAAM;IACNC,kBAAkB;IAClBC,aA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;;IAC3C;IACA,MAAM2C,cAAc7E,YAAY;QAC9B0E,gBAAgB,IAAMD;QACtBE,MAAM;QACN3B,WAAW,kBAAM,KAACW;IACpB;IAEA,OAAO1D,aAAa;QAClB6E,SAAShF,oBAAoB;YAC3BiF,gBAAgB;gBAAC,CAAC,YAAY,EAAEpE,aAAa,sBAAsB,CAAC;aAAC;QACvE;QACAqE,WAAWR,UAAUS,WAAW,CAAC;YAC/BR,eAAeQ,WAAW,CAAC;gBAACL;gBAAmBC;aAAY;SAC5D;IACH;AACF;AAEA,SAASvC,mBAAmBH,UAAgC;IAC1D,OAAO,CAAC+C;QACN,MAAMC,MAAMC,WAAWF;QACvB,IAAIC,IAAIE,QAAQ,KAAK,qCAAqC;YACxD,OAAOC,QAAQC,OAAO,CAACC,aAAa;gBAACC,aAAa;oBAACtD;iBAAW;YAAA;QAChE;QACA,OAAOmD,QAAQC,OAAO,CAACC,aAAa,CAAC,GAAG;YAACE,QAAQ;QAAG;IACtD;AACF;AAEA,SAASN,WAAWF,KAAwB;IAC1C,IAAI,OAAOA,UAAU,UAAU,OAAO,IAAIS,IAAIT;IAC9C,IAAIA,iBAAiBS,KAAK,OAAOT;IACjC,OAAO,IAAIS,IAAIT,MAAMC,GAAG;AAC1B;AAEA,SAASK,aAAaI,IAAa,EAAEC,OAAqB,CAAC,CAAC;IAC1D,OAAO,IAAIC,SAASC,KAAKC,SAAS,CAACJ,OAAO;QACxCF,QAAQ;QACRO,SAAS;YAAC,gBAAgB;QAAkB;QAC5C,GAAGJ,IAAI;IACT;AACF"}
|
|
@@ -1 +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,
|
|
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,sCA6BxF"}
|
|
@@ -7,7 +7,7 @@ import { CopyableValue } from './copyable-value.js';
|
|
|
7
7
|
import { WebhookPublicEndpointAlert } from './webhook-public-endpoint-alert.js';
|
|
8
8
|
export function WebhookUsageDetails({ workspaceId, connectionId }) {
|
|
9
9
|
const connectionsQuery = useWebhookConnectionsQuery(workspaceId);
|
|
10
|
-
const connection = connectionsQuery.data?.
|
|
10
|
+
const connection = connectionsQuery.data?.find((candidate)=>candidate.id === connectionId);
|
|
11
11
|
if (connectionsQuery.isPending) {
|
|
12
12
|
return /*#__PURE__*/ _jsx("div", {
|
|
13
13
|
className: "flex min-h-80 items-center justify-center",
|
|
@@ -38,7 +38,7 @@ export function WebhookUsageDetails({ workspaceId, connectionId }) {
|
|
|
38
38
|
}),
|
|
39
39
|
/*#__PURE__*/ _jsx(CopyableValue, {
|
|
40
40
|
label: "inbound URL",
|
|
41
|
-
value: connection.
|
|
41
|
+
value: connection.inboundUrl
|
|
42
42
|
}),
|
|
43
43
|
/*#__PURE__*/ _jsx(WebhookPublicEndpointAlert, {})
|
|
44
44
|
]
|
|
@@ -1 +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?.
|
|
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?.find((candidate) => candidate.id === connectionId);\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.inboundUrl} />\n <WebhookPublicEndpointAlert />\n </div>\n </div>\n );\n}\n"],"names":["QueryLoadError","ShipfoxLoader","Text","useWebhookConnectionsQuery","CopyableValue","WebhookPublicEndpointAlert","WebhookUsageDetails","workspaceId","connectionId","connectionsQuery","connection","data","find","candidate","id","isPending","div","className","size","animation","color","background","isError","undefined","query","subject","bold","label","value","inboundUrl"],"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,KAAK,CAACC,YAAcA,UAAUC,EAAE,KAAKN;IAE/E,IAAIC,iBAAiBM,SAAS,EAAE;QAC9B,qBACE,KAACC;YAAIC,WAAU;sBACb,cAAA,KAAChB;gBAAciB,MAAM;gBAAIC,WAAU;gBAAWC,OAAM;gBAASC,YAAW;;;IAG9E;IAEA,IAAIZ,iBAAiBa,OAAO,IAAIb,iBAAiBE,IAAI,KAAKY,WAAW;QACnE,qBAAO,KAACvB;YAAewB,OAAOf;YAAkBgB,SAAQ;;IAC1D;IAEA,IAAI,CAACf,YAAY,OAAO;IAExB,qBACE,KAACM;QAAIC,WAAU;kBACb,cAAA,MAACD;YAAIC,WAAU;;8BACb,KAACf;oBAAKgB,MAAK;oBAAKQ,IAAI;8BAAC;;8BAGrB,KAACtB;oBAAcuB,OAAM;oBAAcC,OAAOlB,WAAWmB,UAAU;;8BAC/D,KAACxB;;;;AAIT"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ConnectionLifecycleStatus } from '#core/models.js';
|
|
2
2
|
export interface ConnectionStatusBadgeProps {
|
|
3
|
-
status:
|
|
3
|
+
status: ConnectionLifecycleStatus;
|
|
4
4
|
className?: string;
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection-status-badge.d.ts","sourceRoot":"","sources":["../src/connection-status-badge.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connection-status-badge.d.ts","sourceRoot":"","sources":["../src/connection-status-badge.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,yBAAyB,EAAkC,MAAM,iBAAiB,CAAC;AAEhG,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,yBAAyB,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EAAC,MAAM,EAAE,SAAS,EAAC,EAAE,0BAA0B,sCAiBpF"}
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Badge } from '@shipfox/react-ui/badge';
|
|
3
|
-
|
|
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
|
-
};
|
|
3
|
+
import { connectionLifecyclePresentation } from '#core/models.js';
|
|
16
4
|
/**
|
|
17
5
|
* Single source of truth for a connection's lifecycle pill, shared by the
|
|
18
6
|
* integration gallery and any surface that reflects source health. Renders
|
|
19
7
|
* nothing for the expected `active` state.
|
|
20
8
|
*/ export function ConnectionStatusBadge({ status, className }) {
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
9
|
+
const presentation = connectionLifecyclePresentation(status);
|
|
10
|
+
if (presentation.kind === 'active') return null;
|
|
11
|
+
const pill = presentation.kind === 'disabled' ? {
|
|
12
|
+
variant: 'warning',
|
|
13
|
+
label: presentation.label,
|
|
14
|
+
iconLeft: 'errorWarningLine'
|
|
15
|
+
} : {
|
|
16
|
+
variant: 'error',
|
|
17
|
+
label: presentation.label
|
|
18
|
+
};
|
|
23
19
|
return /*#__PURE__*/ _jsx(Badge, {
|
|
24
20
|
variant: pill.variant,
|
|
25
21
|
radius: "rounded",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/connection-status-badge.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["../src/connection-status-badge.tsx"],"sourcesContent":["import {Badge} from '@shipfox/react-ui/badge';\nimport type {IconName} from '@shipfox/react-ui/icon';\nimport {type ConnectionLifecycleStatus, connectionLifecyclePresentation} from '#core/models.js';\n\nexport interface ConnectionStatusBadgeProps {\n status: ConnectionLifecycleStatus;\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 presentation = connectionLifecyclePresentation(status);\n if (presentation.kind === 'active') return null;\n const pill: {variant: 'warning' | 'error'; label: string; iconLeft?: IconName} =\n presentation.kind === 'disabled'\n ? {variant: 'warning', label: presentation.label, iconLeft: 'errorWarningLine'}\n : {variant: 'error', label: presentation.label};\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","connectionLifecyclePresentation","ConnectionStatusBadge","status","className","presentation","kind","pill","variant","label","iconLeft","radius"],"mappings":";AAAA,SAAQA,KAAK,QAAO,0BAA0B;AAE9C,SAAwCC,+BAA+B,QAAO,kBAAkB;AAOhG;;;;CAIC,GACD,OAAO,SAASC,sBAAsB,EAACC,MAAM,EAAEC,SAAS,EAA6B;IACnF,MAAMC,eAAeJ,gCAAgCE;IACrD,IAAIE,aAAaC,IAAI,KAAK,UAAU,OAAO;IAC3C,MAAMC,OACJF,aAAaC,IAAI,KAAK,aAClB;QAACE,SAAS;QAAWC,OAAOJ,aAAaI,KAAK;QAAEC,UAAU;IAAkB,IAC5E;QAACF,SAAS;QAASC,OAAOJ,aAAaI,KAAK;IAAA;IAClD,qBACE,KAACT;QACCQ,SAASD,KAAKC,OAAO;QACrBG,QAAO;QACPP,WAAWA;QACV,GAAIG,KAAKG,QAAQ,GAAG;YAACA,UAAUH,KAAKG,QAAQ;QAAA,IAAI,CAAC,CAAC;kBAElDH,KAAKE,KAAK;;AAGjB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export type IntegrationCapability = 'source_control' | 'agent_tools';
|
|
2
|
+
export type ConnectionLifecycleStatus = 'active' | 'disabled' | 'error';
|
|
3
|
+
export interface IntegrationProvider {
|
|
4
|
+
provider: string;
|
|
5
|
+
displayName: string;
|
|
6
|
+
capabilities: IntegrationCapability[];
|
|
7
|
+
}
|
|
8
|
+
export interface IntegrationConnection {
|
|
9
|
+
id: string;
|
|
10
|
+
workspaceId: string;
|
|
11
|
+
provider: string;
|
|
12
|
+
externalAccountId: string;
|
|
13
|
+
slug: string;
|
|
14
|
+
displayName: string;
|
|
15
|
+
lifecycleStatus: ConnectionLifecycleStatus;
|
|
16
|
+
capabilities: IntegrationCapability[];
|
|
17
|
+
externalUrl?: string | undefined;
|
|
18
|
+
createdAt: string;
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
}
|
|
21
|
+
export interface Repository {
|
|
22
|
+
connectionId: string;
|
|
23
|
+
externalRepositoryId: string;
|
|
24
|
+
owner: string;
|
|
25
|
+
name: string;
|
|
26
|
+
fullName: string;
|
|
27
|
+
defaultBranch: string;
|
|
28
|
+
visibility: 'public' | 'private' | 'internal' | 'unknown';
|
|
29
|
+
cloneUrl: string;
|
|
30
|
+
htmlUrl: string;
|
|
31
|
+
}
|
|
32
|
+
export interface RepositoryPage {
|
|
33
|
+
repositories: Repository[];
|
|
34
|
+
nextCursor?: string;
|
|
35
|
+
}
|
|
36
|
+
export interface WebhookConnection {
|
|
37
|
+
id: string;
|
|
38
|
+
workspaceId: string;
|
|
39
|
+
name: string;
|
|
40
|
+
slug: string;
|
|
41
|
+
lifecycleStatus: ConnectionLifecycleStatus;
|
|
42
|
+
inboundUrl: string;
|
|
43
|
+
createdAt: string;
|
|
44
|
+
updatedAt: string;
|
|
45
|
+
}
|
|
46
|
+
export interface InstallRedirect {
|
|
47
|
+
installUrl: string;
|
|
48
|
+
}
|
|
49
|
+
export type IntegrationUsageEvent = {
|
|
50
|
+
value: string;
|
|
51
|
+
label: string;
|
|
52
|
+
};
|
|
53
|
+
export type ConnectionLifecyclePresentation = {
|
|
54
|
+
kind: 'active';
|
|
55
|
+
} | {
|
|
56
|
+
kind: 'disabled';
|
|
57
|
+
label: 'Disabled';
|
|
58
|
+
} | {
|
|
59
|
+
kind: 'error';
|
|
60
|
+
label: 'Error';
|
|
61
|
+
};
|
|
62
|
+
export declare function usageEventsForConnection(connection: Pick<IntegrationConnection, 'provider' | 'capabilities'>): IntegrationUsageEvent[];
|
|
63
|
+
export declare function connectionLifecyclePresentation(status: ConnectionLifecycleStatus): ConnectionLifecyclePresentation;
|
|
64
|
+
export declare function hasCapability(connection: IntegrationConnection, capability: IntegrationCapability): boolean;
|
|
65
|
+
export declare function isUsableConnection(connection: IntegrationConnection): boolean;
|
|
66
|
+
//# sourceMappingURL=models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/core/models.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAAG,gBAAgB,GAAG,aAAa,CAAC;AACrE,MAAM,MAAM,yBAAyB,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC;AAExE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,qBAAqB,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM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C,GAChB;IAAC,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,UAAU,CAAA;CAAC,GACrC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAC,CAAC;AAsGpC,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,IAAI,CAAC,qBAAqB,EAAE,UAAU,GAAG,cAAc,CAAC,GACnE,qBAAqB,EAAE,CAazB;AAED,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,yBAAyB,GAChC,+BAA+B,CAIjC;AAED,wBAAgB,aAAa,CAC3B,UAAU,EAAE,qBAAqB,EACjC,UAAU,EAAE,qBAAqB,WAGlC;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,qBAAqB,WAEnE"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
const githubUsageEvents = [
|
|
2
|
+
'push',
|
|
3
|
+
'branch_protection_configuration',
|
|
4
|
+
'branch_protection_rule',
|
|
5
|
+
'check_run',
|
|
6
|
+
'check_suite',
|
|
7
|
+
'code_scanning_alert',
|
|
8
|
+
'commit_comment',
|
|
9
|
+
'create',
|
|
10
|
+
'custom_property',
|
|
11
|
+
'custom_property_values',
|
|
12
|
+
'delete',
|
|
13
|
+
'dependabot_alert',
|
|
14
|
+
'deploy_key',
|
|
15
|
+
'deployment',
|
|
16
|
+
'deployment_protection_rule',
|
|
17
|
+
'deployment_review',
|
|
18
|
+
'deployment_status',
|
|
19
|
+
'discussion',
|
|
20
|
+
'discussion_comment',
|
|
21
|
+
'fork',
|
|
22
|
+
'github_app_authorization',
|
|
23
|
+
'gollum',
|
|
24
|
+
'installation',
|
|
25
|
+
'installation_repositories',
|
|
26
|
+
'installation_target',
|
|
27
|
+
'issue_comment',
|
|
28
|
+
'issue_dependencies',
|
|
29
|
+
'issues',
|
|
30
|
+
'label',
|
|
31
|
+
'marketplace_purchase',
|
|
32
|
+
'member',
|
|
33
|
+
'membership',
|
|
34
|
+
'merge_group',
|
|
35
|
+
'meta',
|
|
36
|
+
'milestone',
|
|
37
|
+
'org_block',
|
|
38
|
+
'organization',
|
|
39
|
+
'package',
|
|
40
|
+
'page_build',
|
|
41
|
+
'personal_access_token_request',
|
|
42
|
+
'ping',
|
|
43
|
+
'project',
|
|
44
|
+
'project_card',
|
|
45
|
+
'project_column',
|
|
46
|
+
'projects_v2',
|
|
47
|
+
'projects_v2_item',
|
|
48
|
+
'projects_v2_status_update',
|
|
49
|
+
'public',
|
|
50
|
+
'pull_request',
|
|
51
|
+
'pull_request_review',
|
|
52
|
+
'pull_request_review_comment',
|
|
53
|
+
'pull_request_review_thread',
|
|
54
|
+
'registry_package',
|
|
55
|
+
'release',
|
|
56
|
+
'repository',
|
|
57
|
+
'repository_advisory',
|
|
58
|
+
'repository_dispatch',
|
|
59
|
+
'repository_import',
|
|
60
|
+
'repository_ruleset',
|
|
61
|
+
'repository_vulnerability_alert',
|
|
62
|
+
'secret_scanning_alert',
|
|
63
|
+
'secret_scanning_alert_location',
|
|
64
|
+
'secret_scanning_scan',
|
|
65
|
+
'security_advisory',
|
|
66
|
+
'security_and_analysis',
|
|
67
|
+
'sponsorship',
|
|
68
|
+
'star',
|
|
69
|
+
'status',
|
|
70
|
+
'sub_issues',
|
|
71
|
+
'team',
|
|
72
|
+
'team_add',
|
|
73
|
+
'watch',
|
|
74
|
+
'workflow_dispatch',
|
|
75
|
+
'workflow_job',
|
|
76
|
+
'workflow_run'
|
|
77
|
+
];
|
|
78
|
+
const linearUsageEvents = [
|
|
79
|
+
'Issue.create',
|
|
80
|
+
'Issue.update',
|
|
81
|
+
'Issue.remove',
|
|
82
|
+
'Comment.create',
|
|
83
|
+
'Comment.update',
|
|
84
|
+
'Comment.remove',
|
|
85
|
+
'IssueLabel.create',
|
|
86
|
+
'IssueLabel.update',
|
|
87
|
+
'IssueLabel.remove',
|
|
88
|
+
'Project.create',
|
|
89
|
+
'Project.update',
|
|
90
|
+
'Project.remove',
|
|
91
|
+
'Cycle.create',
|
|
92
|
+
'Cycle.update',
|
|
93
|
+
'Cycle.remove',
|
|
94
|
+
'agentSession.created',
|
|
95
|
+
'agentSession.prompted'
|
|
96
|
+
];
|
|
97
|
+
const sentryIssueActions = [
|
|
98
|
+
'created',
|
|
99
|
+
'resolved',
|
|
100
|
+
'assigned',
|
|
101
|
+
'archived',
|
|
102
|
+
'unresolved'
|
|
103
|
+
];
|
|
104
|
+
export function usageEventsForConnection(connection) {
|
|
105
|
+
if (connection.provider === 'webhook') return [
|
|
106
|
+
{
|
|
107
|
+
value: 'received',
|
|
108
|
+
label: 'received'
|
|
109
|
+
}
|
|
110
|
+
];
|
|
111
|
+
if (connection.provider === 'github') return githubUsageEvents.map((value)=>({
|
|
112
|
+
value,
|
|
113
|
+
label: value
|
|
114
|
+
}));
|
|
115
|
+
if (connection.provider === 'sentry') return sentryIssueActions.map((action)=>({
|
|
116
|
+
value: `issue.${action}`,
|
|
117
|
+
label: `issue.${action}`
|
|
118
|
+
}));
|
|
119
|
+
if (connection.provider === 'linear') return linearUsageEvents.map((value)=>({
|
|
120
|
+
value,
|
|
121
|
+
label: value
|
|
122
|
+
}));
|
|
123
|
+
if (connection.capabilities.includes('source_control')) return [
|
|
124
|
+
{
|
|
125
|
+
value: 'push',
|
|
126
|
+
label: 'push'
|
|
127
|
+
}
|
|
128
|
+
];
|
|
129
|
+
return [
|
|
130
|
+
{
|
|
131
|
+
value: 'received',
|
|
132
|
+
label: 'received'
|
|
133
|
+
}
|
|
134
|
+
];
|
|
135
|
+
}
|
|
136
|
+
export function connectionLifecyclePresentation(status) {
|
|
137
|
+
if (status === 'disabled') return {
|
|
138
|
+
kind: 'disabled',
|
|
139
|
+
label: 'Disabled'
|
|
140
|
+
};
|
|
141
|
+
if (status === 'error') return {
|
|
142
|
+
kind: 'error',
|
|
143
|
+
label: 'Error'
|
|
144
|
+
};
|
|
145
|
+
return {
|
|
146
|
+
kind: 'active'
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
export function hasCapability(connection, capability) {
|
|
150
|
+
return connection.capabilities.includes(capability);
|
|
151
|
+
}
|
|
152
|
+
export function isUsableConnection(connection) {
|
|
153
|
+
return connection.lifecycleStatus === 'active';
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
//# sourceMappingURL=models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/models.ts"],"sourcesContent":["export type IntegrationCapability = 'source_control' | 'agent_tools';\nexport type ConnectionLifecycleStatus = 'active' | 'disabled' | 'error';\n\nexport interface IntegrationProvider {\n provider: string;\n displayName: string;\n capabilities: IntegrationCapability[];\n}\n\nexport interface IntegrationConnection {\n id: string;\n workspaceId: string;\n provider: string;\n externalAccountId: string;\n slug: string;\n displayName: string;\n lifecycleStatus: ConnectionLifecycleStatus;\n capabilities: IntegrationCapability[];\n externalUrl?: string | undefined;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface Repository {\n connectionId: string;\n externalRepositoryId: string;\n owner: string;\n name: string;\n fullName: string;\n defaultBranch: string;\n visibility: 'public' | 'private' | 'internal' | 'unknown';\n cloneUrl: string;\n htmlUrl: string;\n}\n\nexport interface RepositoryPage {\n repositories: Repository[];\n nextCursor?: string;\n}\n\nexport interface WebhookConnection {\n id: string;\n workspaceId: string;\n name: string;\n slug: string;\n lifecycleStatus: ConnectionLifecycleStatus;\n inboundUrl: string;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface InstallRedirect {\n installUrl: string;\n}\n\nexport type IntegrationUsageEvent = {\n value: string;\n label: string;\n};\n\nexport type ConnectionLifecyclePresentation =\n | {kind: 'active'}\n | {kind: 'disabled'; label: 'Disabled'}\n | {kind: 'error'; label: 'Error'};\n\nconst githubUsageEvents = [\n 'push',\n 'branch_protection_configuration',\n 'branch_protection_rule',\n 'check_run',\n 'check_suite',\n 'code_scanning_alert',\n 'commit_comment',\n 'create',\n 'custom_property',\n 'custom_property_values',\n 'delete',\n 'dependabot_alert',\n 'deploy_key',\n 'deployment',\n 'deployment_protection_rule',\n 'deployment_review',\n 'deployment_status',\n 'discussion',\n 'discussion_comment',\n 'fork',\n 'github_app_authorization',\n 'gollum',\n 'installation',\n 'installation_repositories',\n 'installation_target',\n 'issue_comment',\n 'issue_dependencies',\n 'issues',\n 'label',\n 'marketplace_purchase',\n 'member',\n 'membership',\n 'merge_group',\n 'meta',\n 'milestone',\n 'org_block',\n 'organization',\n 'package',\n 'page_build',\n 'personal_access_token_request',\n 'ping',\n 'project',\n 'project_card',\n 'project_column',\n 'projects_v2',\n 'projects_v2_item',\n 'projects_v2_status_update',\n 'public',\n 'pull_request',\n 'pull_request_review',\n 'pull_request_review_comment',\n 'pull_request_review_thread',\n 'registry_package',\n 'release',\n 'repository',\n 'repository_advisory',\n 'repository_dispatch',\n 'repository_import',\n 'repository_ruleset',\n 'repository_vulnerability_alert',\n 'secret_scanning_alert',\n 'secret_scanning_alert_location',\n 'secret_scanning_scan',\n 'security_advisory',\n 'security_and_analysis',\n 'sponsorship',\n 'star',\n 'status',\n 'sub_issues',\n 'team',\n 'team_add',\n 'watch',\n 'workflow_dispatch',\n 'workflow_job',\n 'workflow_run',\n] as const;\n\nconst linearUsageEvents = [\n 'Issue.create',\n 'Issue.update',\n 'Issue.remove',\n 'Comment.create',\n 'Comment.update',\n 'Comment.remove',\n 'IssueLabel.create',\n 'IssueLabel.update',\n 'IssueLabel.remove',\n 'Project.create',\n 'Project.update',\n 'Project.remove',\n 'Cycle.create',\n 'Cycle.update',\n 'Cycle.remove',\n 'agentSession.created',\n 'agentSession.prompted',\n] as const;\n\nconst sentryIssueActions = ['created', 'resolved', 'assigned', 'archived', 'unresolved'] as const;\n\nexport function usageEventsForConnection(\n connection: Pick<IntegrationConnection, 'provider' | 'capabilities'>,\n): IntegrationUsageEvent[] {\n if (connection.provider === 'webhook') return [{value: 'received', label: 'received'}];\n if (connection.provider === 'github')\n return githubUsageEvents.map((value) => ({value, label: value}));\n if (connection.provider === 'sentry')\n return sentryIssueActions.map((action) => ({\n value: `issue.${action}`,\n label: `issue.${action}`,\n }));\n if (connection.provider === 'linear')\n return linearUsageEvents.map((value) => ({value, label: value}));\n if (connection.capabilities.includes('source_control')) return [{value: 'push', label: 'push'}];\n return [{value: 'received', label: 'received'}];\n}\n\nexport function connectionLifecyclePresentation(\n status: ConnectionLifecycleStatus,\n): ConnectionLifecyclePresentation {\n if (status === 'disabled') return {kind: 'disabled', label: 'Disabled'};\n if (status === 'error') return {kind: 'error', label: 'Error'};\n return {kind: 'active'};\n}\n\nexport function hasCapability(\n connection: IntegrationConnection,\n capability: IntegrationCapability,\n) {\n return connection.capabilities.includes(capability);\n}\n\nexport function isUsableConnection(connection: IntegrationConnection) {\n return connection.lifecycleStatus === 'active';\n}\n"],"names":["githubUsageEvents","linearUsageEvents","sentryIssueActions","usageEventsForConnection","connection","provider","value","label","map","action","capabilities","includes","connectionLifecyclePresentation","status","kind","hasCapability","capability","isUsableConnection","lifecycleStatus"],"mappings":"AAiEA,MAAMA,oBAAoB;IACxB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,oBAAoB;IACxB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,qBAAqB;IAAC;IAAW;IAAY;IAAY;IAAY;CAAa;AAExF,OAAO,SAASC,yBACdC,UAAoE;IAEpE,IAAIA,WAAWC,QAAQ,KAAK,WAAW,OAAO;QAAC;YAACC,OAAO;YAAYC,OAAO;QAAU;KAAE;IACtF,IAAIH,WAAWC,QAAQ,KAAK,UAC1B,OAAOL,kBAAkBQ,GAAG,CAAC,CAACF,QAAW,CAAA;YAACA;YAAOC,OAAOD;QAAK,CAAA;IAC/D,IAAIF,WAAWC,QAAQ,KAAK,UAC1B,OAAOH,mBAAmBM,GAAG,CAAC,CAACC,SAAY,CAAA;YACzCH,OAAO,CAAC,MAAM,EAAEG,QAAQ;YACxBF,OAAO,CAAC,MAAM,EAAEE,QAAQ;QAC1B,CAAA;IACF,IAAIL,WAAWC,QAAQ,KAAK,UAC1B,OAAOJ,kBAAkBO,GAAG,CAAC,CAACF,QAAW,CAAA;YAACA;YAAOC,OAAOD;QAAK,CAAA;IAC/D,IAAIF,WAAWM,YAAY,CAACC,QAAQ,CAAC,mBAAmB,OAAO;QAAC;YAACL,OAAO;YAAQC,OAAO;QAAM;KAAE;IAC/F,OAAO;QAAC;YAACD,OAAO;YAAYC,OAAO;QAAU;KAAE;AACjD;AAEA,OAAO,SAASK,gCACdC,MAAiC;IAEjC,IAAIA,WAAW,YAAY,OAAO;QAACC,MAAM;QAAYP,OAAO;IAAU;IACtE,IAAIM,WAAW,SAAS,OAAO;QAACC,MAAM;QAASP,OAAO;IAAO;IAC7D,OAAO;QAACO,MAAM;IAAQ;AACxB;AAEA,OAAO,SAASC,cACdX,UAAiC,EACjCY,UAAiC;IAEjC,OAAOZ,WAAWM,YAAY,CAACC,QAAQ,CAACK;AAC1C;AAEA,OAAO,SAASC,mBAAmBb,UAAiC;IAClE,OAAOA,WAAWc,eAAe,KAAK;AACxC"}
|
package/dist/feature.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
export declare const integrationsSettingsSections: readonly [{
|
|
2
|
+
readonly id: "settings.integrations";
|
|
3
|
+
readonly pathSegment: "integrations";
|
|
4
|
+
readonly label: "Integrations";
|
|
5
|
+
readonly icon: "plugLine";
|
|
6
|
+
readonly order: 700;
|
|
7
|
+
}];
|
|
1
8
|
export declare const integrationsFeature: {
|
|
2
9
|
readonly id: "shipfox.integrations";
|
|
3
10
|
readonly routes: readonly [{
|
package/dist/feature.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../src/feature.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../src/feature.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,4BAA4B;;;;;;EAQW,CAAC;AAErD,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4D9B,CAAC"}
|
package/dist/feature.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { defineClientFeature } from '@shipfox/client-shell';
|
|
2
|
+
export const integrationsSettingsSections = [
|
|
3
|
+
{
|
|
4
|
+
id: 'settings.integrations',
|
|
5
|
+
pathSegment: 'integrations',
|
|
6
|
+
label: 'Integrations',
|
|
7
|
+
icon: 'plugLine',
|
|
8
|
+
order: 700
|
|
9
|
+
}
|
|
10
|
+
];
|
|
2
11
|
export const integrationsFeature = defineClientFeature({
|
|
3
12
|
id: 'shipfox.integrations',
|
|
4
13
|
routes: [
|
|
@@ -58,15 +67,7 @@ export const integrationsFeature = defineClientFeature({
|
|
|
58
67
|
impl: '@shipfox/client-integrations/routes/integrations-settings'
|
|
59
68
|
}
|
|
60
69
|
],
|
|
61
|
-
settingsSections:
|
|
62
|
-
{
|
|
63
|
-
id: 'settings.integrations',
|
|
64
|
-
pathSegment: 'integrations',
|
|
65
|
-
label: 'Integrations',
|
|
66
|
-
icon: 'plugLine',
|
|
67
|
-
order: 700
|
|
68
|
-
}
|
|
69
|
-
]
|
|
70
|
+
settingsSections: integrationsSettingsSections
|
|
70
71
|
});
|
|
71
72
|
|
|
72
73
|
//# sourceMappingURL=feature.js.map
|
package/dist/feature.js.map
CHANGED
|
@@ -1 +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: '/integrations/slack/callback',\n parent: 'root',\n impl: '@shipfox/client-integrations/routes/slack-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 path: '/workspaces/$wid/integrations/slack',\n parent: 'workspaceLayout',\n impl: '@shipfox/client-integrations/routes/slack',\n },\n {\n path: '/workspaces/$wid/settings/integrations',\n parent: 'workspaceSettings',\n impl: '@shipfox/client-integrations/routes/integrations-settings',\n },\n ],\n settingsSections:
|
|
1
|
+
{"version":3,"sources":["../src/feature.ts"],"sourcesContent":["import {defineClientFeature, type SettingsSectionEntry} from '@shipfox/client-shell';\n\nexport const integrationsSettingsSections = [\n {\n id: 'settings.integrations',\n pathSegment: 'integrations',\n label: 'Integrations',\n icon: 'plugLine',\n order: 700,\n },\n] as const satisfies readonly SettingsSectionEntry[];\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: '/integrations/slack/callback',\n parent: 'root',\n impl: '@shipfox/client-integrations/routes/slack-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 path: '/workspaces/$wid/integrations/slack',\n parent: 'workspaceLayout',\n impl: '@shipfox/client-integrations/routes/slack',\n },\n {\n path: '/workspaces/$wid/settings/integrations',\n parent: 'workspaceSettings',\n impl: '@shipfox/client-integrations/routes/integrations-settings',\n },\n ],\n settingsSections: integrationsSettingsSections,\n});\n"],"names":["defineClientFeature","integrationsSettingsSections","id","pathSegment","label","icon","order","integrationsFeature","routes","path","parent","impl","settingsSections"],"mappings":"AAAA,SAAQA,mBAAmB,QAAkC,wBAAwB;AAErF,OAAO,MAAMC,+BAA+B;IAC1C;QACEC,IAAI;QACJC,aAAa;QACbC,OAAO;QACPC,MAAM;QACNC,OAAO;IACT;CACD,CAAoD;AAErD,OAAO,MAAMC,sBAAsBP,oBAAoB;IACrDE,IAAI;IACJM,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;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;IACDC,kBAAkBX;AACpB,GAAG"}
|