@open-mercato/core 0.6.7-develop.6785.1.1dd7cfac55 → 0.6.7-develop.6795.1.8a3f27921c

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 (196) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/generated/entities.ids.generated.js +1 -0
  3. package/dist/generated/entities.ids.generated.js.map +2 -2
  4. package/dist/modules/auth/backend/settings/page.js +14 -9
  5. package/dist/modules/auth/backend/settings/page.js.map +2 -2
  6. package/dist/modules/customers/cli.js +17 -7
  7. package/dist/modules/customers/cli.js.map +2 -2
  8. package/dist/modules/customers/components/detail/ScheduleActivityDialog.js +229 -216
  9. package/dist/modules/customers/components/detail/ScheduleActivityDialog.js.map +2 -2
  10. package/dist/modules/customers/search.js +50 -29
  11. package/dist/modules/customers/search.js.map +2 -2
  12. package/dist/modules/data_sync/api/mappings/[id]/route.js +22 -9
  13. package/dist/modules/data_sync/api/mappings/[id]/route.js.map +2 -2
  14. package/dist/modules/data_sync/api/mappings/route.js +13 -4
  15. package/dist/modules/data_sync/api/mappings/route.js.map +2 -2
  16. package/dist/modules/data_sync/api/options.js +7 -2
  17. package/dist/modules/data_sync/api/options.js.map +2 -2
  18. package/dist/modules/data_sync/api/run.js +7 -2
  19. package/dist/modules/data_sync/api/run.js.map +2 -2
  20. package/dist/modules/data_sync/api/runs/[id]/cancel.js +8 -3
  21. package/dist/modules/data_sync/api/runs/[id]/cancel.js.map +2 -2
  22. package/dist/modules/data_sync/api/runs/[id]/retry.js +7 -2
  23. package/dist/modules/data_sync/api/runs/[id]/retry.js.map +2 -2
  24. package/dist/modules/data_sync/api/runs/[id]/route.js +8 -3
  25. package/dist/modules/data_sync/api/runs/[id]/route.js.map +2 -2
  26. package/dist/modules/data_sync/api/runs.js +7 -2
  27. package/dist/modules/data_sync/api/runs.js.map +2 -2
  28. package/dist/modules/data_sync/api/schedules/[id]/route.js +19 -6
  29. package/dist/modules/data_sync/api/schedules/[id]/route.js.map +2 -2
  30. package/dist/modules/data_sync/api/schedules/route.js +13 -4
  31. package/dist/modules/data_sync/api/schedules/route.js.map +2 -2
  32. package/dist/modules/data_sync/api/validate.js +9 -4
  33. package/dist/modules/data_sync/api/validate.js.map +2 -2
  34. package/dist/modules/design_system/acl.js +9 -0
  35. package/dist/modules/design_system/acl.js.map +7 -0
  36. package/dist/modules/design_system/backend/design-system/page.js +11 -0
  37. package/dist/modules/design_system/backend/design-system/page.js.map +7 -0
  38. package/dist/modules/design_system/backend/design-system/page.meta.js +15 -0
  39. package/dist/modules/design_system/backend/design-system/page.meta.js.map +7 -0
  40. package/dist/modules/design_system/gallery/components/CodeSnippet.js +52 -0
  41. package/dist/modules/design_system/gallery/components/CodeSnippet.js.map +7 -0
  42. package/dist/modules/design_system/gallery/components/EntryCard.js +63 -0
  43. package/dist/modules/design_system/gallery/components/EntryCard.js.map +7 -0
  44. package/dist/modules/design_system/gallery/components/GalleryShell.js +163 -0
  45. package/dist/modules/design_system/gallery/components/GalleryShell.js.map +7 -0
  46. package/dist/modules/design_system/gallery/components/VariantPreview.js +9 -0
  47. package/dist/modules/design_system/gallery/components/VariantPreview.js.map +7 -0
  48. package/dist/modules/design_system/gallery/entries/banners.js +186 -0
  49. package/dist/modules/design_system/gallery/entries/banners.js.map +7 -0
  50. package/dist/modules/design_system/gallery/entries/buttons.js +361 -0
  51. package/dist/modules/design_system/gallery/entries/buttons.js.map +7 -0
  52. package/dist/modules/design_system/gallery/entries/charts.js +457 -0
  53. package/dist/modules/design_system/gallery/entries/charts.js.map +7 -0
  54. package/dist/modules/design_system/gallery/entries/dates.js +306 -0
  55. package/dist/modules/design_system/gallery/entries/dates.js.map +7 -0
  56. package/dist/modules/design_system/gallery/entries/detail.js +358 -0
  57. package/dist/modules/design_system/gallery/entries/detail.js.map +7 -0
  58. package/dist/modules/design_system/gallery/entries/display.js +785 -0
  59. package/dist/modules/design_system/gallery/entries/display.js.map +7 -0
  60. package/dist/modules/design_system/gallery/entries/feedback.js +658 -0
  61. package/dist/modules/design_system/gallery/entries/feedback.js.map +7 -0
  62. package/dist/modules/design_system/gallery/entries/filters.js +505 -0
  63. package/dist/modules/design_system/gallery/entries/filters.js.map +7 -0
  64. package/dist/modules/design_system/gallery/entries/foundations.js +453 -0
  65. package/dist/modules/design_system/gallery/entries/foundations.js.map +7 -0
  66. package/dist/modules/design_system/gallery/entries/icons.js +140 -0
  67. package/dist/modules/design_system/gallery/entries/icons.js.map +7 -0
  68. package/dist/modules/design_system/gallery/entries/inputs.js +1217 -0
  69. package/dist/modules/design_system/gallery/entries/inputs.js.map +7 -0
  70. package/dist/modules/design_system/gallery/entries/messages.js +334 -0
  71. package/dist/modules/design_system/gallery/entries/messages.js.map +7 -0
  72. package/dist/modules/design_system/gallery/entries/navigation.js +475 -0
  73. package/dist/modules/design_system/gallery/entries/navigation.js.map +7 -0
  74. package/dist/modules/design_system/gallery/entries/notifications.js +257 -0
  75. package/dist/modules/design_system/gallery/entries/notifications.js.map +7 -0
  76. package/dist/modules/design_system/gallery/entries/overlays.js +576 -0
  77. package/dist/modules/design_system/gallery/entries/overlays.js.map +7 -0
  78. package/dist/modules/design_system/gallery/entries/scaffolding.js +378 -0
  79. package/dist/modules/design_system/gallery/entries/scaffolding.js.map +7 -0
  80. package/dist/modules/design_system/gallery/entries/schedule.js +297 -0
  81. package/dist/modules/design_system/gallery/entries/schedule.js.map +7 -0
  82. package/dist/modules/design_system/gallery/registry.js +139 -0
  83. package/dist/modules/design_system/gallery/registry.js.map +7 -0
  84. package/dist/modules/design_system/gallery/types.js +1 -0
  85. package/dist/modules/design_system/gallery/types.js.map +7 -0
  86. package/dist/modules/design_system/index.js +9 -0
  87. package/dist/modules/design_system/index.js.map +7 -0
  88. package/dist/modules/design_system/setup.js +14 -0
  89. package/dist/modules/design_system/setup.js.map +7 -0
  90. package/dist/modules/inbox_ops/search.js +15 -4
  91. package/dist/modules/inbox_ops/search.js.map +2 -2
  92. package/dist/modules/integrations/api/[id]/credentials/route.js +11 -5
  93. package/dist/modules/integrations/api/[id]/credentials/route.js.map +2 -2
  94. package/dist/modules/integrations/api/[id]/health/route.js +6 -3
  95. package/dist/modules/integrations/api/[id]/health/route.js.map +2 -2
  96. package/dist/modules/integrations/api/[id]/route.js +6 -3
  97. package/dist/modules/integrations/api/[id]/route.js.map +2 -2
  98. package/dist/modules/integrations/api/[id]/state/route.js +6 -3
  99. package/dist/modules/integrations/api/[id]/state/route.js.map +2 -2
  100. package/dist/modules/integrations/api/[id]/version/route.js +6 -3
  101. package/dist/modules/integrations/api/[id]/version/route.js.map +2 -2
  102. package/dist/modules/integrations/api/logs/route.js +6 -3
  103. package/dist/modules/integrations/api/logs/route.js.map +2 -2
  104. package/dist/modules/integrations/api/route.js +6 -3
  105. package/dist/modules/integrations/api/route.js.map +2 -2
  106. package/dist/modules/integrations/api/umes-read.js +2 -2
  107. package/dist/modules/integrations/api/umes-read.js.map +2 -2
  108. package/dist/modules/integrations/lib/organization-scope.js +2 -9
  109. package/dist/modules/integrations/lib/organization-scope.js.map +2 -2
  110. package/dist/modules/messages/search.js +10 -5
  111. package/dist/modules/messages/search.js.map +2 -2
  112. package/dist/modules/query_index/data/entities.js +2 -1
  113. package/dist/modules/query_index/data/entities.js.map +2 -2
  114. package/dist/modules/query_index/lib/engine.js +32 -50
  115. package/dist/modules/query_index/lib/engine.js.map +2 -2
  116. package/dist/modules/query_index/migrations/Migration20260731105052_query_index.js +17 -0
  117. package/dist/modules/query_index/migrations/Migration20260731105052_query_index.js.map +7 -0
  118. package/generated/entities.ids.generated.ts +1 -0
  119. package/package.json +16 -16
  120. package/src/modules/auth/backend/settings/page.tsx +17 -8
  121. package/src/modules/customers/cli.ts +17 -7
  122. package/src/modules/customers/components/detail/ScheduleActivityDialog.tsx +24 -13
  123. package/src/modules/customers/i18n/de.json +17 -0
  124. package/src/modules/customers/i18n/en.json +17 -0
  125. package/src/modules/customers/i18n/es.json +17 -0
  126. package/src/modules/customers/i18n/pl.json +17 -0
  127. package/src/modules/customers/search.ts +59 -27
  128. package/src/modules/data_sync/AGENTS.md +1 -0
  129. package/src/modules/data_sync/api/mappings/[id]/route.ts +22 -9
  130. package/src/modules/data_sync/api/mappings/route.ts +13 -4
  131. package/src/modules/data_sync/api/options.ts +7 -2
  132. package/src/modules/data_sync/api/run.ts +7 -2
  133. package/src/modules/data_sync/api/runs/[id]/cancel.ts +8 -3
  134. package/src/modules/data_sync/api/runs/[id]/retry.ts +7 -2
  135. package/src/modules/data_sync/api/runs/[id]/route.ts +8 -3
  136. package/src/modules/data_sync/api/runs.ts +7 -2
  137. package/src/modules/data_sync/api/schedules/[id]/route.ts +19 -6
  138. package/src/modules/data_sync/api/schedules/route.ts +13 -4
  139. package/src/modules/data_sync/api/validate.ts +9 -4
  140. package/src/modules/design_system/AGENTS.md +34 -0
  141. package/src/modules/design_system/acl.ts +5 -0
  142. package/src/modules/design_system/backend/design-system/page.meta.ts +11 -0
  143. package/src/modules/design_system/backend/design-system/page.tsx +14 -0
  144. package/src/modules/design_system/gallery/components/CodeSnippet.tsx +55 -0
  145. package/src/modules/design_system/gallery/components/EntryCard.tsx +95 -0
  146. package/src/modules/design_system/gallery/components/GalleryShell.tsx +206 -0
  147. package/src/modules/design_system/gallery/components/VariantPreview.tsx +15 -0
  148. package/src/modules/design_system/gallery/entries/banners.tsx +226 -0
  149. package/src/modules/design_system/gallery/entries/buttons.tsx +422 -0
  150. package/src/modules/design_system/gallery/entries/charts.tsx +518 -0
  151. package/src/modules/design_system/gallery/entries/dates.tsx +325 -0
  152. package/src/modules/design_system/gallery/entries/detail.tsx +403 -0
  153. package/src/modules/design_system/gallery/entries/display.tsx +893 -0
  154. package/src/modules/design_system/gallery/entries/feedback.tsx +746 -0
  155. package/src/modules/design_system/gallery/entries/filters.tsx +570 -0
  156. package/src/modules/design_system/gallery/entries/foundations.tsx +529 -0
  157. package/src/modules/design_system/gallery/entries/icons.tsx +168 -0
  158. package/src/modules/design_system/gallery/entries/inputs.tsx +1516 -0
  159. package/src/modules/design_system/gallery/entries/messages.tsx +339 -0
  160. package/src/modules/design_system/gallery/entries/navigation.tsx +573 -0
  161. package/src/modules/design_system/gallery/entries/notifications.tsx +285 -0
  162. package/src/modules/design_system/gallery/entries/overlays.tsx +677 -0
  163. package/src/modules/design_system/gallery/entries/scaffolding.tsx +430 -0
  164. package/src/modules/design_system/gallery/entries/schedule.tsx +307 -0
  165. package/src/modules/design_system/gallery/registry.ts +152 -0
  166. package/src/modules/design_system/gallery/types.ts +32 -0
  167. package/src/modules/design_system/i18n/.hardcoded-allowlist.json +71 -0
  168. package/src/modules/design_system/i18n/de.json +46 -0
  169. package/src/modules/design_system/i18n/en.json +46 -0
  170. package/src/modules/design_system/i18n/es.json +46 -0
  171. package/src/modules/design_system/i18n/pl.json +46 -0
  172. package/src/modules/design_system/index.ts +7 -0
  173. package/src/modules/design_system/setup.ts +12 -0
  174. package/src/modules/inbox_ops/i18n/de.json +3 -0
  175. package/src/modules/inbox_ops/i18n/en.json +3 -0
  176. package/src/modules/inbox_ops/i18n/es.json +3 -0
  177. package/src/modules/inbox_ops/i18n/pl.json +3 -0
  178. package/src/modules/inbox_ops/search.ts +20 -4
  179. package/src/modules/integrations/api/[id]/credentials/route.ts +11 -5
  180. package/src/modules/integrations/api/[id]/health/route.ts +6 -3
  181. package/src/modules/integrations/api/[id]/route.ts +6 -3
  182. package/src/modules/integrations/api/[id]/state/route.ts +6 -3
  183. package/src/modules/integrations/api/[id]/version/route.ts +6 -3
  184. package/src/modules/integrations/api/logs/route.ts +6 -3
  185. package/src/modules/integrations/api/route.ts +6 -3
  186. package/src/modules/integrations/api/umes-read.ts +2 -2
  187. package/src/modules/integrations/lib/organization-scope.ts +5 -25
  188. package/src/modules/messages/i18n/de.json +2 -0
  189. package/src/modules/messages/i18n/en.json +2 -0
  190. package/src/modules/messages/i18n/es.json +2 -0
  191. package/src/modules/messages/i18n/pl.json +2 -0
  192. package/src/modules/messages/search.ts +11 -5
  193. package/src/modules/query_index/data/entities.ts +7 -0
  194. package/src/modules/query_index/lib/engine.ts +40 -63
  195. package/src/modules/query_index/migrations/.snapshot-open-mercato.json +12 -0
  196. package/src/modules/query_index/migrations/Migration20260731105052_query_index.ts +35 -0
