@open-mercato/core 0.6.6-develop.6094.1.28b081ea16 → 0.6.6-develop.6121.1.5797a901b3
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/dist/generated/entities/catalog_product/index.js +52 -0
- package/dist/generated/entities/catalog_product/index.js.map +2 -2
- package/dist/generated/entities/catalog_product_variant/index.js +4 -0
- package/dist/generated/entities/catalog_product_variant/index.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +28 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/modules/catalog/api/products/route.js +103 -33
- package/dist/modules/catalog/api/products/route.js.map +2 -2
- package/dist/modules/catalog/api/variants/route.js +4 -0
- package/dist/modules/catalog/api/variants/route.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/[id]/page.js +46 -2
- 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 +4 -0
- package/dist/modules/catalog/backend/catalog/products/[productId]/variants/[variantId]/page.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/[productId]/variants/create/page.js +2 -0
- package/dist/modules/catalog/backend/catalog/products/[productId]/variants/create/page.js.map +2 -2
- package/dist/modules/catalog/backend/catalog/products/create/page.js +42 -2
- package/dist/modules/catalog/backend/catalog/products/create/page.js.map +2 -2
- package/dist/modules/catalog/commands/products.js +251 -14
- package/dist/modules/catalog/commands/products.js.map +2 -2
- package/dist/modules/catalog/commands/variants.js +72 -1
- package/dist/modules/catalog/commands/variants.js.map +2 -2
- package/dist/modules/catalog/components/products/ProductComplianceSection.js +500 -0
- package/dist/modules/catalog/components/products/ProductComplianceSection.js.map +7 -0
- package/dist/modules/catalog/components/products/VariantBuilder.js +39 -1
- package/dist/modules/catalog/components/products/VariantBuilder.js.map +2 -2
- package/dist/modules/catalog/components/products/productForm.js +164 -2
- package/dist/modules/catalog/components/products/productForm.js.map +2 -2
- package/dist/modules/catalog/components/products/variantForm.js +2 -0
- package/dist/modules/catalog/components/products/variantForm.js.map +2 -2
- package/dist/modules/catalog/data/entities.js +93 -0
- package/dist/modules/catalog/data/entities.js.map +2 -2
- package/dist/modules/catalog/data/types.js +28 -0
- package/dist/modules/catalog/data/types.js.map +2 -2
- package/dist/modules/catalog/data/validators.js +100 -5
- package/dist/modules/catalog/data/validators.js.map +2 -2
- package/dist/modules/catalog/lib/gtin.js +61 -0
- package/dist/modules/catalog/lib/gtin.js.map +7 -0
- package/dist/modules/catalog/migrations/Migration20260611090000.js +17 -0
- package/dist/modules/catalog/migrations/Migration20260611090000.js.map +7 -0
- package/dist/modules/catalog/translations.js +1 -1
- package/dist/modules/catalog/translations.js.map +2 -2
- package/dist/modules/configs/api/cache/route.js +60 -10
- package/dist/modules/configs/api/cache/route.js.map +3 -3
- package/dist/modules/configs/components/CachePanel.js +52 -29
- package/dist/modules/configs/components/CachePanel.js.map +2 -2
- package/dist/modules/currencies/api/currencies/options/route.js +18 -4
- package/dist/modules/currencies/api/currencies/options/route.js.map +2 -2
- package/dist/modules/currencies/services/rateFetchingService.js +35 -18
- package/dist/modules/currencies/services/rateFetchingService.js.map +2 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/users/[id]/page.js +16 -16
- package/dist/modules/customer_accounts/backend/customer_accounts/users/[id]/page.js.map +2 -2
- package/dist/modules/customer_accounts/backend/customer_accounts/users/page.js +1 -1
- package/dist/modules/customer_accounts/backend/customer_accounts/users/page.js.map +2 -2
- package/dist/modules/customers/backend/calendar/page.js +10 -0
- package/dist/modules/customers/backend/calendar/page.js.map +7 -0
- package/dist/modules/customers/backend/calendar/page.meta.js +25 -0
- package/dist/modules/customers/backend/calendar/page.meta.js.map +7 -0
- package/dist/modules/customers/cli.js +1 -0
- package/dist/modules/customers/cli.js.map +2 -2
- package/dist/modules/customers/components/calendar/AgendaList.js +182 -0
- package/dist/modules/customers/components/calendar/AgendaList.js.map +7 -0
- package/dist/modules/customers/components/calendar/CalendarEventEditor.js +331 -0
- package/dist/modules/customers/components/calendar/CalendarEventEditor.js.map +7 -0
- package/dist/modules/customers/components/calendar/CalendarFooter.js +48 -0
- package/dist/modules/customers/components/calendar/CalendarFooter.js.map +7 -0
- package/dist/modules/customers/components/calendar/CalendarHeader.js +36 -0
- package/dist/modules/customers/components/calendar/CalendarHeader.js.map +7 -0
- package/dist/modules/customers/components/calendar/CalendarScreen.js +516 -0
- package/dist/modules/customers/components/calendar/CalendarScreen.js.map +7 -0
- package/dist/modules/customers/components/calendar/CalendarSettingsModal.js +163 -0
- package/dist/modules/customers/components/calendar/CalendarSettingsModal.js.map +7 -0
- package/dist/modules/customers/components/calendar/CalendarTabs.js +60 -0
- package/dist/modules/customers/components/calendar/CalendarTabs.js.map +7 -0
- package/dist/modules/customers/components/calendar/CalendarToolbar.js +262 -0
- package/dist/modules/customers/components/calendar/CalendarToolbar.js.map +7 -0
- package/dist/modules/customers/components/calendar/EventBlock.js +149 -0
- package/dist/modules/customers/components/calendar/EventBlock.js.map +7 -0
- package/dist/modules/customers/components/calendar/EventPeekPopover.js +72 -0
- package/dist/modules/customers/components/calendar/EventPeekPopover.js.map +7 -0
- package/dist/modules/customers/components/calendar/MonthGrid.js +214 -0
- package/dist/modules/customers/components/calendar/MonthGrid.js.map +7 -0
- package/dist/modules/customers/components/calendar/ShortcutsDialog.js +44 -0
- package/dist/modules/customers/components/calendar/ShortcutsDialog.js.map +7 -0
- package/dist/modules/customers/components/calendar/TimeGrid.js +410 -0
- package/dist/modules/customers/components/calendar/TimeGrid.js.map +7 -0
- package/dist/modules/customers/components/calendar/UpcomingCards.js +175 -0
- package/dist/modules/customers/components/calendar/UpcomingCards.js.map +7 -0
- package/dist/modules/customers/components/calendar/editor/CategoryField.js +75 -0
- package/dist/modules/customers/components/calendar/editor/CategoryField.js.map +7 -0
- package/dist/modules/customers/components/calendar/editor/LocationField.js +30 -0
- package/dist/modules/customers/components/calendar/editor/LocationField.js.map +7 -0
- package/dist/modules/customers/components/calendar/editor/PeopleField.js +135 -0
- package/dist/modules/customers/components/calendar/editor/PeopleField.js.map +7 -0
- package/dist/modules/customers/components/calendar/editor/RelatedToField.js +218 -0
- package/dist/modules/customers/components/calendar/editor/RelatedToField.js.map +7 -0
- package/dist/modules/customers/components/calendar/editor/RepeatField.js +119 -0
- package/dist/modules/customers/components/calendar/editor/RepeatField.js.map +7 -0
- package/dist/modules/customers/components/calendar/editor/ScheduleSection.js +83 -0
- package/dist/modules/customers/components/calendar/editor/ScheduleSection.js.map +7 -0
- package/dist/modules/customers/components/calendar/editor/SegmentGroup.js +44 -0
- package/dist/modules/customers/components/calendar/editor/SegmentGroup.js.map +7 -0
- package/dist/modules/customers/components/calendar/editor/hooks.js +132 -0
- package/dist/modules/customers/components/calendar/editor/hooks.js.map +7 -0
- package/dist/modules/customers/components/calendar/editor/inputs.js +160 -0
- package/dist/modules/customers/components/calendar/editor/inputs.js.map +7 -0
- package/dist/modules/customers/components/calendar/editor/lookups.js +107 -0
- package/dist/modules/customers/components/calendar/editor/lookups.js.map +7 -0
- package/dist/modules/customers/components/calendar/types.js +30 -0
- package/dist/modules/customers/components/calendar/types.js.map +7 -0
- package/dist/modules/customers/components/calendar/useCalendarItems.js +131 -0
- package/dist/modules/customers/components/calendar/useCalendarItems.js.map +7 -0
- package/dist/modules/customers/components/calendar/useCalendarPreferences.js +41 -0
- package/dist/modules/customers/components/calendar/useCalendarPreferences.js.map +7 -0
- package/dist/modules/customers/lib/calendar/categories.js +28 -0
- package/dist/modules/customers/lib/calendar/categories.js.map +7 -0
- package/dist/modules/customers/lib/calendar/conflicts.js +72 -0
- package/dist/modules/customers/lib/calendar/conflicts.js.map +7 -0
- package/dist/modules/customers/lib/calendar/editorPayload.js +271 -0
- package/dist/modules/customers/lib/calendar/editorPayload.js.map +7 -0
- package/dist/modules/customers/lib/calendar/grid.js +48 -0
- package/dist/modules/customers/lib/calendar/grid.js.map +7 -0
- package/dist/modules/customers/lib/calendar/layout.js +39 -0
- package/dist/modules/customers/lib/calendar/layout.js.map +7 -0
- package/dist/modules/customers/lib/calendar/mapItem.js +79 -0
- package/dist/modules/customers/lib/calendar/mapItem.js.map +7 -0
- package/dist/modules/customers/lib/calendar/preferences.js +71 -0
- package/dist/modules/customers/lib/calendar/preferences.js.map +7 -0
- package/dist/modules/customers/lib/calendar/range.js +46 -0
- package/dist/modules/customers/lib/calendar/range.js.map +7 -0
- package/dist/modules/customers/lib/calendar/recurrence.js +113 -0
- package/dist/modules/customers/lib/calendar/recurrence.js.map +7 -0
- package/dist/modules/dashboards/services/widgetDataService.js +5 -5
- package/dist/modules/dashboards/services/widgetDataService.js.map +2 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/[entryId]/route.js +61 -1
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/[entryId]/route.js.map +2 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/route.js +33 -1
- package/dist/modules/dictionaries/api/[dictionaryId]/entries/route.js.map +2 -2
- package/dist/modules/dictionaries/api/[dictionaryId]/route.js +61 -1
- package/dist/modules/dictionaries/api/[dictionaryId]/route.js.map +2 -2
- package/dist/modules/dictionaries/api/route.js +33 -1
- package/dist/modules/dictionaries/api/route.js.map +2 -2
- package/dist/modules/feature_toggles/lib/queries.js +36 -52
- package/dist/modules/feature_toggles/lib/queries.js.map +2 -2
- package/dist/modules/perspectives/api/[tableId]/[perspectiveId]/route.js +32 -1
- package/dist/modules/perspectives/api/[tableId]/[perspectiveId]/route.js.map +2 -2
- package/dist/modules/perspectives/api/[tableId]/roles/[roleId]/route.js +32 -1
- package/dist/modules/perspectives/api/[tableId]/roles/[roleId]/route.js.map +2 -2
- package/dist/modules/perspectives/api/[tableId]/route.js +73 -2
- package/dist/modules/perspectives/api/[tableId]/route.js.map +2 -2
- package/dist/modules/perspectives/services/perspectiveService.js +5 -3
- package/dist/modules/perspectives/services/perspectiveService.js.map +2 -2
- package/dist/modules/planner/api/access.js +9 -0
- package/dist/modules/planner/api/access.js.map +2 -2
- package/dist/modules/planner/api/availability-date-specific.js +22 -1
- package/dist/modules/planner/api/availability-date-specific.js.map +2 -2
- package/dist/modules/planner/api/availability-weekly.js +22 -1
- package/dist/modules/planner/api/availability-weekly.js.map +2 -2
- package/dist/modules/resources/api/resources/tags/assign/route.js +39 -0
- package/dist/modules/resources/api/resources/tags/assign/route.js.map +2 -2
- package/dist/modules/resources/api/resources/tags/unassign/route.js +39 -0
- package/dist/modules/resources/api/resources/tags/unassign/route.js.map +2 -2
- package/dist/modules/sales/api/settings/document-numbers/route.js +33 -1
- package/dist/modules/sales/api/settings/document-numbers/route.js.map +2 -2
- package/dist/modules/sales/api/settings/order-editing/route.js +35 -3
- package/dist/modules/sales/api/settings/order-editing/route.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/accept/route.js +41 -0
- package/dist/modules/staff/api/leave-requests/accept/route.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/reject/route.js +41 -0
- package/dist/modules/staff/api/leave-requests/reject/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/self/route.js +40 -0
- package/dist/modules/staff/api/team-members/self/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/assign/route.js +41 -0
- package/dist/modules/staff/api/team-members/tags/assign/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/unassign/route.js +41 -0
- package/dist/modules/staff/api/team-members/tags/unassign/route.js.map +2 -2
- package/dist/modules/translations/api/[entityType]/[entityId]/route.js +61 -1
- package/dist/modules/translations/api/[entityType]/[entityId]/route.js.map +2 -2
- package/dist/modules/translations/api/context.js +7 -0
- package/dist/modules/translations/api/context.js.map +2 -2
- package/dist/modules/translations/api/put/locales.js +33 -1
- package/dist/modules/translations/api/put/locales.js.map +2 -2
- package/dist/modules/workflows/backend/definitions/visual-editor/page.js +6 -7
- package/dist/modules/workflows/backend/definitions/visual-editor/page.js.map +2 -2
- package/dist/modules/workflows/backend/instances/[id]/page.js.map +1 -1
- package/dist/modules/workflows/components/EdgeEditDialog.js.map +1 -1
- package/dist/modules/workflows/components/EdgeEditDialogCrudForm.js.map +1 -1
- package/dist/modules/workflows/components/NodeEditDialog.js.map +1 -1
- package/dist/modules/workflows/components/NodeEditDialogCrudForm.js.map +1 -1
- package/dist/modules/workflows/components/WorkflowGraph.js.map +1 -1
- package/dist/modules/workflows/components/WorkflowGraphImpl.js +17 -9
- package/dist/modules/workflows/components/WorkflowGraphImpl.js.map +2 -2
- package/dist/modules/workflows/components/mobile/MobileVisualEditor.js.map +1 -1
- package/dist/modules/workflows/frontend/checkout-demo/deriveCurrentStep.js +8 -0
- package/dist/modules/workflows/frontend/checkout-demo/deriveCurrentStep.js.map +7 -0
- package/dist/modules/workflows/frontend/checkout-demo/page.js +2 -20
- package/dist/modules/workflows/frontend/checkout-demo/page.js.map +2 -2
- package/dist/modules/workflows/lib/graph-utils.js +8 -0
- package/dist/modules/workflows/lib/graph-utils.js.map +2 -2
- package/generated/entities/catalog_product/index.ts +26 -0
- package/generated/entities/catalog_product_variant/index.ts +2 -0
- package/generated/entity-fields-registry.ts +28 -0
- package/package.json +7 -7
- package/src/modules/catalog/api/products/route.ts +123 -39
- package/src/modules/catalog/api/variants/route.ts +4 -0
- package/src/modules/catalog/backend/catalog/products/[id]/page.tsx +43 -0
- package/src/modules/catalog/backend/catalog/products/[productId]/variants/[variantId]/page.tsx +14 -0
- package/src/modules/catalog/backend/catalog/products/[productId]/variants/create/page.tsx +2 -0
- package/src/modules/catalog/backend/catalog/products/create/page.tsx +41 -0
- package/src/modules/catalog/commands/products.ts +307 -2
- package/src/modules/catalog/commands/variants.ts +90 -1
- package/src/modules/catalog/components/products/ProductComplianceSection.tsx +497 -0
- package/src/modules/catalog/components/products/VariantBuilder.tsx +43 -0
- package/src/modules/catalog/components/products/productForm.ts +262 -0
- package/src/modules/catalog/components/products/variantForm.ts +4 -0
- package/src/modules/catalog/data/entities.ts +97 -0
- package/src/modules/catalog/data/types.ts +36 -0
- package/src/modules/catalog/data/validators.ts +159 -3
- package/src/modules/catalog/i18n/de.json +64 -0
- package/src/modules/catalog/i18n/en.json +64 -0
- package/src/modules/catalog/i18n/es.json +64 -0
- package/src/modules/catalog/i18n/pl.json +64 -0
- package/src/modules/catalog/lib/gtin.ts +66 -0
- package/src/modules/catalog/migrations/.snapshot-open-mercato.json +457 -0
- package/src/modules/catalog/migrations/Migration20260611090000.ts +17 -0
- package/src/modules/catalog/translations.ts +1 -1
- package/src/modules/configs/api/cache/route.ts +72 -10
- package/src/modules/configs/components/CachePanel.tsx +59 -29
- package/src/modules/currencies/api/currencies/options/route.ts +22 -4
- package/src/modules/currencies/services/rateFetchingService.ts +63 -26
- package/src/modules/customer_accounts/backend/customer_accounts/users/[id]/page.tsx +18 -18
- package/src/modules/customer_accounts/backend/customer_accounts/users/page.tsx +1 -1
- package/src/modules/customer_accounts/i18n/de.json +1 -1
- package/src/modules/customer_accounts/i18n/en.json +1 -1
- package/src/modules/customer_accounts/i18n/es.json +1 -1
- package/src/modules/customer_accounts/i18n/pl.json +1 -1
- package/src/modules/customers/backend/calendar/page.meta.ts +23 -0
- package/src/modules/customers/backend/calendar/page.tsx +12 -0
- package/src/modules/customers/cli.ts +1 -0
- package/src/modules/customers/components/calendar/AgendaList.tsx +219 -0
- package/src/modules/customers/components/calendar/CalendarEventEditor.tsx +386 -0
- package/src/modules/customers/components/calendar/CalendarFooter.tsx +61 -0
- package/src/modules/customers/components/calendar/CalendarHeader.tsx +40 -0
- package/src/modules/customers/components/calendar/CalendarScreen.tsx +590 -0
- package/src/modules/customers/components/calendar/CalendarSettingsModal.tsx +207 -0
- package/src/modules/customers/components/calendar/CalendarTabs.tsx +63 -0
- package/src/modules/customers/components/calendar/CalendarToolbar.tsx +295 -0
- package/src/modules/customers/components/calendar/EventBlock.tsx +205 -0
- package/src/modules/customers/components/calendar/EventPeekPopover.tsx +100 -0
- package/src/modules/customers/components/calendar/MonthGrid.tsx +236 -0
- package/src/modules/customers/components/calendar/ShortcutsDialog.tsx +57 -0
- package/src/modules/customers/components/calendar/TimeGrid.tsx +510 -0
- package/src/modules/customers/components/calendar/UpcomingCards.tsx +220 -0
- package/src/modules/customers/components/calendar/editor/CategoryField.tsx +79 -0
- package/src/modules/customers/components/calendar/editor/LocationField.tsx +37 -0
- package/src/modules/customers/components/calendar/editor/PeopleField.tsx +148 -0
- package/src/modules/customers/components/calendar/editor/RelatedToField.tsx +242 -0
- package/src/modules/customers/components/calendar/editor/RepeatField.tsx +132 -0
- package/src/modules/customers/components/calendar/editor/ScheduleSection.tsx +110 -0
- package/src/modules/customers/components/calendar/editor/SegmentGroup.tsx +50 -0
- package/src/modules/customers/components/calendar/editor/hooks.ts +162 -0
- package/src/modules/customers/components/calendar/editor/inputs.tsx +158 -0
- package/src/modules/customers/components/calendar/editor/lookups.ts +160 -0
- package/src/modules/customers/components/calendar/types.ts +163 -0
- package/src/modules/customers/components/calendar/useCalendarItems.ts +162 -0
- package/src/modules/customers/components/calendar/useCalendarPreferences.ts +52 -0
- package/src/modules/customers/i18n/de.json +195 -0
- package/src/modules/customers/i18n/en.json +195 -0
- package/src/modules/customers/i18n/es.json +195 -0
- package/src/modules/customers/i18n/pl.json +195 -0
- package/src/modules/customers/lib/calendar/categories.ts +26 -0
- package/src/modules/customers/lib/calendar/conflicts.ts +117 -0
- package/src/modules/customers/lib/calendar/editorPayload.ts +388 -0
- package/src/modules/customers/lib/calendar/grid.ts +50 -0
- package/src/modules/customers/lib/calendar/layout.ts +47 -0
- package/src/modules/customers/lib/calendar/mapItem.ts +94 -0
- package/src/modules/customers/lib/calendar/preferences.ts +95 -0
- package/src/modules/customers/lib/calendar/range.ts +45 -0
- package/src/modules/customers/lib/calendar/recurrence.ts +137 -0
- package/src/modules/dashboards/services/widgetDataService.ts +8 -6
- package/src/modules/dictionaries/api/[dictionaryId]/entries/[entryId]/route.ts +61 -1
- package/src/modules/dictionaries/api/[dictionaryId]/entries/route.ts +33 -1
- package/src/modules/dictionaries/api/[dictionaryId]/route.ts +65 -1
- package/src/modules/dictionaries/api/route.ts +36 -1
- package/src/modules/feature_toggles/lib/queries.ts +41 -60
- package/src/modules/perspectives/api/[tableId]/[perspectiveId]/route.ts +34 -1
- package/src/modules/perspectives/api/[tableId]/roles/[roleId]/route.ts +34 -1
- package/src/modules/perspectives/api/[tableId]/route.ts +107 -32
- package/src/modules/perspectives/services/perspectiveService.ts +9 -5
- package/src/modules/planner/api/access.ts +9 -0
- package/src/modules/planner/api/availability-date-specific.ts +22 -1
- package/src/modules/planner/api/availability-weekly.ts +22 -1
- package/src/modules/resources/api/resources/tags/assign/route.ts +42 -0
- package/src/modules/resources/api/resources/tags/unassign/route.ts +42 -0
- package/src/modules/sales/api/settings/document-numbers/route.ts +35 -1
- package/src/modules/sales/api/settings/order-editing/route.ts +37 -3
- package/src/modules/staff/api/leave-requests/accept/route.ts +45 -0
- package/src/modules/staff/api/leave-requests/reject/route.ts +45 -0
- package/src/modules/staff/api/team-members/self/route.ts +43 -0
- package/src/modules/staff/api/team-members/tags/assign/route.ts +45 -0
- package/src/modules/staff/api/team-members/tags/unassign/route.ts +45 -0
- package/src/modules/translations/api/[entityType]/[entityId]/route.ts +65 -1
- package/src/modules/translations/api/context.ts +7 -0
- package/src/modules/translations/api/put/locales.ts +35 -1
- package/src/modules/workflows/backend/definitions/visual-editor/page.tsx +11 -9
- package/src/modules/workflows/backend/instances/[id]/page.tsx +1 -1
- package/src/modules/workflows/components/EdgeEditDialog.tsx +1 -1
- package/src/modules/workflows/components/EdgeEditDialogCrudForm.tsx +1 -1
- package/src/modules/workflows/components/NodeEditDialog.tsx +1 -1
- package/src/modules/workflows/components/NodeEditDialogCrudForm.tsx +1 -1
- package/src/modules/workflows/components/WorkflowGraph.tsx +2 -2
- package/src/modules/workflows/components/WorkflowGraphImpl.tsx +27 -13
- package/src/modules/workflows/components/mobile/MobileVisualEditor.tsx +3 -3
- package/src/modules/workflows/frontend/checkout-demo/deriveCurrentStep.ts +12 -0
- package/src/modules/workflows/frontend/checkout-demo/page.tsx +3 -23
- package/src/modules/workflows/lib/graph-utils.ts +21 -1
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { differenceInCalendarDays } from 'date-fns/differenceInCalendarDays'
|
|
5
|
+
import { format } from 'date-fns/format'
|
|
6
|
+
import { AlertTriangle, ChevronDown, Clock } from 'lucide-react'
|
|
7
|
+
import { Button } from '@open-mercato/ui/primitives/button'
|
|
8
|
+
import { IconButton } from '@open-mercato/ui/primitives/icon-button'
|
|
9
|
+
import { LinkButton } from '@open-mercato/ui/primitives/link-button'
|
|
10
|
+
import {
|
|
11
|
+
Popover,
|
|
12
|
+
PopoverClose,
|
|
13
|
+
PopoverContent,
|
|
14
|
+
PopoverTrigger,
|
|
15
|
+
} from '@open-mercato/ui/primitives/popover'
|
|
16
|
+
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
17
|
+
import type { CalendarItem, UpcomingCard, UpcomingCardsProps } from './types'
|
|
18
|
+
|
|
19
|
+
function formatTimeRange(item: CalendarItem, allDayLabel: string): string {
|
|
20
|
+
if (item.allDay) return allDayLabel
|
|
21
|
+
return `${format(item.start, 'h:mm a')} – ${format(item.end, 'h:mm a')}`
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function canJoin(item: CalendarItem): boolean {
|
|
25
|
+
return item.locationKind === 'url' || item.locationKind === 'platform'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
type CardCallbacks = Pick<UpcomingCardsProps, 'canManage' | 'onJoin' | 'onSeeConflict' | 'onOpen' | 'onEdit' | 'onCancel'>
|
|
29
|
+
|
|
30
|
+
function UpcomingCardStatus({
|
|
31
|
+
card,
|
|
32
|
+
onJoin,
|
|
33
|
+
onSeeConflict,
|
|
34
|
+
}: {
|
|
35
|
+
card: UpcomingCard
|
|
36
|
+
onJoin: UpcomingCardsProps['onJoin']
|
|
37
|
+
onSeeConflict: UpcomingCardsProps['onSeeConflict']
|
|
38
|
+
}) {
|
|
39
|
+
const t = useT()
|
|
40
|
+
const { item, kind, conflictCount } = card
|
|
41
|
+
|
|
42
|
+
if (kind === 'today') {
|
|
43
|
+
return (
|
|
44
|
+
<div className="flex w-full items-center gap-1.5 rounded-lg bg-status-success-bg py-2 pl-2 pr-3">
|
|
45
|
+
<Clock className="size-4 shrink-0 text-status-success-icon" aria-hidden="true" />
|
|
46
|
+
<span className="min-w-0 flex-1 truncate text-xs font-medium text-foreground">
|
|
47
|
+
{t('customers.calendar.cards.today', 'Today')}
|
|
48
|
+
</span>
|
|
49
|
+
{canJoin(item) ? (
|
|
50
|
+
<LinkButton
|
|
51
|
+
variant="gray"
|
|
52
|
+
size="sm"
|
|
53
|
+
underline="always"
|
|
54
|
+
onClick={() => onJoin(item)}
|
|
55
|
+
className="shrink-0"
|
|
56
|
+
>
|
|
57
|
+
{t('customers.calendar.cards.join', 'Join Meeting')}
|
|
58
|
+
</LinkButton>
|
|
59
|
+
) : null}
|
|
60
|
+
</div>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (kind === 'conflicted') {
|
|
65
|
+
return (
|
|
66
|
+
<div className="flex w-full items-center gap-1.5 rounded-lg bg-status-warning-bg py-2 pl-2 pr-3">
|
|
67
|
+
<AlertTriangle className="size-4 shrink-0 text-status-warning-icon" aria-hidden="true" />
|
|
68
|
+
<span className="min-w-0 flex-1 truncate text-xs font-medium text-foreground">
|
|
69
|
+
{t('customers.calendar.cards.conflictedCount', '{count} Conflicted', {
|
|
70
|
+
count: conflictCount,
|
|
71
|
+
})}
|
|
72
|
+
</span>
|
|
73
|
+
<LinkButton
|
|
74
|
+
variant="gray"
|
|
75
|
+
size="sm"
|
|
76
|
+
underline="always"
|
|
77
|
+
onClick={() => onSeeConflict(item)}
|
|
78
|
+
className="shrink-0"
|
|
79
|
+
>
|
|
80
|
+
{t('customers.calendar.cards.seeConflict', 'See Conflict')}
|
|
81
|
+
</LinkButton>
|
|
82
|
+
</div>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (kind === 'cancelled') {
|
|
87
|
+
return (
|
|
88
|
+
<div className="flex w-full items-center gap-1.5 rounded-lg bg-status-error-bg py-2 pl-2 pr-3">
|
|
89
|
+
<Clock className="size-4 shrink-0 text-status-error-icon" aria-hidden="true" />
|
|
90
|
+
<span className="min-w-0 flex-1 truncate text-xs font-medium text-foreground">
|
|
91
|
+
{t('customers.calendar.cards.cancelled', 'Cancelled')}
|
|
92
|
+
</span>
|
|
93
|
+
<span className="shrink-0 text-xs text-muted-foreground">
|
|
94
|
+
{format(item.start, 'MMM dd, yyyy')}
|
|
95
|
+
</span>
|
|
96
|
+
</div>
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const daysLater = Math.max(0, differenceInCalendarDays(item.start, new Date()))
|
|
101
|
+
return (
|
|
102
|
+
<div className="flex w-full items-center gap-1.5 rounded-lg bg-muted py-2 pl-2 pr-3">
|
|
103
|
+
<Clock className="size-4 shrink-0 text-muted-foreground" aria-hidden="true" />
|
|
104
|
+
<span className="min-w-0 flex-1 truncate text-xs text-muted-foreground">
|
|
105
|
+
{daysLater === 1
|
|
106
|
+
? t('customers.calendar.cards.dayLater', '1 day later')
|
|
107
|
+
: t('customers.calendar.cards.daysLater', '{days} days later', { days: daysLater })}
|
|
108
|
+
</span>
|
|
109
|
+
<span className="shrink-0 text-xs text-muted-foreground">
|
|
110
|
+
{format(item.start, 'MMM dd, yyyy')}
|
|
111
|
+
</span>
|
|
112
|
+
</div>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function UpcomingCardItem({
|
|
117
|
+
card,
|
|
118
|
+
canManage,
|
|
119
|
+
onJoin,
|
|
120
|
+
onSeeConflict,
|
|
121
|
+
onOpen,
|
|
122
|
+
onEdit,
|
|
123
|
+
onCancel,
|
|
124
|
+
}: { card: UpcomingCard } & CardCallbacks) {
|
|
125
|
+
const t = useT()
|
|
126
|
+
const { item } = card
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
<article className="flex w-[260px] shrink-0 snap-start flex-col gap-3 rounded-xl border bg-card px-2 pb-2 pt-4 shadow-xs sm:w-auto sm:shrink">
|
|
130
|
+
<div className="flex items-start gap-2 px-2">
|
|
131
|
+
<div className="flex min-w-0 flex-1 flex-col gap-1">
|
|
132
|
+
<p className="truncate text-sm font-medium text-foreground">{item.title}</p>
|
|
133
|
+
<p className="truncate text-xs text-muted-foreground">
|
|
134
|
+
{formatTimeRange(item, t('customers.calendar.cards.allDay', 'All day'))}
|
|
135
|
+
</p>
|
|
136
|
+
</div>
|
|
137
|
+
<Popover>
|
|
138
|
+
<PopoverTrigger asChild>
|
|
139
|
+
<IconButton
|
|
140
|
+
variant="outline"
|
|
141
|
+
size="xs"
|
|
142
|
+
fullRadius
|
|
143
|
+
aria-label={t('customers.calendar.cards.menu.label', 'Event actions')}
|
|
144
|
+
>
|
|
145
|
+
<ChevronDown aria-hidden="true" />
|
|
146
|
+
</IconButton>
|
|
147
|
+
</PopoverTrigger>
|
|
148
|
+
<PopoverContent align="end" className="w-40 min-w-0 p-1">
|
|
149
|
+
<PopoverClose asChild>
|
|
150
|
+
<Button
|
|
151
|
+
type="button"
|
|
152
|
+
variant="ghost"
|
|
153
|
+
size="sm"
|
|
154
|
+
className="w-full justify-start"
|
|
155
|
+
onClick={() => onOpen(item)}
|
|
156
|
+
>
|
|
157
|
+
{t('customers.calendar.cards.menu.open', 'Open')}
|
|
158
|
+
</Button>
|
|
159
|
+
</PopoverClose>
|
|
160
|
+
{canManage ? (
|
|
161
|
+
<PopoverClose asChild>
|
|
162
|
+
<Button
|
|
163
|
+
type="button"
|
|
164
|
+
variant="ghost"
|
|
165
|
+
size="sm"
|
|
166
|
+
className="w-full justify-start"
|
|
167
|
+
onClick={() => onEdit(item)}
|
|
168
|
+
>
|
|
169
|
+
{t('customers.calendar.cards.menu.edit', 'Edit')}
|
|
170
|
+
</Button>
|
|
171
|
+
</PopoverClose>
|
|
172
|
+
) : null}
|
|
173
|
+
{canManage ? (
|
|
174
|
+
<PopoverClose asChild>
|
|
175
|
+
<Button
|
|
176
|
+
type="button"
|
|
177
|
+
variant="destructive-ghost"
|
|
178
|
+
size="sm"
|
|
179
|
+
className="w-full justify-start"
|
|
180
|
+
onClick={() => onCancel(item)}
|
|
181
|
+
>
|
|
182
|
+
{t('customers.calendar.cards.menu.cancel', 'Cancel')}
|
|
183
|
+
</Button>
|
|
184
|
+
</PopoverClose>
|
|
185
|
+
) : null}
|
|
186
|
+
</PopoverContent>
|
|
187
|
+
</Popover>
|
|
188
|
+
</div>
|
|
189
|
+
<UpcomingCardStatus card={card} onJoin={onJoin} onSeeConflict={onSeeConflict} />
|
|
190
|
+
</article>
|
|
191
|
+
)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export function UpcomingCards({
|
|
195
|
+
cards,
|
|
196
|
+
canManage = true,
|
|
197
|
+
onJoin,
|
|
198
|
+
onSeeConflict,
|
|
199
|
+
onOpen,
|
|
200
|
+
onEdit,
|
|
201
|
+
onCancel,
|
|
202
|
+
}: UpcomingCardsProps) {
|
|
203
|
+
if (cards.length === 0) return null
|
|
204
|
+
return (
|
|
205
|
+
<div className="flex snap-x snap-mandatory gap-3 overflow-x-auto pb-1 sm:grid sm:snap-none sm:grid-cols-2 sm:gap-4 sm:overflow-visible sm:pb-0 xl:grid-cols-4">
|
|
206
|
+
{cards.map((card) => (
|
|
207
|
+
<UpcomingCardItem
|
|
208
|
+
key={card.item.id}
|
|
209
|
+
card={card}
|
|
210
|
+
canManage={canManage}
|
|
211
|
+
onJoin={onJoin}
|
|
212
|
+
onSeeConflict={onSeeConflict}
|
|
213
|
+
onOpen={onOpen}
|
|
214
|
+
onEdit={onEdit}
|
|
215
|
+
onCancel={onCancel}
|
|
216
|
+
/>
|
|
217
|
+
))}
|
|
218
|
+
</div>
|
|
219
|
+
)
|
|
220
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { ChevronDown } from 'lucide-react'
|
|
5
|
+
import { cn } from '@open-mercato/shared/lib/utils'
|
|
6
|
+
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
7
|
+
import { Button } from '@open-mercato/ui/primitives/button'
|
|
8
|
+
import { categoryPillStyle, CONTROL_BORDER, DROPDOWN_PANEL_CLASS, UppercaseBadge } from './inputs'
|
|
9
|
+
|
|
10
|
+
export function CategoryField({
|
|
11
|
+
label,
|
|
12
|
+
value,
|
|
13
|
+
options,
|
|
14
|
+
colors,
|
|
15
|
+
onChange,
|
|
16
|
+
}: {
|
|
17
|
+
label: string
|
|
18
|
+
value: string
|
|
19
|
+
options: Array<{ value: string; label: string }>
|
|
20
|
+
colors: Record<string, string | null>
|
|
21
|
+
onChange(next: string): void
|
|
22
|
+
}) {
|
|
23
|
+
const t = useT()
|
|
24
|
+
const [open, setOpen] = React.useState(false)
|
|
25
|
+
const selected = options.find((option) => option.value === value) ?? { value, label: value }
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<div
|
|
29
|
+
className="relative w-full"
|
|
30
|
+
onBlur={(event) => {
|
|
31
|
+
if (!event.currentTarget.contains(event.relatedTarget as Node | null)) setOpen(false)
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
<Button
|
|
35
|
+
type="button"
|
|
36
|
+
variant="outline"
|
|
37
|
+
aria-haspopup="listbox"
|
|
38
|
+
aria-expanded={open}
|
|
39
|
+
aria-label={label}
|
|
40
|
+
onClick={() => setOpen((previous) => !previous)}
|
|
41
|
+
className={cn(
|
|
42
|
+
'h-9 w-full justify-between bg-background px-3 shadow-none',
|
|
43
|
+
CONTROL_BORDER,
|
|
44
|
+
)}
|
|
45
|
+
>
|
|
46
|
+
<UppercaseBadge style={categoryPillStyle(colors[selected.value] ?? null)}>{selected.label}</UppercaseBadge>
|
|
47
|
+
<span className="flex shrink-0 items-center">
|
|
48
|
+
<span aria-hidden className="h-px w-2" />
|
|
49
|
+
<ChevronDown aria-hidden className="size-4 opacity-60" />
|
|
50
|
+
</span>
|
|
51
|
+
</Button>
|
|
52
|
+
{open ? (
|
|
53
|
+
<div role="listbox" aria-label={label} className={DROPDOWN_PANEL_CLASS}>
|
|
54
|
+
{options.length === 0 ? (
|
|
55
|
+
<p className="px-2 py-3 text-center text-xs text-muted-foreground">
|
|
56
|
+
{t('customers.calendar.editor.noResults', 'No results')}
|
|
57
|
+
</p>
|
|
58
|
+
) : null}
|
|
59
|
+
{options.map((option) => (
|
|
60
|
+
<Button
|
|
61
|
+
key={option.value}
|
|
62
|
+
type="button"
|
|
63
|
+
variant="ghost"
|
|
64
|
+
role="option"
|
|
65
|
+
aria-selected={option.value === value}
|
|
66
|
+
onClick={() => {
|
|
67
|
+
onChange(option.value)
|
|
68
|
+
setOpen(false)
|
|
69
|
+
}}
|
|
70
|
+
className="h-auto w-full justify-start px-2 py-1.5 text-left"
|
|
71
|
+
>
|
|
72
|
+
<UppercaseBadge style={categoryPillStyle(colors[option.value] ?? null)}>{option.label}</UppercaseBadge>
|
|
73
|
+
</Button>
|
|
74
|
+
))}
|
|
75
|
+
</div>
|
|
76
|
+
) : null}
|
|
77
|
+
</div>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { MapPin } from 'lucide-react'
|
|
5
|
+
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
6
|
+
import { Input } from '@open-mercato/ui/primitives/input'
|
|
7
|
+
import { Field } from './inputs'
|
|
8
|
+
|
|
9
|
+
export function LocationField({
|
|
10
|
+
variant,
|
|
11
|
+
value,
|
|
12
|
+
onChange,
|
|
13
|
+
}: {
|
|
14
|
+
variant: 'location' | 'phoneLink'
|
|
15
|
+
value: string
|
|
16
|
+
onChange(next: string): void
|
|
17
|
+
}) {
|
|
18
|
+
const t = useT()
|
|
19
|
+
const label = variant === 'phoneLink'
|
|
20
|
+
? t('customers.calendar.editor.phoneLink', 'Phone / link')
|
|
21
|
+
: t('customers.calendar.editor.location', 'Location')
|
|
22
|
+
const placeholder = variant === 'phoneLink'
|
|
23
|
+
? t('customers.calendar.editor.phoneLinkPlaceholder', 'Add a phone number or link…')
|
|
24
|
+
: t('customers.calendar.editor.locationPlaceholder', 'Add a location or link…')
|
|
25
|
+
return (
|
|
26
|
+
<Field label={label}>
|
|
27
|
+
<Input
|
|
28
|
+
type="text"
|
|
29
|
+
value={value}
|
|
30
|
+
onChange={(event) => onChange(event.target.value)}
|
|
31
|
+
placeholder={placeholder}
|
|
32
|
+
aria-label={label}
|
|
33
|
+
leftIcon={<MapPin />}
|
|
34
|
+
/>
|
|
35
|
+
</Field>
|
|
36
|
+
)
|
|
37
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { cn } from '@open-mercato/shared/lib/utils'
|
|
5
|
+
import { useT } from '@open-mercato/shared/lib/i18n/context'
|
|
6
|
+
import { Avatar } from '@open-mercato/ui/primitives/avatar'
|
|
7
|
+
import { Button } from '@open-mercato/ui/primitives/button'
|
|
8
|
+
import { Input } from '@open-mercato/ui/primitives/input'
|
|
9
|
+
import type { EditorParticipant } from '../../../lib/calendar/editorPayload'
|
|
10
|
+
import { searchPeopleOptions, type PersonOption } from './lookups'
|
|
11
|
+
import { CONTROL_BORDER, DROPDOWN_PANEL_CLASS, PersonChip, UppercaseBadge } from './inputs'
|
|
12
|
+
|
|
13
|
+
export function PeopleField({
|
|
14
|
+
mode,
|
|
15
|
+
placeholder,
|
|
16
|
+
ariaLabel,
|
|
17
|
+
value,
|
|
18
|
+
onChange,
|
|
19
|
+
includeCustomers,
|
|
20
|
+
}: {
|
|
21
|
+
mode: 'multi' | 'single'
|
|
22
|
+
placeholder: string
|
|
23
|
+
ariaLabel: string
|
|
24
|
+
value: EditorParticipant[]
|
|
25
|
+
onChange(next: EditorParticipant[]): void
|
|
26
|
+
includeCustomers: boolean
|
|
27
|
+
}) {
|
|
28
|
+
const t = useT()
|
|
29
|
+
const [query, setQuery] = React.useState('')
|
|
30
|
+
const [open, setOpen] = React.useState(false)
|
|
31
|
+
const [options, setOptions] = React.useState<PersonOption[]>([])
|
|
32
|
+
const [loading, setLoading] = React.useState(false)
|
|
33
|
+
|
|
34
|
+
React.useEffect(() => {
|
|
35
|
+
if (!open) return
|
|
36
|
+
const controller = new AbortController()
|
|
37
|
+
let cancelled = false
|
|
38
|
+
const timer = window.setTimeout(async () => {
|
|
39
|
+
setLoading(true)
|
|
40
|
+
try {
|
|
41
|
+
const results = await searchPeopleOptions(query.trim(), { includeCustomers, signal: controller.signal })
|
|
42
|
+
if (cancelled) return
|
|
43
|
+
setOptions(results)
|
|
44
|
+
} catch {
|
|
45
|
+
if (!cancelled) setOptions([])
|
|
46
|
+
} finally {
|
|
47
|
+
if (!cancelled) setLoading(false)
|
|
48
|
+
}
|
|
49
|
+
}, 250)
|
|
50
|
+
return () => {
|
|
51
|
+
cancelled = true
|
|
52
|
+
controller.abort()
|
|
53
|
+
window.clearTimeout(timer)
|
|
54
|
+
}
|
|
55
|
+
}, [open, query, includeCustomers])
|
|
56
|
+
|
|
57
|
+
const selectedIds = new Set(value.map((participant) => participant.userId))
|
|
58
|
+
const visibleOptions = options.filter((option) => !selectedIds.has(option.userId))
|
|
59
|
+
|
|
60
|
+
const customerBadge = (
|
|
61
|
+
<UppercaseBadge className="bg-status-info-bg text-status-info-text">
|
|
62
|
+
{t('customers.calendar.editor.customerBadge', 'Customer')}
|
|
63
|
+
</UppercaseBadge>
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<div
|
|
68
|
+
className="relative w-full"
|
|
69
|
+
onBlur={(event) => {
|
|
70
|
+
if (!event.currentTarget.contains(event.relatedTarget as Node | null)) setOpen(false)
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
<div
|
|
74
|
+
className={cn(
|
|
75
|
+
'flex w-full flex-wrap content-center items-center gap-2 rounded-md bg-background px-2.5 py-2',
|
|
76
|
+
mode === 'multi' ? 'min-h-24' : 'min-h-14',
|
|
77
|
+
CONTROL_BORDER,
|
|
78
|
+
)}
|
|
79
|
+
>
|
|
80
|
+
{value.map((participant) => (
|
|
81
|
+
<PersonChip
|
|
82
|
+
key={participant.userId}
|
|
83
|
+
name={participant.name}
|
|
84
|
+
badge={participant.isCustomer ? customerBadge : undefined}
|
|
85
|
+
onRemove={() => onChange(value.filter((entry) => entry.userId !== participant.userId))}
|
|
86
|
+
removeLabel={t('customers.calendar.editor.removePerson', 'Remove {name}', { name: participant.name })}
|
|
87
|
+
/>
|
|
88
|
+
))}
|
|
89
|
+
<Input
|
|
90
|
+
type="text"
|
|
91
|
+
value={query}
|
|
92
|
+
onChange={(event) => setQuery(event.target.value)}
|
|
93
|
+
onFocus={() => setOpen(true)}
|
|
94
|
+
placeholder={placeholder}
|
|
95
|
+
aria-label={ariaLabel}
|
|
96
|
+
role="combobox"
|
|
97
|
+
aria-expanded={open}
|
|
98
|
+
className="min-w-36 flex-1 border-0 bg-transparent px-0 shadow-none hover:bg-transparent focus-within:border-transparent focus-within:shadow-none"
|
|
99
|
+
inputClassName="text-sm text-foreground placeholder:text-muted-foreground"
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
{open ? (
|
|
103
|
+
<div role="listbox" aria-label={ariaLabel} className={DROPDOWN_PANEL_CLASS}>
|
|
104
|
+
{loading ? (
|
|
105
|
+
<p className="px-2 py-3 text-center text-xs text-muted-foreground">
|
|
106
|
+
{t('customers.calendar.editor.searching', 'Searching…')}
|
|
107
|
+
</p>
|
|
108
|
+
) : null}
|
|
109
|
+
{!loading && visibleOptions.length === 0 ? (
|
|
110
|
+
<p className="px-2 py-3 text-center text-xs text-muted-foreground">
|
|
111
|
+
{t('customers.calendar.editor.noResults', 'No results')}
|
|
112
|
+
</p>
|
|
113
|
+
) : null}
|
|
114
|
+
{!loading
|
|
115
|
+
? visibleOptions.map((option) => (
|
|
116
|
+
<Button
|
|
117
|
+
key={`${option.isCustomer ? 'customer' : 'staff'}:${option.userId}`}
|
|
118
|
+
type="button"
|
|
119
|
+
variant="ghost"
|
|
120
|
+
role="option"
|
|
121
|
+
aria-selected={false}
|
|
122
|
+
onClick={() => {
|
|
123
|
+
const participant: EditorParticipant = {
|
|
124
|
+
userId: option.userId,
|
|
125
|
+
name: option.name,
|
|
126
|
+
email: option.email ?? undefined,
|
|
127
|
+
isCustomer: option.isCustomer,
|
|
128
|
+
}
|
|
129
|
+
onChange(mode === 'single' ? [participant] : [...value, participant])
|
|
130
|
+
setQuery('')
|
|
131
|
+
if (mode === 'single') setOpen(false)
|
|
132
|
+
}}
|
|
133
|
+
className="h-auto w-full justify-start gap-2 whitespace-normal px-2 py-1.5 text-left text-sm font-normal text-foreground"
|
|
134
|
+
>
|
|
135
|
+
<Avatar size="xs" label={option.name} />
|
|
136
|
+
<span className="min-w-0 flex-1 truncate">
|
|
137
|
+
{option.name}
|
|
138
|
+
{option.email ? <span className="ml-1.5 text-xs text-muted-foreground">{option.email}</span> : null}
|
|
139
|
+
</span>
|
|
140
|
+
{option.isCustomer ? customerBadge : null}
|
|
141
|
+
</Button>
|
|
142
|
+
))
|
|
143
|
+
: null}
|
|
144
|
+
</div>
|
|
145
|
+
) : null}
|
|
146
|
+
</div>
|
|
147
|
+
)
|
|
148
|
+
}
|