@open-mercato/core 0.6.1-develop.3291.1.6fad645fd0 → 0.6.1-develop.3306.1.9ad9ff2526
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/AGENTS.md +14 -0
- package/dist/modules/auth/backend/roles/[id]/edit/page.js +2 -1
- package/dist/modules/auth/backend/roles/[id]/edit/page.js.map +2 -2
- package/dist/modules/auth/backend/users/[id]/edit/page.js +2 -5
- package/dist/modules/auth/backend/users/[id]/edit/page.js.map +2 -2
- package/dist/modules/catalog/ai-agents.js +47 -5
- package/dist/modules/catalog/ai-agents.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/categories/[id]/edit/page.js +2 -5
- package/dist/modules/catalog/backend/catalog/categories/[id]/edit/page.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/MerchandisingAssistantSheet.js +4 -3
- package/dist/modules/catalog/backend/catalog/products/MerchandisingAssistantSheet.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js +2 -9
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/[productId]/variants/[variantId]/page.js +2 -9
- package/dist/modules/catalog/backend/catalog/products/[productId]/variants/[variantId]/page.js.map +2 -2
- package/dist/modules/customers/ai-agents.js +174 -1
- package/dist/modules/customers/ai-agents.js.map +2 -2
- package/dist/modules/customers/ai-tools/deal-analyzer-pack.js +196 -0
- package/dist/modules/customers/ai-tools/deal-analyzer-pack.js.map +7 -0
- package/dist/modules/customers/ai-tools.js +3 -1
- package/dist/modules/customers/ai-tools.js.map +2 -2
- package/dist/modules/customers/backend/customers/companies/page.js +11 -1
- package/dist/modules/customers/backend/customers/companies/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/deals/page.js +11 -1
- package/dist/modules/customers/backend/customers/deals/page.js.map +2 -2
- package/dist/modules/customers/backend/customers/people/page.js +11 -1
- package/dist/modules/customers/backend/customers/people/page.js.map +2 -2
- package/dist/modules/customers/commands/companies.js +37 -15
- package/dist/modules/customers/commands/companies.js.map +2 -2
- package/dist/modules/customers/components/detail/AiActionChips.js +2 -2
- package/dist/modules/customers/components/detail/AiActionChips.js.map +2 -2
- package/dist/modules/customers/components/detail/ChangelogTab.js +3 -9
- package/dist/modules/customers/components/detail/ChangelogTab.js.map +2 -2
- package/dist/modules/customers/components/detail/changelogValues.js +35 -0
- package/dist/modules/customers/components/detail/changelogValues.js.map +7 -0
- package/dist/modules/customers/components/detail/customFieldUtils.js +1 -1
- package/dist/modules/customers/components/detail/customFieldUtils.js.map +1 -1
- package/dist/modules/customers/components/formConfig.js +3 -2
- package/dist/modules/customers/components/formConfig.js.map +2 -2
- package/dist/modules/customers/widgets/injection/ai-assistant-trigger/widget.client.js +4 -9
- package/dist/modules/customers/widgets/injection/ai-assistant-trigger/widget.client.js.map +2 -2
- package/dist/modules/customers/widgets/injection/ai-deal-analyzer-trigger/widget.client.js +302 -0
- package/dist/modules/customers/widgets/injection/ai-deal-analyzer-trigger/widget.client.js.map +7 -0
- package/dist/modules/customers/widgets/injection/ai-deal-analyzer-trigger/widget.js +17 -0
- package/dist/modules/customers/widgets/injection/ai-deal-analyzer-trigger/widget.js.map +7 -0
- package/dist/modules/customers/widgets/injection/ai-deal-detail-trigger/widget.client.js +2 -2
- package/dist/modules/customers/widgets/injection/ai-deal-detail-trigger/widget.client.js.map +2 -2
- package/dist/modules/customers/widgets/injection-table.js +2 -2
- package/dist/modules/customers/widgets/injection-table.js.map +2 -2
- package/dist/modules/directory/backend/directory/organizations/[id]/edit/page.js +2 -5
- package/dist/modules/directory/backend/directory/organizations/[id]/edit/page.js.map +2 -2
- package/dist/modules/directory/backend/directory/tenants/[id]/edit/page.js +2 -5
- package/dist/modules/directory/backend/directory/tenants/[id]/edit/page.js.map +2 -2
- package/dist/modules/resources/backend/resources/resources/[id]/page.js +2 -5
- package/dist/modules/resources/backend/resources/resources/[id]/page.js.map +2 -2
- package/dist/modules/sales/backend/sales/channels/[channelId]/edit/page.js +2 -25
- package/dist/modules/sales/backend/sales/channels/[channelId]/edit/page.js.map +2 -2
- package/dist/modules/sales/components/channels/ChannelOfferForm.js +2 -43
- package/dist/modules/sales/components/channels/ChannelOfferForm.js.map +2 -2
- package/dist/modules/sales/components/documents/LineItemDialog.js +162 -42
- package/dist/modules/sales/components/documents/LineItemDialog.js.map +2 -2
- package/dist/modules/sales/components/documents/customFieldHelpers.js +4 -31
- package/dist/modules/sales/components/documents/customFieldHelpers.js.map +2 -2
- package/package.json +15 -6
- package/src/modules/auth/backend/roles/[id]/edit/page.tsx +2 -1
- package/src/modules/auth/backend/users/[id]/edit/page.tsx +2 -5
- package/src/modules/business_rules/migrations/.snapshot-open-mercato.json +746 -394
- package/src/modules/catalog/ai-agents.ts +62 -4
- package/src/modules/catalog/backend/catalog/categories/[id]/edit/page.tsx +2 -5
- package/src/modules/catalog/backend/catalog/products/MerchandisingAssistantSheet.tsx +4 -3
- package/src/modules/catalog/backend/catalog/products/[id]/page.tsx +2 -12
- package/src/modules/catalog/backend/catalog/products/[productId]/variants/[variantId]/page.tsx +2 -10
- package/src/modules/catalog/migrations/.snapshot-open-mercato.json +2519 -1307
- package/src/modules/customer_accounts/migrations/.snapshot-open-mercato.json +828 -834
- package/src/modules/customers/AGENTS.md +6 -1
- package/src/modules/customers/ai-agents.ts +213 -6
- package/src/modules/customers/ai-tools/deal-analyzer-pack.ts +286 -0
- package/src/modules/customers/ai-tools.ts +2 -0
- package/src/modules/customers/backend/customers/companies/page.tsx +10 -0
- package/src/modules/customers/backend/customers/deals/page.tsx +10 -0
- package/src/modules/customers/backend/customers/people/page.tsx +10 -0
- package/src/modules/customers/commands/companies.ts +38 -14
- package/src/modules/customers/components/detail/AiActionChips.tsx +2 -2
- package/src/modules/customers/components/detail/ChangelogTab.tsx +3 -10
- package/src/modules/customers/components/detail/changelogValues.ts +42 -0
- package/src/modules/customers/components/detail/customFieldUtils.ts +1 -1
- package/src/modules/customers/components/formConfig.tsx +3 -2
- package/src/modules/customers/i18n/de.json +7 -0
- package/src/modules/customers/i18n/en.json +7 -0
- package/src/modules/customers/i18n/es.json +7 -0
- package/src/modules/customers/i18n/pl.json +7 -0
- package/src/modules/customers/migrations/.snapshot-open-mercato.json +2313 -2336
- package/src/modules/customers/widgets/injection/ai-assistant-trigger/widget.client.tsx +4 -6
- package/src/modules/customers/widgets/injection/ai-deal-analyzer-trigger/widget.client.tsx +358 -0
- package/src/modules/customers/widgets/injection/ai-deal-analyzer-trigger/widget.ts +34 -0
- package/src/modules/customers/widgets/injection/ai-deal-detail-trigger/widget.client.tsx +2 -2
- package/src/modules/customers/widgets/injection-table.ts +12 -9
- package/src/modules/data_sync/migrations/.snapshot-open-mercato.json +554 -210
- package/src/modules/dictionaries/migrations/.snapshot-open-mercato.json +146 -146
- package/src/modules/directory/backend/directory/organizations/[id]/edit/page.tsx +2 -5
- package/src/modules/directory/backend/directory/tenants/[id]/edit/page.tsx +2 -5
- package/src/modules/directory/migrations/.snapshot-open-mercato.json +273 -140
- package/src/modules/feature_toggles/migrations/.snapshot-open-mercato.json +242 -137
- package/src/modules/integrations/migrations/.snapshot-open-mercato.json +498 -195
- package/src/modules/payment_gateways/migrations/.snapshot-open-mercato.json +158 -157
- package/src/modules/perspectives/migrations/.snapshot-open-mercato.json +274 -129
- package/src/modules/planner/migrations/.snapshot-open-mercato.json +327 -157
- package/src/modules/progress/AGENTS.md +72 -0
- package/src/modules/resources/backend/resources/resources/[id]/page.tsx +2 -5
- package/src/modules/resources/migrations/.snapshot-open-mercato.json +920 -470
- package/src/modules/sales/backend/sales/channels/[channelId]/edit/page.tsx +2 -27
- package/src/modules/sales/components/channels/ChannelOfferForm.tsx +2 -49
- package/src/modules/sales/components/documents/LineItemDialog.tsx +214 -78
- package/src/modules/sales/components/documents/customFieldHelpers.ts +4 -43
- package/src/modules/sales/i18n/de.json +3 -0
- package/src/modules/sales/i18n/en.json +3 -0
- package/src/modules/sales/i18n/es.json +3 -0
- package/src/modules/sales/i18n/pl.json +3 -0
- package/src/modules/sales/migrations/.snapshot-open-mercato.json +4740 -4778
- package/src/modules/shipping_carriers/migrations/.snapshot-open-mercato.json +340 -81
- package/src/modules/staff/migrations/.snapshot-open-mercato.json +1439 -729
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Progress Module — Agent Guidelines
|
|
2
|
+
|
|
3
|
+
Use the progress module for every user-visible bulk operation and every long-running operation. Keep `ProgressTopBar` the single shared progress surface.
|
|
4
|
+
|
|
5
|
+
## MUST Rules
|
|
6
|
+
|
|
7
|
+
1. **MUST create `ProgressJob` for durable work** — imports, exports, bulk mutations, reindexing, external sync, and queued work must persist progress server-side.
|
|
8
|
+
2. **MUST return `progressJobId` to the UI** — DataTable bulk actions and start-operation APIs must expose the job id so the top bar can track it.
|
|
9
|
+
3. **MUST update terminal status** — every job must reach `completed`, `failed`, or `cancelled`; never leave running jobs without heartbeat/progress updates.
|
|
10
|
+
4. **MUST scope by tenant and organization** — create, read, update, cancel, and worker payloads must carry `tenantId` and `organizationId`.
|
|
11
|
+
5. **MUST use queue workers for durable work** — use `@open-mercato/queue`; do not implement custom queues, timers, or page polling loops.
|
|
12
|
+
6. **MUST run mutations through commands** — workers must use `commandBus.execute(...)` for domain writes so audit, undo, cache, events, and index invalidation stay intact.
|
|
13
|
+
7. **MUST use client-local progress only for browser-bound loops** — local `client:*` progress events are best-effort and must not represent work that should survive navigation.
|
|
14
|
+
8. **MUST NOT build per-module progress bars for global operations** — use `ProgressTopBar` and shared progress hooks.
|
|
15
|
+
|
|
16
|
+
## Choosing Progress Mode
|
|
17
|
+
|
|
18
|
+
| When to use | Progress mode |
|
|
19
|
+
|-------------|---------------|
|
|
20
|
+
| Bulk delete/update/create, import/export, reindexing, external sync, report generation, long AI/tool execution | Server `ProgressJob` + queue worker |
|
|
21
|
+
| DataTable selected-row loop that must keep response-side metadata in the browser and completes in-page | Shared client-local progress events |
|
|
22
|
+
| Single-row CRUD action that normally completes quickly | Button/loading state + audit `LastOperationBanner`; no `ProgressJob` by default |
|
|
23
|
+
| Cancellable background operation | Server `ProgressJob` with `cancellable: true` and worker checks via `isCancellationRequested()` |
|
|
24
|
+
|
|
25
|
+
## Adding a Server-Side Bulk Operation
|
|
26
|
+
|
|
27
|
+
1. Create an API route that validates input with Zod and requires the module manage feature.
|
|
28
|
+
2. Resolve `progressService` from DI and call `createJob({ jobType, name, description, totalCount, cancellable, meta }, scope)`.
|
|
29
|
+
3. Enqueue a worker payload containing `progressJobId`, ids/filter criteria, and trusted `{ tenantId, organizationId, userId }` scope.
|
|
30
|
+
4. Return `202` with `{ ok: true, progressJobId, message }`.
|
|
31
|
+
5. In the worker, call `startJob`, process records through `commandBus.execute(...)`, update progress after each item or batch, and call `completeJob`.
|
|
32
|
+
6. Catch failures, call `failJob`, then rethrow so queue retry/error handling remains truthful.
|
|
33
|
+
7. Run `yarn generate` after adding worker files and test with the queue strategy used by the target environment.
|
|
34
|
+
|
|
35
|
+
## Adding a DataTable Bulk Action
|
|
36
|
+
|
|
37
|
+
1. Prefer an injected `:bulk-actions` widget for cross-module bulk actions; use the `bulkActions` prop only for host-owned actions.
|
|
38
|
+
2. For server-side work, call the start API and return `{ ok: true, progressJobId }` from `onExecute`.
|
|
39
|
+
3. For browser-bound loops, call shared UI bulk helpers with progress metadata; never maintain custom page-local progress state.
|
|
40
|
+
4. Keep destructive confirmation in the action before starting work.
|
|
41
|
+
5. Clear selection only after work starts or finishes through the DataTable bulk action contract.
|
|
42
|
+
6. Add unit coverage for progress emission or `progressJobId` handling.
|
|
43
|
+
|
|
44
|
+
## Job Type Naming
|
|
45
|
+
|
|
46
|
+
Use stable, grep-friendly ids:
|
|
47
|
+
|
|
48
|
+
| Operation | Job type |
|
|
49
|
+
|-----------|----------|
|
|
50
|
+
| Catalog product bulk delete | `catalog.products.bulk_delete` |
|
|
51
|
+
| Customer people bulk delete | `customers.people.bulk_delete` |
|
|
52
|
+
| Customer companies bulk delete | `customers.companies.bulk_delete` |
|
|
53
|
+
| Customer deals bulk delete | `customers.deals.bulk_delete` |
|
|
54
|
+
| Future operations | `<module>.<surface_or_resource>.<operation>` |
|
|
55
|
+
|
|
56
|
+
## Reference Files
|
|
57
|
+
|
|
58
|
+
| When you need | Copy from |
|
|
59
|
+
|---------------|-----------|
|
|
60
|
+
| Server-side progress start API | `packages/core/src/modules/catalog/api/bulk-delete/route.ts` |
|
|
61
|
+
| Worker progress lifecycle | `packages/core/src/modules/catalog/workers/catalog-product-bulk-delete.ts` |
|
|
62
|
+
| Command-driven bulk mutation with progress | `packages/core/src/modules/catalog/lib/bulkDelete.ts` |
|
|
63
|
+
| Client-local progress fallback | `packages/ui/src/backend/utils/bulkDelete.ts` |
|
|
64
|
+
| DataTable progress result handling | `packages/ui/src/backend/DataTable.tsx` |
|
|
65
|
+
| Progress UI merge/polling | `packages/ui/src/backend/progress/useProgressPoll.ts` and `useProgressSse.ts` |
|
|
66
|
+
|
|
67
|
+
## Cross-References
|
|
68
|
+
|
|
69
|
+
- **Queue worker rules**: `packages/queue/AGENTS.md`
|
|
70
|
+
- **DataTable bulk actions**: `packages/ui/AGENTS.md` → DataTable Guidelines
|
|
71
|
+
- **DOM Event Bridge**: `packages/events/AGENTS.md` → DOM Event Bridge
|
|
72
|
+
- **Framework spec**: `.ai/specs/2026-05-13-operation-progress-framework.md`
|
|
@@ -14,6 +14,7 @@ import { ActivitiesSection, NotesSection, type SectionAction, type TagOption } f
|
|
|
14
14
|
import { VersionHistoryAction } from '@open-mercato/ui/backend/version-history'
|
|
15
15
|
import { SendObjectMessageDialog } from '@open-mercato/ui/backend/messages'
|
|
16
16
|
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
17
|
+
import { extractCustomFieldEntries } from '@open-mercato/shared/lib/crud/custom-fields-client'
|
|
17
18
|
import { createTranslatorWithFallback } from '@open-mercato/shared/lib/i18n/translate'
|
|
18
19
|
import { buildResourceScheduleItems } from '@open-mercato/core/modules/resources/lib/resourceSchedule'
|
|
19
20
|
import { RESOURCES_RESOURCE_FIELDSET_DEFAULT } from '@open-mercato/core/modules/resources/lib/resourceCustomFields'
|
|
@@ -422,11 +423,7 @@ export default function ResourcesResourceDetailPage({ params }: { params?: { id?
|
|
|
422
423
|
const resource = resourceRaw ? normalizeResourceRecord(resourceRaw) : null
|
|
423
424
|
if (!resource) throw new Error(t('resources.resources.form.errors.notFound', 'Resource not found.'))
|
|
424
425
|
if (!cancelled) {
|
|
425
|
-
const customValues
|
|
426
|
-
for (const [key, value] of Object.entries(resource)) {
|
|
427
|
-
if (key.startsWith('cf_')) customValues[key] = value
|
|
428
|
-
else if (key.startsWith('cf:')) customValues[`cf_${key.slice(3)}`] = value
|
|
429
|
-
}
|
|
426
|
+
const customValues = extractCustomFieldEntries(resource)
|
|
430
427
|
setTags(Array.isArray(resource.tags) ? resource.tags : [])
|
|
431
428
|
setAvailabilityRuleSetId(
|
|
432
429
|
typeof resource.availabilityRuleSetId === 'string'
|