@@ -0,0 +1,17 @@
1
+ import { Migration } from "@mikro-orm/migrations";
2
+ class Migration20260731105052_query_index extends Migration {
3
+ isTransactional() {
4
+ return false;
5
+ }
6
+ up() {
7
+ this.addSql(`drop index concurrently if exists "search_tokens_presence_idx";`);
8
+ this.addSql(`create index concurrently "search_tokens_presence_idx" on "search_tokens" ("entity_type", "tenant_id", "organization_id");`);
9
+ }
10
+ down() {
11
+ this.addSql(`drop index concurrently if exists "search_tokens_presence_idx";`);
12
+ }
13
+ }
14
+ export {
15
+ Migration20260731105052_query_index
16
+ };
17
+ //# sourceMappingURL=Migration20260731105052_query_index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/modules/query_index/migrations/Migration20260731105052_query_index.ts"],
4
+ "sourcesContent": ["import { Migration } from '@mikro-orm/migrations';\n\n// Availability-probe index (.ai/specs/2026-07-31-search-token-probe-index.md).\n// The query engines gate like/ilike routing on \"does (entity_type, tenant, org)\n// have any search tokens?\". Neither existing index serves that probe as an\n// access path \u2014 lookup_idx buries tenant_id behind field/token_hash \u2014 so on a\n// large search_tokens the planner degraded the probe to a seq scan and the MISS\n// answer had to exhaust every entry for the entity type (p95 12.5 s in\n// production, #4723). With this (entity_type, tenant_id, organization_id)\n// prefix and the index-usable `= / IS NULL` predicates the availability\n// resolver emits, both the hit AND the miss become a B-tree prefix seek.\n//\n// search_tokens is high-churn, so the index is built CONCURRENTLY to avoid\n// blocking writes during the build. CREATE INDEX CONCURRENTLY cannot run\n// inside a transaction, hence isTransactional() => false; the migration runner\n// applies migrations one-by-one, so this opt-out is safe (same pattern as\n// Migration20260611103000_query_index). Drop first so retrying a failed\n// concurrent build removes PostgreSQL's invalid index stub instead of letting\n// IF NOT EXISTS silently accept it.\nexport class Migration20260731105052_query_index extends Migration {\n\n override isTransactional(): boolean {\n return false;\n }\n\n override up(): void | Promise<void> {\n this.addSql(`drop index concurrently if exists \"search_tokens_presence_idx\";`);\n this.addSql(`create index concurrently \"search_tokens_presence_idx\" on \"search_tokens\" (\"entity_type\", \"tenant_id\", \"organization_id\");`);\n }\n\n override down(): void | Promise<void> {\n this.addSql(`drop index concurrently if exists \"search_tokens_presence_idx\";`);\n }\n\n}\n"],
5
+ "mappings": "AAAA,SAAS,iBAAiB;AAmBnB,MAAM,4CAA4C,UAAU;AAAA,EAExD,kBAA2B;AAClC,WAAO;AAAA,EACT;AAAA,EAES,KAA2B;AAClC,SAAK,OAAO,iEAAiE;AAC7E,SAAK,OAAO,4HAA4H;AAAA,EAC1I;AAAA,EAES,OAA6B;AACpC,SAAK,OAAO,iEAAiE;AAAA,EAC/E;AAEF;",
6
+ "names": []
7
+ }
@@ -16,6 +16,7 @@ export const M = {
16
16
  "api_keys": "api_keys",
17
17
  "dictionaries": "dictionaries",
18
18
  "api_docs": "api_docs",
19
+ "design_system": "design_system",
19
20
  "business_rules": "business_rules",
20
21
  "feature_toggles": "feature_toggles",
21
22
  "workflows": "workflows",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-mercato/core",
3
- "version": "0.6.7-develop.6785.1.1dd7cfac55",
3
+ "version": "0.6.7-develop.6795.1.8a3f27921c",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -228,9 +228,9 @@
228
228
  }
