@open-mercato/core 0.6.4-develop.4305.1.efaf0ebab1 → 0.6.4-develop.4310.1.0be8773280

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/modules/currencies/backend/exchange-rates/[id]/page.js +16 -3
  2. package/dist/modules/currencies/backend/exchange-rates/[id]/page.js.map +2 -2
  3. package/dist/modules/customers/api/companies/[id]/route.js +4 -0
  4. package/dist/modules/customers/api/companies/[id]/route.js.map +2 -2
  5. package/dist/modules/customers/backend/customers/companies-v2/[id]/page.js +21 -5
  6. package/dist/modules/customers/backend/customers/companies-v2/[id]/page.js.map +2 -2
  7. package/dist/modules/customers/backend/customers/people-v2/[id]/page.js +21 -5
  8. package/dist/modules/customers/backend/customers/people-v2/[id]/page.js.map +2 -2
  9. package/dist/modules/customers/commands/companies.js +48 -32
  10. package/dist/modules/customers/commands/companies.js.map +2 -2
  11. package/dist/modules/data_sync/backend/data-sync/runs/[id]/page.js +18 -3
  12. package/dist/modules/data_sync/backend/data-sync/runs/[id]/page.js.map +2 -2
  13. package/dist/modules/inbox_ops/backend/inbox-ops/proposals/[id]/page.js +21 -3
  14. package/dist/modules/inbox_ops/backend/inbox-ops/proposals/[id]/page.js.map +2 -2
  15. package/dist/modules/integrations/backend/integrations/[id]/page.js +18 -2
  16. package/dist/modules/integrations/backend/integrations/[id]/page.js.map +2 -2
  17. package/dist/modules/integrations/backend/integrations/bundle/[id]/page.js +18 -3
  18. package/dist/modules/integrations/backend/integrations/bundle/[id]/page.js.map +2 -2
  19. package/jest.config.cjs +3 -0
  20. package/package.json +7 -7
  21. package/src/modules/currencies/backend/exchange-rates/[id]/page.tsx +20 -3
  22. package/src/modules/customers/api/companies/[id]/route.ts +4 -0
  23. package/src/modules/customers/backend/customers/companies-v2/[id]/page.tsx +25 -5
  24. package/src/modules/customers/backend/customers/people-v2/[id]/page.tsx +25 -5
  25. package/src/modules/customers/commands/companies.ts +51 -34
  26. package/src/modules/data_sync/backend/data-sync/runs/[id]/page.tsx +21 -3
  27. package/src/modules/inbox_ops/backend/inbox-ops/proposals/[id]/page.tsx +36 -3
  28. package/src/modules/integrations/backend/integrations/[id]/page.tsx +21 -2
  29. package/src/modules/integrations/backend/integrations/bundle/[id]/page.tsx +21 -3
@@ -35,7 +35,7 @@ import {
35
35
  type IntegrationCredentialField,
36
36
  type IntegrationDetailBuiltInTab,
37
37
  } from '@open-mercato/shared/modules/integrations/types'
38
- import { LoadingMessage, ErrorMessage } from '@open-mercato/ui/backend/detail'
38
+ import { LoadingMessage, ErrorMessage, RecordNotFoundState } from '@open-mercato/ui/backend/detail'
39
39
  import { LogList, type LogListEntry } from '@open-mercato/ui/backend/LogList'
40
40
  import { Activity, AlertTriangle, Bell, Calendar, CheckCircle2, CreditCard, FileText, FileX, HardDrive, Key, MessageSquare, RefreshCw, Settings, Truck, Webhook, XCircle, Zap } from 'lucide-react'
41
41
  import { EmptyState } from '@open-mercato/ui/primitives/empty-state'
