@open-mercato/core 0.6.4-develop.4305.1.efaf0ebab1 → 0.6.4-develop.4322.1.7bf54b8070
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/dist/modules/currencies/backend/exchange-rates/[id]/page.js +16 -3
- package/dist/modules/currencies/backend/exchange-rates/[id]/page.js.map +2 -2
- package/dist/modules/customers/api/companies/[id]/route.js +4 -0
- package/dist/modules/customers/api/companies/[id]/route.js.map +2 -2
- package/dist/modules/customers/backend/customers/companies-v2/[id]/page.js +21 -5
- package/dist/modules/customers/backend/customers/companies-v2/[id]/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/people-v2/[id]/page.js +21 -5
- package/dist/modules/customers/backend/customers/people-v2/[id]/page.js.map +2 -2
- package/dist/modules/customers/commands/companies.js +48 -32
- package/dist/modules/customers/commands/companies.js.map +2 -2
- package/dist/modules/data_sync/backend/data-sync/runs/[id]/page.js +18 -3
- package/dist/modules/data_sync/backend/data-sync/runs/[id]/page.js.map +2 -2
- package/dist/modules/entities/api/entities.js +4 -1
- package/dist/modules/entities/api/entities.js.map +2 -2
- package/dist/modules/entities/backend/entities/user/[entityId]/page.js +14 -9
- package/dist/modules/entities/backend/entities/user/[entityId]/page.js.map +2 -2
- package/dist/modules/inbox_ops/backend/inbox-ops/proposals/[id]/page.js +21 -3
- package/dist/modules/inbox_ops/backend/inbox-ops/proposals/[id]/page.js.map +2 -2
- package/dist/modules/integrations/backend/integrations/[id]/page.js +18 -2
- package/dist/modules/integrations/backend/integrations/[id]/page.js.map +2 -2
- package/dist/modules/integrations/backend/integrations/bundle/[id]/page.js +18 -3
- package/dist/modules/integrations/backend/integrations/bundle/[id]/page.js.map +2 -2
- package/jest.config.cjs +3 -0
- package/package.json +7 -7
- package/src/modules/currencies/backend/exchange-rates/[id]/page.tsx +20 -3
- package/src/modules/customers/api/companies/[id]/route.ts +4 -0
- package/src/modules/customers/backend/customers/companies-v2/[id]/page.tsx +25 -5
- package/src/modules/customers/backend/customers/people-v2/[id]/page.tsx +25 -5
- package/src/modules/customers/commands/companies.ts +51 -34
- package/src/modules/data_sync/backend/data-sync/runs/[id]/page.tsx +21 -3
- package/src/modules/entities/api/entities.ts +4 -1
- package/src/modules/entities/backend/entities/user/[entityId]/page.tsx +22 -11
- package/src/modules/inbox_ops/backend/inbox-ops/proposals/[id]/page.tsx +36 -3
- package/src/modules/integrations/backend/integrations/[id]/page.tsx +21 -2
- package/src/modules/integrations/backend/integrations/bundle/[id]/page.tsx +21 -3
|
@@ -7,7 +7,7 @@ import { Page, PageBody } from '@open-mercato/ui/backend/Page'
|
|
|
7
7
|
import { Button } from '@open-mercato/ui/primitives/button'
|
|
8
8
|
import { apiCall } from '@open-mercato/ui/backend/utils/apiCall'
|
|
9
9
|
import { flash } from '@open-mercato/ui/backend/FlashMessages'
|
|
10
|
-
import { LoadingMessage, ErrorMessage } from '@open-mercato/ui/backend/detail'
|
|
10
|
+
import { LoadingMessage, ErrorMessage, RecordNotFoundState } from '@open-mercato/ui/backend/detail'
|
|
11
11
|
import { useT, useLocale } from '@open-mercato/shared/lib/i18n/context'
|
|
12
12
|
import { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'
|
|
13
13
|
import { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuardedMutation'
|
|
@@ -156,6 +156,7 @@ export default function ProposalDetailPage({ params }: { params?: { id?: string
|
|
|
156
156
|
const [email, setEmail] = React.useState<EmailDetail | null>(null)
|
|
157
157
|
const [isLoading, setIsLoading] = React.useState(true)
|
|
158
158
|
const [error, setError] = React.useState<string | null>(null)
|
|
159
|
+
const [isNotFound, setIsNotFound] = React.useState(false)
|
|
159
160
|
const [isProcessing, setIsProcessing] = React.useState(false)
|
|
160
161
|
|
|
161
162
|
const { confirm, ConfirmDialogElement } = useConfirmDialog()
|
|
@@ -244,6 +245,7 @@ export default function ProposalDetailPage({ params }: { params?: { id?: string
|
|
|
244
245
|
if (!proposalId) return
|
|
245
246
|
setIsLoading(true)
|
|
246
247
|
setError(null)
|
|
248
|
+
setIsNotFound(false)
|
|
247
249
|
try {
|
|
248
250
|
const result = await apiCall<{
|
|
249
251
|
proposal: ProposalDetail
|
|
@@ -256,6 +258,8 @@ export default function ProposalDetailPage({ params }: { params?: { id?: string
|
|
|
256
258
|
setActions(result.result.actions || [])
|
|
257
259
|
setDiscrepancies(result.result.discrepancies || [])
|
|
258
260
|
setEmail(result.result.email)
|
|
261
|
+
} else if (result?.status === 404) {
|
|
262
|
+
setIsNotFound(true)
|
|
259
263
|
} else {
|
|
260
264
|
setError(t('inbox_ops.flash.load_failed', 'Failed to load proposal'))
|
|
261
265
|
}
|
|
@@ -400,8 +404,37 @@ export default function ProposalDetailPage({ params }: { params?: { id?: string
|
|
|
400
404
|
setSendingReplyId(null)
|
|
401
405
|
}, [proposalId, t, loadData, runMutation])
|
|
402
406
|
|
|
403
|
-
if (isLoading)
|
|
404
|
-
|
|
407
|
+
if (isLoading) {
|
|
408
|
+
return (
|
|
409
|
+
<Page>
|
|
410
|
+
<PageBody>
|
|
411
|
+
<LoadingMessage label={t('inbox_ops.loading_proposal', 'Loading proposal...')} />
|
|
412
|
+
</PageBody>
|
|
413
|
+
</Page>
|
|
414
|
+
)
|
|
415
|
+
}
|
|
416
|
+
if (isNotFound) {
|
|
417
|
+
return (
|
|
418
|
+
<Page>
|
|
419
|
+
<PageBody>
|
|
420
|
+
<RecordNotFoundState
|
|
421
|
+
label={t('inbox_ops.proposal.notFound', 'Proposal not found.')}
|
|
422
|
+
backHref="/backend/inbox-ops"
|
|
423
|
+
backLabel={t('inbox_ops.proposal.backToList', 'Back to inbox')}
|
|
424
|
+
/>
|
|
425
|
+
</PageBody>
|
|
426
|
+
</Page>
|
|
427
|
+
)
|
|
428
|
+
}
|
|
429
|
+
if (error) {
|
|
430
|
+
return (
|
|
431
|
+
<Page>
|
|
432
|
+
<PageBody>
|
|
433
|
+
<ErrorMessage label={error} />
|
|
434
|
+
</PageBody>
|
|
435
|
+
</Page>
|
|
436
|
+
)
|
|
437
|
+
}
|
|
405
438
|
|
|
406
439
|
const pendingActions = actions.filter((a) => a.status === 'pending')
|
|
407
440
|
const emailIsProcessing = email?.status === 'processing'
|
|
@@ -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 (
|
|
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
|
-
|
|
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)
|