229
229
  },
230
230
  "dependencies": {
231
- "@mikro-orm/core": "^7.1.5",
232
- "@mikro-orm/decorators": "^7.1.5",
233
- "@mikro-orm/postgresql": "^7.1.5",
231
+ "@mikro-orm/core": "^7.1.8",
232
+ "@mikro-orm/decorators": "^7.1.8",
233
+ "@mikro-orm/postgresql": "^7.1.8",
234
234
  "@types/html-to-text": "^9.0.4",
235
235
  "@types/leaflet": "^1.9.12",
236
236
  "@types/leaflet.markercluster": "^1.5.5",
@@ -245,25 +245,25 @@
245
245
  "leaflet.markercluster": "^1.5.3",
246
246
  "mammoth": "^1.9.0",
247
247
  "pdfjs-dist": "^6.1.200",
248
- "resend": "^6.17.2",
249
- "sanitize-html": "^2.17.5",
248
+ "resend": "^6.18.1",
249
+ "sanitize-html": "2.17.5",
250
250
  "semver": "^7.8.5",
251
251
  "sharp": "^0.35.3",
252
- "svix": "^1.96.1",
252
+ "svix": "^1.99.1",
253
253
  "ts-pattern": "^5.0.0",
254
254
  "zod": "^4.4.3"
255
255
  },