@@ -415,6 +415,7 @@ export default function IntegrationDetailPage({ params }: IntegrationDetailPageP
415
415
  const [detail, setDetail] = React.useState<IntegrationDetail | null>(null)
416
416
  const [isLoading, setIsLoading] = React.useState(true)
417
417
  const [error, setError] = React.useState<string | null>(null)
418
+ const [isNotFound, setIsNotFound] = React.useState(false)
418
419
 
419
420
  const [credValues, setCredValues] = React.useState<Record<string, unknown>>({})
420
421
  const [credentialsFormKey, setCredentialsFormKey] = React.useState(0)
@@ -451,6 +452,7 @@ export default function IntegrationDetailPage({ params }: IntegrationDetailPageP
451
452
  return
452
453
  }
453
454
  if (showLoading) setError(null)
455
+ if (showLoading) setIsNotFound(false)
454
456
  if (showLoading) setIsLoading(true)
455
457
  try {
456
458
  const call = await apiCall<IntegrationDetail>(
@@ -459,7 +461,11 @@ export default function IntegrationDetailPage({ params }: IntegrationDetailPageP
459
461
  { fallback: null },
460
462
  )
461
463
  if (!call.ok || !call.result) {
462
- if (showLoading) setError(t('integrations.detail.loadError', 'Failed to load integration'))
464
+ if (call.status === 404) {
465
+ if (showLoading) setIsNotFound(true)
466
+ } else {
467
+ if (showLoading) setError(t('integrations.detail.loadError', 'Failed to load integration'))
468
+ }
463
469
  if (showLoading) setIsLoading(false)
464
470
  return
465
471
  }
@@ -1012,6 +1018,19 @@ export default function IntegrationDetailPage({ params }: IntegrationDetailPageP
1012
1018
  }, [activeTab, refreshRunActivity, runIdFromUrl])
1013
1019
 
1014
1020
  if (isLoading) return <Page><PageBody><LoadingMessage label={t('integrations.detail.title')} /></PageBody></Page>
1021
+ if (isNotFound) {
1022
+ return (
1023
+ <Page>
1024
+ <PageBody>
1025
+ <RecordNotFoundState
1026
+ label={t('integrations.detail.notFound', 'Integration not found.')}
1027
+ backHref="/backend/integrations"
1028
+ backLabel={t('integrations.detail.backToList', 'Back to integrations')}
1029
+ />
1030
+ </PageBody>
1031
+ </Page>
1032
+ )
1033
+ }
1015
1034
  if (error || !detail || !resolvedIntegration || !resolvedState) {
1016
1035
  return <Page><PageBody><ErrorMessage label={error ?? t('integrations.detail.loadError')} /></PageBody></Page>
1017
1036
  }
@@ -20,8 +20,7 @@ import { apiCall } from '@open-mercato/ui/backend/utils/apiCall'
20
20
  import { flash } from '@open-mercato/ui/backend/FlashMessages'
21
21
  import { useT } from '@open-mercato/shared/lib/i18n/context'
22
22
  import type { CredentialFieldType, IntegrationCredentialField } from '@open-mercato/shared/modules/integrations/types'
23
- import { LoadingMessage } from '@open-mercato/ui/backend/detail'
24
- import { ErrorMessage } from '@open-mercato/ui/backend/detail'
23
+ import { LoadingMessage, ErrorMessage, RecordNotFoundState } from '@open-mercato/ui/backend/detail'
25
24
 
26
25
  type CredentialField = IntegrationCredentialField
27
26
 
@@ -83,6 +82,7 @@ export default function BundleConfigPage({ params }: BundleConfigPageProps) {
83
82
  const [detail, setDetail] = React.useState<BundleDetail | null>(null)
84
83
  const [isLoading, setIsLoading] = React.useState(true)
85
84
  const [error, setError] = React.useState<string | null>(null)
85
+ const [isNotFound, setIsNotFound] = React.useState(false)
86
86
  const [credValues, setCredValues] = React.useState<Record<string, unknown>>({})
87
87
  const [isSavingCreds, setIsSavingCreds] = React.useState(false)
88
88
  const [togglingIds, setTogglingIds] = React.useState<Set<string>>(new Set())
@@ -104,13 +104,18 @@ export default function BundleConfigPage({ params }: BundleConfigPageProps) {
104
104
  }
105
105
  setIsLoading(true)
106
106
  setError(null)
107
+ setIsNotFound(false)
107
108
  const call = await apiCall<BundleDetail>(
108
109
  `/api/integrations/${encodeURIComponent(currentBundleId)}`,
109
110
  undefined,
110
111
  { fallback: null },
111
112
  )
112
113
  if (!call.ok || !call.result) {
113
- setError(t('integrations.detail.loadError'))
114
+ if (call.status === 404) {
115
+ setIsNotFound(true)
116
+ } else {
117
+ setError(t('integrations.detail.loadError'))
118
+ }
114
119
  setIsLoading(false)
115
120
  return
116
121
  }
@@ -184,6 +189,19 @@ export default function BundleConfigPage({ params }: BundleConfigPageProps) {
184
189
  }, [detail, handleToggle])
185
190
 
186
191
  if (isLoading) return <Page><PageBody><LoadingMessage label={t('integrations.bundle.title')} /></PageBody></Page>
192
+ if (isNotFound) {
193
+ return (
194
+ <Page>
195
+ <PageBody>
196
+ <RecordNotFoundState
197
+ label={t('integrations.detail.notFound', 'Integration not found.')}
198
+ backHref="/backend/integrations"
199
+ backLabel={t('integrations.detail.backToList', 'Back to integrations')}
200
+ />
201
+ </PageBody>
202
+ </Page>
203
+ )
204
+ }
187
205
  if (error || !detail?.bundle) return <Page><PageBody><ErrorMessage label={error ?? t('integrations.detail.loadError')} /></PageBody></Page>
188
206
 
189
207
  const credFields = (detail.bundle.credentials?.fields ?? []).filter(isEditableCredentialField)