256
256
  "peerDependencies": {
257
- "@open-mercato/ai-assistant": "0.6.7-develop.6785.1.1dd7cfac55",
258
- "@open-mercato/shared": "0.6.7-develop.6785.1.1dd7cfac55",
259
- "@open-mercato/ui": "0.6.7-develop.6785.1.1dd7cfac55",
257
+ "@open-mercato/ai-assistant": "0.6.7-develop.6795.1.8a3f27921c",
258
+ "@open-mercato/shared": "0.6.7-develop.6795.1.8a3f27921c",
259
+ "@open-mercato/ui": "0.6.7-develop.6795.1.8a3f27921c",
260
260
  "react": "^19.0.0",
261
261
  "react-dom": "^19.0.0"
262
262
  },
263
263
  "devDependencies": {
264
- "@open-mercato/ai-assistant": "0.6.7-develop.6785.1.1dd7cfac55",
265
- "@open-mercato/shared": "0.6.7-develop.6785.1.1dd7cfac55",
266
- "@open-mercato/ui": "0.6.7-develop.6785.1.1dd7cfac55",
264
+ "@open-mercato/ai-assistant": "0.6.7-develop.6795.1.8a3f27921c",
265
+ "@open-mercato/shared": "0.6.7-develop.6795.1.8a3f27921c",
266
+ "@open-mercato/ui": "0.6.7-develop.6795.1.8a3f27921c",
267
267
  "@testing-library/dom": "^10.4.1",
268
268
  "@testing-library/jest-dom": "^6.9.1",
269
269
  "@testing-library/react": "^16.3.1",
@@ -274,9 +274,9 @@
274
274
  "chance": "^1.1.13",
275
275
  "jest": "^30.4.2",
276
276
  "jest-environment-jsdom": "^30.4.1",
277
- "react": "19.2.7",
278
- "react-dom": "19.2.7",
279
- "ts-jest": "^29.4.11",
277
+ "react": "19.2.8",
278
+ "react-dom": "19.2.8",
279
+ "ts-jest": "^29.4.12",
280
280
  "typescript": "7.0.2"
281
281
  },
282
282
  "publishConfig": {
@@ -1,12 +1,21 @@
1
1
  'use client'
2
- import { useEffect } from 'react'
3
- import { useRouter } from 'next/navigation'
4
- import { Spinner } from '@open-mercato/ui/primitives/spinner'
2
+ import { useT } from '@open-mercato/shared/lib/i18n/context'
3
+ import { Page, PageBody, PageHeader } from '@open-mercato/ui/backend/Page'
5
4
 
6
5
  export default function SettingsPage() {
7
- const router = useRouter()
8
- useEffect(() => {
9
- router.replace('/backend/config/system-status')
10
- }, [router])
11
- return <Spinner className="h-4 w-4" />
6
+ const t = useT()
7
+
8
+ return (
9
+ <Page>
10
+ <PageHeader
11
+ title={t('settings.page.title', 'Settings')}
12
+ description={t('settings.page.description', 'System configuration and administration')}
13
+ />
14
+ <PageBody>
15
+ <p className="text-sm text-muted-foreground">
16
+ {t('settings.page.selectItem', 'Select an item from the menu to configure system settings.')}
17
+ </p>
18
+ </PageBody>
19
+ </Page>
20
+ )
12
21
  }
@@ -12,6 +12,7 @@ import { E as CoreEntities } from '#generated/entities.ids.generated'
12
12
  import { createProgressBar } from '@open-mercato/shared/lib/cli/progress'
13
13
  import { buildIndexDocument, type IndexCustomFieldValue } from '@open-mercato/core/modules/query_index/lib/document'
14
14
  import { parseBooleanToken } from '@open-mercato/shared/lib/boolean'
15
+ import { findWithDecryption } from '@open-mercato/shared/lib/encryption/find'
15
16
  import { resolveSearchConfig } from '@open-mercato/shared/lib/search/config'
16
17
  import type { QueryEngine } from '@open-mercato/shared/lib/query/types'
17
18
  import type { EntityId } from '@open-mercato/shared/modules/entities'
@@ -1396,13 +1397,22 @@ async function seedCustomerExamples(
1396
1397
  )
1397
1398
  )
1398
1399
  if (exampleDealTitles.length > 0) {
1399
- const already = await em.count(CustomerDeal, {
1400
- tenantId,
1401
- organizationId,
1402
- title: { $in: exampleDealTitles as any },
1403
- })
1404
- if (already > 0) {
1405
- return false
1400
+ const exampleTitles = new Set(exampleDealTitles)
1401
+ const batchSize = 100
1402
+ let offset = 0
1403
+ while (true) {
1404
+ const existingDeals = await findWithDecryption(
1405
+ em,
1406
+ CustomerDeal,
1407
+ { tenantId, organizationId },
1408
+ { fields: ['title'], limit: batchSize, offset, orderBy: { id: 'asc' } },
1409
+ { tenantId, organizationId },
1410
+ )
1411
+ if (existingDeals.some((deal) => typeof deal.title === 'string' && exampleTitles.has(deal.title))) {
1412
+ return false
1413
+ }
1414
+ if (existingDeals.length < batchSize) break
1415
+ offset += existingDeals.length
1406
1416
  }
1407
1417
  }
1408
1418
 
@@ -207,6 +207,7 @@ export function ScheduleActivityDialog({
207
207
  const initialSnapshotRef = React.useRef<string | null>(null)
208
208
  const snapshotOpenKeyRef = React.useRef<string | null>(null)
209
209
  const snapshotSettleCountRef = React.useRef(0)
210
+ const closeConfirmPendingRef = React.useRef(false)
210
211
  const openKey = open ? `${editData?.id ?? 'new'}` : null
211
212
  React.useEffect(() => {
212
213
  if (!open) {
@@ -232,21 +233,27 @@ export function ScheduleActivityDialog({
232
233
  }, [formSnapshot])
233
234
 
234
235
  const guardedClose = React.useCallback(async () => {
236
+ if (closeConfirmPendingRef.current) return
235
237
  if (!isDirty()) {
236
238
  onClose()
237
239
  return
238
240
  }
239
- const ok = await confirm({
240
- title: t('customers.schedule.discardConfirm.title', 'Discard unsaved changes?'),
241
- description: t(
242
- 'customers.schedule.discardConfirm.description',
243
- 'You have unsaved edits in this activity. Save them first or continue to discard them.',
244
- ),
245
- confirmText: t('customers.schedule.discardConfirm.confirm', 'Discard'),
246
- cancelText: t('customers.schedule.discardConfirm.cancel', 'Keep editing'),
247
- variant: 'destructive',
248
- })
249
- if (ok) onClose()
241
+ closeConfirmPendingRef.current = true
242
+ try {
243
+ const ok = await confirm({
244
+ title: t('customers.schedule.discardConfirm.title', 'Discard unsaved changes?'),
245
+ description: t(
246
+ 'customers.schedule.discardConfirm.description',
247
+ 'You have unsaved edits in this activity. Save them first or continue to discard them.',
248
+ ),
249
+ confirmText: t('customers.schedule.discardConfirm.confirm', 'Discard'),
250
+ cancelText: t('customers.schedule.discardConfirm.cancel', 'Keep editing'),
251
+ variant: 'destructive',
252
+ })
253
+ if (ok) onClose()
254
+ } finally {
255
+ closeConfirmPendingRef.current = false
256
+ }
250
257
  }, [confirm, isDirty, onClose, t])
251
258
 
252
259
  const mutationContextId = React.useMemo(
@@ -468,8 +475,12 @@ export function ScheduleActivityDialog({
468
475
 
469
476
  return (
470
477
  <Dialog open={open} onOpenChange={(o) => { if (!o) void guardedClose() }}>
471
- {ConfirmDialogElement}
472
- <DialogContent className="flex max-h-[90vh] flex-col overflow-hidden border-border p-0 shadow-xl sm:max-w-[760px] sm:rounded-xl [&>[data-dialog-close]]:hidden" onKeyDown={handleKeyDown} aria-describedby={undefined}>
478
+ <DialogContent
479
+ className="flex max-h-[90vh] flex-col overflow-hidden border-border p-0 shadow-xl sm:max-w-[760px] sm:rounded-xl [&>[data-dialog-close]]:hidden"
480
+ onKeyDown={handleKeyDown}
481
+ aria-describedby={undefined}
482
+ >
483
+ {ConfirmDialogElement}
473
484
  <VisuallyHidden>
474
485
  <DialogTitle>{isEditing ? t('customers.schedule.editTitle', 'Edit activity') : t(chrome.titleKey, chrome.titleFallback)}</DialogTitle>
475
486
  </VisuallyHidden>
@@ -2651,6 +2651,23 @@
2651
2651
  "customers.schedule.visibility": "Visibility",
2652
2652
  "customers.schedule.visibility.public": "Public",
2653
2653
  "customers.schedule.visibility.team": "Team only",
2654
+ "customers.search.badge.activity": "Aktivität",
2655
+ "customers.search.badge.company": "Unternehmen",
2656
+ "customers.search.badge.deal": "Deal",
2657
+ "customers.search.badge.person": "Person",
2658
+ "customers.search.fallback.activity": "Aktivität: {{type}}",
2659
+ "customers.search.fallback.activityUpdate": "Aktualisierung",
2660
+ "customers.search.fallback.company": "Unternehmen",
2661
+ "customers.search.fallback.customerNote": "Kundennotiz",
2662
+ "customers.search.fallback.customerTask": "Kundenaufgabe",
2663
+ "customers.search.fallback.deal": "Deal",
2664
+ "customers.search.fallback.person": "Person",
2665
+ "customers.search.link.edit": "Bearbeiten",
2666
+ "customers.search.link.openCompany": "Unternehmen öffnen",
2667
+ "customers.search.link.openDeal": "Deal öffnen",
2668
+ "customers.search.link.openPerson": "Person öffnen",
2669
+ "customers.search.link.openTodo": "Aufgabe öffnen",
2670
+ "customers.search.link.viewCustomer": "Kunde anzeigen",
2654
2671
  "customers.tags.manage.addCategory": "Neue Kategorie",
2655
2672
  "customers.tags.manage.addCategoryPlaceholder": "Kategoriename...",
2656
2673
  "customers.tags.manage.addCategoryRequired": "Geben Sie zuerst einen Kategorienamen ein.",
@@ -2651,6 +2651,23 @@
2651
2651
  "customers.schedule.visibility": "Visibility",
2652
2652
  "customers.schedule.visibility.public": "Public",
2653
2653
  "customers.schedule.visibility.team": "Team only",
2654
+ "customers.search.badge.activity": "Activity",
2655
+ "customers.search.badge.company": "Company",
2656
+ "customers.search.badge.deal": "Deal",
2657
+ "customers.search.badge.person": "Person",
2658
+ "customers.search.fallback.activity": "Activity: {{type}}",
2659
+ "customers.search.fallback.activityUpdate": "update",
2660
+ "customers.search.fallback.company": "Company",
2661
+ "customers.search.fallback.customerNote": "Customer note",
2662
+ "customers.search.fallback.customerTask": "Customer task",
2663
+ "customers.search.fallback.deal": "Deal",
2664
+ "customers.search.fallback.person": "Person",
2665
+ "customers.search.link.edit": "Edit",
2666
+ "customers.search.link.openCompany": "Open company",
2667
+ "customers.search.link.openDeal": "Open deal",
2668
+ "customers.search.link.openPerson": "Open person",
2669
+ "customers.search.link.openTodo": "Open todo",
2670
+ "customers.search.link.viewCustomer": "View customer",
2654
2671
  "customers.tags.manage.addCategory": "New category",
2655
2672
  "customers.tags.manage.addCategoryPlaceholder": "Category name...",
2656
2673
  "customers.tags.manage.addCategoryRequired": "Enter a category name first.",
@@ -2651,6 +2651,23 @@
2651
2651
  "customers.schedule.visibility": "Visibility",
2652
2652
  "customers.schedule.visibility.public": "Public",
2653
2653
  "customers.schedule.visibility.team": "Team only",
2654
+ "customers.search.badge.activity": "Actividad",
2655
+ "customers.search.badge.company": "Empresa",
2656
+ "customers.search.badge.deal": "Oportunidad",
2657
+ "customers.search.badge.person": "Persona",
2658
+ "customers.search.fallback.activity": "Actividad: {{type}}",
2659
+ "customers.search.fallback.activityUpdate": "actualización",
2660
+ "customers.search.fallback.company": "Empresa",
2661
+ "customers.search.fallback.customerNote": "Nota del cliente",
2662
+ "customers.search.fallback.customerTask": "Tarea del cliente",
2663
+ "customers.search.fallback.deal": "Oportunidad",
2664
+ "customers.search.fallback.person": "Persona",
2665
+ "customers.search.link.edit": "Editar",
2666
+ "customers.search.link.openCompany": "Abrir empresa",
2667
+ "customers.search.link.openDeal": "Abrir oportunidad",
2668
+ "customers.search.link.openPerson": "Abrir persona",
2669
+ "customers.search.link.openTodo": "Abrir tarea",
2670
+ "customers.search.link.viewCustomer": "Ver cliente",
2654
2671
  "customers.tags.manage.addCategory": "Nueva categoría",
2655
2672
  "customers.tags.manage.addCategoryPlaceholder": "Nombre de la categoría...",
2656
2673
  "customers.tags.manage.addCategoryRequired": "Primero introduce un nombre de categoría.",
@@ -2651,6 +2651,23 @@
2651
2651
  "customers.schedule.visibility": "Widoczność",
2652
2652
  "customers.schedule.visibility.public": "Publiczny",
2653
2653
  "customers.schedule.visibility.team": "Tylko zespół",
2654
+ "customers.search.badge.activity": "Aktywność",
2655
+ "customers.search.badge.company": "Firma",
2656
+ "customers.search.badge.deal": "Szansa sprzedaży",
2657
+ "customers.search.badge.person": "Osoba",
2658
+ "customers.search.fallback.activity": "Aktywność: {{type}}",
2659
+ "customers.search.fallback.activityUpdate": "aktualizacja",
2660
+ "customers.search.fallback.company": "Firma",
2661
+ "customers.search.fallback.customerNote": "Notatka klienta",
2662
+ "customers.search.fallback.customerTask": "Zadanie klienta",
2663
+ "customers.search.fallback.deal": "Szansa sprzedaży",
2664
+ "customers.search.fallback.person": "Osoba",
2665
+ "customers.search.link.edit": "Edytuj",
2666
+ "customers.search.link.openCompany": "Otwórz firmę",
2667
+ "customers.search.link.openDeal": "Otwórz szansę",
2668
+ "customers.search.link.openPerson": "Otwórz osobę",
2669
+ "customers.search.link.openTodo": "Otwórz zadanie",
2670
+ "customers.search.link.viewCustomer": "Zobacz klienta",
2654
2671
  "customers.tags.manage.addCategory": "Nowa kategoria",
2655
2672
  "customers.tags.manage.addCategoryPlaceholder": "Nazwa kategorii...",
2656
2673
  "customers.tags.manage.addCategoryRequired": "Najpierw wpisz nazwę kategorii.",