@endora-commerce/admin-kit 0.0.0-stage → 0.100.0
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/LICENSE +21 -0
- package/README.md +212 -2
- package/dist/components/FileDropzone.d.ts +13 -0
- package/dist/components/FileDropzone.d.ts.map +1 -0
- package/dist/components/FileDropzone.js +39 -0
- package/dist/components/FileDropzone.js.map +1 -0
- package/dist/components/PaginationFooter.d.ts +25 -0
- package/dist/components/PaginationFooter.d.ts.map +1 -0
- package/dist/components/PaginationFooter.js +33 -0
- package/dist/components/PaginationFooter.js.map +1 -0
- package/dist/components/ResponsiveTable.d.ts +26 -0
- package/dist/components/ResponsiveTable.d.ts.map +1 -0
- package/dist/components/ResponsiveTable.js +34 -0
- package/dist/components/ResponsiveTable.js.map +1 -0
- package/dist/components/RowActionMenu.d.ts +40 -0
- package/dist/components/RowActionMenu.d.ts.map +1 -0
- package/dist/components/RowActionMenu.js +15 -0
- package/dist/components/RowActionMenu.js.map +1 -0
- package/dist/components/StickyFormActions.d.ts +10 -0
- package/dist/components/StickyFormActions.d.ts.map +1 -0
- package/dist/components/StickyFormActions.js +10 -0
- package/dist/components/StickyFormActions.js.map +1 -0
- package/dist/components/TouchReorderButtons.d.ts +13 -0
- package/dist/components/TouchReorderButtons.d.ts.map +1 -0
- package/dist/components/TouchReorderButtons.js +12 -0
- package/dist/components/TouchReorderButtons.js.map +1 -0
- package/dist/components/admin-user-picker/AdminUserPicker.d.ts +14 -0
- package/dist/components/admin-user-picker/AdminUserPicker.d.ts.map +1 -0
- package/dist/components/admin-user-picker/AdminUserPicker.js +68 -0
- package/dist/components/admin-user-picker/AdminUserPicker.js.map +1 -0
- package/dist/components/asset-picker/AssetFieldPicker.d.ts +32 -0
- package/dist/components/asset-picker/AssetFieldPicker.d.ts.map +1 -0
- package/dist/components/asset-picker/AssetFieldPicker.js +42 -0
- package/dist/components/asset-picker/AssetFieldPicker.js.map +1 -0
- package/dist/components/asset-picker/AssetPicker.d.ts +31 -0
- package/dist/components/asset-picker/AssetPicker.d.ts.map +1 -0
- package/dist/components/asset-picker/AssetPicker.js +68 -0
- package/dist/components/asset-picker/AssetPicker.js.map +1 -0
- package/dist/components/asset-picker/AssetUploader.d.ts +15 -0
- package/dist/components/asset-picker/AssetUploader.d.ts.map +1 -0
- package/dist/components/asset-picker/AssetUploader.js +61 -0
- package/dist/components/asset-picker/AssetUploader.js.map +1 -0
- package/dist/components/asset-picker/assets-api.d.ts +49 -0
- package/dist/components/asset-picker/assets-api.d.ts.map +1 -0
- package/dist/components/asset-picker/assets-api.js +67 -0
- package/dist/components/asset-picker/assets-api.js.map +1 -0
- package/dist/components/category-picker/CategorySelect.d.ts +14 -0
- package/dist/components/category-picker/CategorySelect.d.ts.map +1 -0
- package/dist/components/category-picker/CategorySelect.js +41 -0
- package/dist/components/category-picker/CategorySelect.js.map +1 -0
- package/dist/components/category-tree-picker/CategoryTreeNodeRow.d.ts +18 -0
- package/dist/components/category-tree-picker/CategoryTreeNodeRow.d.ts.map +1 -0
- package/dist/components/category-tree-picker/CategoryTreeNodeRow.js +19 -0
- package/dist/components/category-tree-picker/CategoryTreeNodeRow.js.map +1 -0
- package/dist/components/category-tree-picker/CategoryTreePicker.d.ts +23 -0
- package/dist/components/category-tree-picker/CategoryTreePicker.d.ts.map +1 -0
- package/dist/components/category-tree-picker/CategoryTreePicker.js +82 -0
- package/dist/components/category-tree-picker/CategoryTreePicker.js.map +1 -0
- package/dist/components/category-tree-picker/category-tree-utils.d.ts +35 -0
- package/dist/components/category-tree-picker/category-tree-utils.d.ts.map +1 -0
- package/dist/components/category-tree-picker/category-tree-utils.js +140 -0
- package/dist/components/category-tree-picker/category-tree-utils.js.map +1 -0
- package/dist/components/category-tree-picker/index.d.ts +4 -0
- package/dist/components/category-tree-picker/index.d.ts.map +1 -0
- package/dist/components/category-tree-picker/index.js +2 -0
- package/dist/components/category-tree-picker/index.js.map +1 -0
- package/dist/components/charts/echart.d.ts +17 -0
- package/dist/components/charts/echart.d.ts.map +1 -0
- package/dist/components/charts/echart.js +61 -0
- package/dist/components/charts/echart.js.map +1 -0
- package/dist/components/cms-picker/CmsBlockPicker.d.ts +14 -0
- package/dist/components/cms-picker/CmsBlockPicker.d.ts.map +1 -0
- package/dist/components/cms-picker/CmsBlockPicker.js +40 -0
- package/dist/components/cms-picker/CmsBlockPicker.js.map +1 -0
- package/dist/components/cms-picker/CmsPagePicker.d.ts +15 -0
- package/dist/components/cms-picker/CmsPagePicker.d.ts.map +1 -0
- package/dist/components/cms-picker/CmsPagePicker.js +80 -0
- package/dist/components/cms-picker/CmsPagePicker.js.map +1 -0
- package/dist/components/content-language-tabs/ContentLanguageTabs.d.ts +30 -0
- package/dist/components/content-language-tabs/ContentLanguageTabs.d.ts.map +1 -0
- package/dist/components/content-language-tabs/ContentLanguageTabs.js +14 -0
- package/dist/components/content-language-tabs/ContentLanguageTabs.js.map +1 -0
- package/dist/components/country-select/CountrySelect.d.ts +29 -0
- package/dist/components/country-select/CountrySelect.d.ts.map +1 -0
- package/dist/components/country-select/CountrySelect.js +40 -0
- package/dist/components/country-select/CountrySelect.js.map +1 -0
- package/dist/components/country-select/index.d.ts +3 -0
- package/dist/components/country-select/index.d.ts.map +1 -0
- package/dist/components/country-select/index.js +3 -0
- package/dist/components/country-select/index.js.map +1 -0
- package/dist/components/country-select/useCountriesQuery.d.ts +12 -0
- package/dist/components/country-select/useCountriesQuery.d.ts.map +1 -0
- package/dist/components/country-select/useCountriesQuery.js +69 -0
- package/dist/components/country-select/useCountriesQuery.js.map +1 -0
- package/dist/components/custom-field-values/CustomFieldValuesPanel.d.ts +48 -0
- package/dist/components/custom-field-values/CustomFieldValuesPanel.d.ts.map +1 -0
- package/dist/components/custom-field-values/CustomFieldValuesPanel.js +122 -0
- package/dist/components/custom-field-values/CustomFieldValuesPanel.js.map +1 -0
- package/dist/components/customer-group-picker/CustomerGroupPicker.d.ts +14 -0
- package/dist/components/customer-group-picker/CustomerGroupPicker.d.ts.map +1 -0
- package/dist/components/customer-group-picker/CustomerGroupPicker.js +36 -0
- package/dist/components/customer-group-picker/CustomerGroupPicker.js.map +1 -0
- package/dist/components/customer-picker/CustomerPicker.d.ts +18 -0
- package/dist/components/customer-picker/CustomerPicker.d.ts.map +1 -0
- package/dist/components/customer-picker/CustomerPicker.js +85 -0
- package/dist/components/customer-picker/CustomerPicker.js.map +1 -0
- package/dist/components/dictionary-picker/CountryPicker.d.ts +26 -0
- package/dist/components/dictionary-picker/CountryPicker.d.ts.map +1 -0
- package/dist/components/dictionary-picker/CountryPicker.js +29 -0
- package/dist/components/dictionary-picker/CountryPicker.js.map +1 -0
- package/dist/components/dictionary-picker/CurrencyPicker.d.ts +17 -0
- package/dist/components/dictionary-picker/CurrencyPicker.d.ts.map +1 -0
- package/dist/components/dictionary-picker/CurrencyPicker.js +29 -0
- package/dist/components/dictionary-picker/CurrencyPicker.js.map +1 -0
- package/dist/components/dictionary-picker/dictionary-api.d.ts +21 -0
- package/dist/components/dictionary-picker/dictionary-api.d.ts.map +1 -0
- package/dist/components/dictionary-picker/dictionary-api.js +26 -0
- package/dist/components/dictionary-picker/dictionary-api.js.map +1 -0
- package/dist/components/dictionary-picker/index.d.ts +4 -0
- package/dist/components/dictionary-picker/index.d.ts.map +1 -0
- package/dist/components/dictionary-picker/index.js +4 -0
- package/dist/components/dictionary-picker/index.js.map +1 -0
- package/dist/components/fulfilment-strategy-picker/FulfilmentStrategyPicker.d.ts +49 -0
- package/dist/components/fulfilment-strategy-picker/FulfilmentStrategyPicker.d.ts.map +1 -0
- package/dist/components/fulfilment-strategy-picker/FulfilmentStrategyPicker.js +43 -0
- package/dist/components/fulfilment-strategy-picker/FulfilmentStrategyPicker.js.map +1 -0
- package/dist/components/hooks/useFocusTrap.d.ts +6 -0
- package/dist/components/hooks/useFocusTrap.d.ts.map +1 -0
- package/dist/components/hooks/useFocusTrap.js +41 -0
- package/dist/components/hooks/useFocusTrap.js.map +1 -0
- package/dist/components/hooks/useViewportTier.d.ts +7 -0
- package/dist/components/hooks/useViewportTier.d.ts.map +1 -0
- package/dist/components/hooks/useViewportTier.js +23 -0
- package/dist/components/hooks/useViewportTier.js.map +1 -0
- package/dist/components/index.d.ts +101 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +63 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/organization-picker/OrganizationPicker.d.ts +28 -0
- package/dist/components/organization-picker/OrganizationPicker.d.ts.map +1 -0
- package/dist/components/organization-picker/OrganizationPicker.js +35 -0
- package/dist/components/organization-picker/OrganizationPicker.js.map +1 -0
- package/dist/components/organization-picker/OrganizationPickerMulti.d.ts +32 -0
- package/dist/components/organization-picker/OrganizationPickerMulti.d.ts.map +1 -0
- package/dist/components/organization-picker/OrganizationPickerMulti.js +55 -0
- package/dist/components/organization-picker/OrganizationPickerMulti.js.map +1 -0
- package/dist/components/organization-picker/OrganizationStatusBadge.d.ts +7 -0
- package/dist/components/organization-picker/OrganizationStatusBadge.d.ts.map +1 -0
- package/dist/components/organization-picker/OrganizationStatusBadge.js +33 -0
- package/dist/components/organization-picker/OrganizationStatusBadge.js.map +1 -0
- package/dist/components/organization-picker/useOrganizationsQuery.d.ts +33 -0
- package/dist/components/organization-picker/useOrganizationsQuery.d.ts.map +1 -0
- package/dist/components/organization-picker/useOrganizationsQuery.js +92 -0
- package/dist/components/organization-picker/useOrganizationsQuery.js.map +1 -0
- package/dist/components/payment-method-availability/MethodAvailabilityCell.d.ts +38 -0
- package/dist/components/payment-method-availability/MethodAvailabilityCell.d.ts.map +1 -0
- package/dist/components/payment-method-availability/MethodAvailabilityCell.js +50 -0
- package/dist/components/payment-method-availability/MethodAvailabilityCell.js.map +1 -0
- package/dist/components/product-picker/ProductPicker.d.ts +22 -0
- package/dist/components/product-picker/ProductPicker.d.ts.map +1 -0
- package/dist/components/product-picker/ProductPicker.js +143 -0
- package/dist/components/product-picker/ProductPicker.js.map +1 -0
- package/dist/components/reorder/ReorderAnnouncer.d.ts +29 -0
- package/dist/components/reorder/ReorderAnnouncer.d.ts.map +1 -0
- package/dist/components/reorder/ReorderAnnouncer.js +6 -0
- package/dist/components/reorder/ReorderAnnouncer.js.map +1 -0
- package/dist/components/reorder/useReorderList.d.ts +121 -0
- package/dist/components/reorder/useReorderList.d.ts.map +1 -0
- package/dist/components/reorder/useReorderList.js +241 -0
- package/dist/components/reorder/useReorderList.js.map +1 -0
- package/dist/components/rule-builder/RuleBuilder.d.ts +105 -0
- package/dist/components/rule-builder/RuleBuilder.d.ts.map +1 -0
- package/dist/components/rule-builder/RuleBuilder.js +138 -0
- package/dist/components/rule-builder/RuleBuilder.js.map +1 -0
- package/dist/components/sales-channel-picker/SalesChannelPicker.d.ts +15 -0
- package/dist/components/sales-channel-picker/SalesChannelPicker.d.ts.map +1 -0
- package/dist/components/sales-channel-picker/SalesChannelPicker.js +79 -0
- package/dist/components/sales-channel-picker/SalesChannelPicker.js.map +1 -0
- package/dist/components/scope-notice/ScopeNotice.d.ts +33 -0
- package/dist/components/scope-notice/ScopeNotice.d.ts.map +1 -0
- package/dist/components/scope-notice/ScopeNotice.js +11 -0
- package/dist/components/scope-notice/ScopeNotice.js.map +1 -0
- package/dist/components/scope-picker/ScopePicker.d.ts +28 -0
- package/dist/components/scope-picker/ScopePicker.d.ts.map +1 -0
- package/dist/components/scope-picker/ScopePicker.js +114 -0
- package/dist/components/scope-picker/ScopePicker.js.map +1 -0
- package/dist/components/scope-picker/sales-channels-api.d.ts +19 -0
- package/dist/components/scope-picker/sales-channels-api.d.ts.map +1 -0
- package/dist/components/scope-picker/sales-channels-api.js +30 -0
- package/dist/components/scope-picker/sales-channels-api.js.map +1 -0
- package/dist/components/status-transition-graph/StatusTransitionGraph.d.ts +26 -0
- package/dist/components/status-transition-graph/StatusTransitionGraph.d.ts.map +1 -0
- package/dist/components/status-transition-graph/StatusTransitionGraph.js +241 -0
- package/dist/components/status-transition-graph/StatusTransitionGraph.js.map +1 -0
- package/dist/components/status-transition-graph/index.d.ts +3 -0
- package/dist/components/status-transition-graph/index.d.ts.map +1 -0
- package/dist/components/status-transition-graph/index.js +2 -0
- package/dist/components/status-transition-graph/index.js.map +1 -0
- package/dist/contributions/index.d.ts +44 -0
- package/dist/contributions/index.d.ts.map +1 -0
- package/dist/contributions/index.js +42 -0
- package/dist/contributions/index.js.map +1 -0
- package/dist/contributions/zone-component.d.ts +70 -0
- package/dist/contributions/zone-component.d.ts.map +1 -0
- package/dist/contributions/zone-component.js +26 -0
- package/dist/contributions/zone-component.js.map +1 -0
- package/dist/field-protection/FieldProtectionPricePanel.d.ts +26 -0
- package/dist/field-protection/FieldProtectionPricePanel.d.ts.map +1 -0
- package/dist/field-protection/FieldProtectionPricePanel.js +14 -0
- package/dist/field-protection/FieldProtectionPricePanel.js.map +1 -0
- package/dist/field-protection/FieldProtectionSummary.d.ts +18 -0
- package/dist/field-protection/FieldProtectionSummary.d.ts.map +1 -0
- package/dist/field-protection/FieldProtectionSummary.js +18 -0
- package/dist/field-protection/FieldProtectionSummary.js.map +1 -0
- package/dist/field-protection/FieldProtectionToggle.d.ts +36 -0
- package/dist/field-protection/FieldProtectionToggle.d.ts.map +1 -0
- package/dist/field-protection/FieldProtectionToggle.js +30 -0
- package/dist/field-protection/FieldProtectionToggle.js.map +1 -0
- package/dist/field-protection/describe-path.d.ts +27 -0
- package/dist/field-protection/describe-path.d.ts.map +1 -0
- package/dist/field-protection/describe-path.js +28 -0
- package/dist/field-protection/describe-path.js.map +1 -0
- package/dist/field-protection/index.d.ts +46 -0
- package/dist/field-protection/index.d.ts.map +1 -0
- package/dist/field-protection/index.js +41 -0
- package/dist/field-protection/index.js.map +1 -0
- package/dist/field-protection/types.d.ts +93 -0
- package/dist/field-protection/types.d.ts.map +1 -0
- package/dist/field-protection/types.js +2 -0
- package/dist/field-protection/types.js.map +1 -0
- package/dist/field-protection/use-field-protection.d.ts +27 -0
- package/dist/field-protection/use-field-protection.d.ts.map +1 -0
- package/dist/field-protection/use-field-protection.js +149 -0
- package/dist/field-protection/use-field-protection.js.map +1 -0
- package/dist/i18n/TranslationProvider.d.ts +27 -0
- package/dist/i18n/TranslationProvider.d.ts.map +1 -0
- package/dist/i18n/TranslationProvider.js +130 -0
- package/dist/i18n/TranslationProvider.js.map +1 -0
- package/dist/i18n/app-language-context.d.ts +8 -0
- package/dist/i18n/app-language-context.d.ts.map +1 -0
- package/dist/i18n/app-language-context.js +13 -0
- package/dist/i18n/app-language-context.js.map +1 -0
- package/dist/i18n/index.d.ts +29 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +25 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/interpolate.d.ts +2 -0
- package/dist/i18n/interpolate.d.ts.map +1 -0
- package/dist/i18n/interpolate.js +10 -0
- package/dist/i18n/interpolate.js.map +1 -0
- package/dist/i18n/language-storage.d.ts +16 -0
- package/dist/i18n/language-storage.d.ts.map +1 -0
- package/dist/i18n/language-storage.js +26 -0
- package/dist/i18n/language-storage.js.map +1 -0
- package/dist/i18n/resolver.d.ts +19 -0
- package/dist/i18n/resolver.d.ts.map +1 -0
- package/dist/i18n/resolver.js +23 -0
- package/dist/i18n/resolver.js.map +1 -0
- package/dist/i18n/types.d.ts +12 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/types.js +7 -0
- package/dist/i18n/types.js.map +1 -0
- package/dist/i18n/useTranslation.d.ts +2 -0
- package/dist/i18n/useTranslation.d.ts.map +1 -0
- package/dist/i18n/useTranslation.js +16 -0
- package/dist/i18n/useTranslation.js.map +1 -0
- package/dist/lib/admin-actions/icon-map.d.ts +3 -0
- package/dist/lib/admin-actions/icon-map.d.ts.map +1 -0
- package/dist/lib/admin-actions/icon-map.js +115 -0
- package/dist/lib/admin-actions/icon-map.js.map +1 -0
- package/dist/lib/api-client.d.ts +55 -0
- package/dist/lib/api-client.d.ts.map +1 -0
- package/dist/lib/api-client.js +89 -0
- package/dist/lib/api-client.js.map +1 -0
- package/dist/lib/asset-url.d.ts +32 -0
- package/dist/lib/asset-url.d.ts.map +1 -0
- package/dist/lib/asset-url.js +42 -0
- package/dist/lib/asset-url.js.map +1 -0
- package/dist/lib/auth.d.ts +92 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/auth.js +133 -0
- package/dist/lib/auth.js.map +1 -0
- package/dist/lib/format.d.ts +2 -0
- package/dist/lib/format.d.ts.map +1 -0
- package/dist/lib/format.js +9 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/index.d.ts +46 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +41 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/invoice-email-outcome.d.ts +53 -0
- package/dist/lib/invoice-email-outcome.d.ts.map +1 -0
- package/dist/lib/invoice-email-outcome.js +43 -0
- package/dist/lib/invoice-email-outcome.js.map +1 -0
- package/dist/lib/module-presence/ModulePresenceProvider.d.ts +49 -0
- package/dist/lib/module-presence/ModulePresenceProvider.d.ts.map +1 -0
- package/dist/lib/module-presence/ModulePresenceProvider.js +73 -0
- package/dist/lib/module-presence/ModulePresenceProvider.js.map +1 -0
- package/dist/lib/module-presence/api.d.ts +15 -0
- package/dist/lib/module-presence/api.d.ts.map +1 -0
- package/dist/lib/module-presence/api.js +25 -0
- package/dist/lib/module-presence/api.js.map +1 -0
- package/dist/lib/module-presence/index.d.ts +3 -0
- package/dist/lib/module-presence/index.d.ts.map +1 -0
- package/dist/lib/module-presence/index.js +3 -0
- package/dist/lib/module-presence/index.js.map +1 -0
- package/dist/lib/money.d.ts +22 -0
- package/dist/lib/money.d.ts.map +1 -0
- package/dist/lib/money.js +51 -0
- package/dist/lib/money.js.map +1 -0
- package/dist/lib/page-size-options.d.ts +15 -0
- package/dist/lib/page-size-options.d.ts.map +1 -0
- package/dist/lib/page-size-options.js +14 -0
- package/dist/lib/page-size-options.js.map +1 -0
- package/dist/lib/status-color.d.ts +32 -0
- package/dist/lib/status-color.d.ts.map +1 -0
- package/dist/lib/status-color.js +24 -0
- package/dist/lib/status-color.js.map +1 -0
- package/dist/lib/surface-visibility.d.ts +70 -0
- package/dist/lib/surface-visibility.d.ts.map +1 -0
- package/dist/lib/surface-visibility.js +37 -0
- package/dist/lib/surface-visibility.js.map +1 -0
- package/dist/lib/text-normalization.d.ts +56 -0
- package/dist/lib/text-normalization.d.ts.map +1 -0
- package/dist/lib/text-normalization.js +59 -0
- package/dist/lib/text-normalization.js.map +1 -0
- package/dist/lib/use-page-size-preference.d.ts +29 -0
- package/dist/lib/use-page-size-preference.d.ts.map +1 -0
- package/dist/lib/use-page-size-preference.js +61 -0
- package/dist/lib/use-page-size-preference.js.map +1 -0
- package/dist/lib/use-unsaved-changes-prompt.d.ts +23 -0
- package/dist/lib/use-unsaved-changes-prompt.d.ts.map +1 -0
- package/dist/lib/use-unsaved-changes-prompt.js +75 -0
- package/dist/lib/use-unsaved-changes-prompt.js.map +1 -0
- package/dist/lib/utils.d.ts +9 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +12 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/uuid.d.ts +8 -0
- package/dist/lib/uuid.d.ts.map +1 -0
- package/dist/lib/uuid.js +18 -0
- package/dist/lib/uuid.js.map +1 -0
- package/dist/ui/alert.d.ts +12 -0
- package/dist/ui/alert.d.ts.map +1 -0
- package/dist/ui/alert.js +22 -0
- package/dist/ui/alert.js.map +1 -0
- package/dist/ui/badge.d.ts +10 -0
- package/dist/ui/badge.d.ts.map +1 -0
- package/dist/ui/badge.js +21 -0
- package/dist/ui/badge.js.map +1 -0
- package/dist/ui/button.d.ts +12 -0
- package/dist/ui/button.d.ts.map +1 -0
- package/dist/ui/button.js +31 -0
- package/dist/ui/button.js.map +1 -0
- package/dist/ui/card.d.ts +8 -0
- package/dist/ui/card.d.ts.map +1 -0
- package/dist/ui/card.js +16 -0
- package/dist/ui/card.js.map +1 -0
- package/dist/ui/checkbox.d.ts +8 -0
- package/dist/ui/checkbox.d.ts.map +1 -0
- package/dist/ui/checkbox.js +11 -0
- package/dist/ui/checkbox.js.map +1 -0
- package/dist/ui/color-picker.d.ts +23 -0
- package/dist/ui/color-picker.d.ts.map +1 -0
- package/dist/ui/color-picker.js +76 -0
- package/dist/ui/color-picker.js.map +1 -0
- package/dist/ui/combobox.d.ts +68 -0
- package/dist/ui/combobox.d.ts.map +1 -0
- package/dist/ui/combobox.js +182 -0
- package/dist/ui/combobox.js.map +1 -0
- package/dist/ui/dropdown-menu.d.ts +26 -0
- package/dist/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/ui/dropdown-menu.js +38 -0
- package/dist/ui/dropdown-menu.js.map +1 -0
- package/dist/ui/index.d.ts +47 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +38 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/input.d.ts +3 -0
- package/dist/ui/input.d.ts.map +1 -0
- package/dist/ui/input.js +8 -0
- package/dist/ui/input.js.map +1 -0
- package/dist/ui/label.d.ts +4 -0
- package/dist/ui/label.d.ts.map +1 -0
- package/dist/ui/label.js +9 -0
- package/dist/ui/label.js.map +1 -0
- package/dist/ui/multi-select.d.ts +32 -0
- package/dist/ui/multi-select.d.ts.map +1 -0
- package/dist/ui/multi-select.js +63 -0
- package/dist/ui/multi-select.js.map +1 -0
- package/dist/ui/page-header.d.ts +21 -0
- package/dist/ui/page-header.d.ts.map +1 -0
- package/dist/ui/page-header.js +9 -0
- package/dist/ui/page-header.js.map +1 -0
- package/dist/ui/route-tabs.d.ts +58 -0
- package/dist/ui/route-tabs.d.ts.map +1 -0
- package/dist/ui/route-tabs.js +34 -0
- package/dist/ui/route-tabs.js.map +1 -0
- package/dist/ui/save-button-group.d.ts +27 -0
- package/dist/ui/save-button-group.d.ts.map +1 -0
- package/dist/ui/save-button-group.js +44 -0
- package/dist/ui/save-button-group.js.map +1 -0
- package/dist/ui/section.d.ts +20 -0
- package/dist/ui/section.d.ts.map +1 -0
- package/dist/ui/section.js +7 -0
- package/dist/ui/section.js.map +1 -0
- package/dist/ui/select.d.ts +10 -0
- package/dist/ui/select.d.ts.map +1 -0
- package/dist/ui/select.js +15 -0
- package/dist/ui/select.js.map +1 -0
- package/dist/ui/separator.d.ts +3 -0
- package/dist/ui/separator.d.ts.map +1 -0
- package/dist/ui/separator.js +7 -0
- package/dist/ui/separator.js.map +1 -0
- package/dist/ui/table.d.ts +10 -0
- package/dist/ui/table.d.ts.map +1 -0
- package/dist/ui/table.js +20 -0
- package/dist/ui/table.js.map +1 -0
- package/dist/ui/textarea.d.ts +3 -0
- package/dist/ui/textarea.d.ts.map +1 -0
- package/dist/ui/textarea.js +8 -0
- package/dist/ui/textarea.js.map +1 -0
- package/dist/zones/AdminContributionsProvider.d.ts +72 -0
- package/dist/zones/AdminContributionsProvider.d.ts.map +1 -0
- package/dist/zones/AdminContributionsProvider.js +63 -0
- package/dist/zones/AdminContributionsProvider.js.map +1 -0
- package/dist/zones/AdminZone.d.ts +30 -0
- package/dist/zones/AdminZone.d.ts.map +1 -0
- package/dist/zones/AdminZone.js +59 -0
- package/dist/zones/AdminZone.js.map +1 -0
- package/dist/zones/RouteTabsZone.d.ts +62 -0
- package/dist/zones/RouteTabsZone.d.ts.map +1 -0
- package/dist/zones/RouteTabsZone.js +25 -0
- package/dist/zones/RouteTabsZone.js.map +1 -0
- package/dist/zones/ZoneErrorBoundary.d.ts +36 -0
- package/dist/zones/ZoneErrorBoundary.d.ts.map +1 -0
- package/dist/zones/ZoneErrorBoundary.js +44 -0
- package/dist/zones/ZoneErrorBoundary.js.map +1 -0
- package/dist/zones/index.d.ts +31 -0
- package/dist/zones/index.d.ts.map +1 -0
- package/dist/zones/index.js +27 -0
- package/dist/zones/index.js.map +1 -0
- package/dist/zones/use-admin-zone.d.ts +32 -0
- package/dist/zones/use-admin-zone.d.ts.map +1 -0
- package/dist/zones/use-admin-zone.js +96 -0
- package/dist/zones/use-admin-zone.js.map +1 -0
- package/package.json +94 -3
- package/tailwind.css +14 -0
- package/theme.css +2056 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { PromotionRule } from '@endora-commerce/contracts';
|
|
3
|
+
/**
|
|
4
|
+
* Feature 045 — generic, controlled rule builder for a typed rule AST
|
|
5
|
+
* (`all` | `condition` | `group`). Extracted as a shared admin component so it
|
|
6
|
+
* can be reused beyond promotions.
|
|
7
|
+
*
|
|
8
|
+
* Feature 067 made the **built-in field catalogue a prop**. It was hard-coded
|
|
9
|
+
* to the promotion cart context (`cartTotal`, `paymentMethod`, …), which the
|
|
10
|
+
* product feed criteria panel cannot use: its criteria are about products, not
|
|
11
|
+
* carts. Forking the file would have made this the admin's *third* rule builder
|
|
12
|
+
* and forked its accessibility and bug fixes with it (Principle IX).
|
|
13
|
+
*
|
|
14
|
+
* The generalisation is deliberately conservative. Every new prop is optional
|
|
15
|
+
* and every default reproduces the promotion behaviour **exactly** — the same
|
|
16
|
+
* catalogue in the same order, the same operators, the same seed condition
|
|
17
|
+
* (`cartTotal >= 0`) and the same copy. `admin/test/components/RuleBuilder.test.tsx`
|
|
18
|
+
* pins all of it, because the incumbent callers (`PromotionRulesPage`,
|
|
19
|
+
* `PromotionEditPage`) are live screens that must not shift under this feature.
|
|
20
|
+
*/
|
|
21
|
+
export interface RuleAttributeField {
|
|
22
|
+
attributeKey: string;
|
|
23
|
+
label: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The structural rule tree the component actually manipulates. Every concrete
|
|
27
|
+
* AST it edits (`PromotionRule`, the feed's `ProductSelectionRule`) is a
|
|
28
|
+
* narrowing of this: same three node kinds, different field catalogue and
|
|
29
|
+
* operator enum. Typing against the structure rather than one module's contract
|
|
30
|
+
* is what lets a second caller reuse the component without either contract
|
|
31
|
+
* learning about the other.
|
|
32
|
+
*/
|
|
33
|
+
export type StructuralRuleField = {
|
|
34
|
+
kind: 'builtin';
|
|
35
|
+
key: string;
|
|
36
|
+
} | {
|
|
37
|
+
kind: 'attribute';
|
|
38
|
+
attributeKey: string;
|
|
39
|
+
} | {
|
|
40
|
+
kind: 'customField';
|
|
41
|
+
fieldKey: string;
|
|
42
|
+
};
|
|
43
|
+
export type StructuralRuleValue = string | number | boolean;
|
|
44
|
+
export interface StructuralRuleCondition {
|
|
45
|
+
kind: 'condition';
|
|
46
|
+
field: StructuralRuleField;
|
|
47
|
+
op: string;
|
|
48
|
+
values: StructuralRuleValue[];
|
|
49
|
+
}
|
|
50
|
+
export type StructuralRule = {
|
|
51
|
+
kind: 'all';
|
|
52
|
+
} | StructuralRuleCondition | {
|
|
53
|
+
kind: 'group';
|
|
54
|
+
op: 'AND' | 'OR';
|
|
55
|
+
children: StructuralRule[];
|
|
56
|
+
};
|
|
57
|
+
export interface RuleBuilderBuiltinField {
|
|
58
|
+
key: string;
|
|
59
|
+
kind: 'number' | 'string' | 'set';
|
|
60
|
+
ops: string[];
|
|
61
|
+
/** Shown in the picker. Defaults to `key`, which is what promotions renders. */
|
|
62
|
+
label?: string;
|
|
63
|
+
/**
|
|
64
|
+
* The operator and values used when this field seeds a brand-new condition.
|
|
65
|
+
* Only the first field of a catalogue ever needs it; it exists so the
|
|
66
|
+
* promotion default (`cartTotal >= 0`) survives the generalisation verbatim
|
|
67
|
+
* instead of silently becoming `cartTotal = ∅`.
|
|
68
|
+
*/
|
|
69
|
+
seed?: {
|
|
70
|
+
op: string;
|
|
71
|
+
values: StructuralRuleValue[];
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/** Copy the component cannot know, because it depends on what is being filtered. */
|
|
75
|
+
export interface RuleBuilderLabels {
|
|
76
|
+
/** Heading of the built-in `optgroup`. */
|
|
77
|
+
builtinGroup?: string;
|
|
78
|
+
/** Heading of the attribute `optgroup`. */
|
|
79
|
+
attributeGroup?: string;
|
|
80
|
+
/** The sentence shown on the `all` node. */
|
|
81
|
+
matchAll?: string;
|
|
82
|
+
/** Trigger text for the value picker while nothing is chosen. */
|
|
83
|
+
valuesPlaceholder?: string;
|
|
84
|
+
/** Accessible name for the value picker's trigger. */
|
|
85
|
+
valuesLabel?: string;
|
|
86
|
+
/** Placeholder inside the value picker's search box. */
|
|
87
|
+
valuesSearchPlaceholder?: string;
|
|
88
|
+
}
|
|
89
|
+
/** Option lists for fields that should render a value picker, keyed by field key. */
|
|
90
|
+
export type RuleFieldOptions = Partial<Record<string, Array<{
|
|
91
|
+
value: string;
|
|
92
|
+
label: string;
|
|
93
|
+
}>>>;
|
|
94
|
+
export interface RuleBuilderProps<T extends StructuralRule = PromotionRule> {
|
|
95
|
+
value: T;
|
|
96
|
+
onChange: (next: T) => void;
|
|
97
|
+
/** Defaults to the promotion cart catalogue — see the file header. */
|
|
98
|
+
builtinFields?: RuleBuilderBuiltinField[];
|
|
99
|
+
attributeFields?: RuleAttributeField[];
|
|
100
|
+
fieldOptions?: RuleFieldOptions;
|
|
101
|
+
labels?: RuleBuilderLabels;
|
|
102
|
+
disabled?: boolean;
|
|
103
|
+
}
|
|
104
|
+
export declare function RuleBuilder<T extends StructuralRule = PromotionRule>({ value, onChange, builtinFields, attributeFields, fieldOptions, labels, disabled, }: RuleBuilderProps<T>): ReactNode;
|
|
105
|
+
//# sourceMappingURL=RuleBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuleBuilder.d.ts","sourceRoot":"","sources":["../../../src/components/rule-builder/RuleBuilder.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,mBAAmB,GAC3B;IAAE,IAAI,EAAE,SAAS,C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AAW,CAAC,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC;AA2ED,qFAAqF;AACrF,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAAC,CAAC;AAEhG,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,cAAc,GAAG,aAAa;IACxE,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IAC5B,sEAAsE;IACtE,aAAa,CAAC,EAAE,uBAAuB,EAAE,CAAC;IAC1C,eAAe,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACvC,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,WAAW,CAAC,CAAC,SAAS,cAAc,GAAG,aAAa,EAAE,EACpE,KAAK,EACL,QAAQ,EACR,aAA8B,EAC9B,eAAoB,EACpB,YAAiB,EACjB,MAAM,EACN,QAAgB,GACjB,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG,SAAS,CAmBjC"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import {} from 'react';
|
|
3
|
+
import { Plus, Trash2 } from 'lucide-react';
|
|
4
|
+
import { Button } from '../../ui/button.js';
|
|
5
|
+
import { Input } from '../../ui/input.js';
|
|
6
|
+
import { MultiSelect } from '../../ui/multi-select.js';
|
|
7
|
+
import { Select } from '../../ui/select.js';
|
|
8
|
+
const BUILTIN_FIELDS = [
|
|
9
|
+
{
|
|
10
|
+
key: 'cartTotal',
|
|
11
|
+
kind: 'number',
|
|
12
|
+
ops: ['eq', 'neq', 'gt', 'gte', 'lt', 'lte', 'between'],
|
|
13
|
+
seed: { op: 'gte', values: [0] },
|
|
14
|
+
},
|
|
15
|
+
{ key: 'paymentMethod', kind: 'string', ops: ['eq', 'neq', 'in', 'notIn'] },
|
|
16
|
+
{ key: 'deliveryMethod', kind: 'string', ops: ['eq', 'neq', 'in', 'notIn'] },
|
|
17
|
+
{ key: 'deliveryCountry', kind: 'string', ops: ['eq', 'neq', 'in', 'notIn'] },
|
|
18
|
+
{ key: 'deliveryPostalCode', kind: 'string', ops: ['eq', 'neq', 'contains', 'startsWith'] },
|
|
19
|
+
{ key: 'organization', kind: 'string', ops: ['eq', 'neq', 'in', 'notIn'] },
|
|
20
|
+
{ key: 'customerGroup', kind: 'string', ops: ['eq', 'neq', 'in', 'notIn'] },
|
|
21
|
+
{ key: 'category', kind: 'set', ops: ['in', 'notIn'] },
|
|
22
|
+
];
|
|
23
|
+
const DEFAULT_LABELS = {
|
|
24
|
+
builtinGroup: 'Cart & relationship',
|
|
25
|
+
attributeGroup: 'Attributes',
|
|
26
|
+
matchAll: 'Matches all carts.',
|
|
27
|
+
valuesPlaceholder: 'Any value',
|
|
28
|
+
valuesLabel: 'Value',
|
|
29
|
+
valuesSearchPlaceholder: 'Search…',
|
|
30
|
+
};
|
|
31
|
+
const ATTRIBUTE_OPS = ['eq', 'neq', 'in', 'notIn', 'between'];
|
|
32
|
+
function defaultCondition(fields) {
|
|
33
|
+
const first = fields[0];
|
|
34
|
+
if (!first)
|
|
35
|
+
return { kind: 'condition', field: { kind: 'attribute', attributeKey: '' }, op: 'eq', values: [] };
|
|
36
|
+
return {
|
|
37
|
+
kind: 'condition',
|
|
38
|
+
field: { kind: 'builtin', key: first.key },
|
|
39
|
+
op: first.seed?.op ?? first.ops[0] ?? 'eq',
|
|
40
|
+
values: first.seed?.values ?? [],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function fieldKey(field) {
|
|
44
|
+
if (field.kind === 'builtin')
|
|
45
|
+
return `builtin:${field.key}`;
|
|
46
|
+
if (field.kind === 'attribute')
|
|
47
|
+
return `attribute:${field.attributeKey}`;
|
|
48
|
+
return `attribute:${field.fieldKey}`;
|
|
49
|
+
}
|
|
50
|
+
function builtinDef(field, fields) {
|
|
51
|
+
if (field.kind !== 'builtin')
|
|
52
|
+
return null;
|
|
53
|
+
return fields.find((f) => f.key === field.key) ?? null;
|
|
54
|
+
}
|
|
55
|
+
function opsForField(field, fields) {
|
|
56
|
+
const def = builtinDef(field, fields);
|
|
57
|
+
return def ? def.ops : ATTRIBUTE_OPS;
|
|
58
|
+
}
|
|
59
|
+
function isNumericField(field, fields) {
|
|
60
|
+
return builtinDef(field, fields)?.kind === 'number';
|
|
61
|
+
}
|
|
62
|
+
function valuesToText(values) {
|
|
63
|
+
return values.map((v) => String(v)).join(', ');
|
|
64
|
+
}
|
|
65
|
+
function textToValues(text, numeric) {
|
|
66
|
+
return text
|
|
67
|
+
.split(',')
|
|
68
|
+
.map((s) => s.trim())
|
|
69
|
+
.filter((s) => s.length > 0)
|
|
70
|
+
.map((s) => (numeric ? Number(s) : s));
|
|
71
|
+
}
|
|
72
|
+
export function RuleBuilder({ value, onChange, builtinFields = BUILTIN_FIELDS, attributeFields = [], fieldOptions = {}, labels, disabled = false, }) {
|
|
73
|
+
const copy = { ...DEFAULT_LABELS, ...labels };
|
|
74
|
+
return (_jsx("div", { className: "rounded-md border border-line p-3", children: _jsx(RuleNode, { node: value,
|
|
75
|
+
// The editor produces structural nodes; the caller owns the concrete
|
|
76
|
+
// AST. Every node this component can build is valid in `T` because the
|
|
77
|
+
// caller supplied the field catalogue and the operator lists it uses.
|
|
78
|
+
onChange: (next) => onChange(next), builtinFields: builtinFields, attributeFields: attributeFields, fieldOptions: fieldOptions, labels: copy, disabled: disabled, depth: 0 }) }));
|
|
79
|
+
}
|
|
80
|
+
function RuleNode({ node, onChange, builtinFields, attributeFields, fieldOptions, labels, disabled, depth, }) {
|
|
81
|
+
if (node.kind === 'all') {
|
|
82
|
+
return (_jsxs("div", { className: "flex items-center gap-2 text-sm text-muted-foreground", children: [_jsx("span", { children: labels.matchAll }), _jsxs(Button, { type: "button", size: "sm", variant: "outline", disabled: disabled, onClick: () => onChange(defaultCondition(builtinFields)), children: [_jsx(Plus, { className: "mr-1 h-3 w-3" }), " Add condition"] }), _jsxs(Button, { type: "button", size: "sm", variant: "outline", disabled: disabled, onClick: () => onChange({ kind: 'group', op: 'AND', children: [defaultCondition(builtinFields)] }), children: [_jsx(Plus, { className: "mr-1 h-3 w-3" }), " Add group"] })] }));
|
|
83
|
+
}
|
|
84
|
+
if (node.kind === 'condition') {
|
|
85
|
+
return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(ConditionRow, { condition: node, onChange: onChange, builtinFields: builtinFields, attributeFields: attributeFields, fieldOptions: fieldOptions, labels: labels, disabled: disabled, onRemove: () => onChange({ kind: 'all' }) }), _jsx("div", { children: _jsxs(Button, { type: "button", size: "sm", variant: "ghost", disabled: disabled, onClick: () => onChange({
|
|
86
|
+
kind: 'group',
|
|
87
|
+
op: 'AND',
|
|
88
|
+
children: [node, defaultCondition(builtinFields)],
|
|
89
|
+
}), children: [_jsx(Plus, { className: "mr-1 h-3 w-3" }), " Combine with\u2026"] }) })] }));
|
|
90
|
+
}
|
|
91
|
+
// group
|
|
92
|
+
const setChild = (idx, child) => {
|
|
93
|
+
onChange({ ...node, children: node.children.map((c, i) => (i === idx ? child : c)) });
|
|
94
|
+
};
|
|
95
|
+
const removeChild = (idx) => {
|
|
96
|
+
const next = node.children.filter((_, i) => i !== idx);
|
|
97
|
+
if (next.length === 0)
|
|
98
|
+
onChange({ kind: 'all' });
|
|
99
|
+
else if (next.length === 1 && next[0])
|
|
100
|
+
onChange(next[0]);
|
|
101
|
+
else
|
|
102
|
+
onChange({ ...node, children: next });
|
|
103
|
+
};
|
|
104
|
+
return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsxs(Select, { className: "w-24", value: node.op, disabled: disabled, onChange: (e) => onChange({ ...node, op: e.target.value }), children: [_jsx("option", { value: "AND", children: "ALL of" }), _jsx("option", { value: "OR", children: "ANY of" })] }), _jsx("span", { className: "text-xs text-muted-foreground", children: "the following conditions:" })] }), _jsxs("div", { className: "flex flex-col gap-2 border-l-2 border-line pl-3", children: [node.children.map((child, idx) => (_jsxs("div", { className: "flex items-start gap-2", children: [_jsx("div", { className: "flex-1", children: _jsx(RuleNode, { node: child, onChange: (c) => setChild(idx, c), builtinFields: builtinFields, attributeFields: attributeFields, fieldOptions: fieldOptions, labels: labels, disabled: disabled, depth: depth + 1 }) }), _jsx(Button, { type: "button", size: "icon", variant: "ghost", disabled: disabled, onClick: () => removeChild(idx), children: _jsx(Trash2, { className: "h-3 w-3" }) })] }, idx))), _jsxs("div", { className: "flex gap-2", children: [_jsxs(Button, { type: "button", size: "sm", variant: "outline", disabled: disabled, onClick: () => onChange({
|
|
105
|
+
...node,
|
|
106
|
+
children: [...node.children, defaultCondition(builtinFields)],
|
|
107
|
+
}), children: [_jsx(Plus, { className: "mr-1 h-3 w-3" }), " Condition"] }), depth < 4 ? (_jsxs(Button, { type: "button", size: "sm", variant: "outline", disabled: disabled, onClick: () => onChange({
|
|
108
|
+
...node,
|
|
109
|
+
children: [
|
|
110
|
+
...node.children,
|
|
111
|
+
{ kind: 'group', op: 'AND', children: [defaultCondition(builtinFields)] },
|
|
112
|
+
],
|
|
113
|
+
}), children: [_jsx(Plus, { className: "mr-1 h-3 w-3" }), " Group"] })) : null] })] })] }));
|
|
114
|
+
}
|
|
115
|
+
function ConditionRow({ condition, onChange, builtinFields, attributeFields, fieldOptions, labels, disabled, onRemove, }) {
|
|
116
|
+
const numeric = isNumericField(condition.field, builtinFields);
|
|
117
|
+
const ops = opsForField(condition.field, builtinFields);
|
|
118
|
+
const options = condition.field.kind === 'builtin' ? fieldOptions[condition.field.key] : undefined;
|
|
119
|
+
const onFieldChange = (selected) => {
|
|
120
|
+
const field = selected.startsWith('attribute:')
|
|
121
|
+
? { kind: 'attribute', attributeKey: selected.slice('attribute:'.length) }
|
|
122
|
+
: { kind: 'builtin', key: selected.slice('builtin:'.length) };
|
|
123
|
+
const nextOps = opsForField(field, builtinFields);
|
|
124
|
+
const op = nextOps.includes(condition.op) ? condition.op : (nextOps[0] ?? condition.op);
|
|
125
|
+
onChange({ ...condition, field, op, values: [] });
|
|
126
|
+
};
|
|
127
|
+
return (_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [_jsxs(Select, { className: "w-44", value: fieldKey(condition.field), disabled: disabled, onChange: (e) => onFieldChange(e.target.value), children: [_jsx("optgroup", { label: labels.builtinGroup, children: builtinFields.map((f) => (_jsx("option", { value: `builtin:${f.key}`, children: f.label ?? f.key }, f.key))) }), attributeFields.length > 0 ? (_jsx("optgroup", { label: labels.attributeGroup, children: attributeFields.map((a) => (_jsx("option", { value: `attribute:${a.attributeKey}`, children: a.label }, a.attributeKey))) })) : null] }), _jsx(Select, { className: "w-28", value: condition.op, disabled: disabled, onChange: (e) => onChange({ ...condition, op: e.target.value }), children: ops.map((op) => (_jsx("option", { value: op, children: op }, op))) }), options ? (
|
|
128
|
+
// Not a native `<select multiple>`: its only way to pick a second
|
|
129
|
+
// option is ctrl-click, which most people have never been taught, and
|
|
130
|
+
// one stray click silently drops everything already selected. It also
|
|
131
|
+
// has no search — and categories, the field this is used for most, are
|
|
132
|
+
// exactly the long list that makes worst. `MultiSelect` is the same
|
|
133
|
+
// control every other filter surface in the admin uses (Principle IX).
|
|
134
|
+
_jsx(MultiSelect, { className: "w-48", options: options, selected: condition.values.map(String), onChange: (next) => onChange({ ...condition, values: next }), placeholder: labels.valuesPlaceholder, ariaLabel: labels.valuesLabel, disabled: disabled,
|
|
135
|
+
// Worth it wherever the set can be long; harmless when it is short.
|
|
136
|
+
searchable: true, searchPlaceholder: labels.valuesSearchPlaceholder })) : (_jsx(Input, { className: "w-48", value: valuesToText(condition.values), disabled: disabled, placeholder: numeric ? '0' : 'value(s), comma-separated', onChange: (e) => onChange({ ...condition, values: textToValues(e.target.value, numeric) }) })), _jsx(Button, { type: "button", size: "icon", variant: "ghost", disabled: disabled, onClick: onRemove, children: _jsx(Trash2, { className: "h-3 w-3" }) })] }));
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=RuleBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RuleBuilder.js","sourceRoot":"","sources":["../../../src/components/rule-builder/RuleBuilder.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAoF5C,MAAM,cAAc,GAA8B;IAChD;QACE,GAAG,EAAE,WAAW;QAChB,IAAI,EAAE,QAAQ;QACd,GAAG,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC;QACvD,IAAI,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE;KACjC;IACD,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE;IAC3E,EAAE,GAAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE;IAC5E,EAAE,GAAG,E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,oEAAoE;gBACpE,UAAU,QACV,iBAAiB,EAAE,MAAM,CAAC,uBAAuB,GACjD,CACH,CAAC,CAAC,CAAC,CACF,KAAC,KAAK,IACJ,SAAS,EAAC,MAAM,EAChB,KAAK,EAAE,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC,EACrC,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,2BAA2B,EACxD,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,GAC1F,CACH,EACD,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,MAAM,EAAC,OAAO,EAAC,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,YACrF,KAAC,MAAM,IAAC,SAAS,EAAC,SAAS,GAAG,GACvB,IACL,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface SalesChannelPickerProps {
|
|
3
|
+
value: string | null;
|
|
4
|
+
onChange: (salesChannelId: string | null) => void;
|
|
5
|
+
activeOnly?: boolean;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
emptyMessage?: string;
|
|
8
|
+
clearable?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
ariaLabel?: string;
|
|
11
|
+
id?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function SalesChannelPicker(props: SalesChannelPickerProps): ReactNode;
|
|
15
|
+
//# sourceMappingURL=SalesChannelPicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SalesChannelPicker.d.ts","sourceRoot":"","sources":["../../../src/components/sales-channel-picker/SalesChannelPicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AA4CrE,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAClD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,SAAS,CA0D5E"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
// `apiClient` comes through the kit's published `lib` **barrel** rather than
|
|
4
|
+
// through `../../lib/api-client.js`, which is what the kit's five older
|
|
5
|
+
// data-fetching components do. `vi.mock` keys on a resolved module id, so the
|
|
6
|
+
// barrel is the only spelling an admin test can name: it resolves to the same
|
|
7
|
+
// file as `@endora-commerce/admin-kit/lib`, the seam every packaged screen's
|
|
8
|
+
// test already mocks. A deep import is unreachable from outside the package —
|
|
9
|
+
// the `exports` map declares no such subpath — which is why the five older ones
|
|
10
|
+
// have no tests. Nothing else changes: it is the same module record either way,
|
|
11
|
+
// which `admin/test/kit/admin-kit-identity.test.ts` asserts by reference.
|
|
12
|
+
import { ApiError, apiClient } from '../../lib/index.js';
|
|
13
|
+
import { useAppLanguage } from '../../i18n/app-language-context.js';
|
|
14
|
+
import { Combobox } from '../../ui/combobox.js';
|
|
15
|
+
/**
|
|
16
|
+
* Single-select sales-channel picker.
|
|
17
|
+
*
|
|
18
|
+
* Channels are few and unpaged in practice, so the first (large) page is
|
|
19
|
+
* fetched on mount and the <Combobox> filters client-side. The committed
|
|
20
|
+
* value is the channel `id` (UUID) — the identifier persisted on
|
|
21
|
+
* channel-scoped records. Labels are locale-aware; the channel `code` is
|
|
22
|
+
* shown as the secondary line.
|
|
23
|
+
*
|
|
24
|
+
* **The request is built here** (feature 091, P2). Until this component moved
|
|
25
|
+
* into the kit it called `sales_channels`' own admin API client, which is a
|
|
26
|
+
* reach out of the platform's frontend into a module's admin code — one of the
|
|
27
|
+
* ten keys `backend/scripts/ledgers/cross-module-imports/host.ts` opened with.
|
|
28
|
+
* The exit is the one batches three and five took for a module screen: name the
|
|
29
|
+
* endpoint and the published response type, which both sides already compile,
|
|
30
|
+
* and depend on no module's code. `SalesChannelListResponse` is
|
|
31
|
+
* `@endora-commerce/contracts`', so nothing about the shape is duplicated —
|
|
32
|
+
* only the one `GET` the picker needs out of that client's ten methods.
|
|
33
|
+
*/
|
|
34
|
+
const PICKER_PAGE_SIZE = 200;
|
|
35
|
+
function listSalesChannels(activeOnly) {
|
|
36
|
+
const qs = new URLSearchParams();
|
|
37
|
+
qs.set('pageSize', String(PICKER_PAGE_SIZE));
|
|
38
|
+
qs.set('activeOnly', String(activeOnly));
|
|
39
|
+
return apiClient.get(`/api/v1/admin/sales-channels?${qs.toString()}`);
|
|
40
|
+
}
|
|
41
|
+
export function SalesChannelPicker(props) {
|
|
42
|
+
const { language } = useAppLanguage();
|
|
43
|
+
const [options, setOptions] = useState([]);
|
|
44
|
+
const [loading, setLoading] = useState(true);
|
|
45
|
+
const [error, setError] = useState(null);
|
|
46
|
+
const activeOnly = props.activeOnly ?? false;
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
let alive = true;
|
|
49
|
+
setLoading(true);
|
|
50
|
+
listSalesChannels(activeOnly)
|
|
51
|
+
.then((res) => {
|
|
52
|
+
if (!alive)
|
|
53
|
+
return;
|
|
54
|
+
setOptions(res.items.map((ch) => {
|
|
55
|
+
const name = ch.name[language] ?? ch.name['en-US'] ?? Object.values(ch.name)[0] ?? ch.code;
|
|
56
|
+
return {
|
|
57
|
+
value: ch.id,
|
|
58
|
+
label: name,
|
|
59
|
+
description: ch.active ? ch.code : `${ch.code} · inactive`,
|
|
60
|
+
};
|
|
61
|
+
}));
|
|
62
|
+
})
|
|
63
|
+
.catch((err) => {
|
|
64
|
+
if (!alive)
|
|
65
|
+
return;
|
|
66
|
+
setError(err instanceof ApiError ? err.envelope.error.message : 'Failed to load channels.');
|
|
67
|
+
})
|
|
68
|
+
.finally(() => {
|
|
69
|
+
if (alive)
|
|
70
|
+
setLoading(false);
|
|
71
|
+
});
|
|
72
|
+
return () => {
|
|
73
|
+
alive = false;
|
|
74
|
+
};
|
|
75
|
+
}, [activeOnly, language]);
|
|
76
|
+
const emptyMessage = useMemo(() => props.emptyMessage ?? error ?? 'No sales channels.', [props.emptyMessage, error]);
|
|
77
|
+
return (_jsx(Combobox, { options: options, value: props.value, onChange: props.onChange, loading: loading, clearable: props.clearable ?? true, disabled: props.disabled ?? false, placeholder: props.placeholder ?? 'Select a sales channel…', emptyMessage: emptyMessage, ariaLabel: props.ariaLabel ?? 'Select sales channel', id: props.id ?? '', className: props.className ?? '' }));
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=SalesChannelPicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SalesChannelPicker.js","sourceRoot":"","sources":["../../../src/components/sales-channel-picker/SalesChannelPicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAErE,6EAA6E;AAC7E,wEAAwE;AACxE,8EAA8E;AAC9E,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAC9E,gFAAgF;AAChF,gFAAgF;AAChF,0EAA0E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KAAK,EAClB,QAAQ,EAAE,KAAK,CAAC,QAAQ,EACxB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,IAAI,EAClC,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,KAAK,EACjC,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,yBAAyB,EAC3D,YAAY,EAAE,YAAY,EAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,sBAAsB,EACpD,EAAE,EAAE,KAAK,CAAC,EAAE,IAAI,EAAE,EAClB,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,EAAE,GAChC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ScopeNoticeCode } from '@endora-commerce/contracts';
|
|
3
|
+
/**
|
|
4
|
+
* Why a listing is empty, when "empty" and "there is nothing" are different
|
|
5
|
+
* statements (feature 087, owner decision of 2026-08-29).
|
|
6
|
+
*
|
|
7
|
+
* A viewer whose access is limited to particular organizations is shown none of
|
|
8
|
+
* the records in a table that carries no organization at all. The refusal is
|
|
9
|
+
* correct; the silence was not — an operator reading zero rows concludes
|
|
10
|
+
* something false about the **data**, and there is no way for them to find out
|
|
11
|
+
* otherwise. The server says which of the two it meant (`meta.scopeNotice`) and
|
|
12
|
+
* this renders the sentence.
|
|
13
|
+
*
|
|
14
|
+
* **One component rather than three strings.** The three screens it serves
|
|
15
|
+
* today (`/comparisons`, `/newsletter/subscribers`,
|
|
16
|
+
* `/inventory/availability-notifications`) are all of the surfaces in this
|
|
17
|
+
* state, and feature 087's Group B adds four more when its columns land in the
|
|
18
|
+
* opposite direction. A per-screen sentence is seven copies of one paragraph,
|
|
19
|
+
* which is seven places to correct it and seven chances for one of them to keep
|
|
20
|
+
* saying something that has stopped being true. The copy lives in the `core`
|
|
21
|
+
* bundle for the same reason: it belongs to no module.
|
|
22
|
+
*
|
|
23
|
+
* It renders **nothing** when there is no notice, so a screen may mount it
|
|
24
|
+
* unconditionally in its empty branch. That is deliberate — the caller does not
|
|
25
|
+
* have to know when the sentence applies, and an unrestricted viewer, whose
|
|
26
|
+
* responses never carry the code, never sees it.
|
|
27
|
+
*/
|
|
28
|
+
export interface ScopeNoticeProps {
|
|
29
|
+
/** The code from the response envelope, or `null` when it carried none. */
|
|
30
|
+
notice: ScopeNoticeCode | null | undefined;
|
|
31
|
+
}
|
|
32
|
+
export declare function ScopeNotice({ notice }: ScopeNoticeProps): ReactNode;
|
|
33
|
+
//# sourceMappingURL=ScopeNotice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScopeNotice.d.ts","sourceRoot":"","sources":["../../../src/components/scope-notice/ScopeNotice.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAIlE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,gBAAgB;IAC/B,2EAA2E;IAC3E,MAAM,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,CAAC;CAC5C;AAED,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,EAAE,gBAAgB,GAAG,SAAS,CAYnE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Info } from 'lucide-react';
|
|
3
|
+
import { Alert, AlertDescription, AlertTitle } from '../../ui/alert.js';
|
|
4
|
+
import { useTranslation } from '../../i18n/useTranslation.js';
|
|
5
|
+
export function ScopeNotice({ notice }) {
|
|
6
|
+
const t = useTranslation('core');
|
|
7
|
+
if (notice !== 'ORGANIZATION_ATTRIBUTION_PENDING')
|
|
8
|
+
return null;
|
|
9
|
+
return (_jsxs(Alert, { children: [_jsx(Info, { className: "size-4" }), _jsx(AlertTitle, { children: t('scopeNotice.organizationAttributionPending.title') }), _jsx(AlertDescription, { children: t('scopeNotice.organizationAttributionPending.body') })] }));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=ScopeNotice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScopeNotice.js","sourceRoot":"","sources":["../../../src/components/scope-notice/ScopeNotice.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGpC,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAgC9D,MAAM,UAAU,WAAW,CAAC,EAAE,MAAM,EAAoB;IACtD,MAAM,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IACjC,IAAI,MAAM,KAAK,kCAAkC;QAAE,OAAO,IAAI,CAAC;IAC/D,OAAO,CACL,MAAC,KAAK,eACJ,KAAC,IAAI,IAAC,SAAS,EAAC,QAAQ,GAAG,EAC3B,KAAC,UAAU,cAAE,CAAC,CAAC,kDAAkD,CAAC,GAAc,EAChF,KAAC,gBAAgB,cACd,CAAC,CAAC,iDAAiD,CAAC,GACpC,IACb,CACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The sales channels a piece of content is scoped to, and the content languages
|
|
4
|
+
* inside them. The caller passes a value in and gets one back.
|
|
5
|
+
*
|
|
6
|
+
* **Published by feature 091, P8.** It sat under `cms`' admin directory and was
|
|
7
|
+
* rendered by `blog`'s two editors as well as by `cms`' own three, which is
|
|
8
|
+
* `admin-component-contribution.md` Z1 question 1: the consumer decides that it
|
|
9
|
+
* appears, so it is a published component and not a zone contribution.
|
|
10
|
+
*
|
|
11
|
+
* **The requests are built here**, in `./sales-channels-api.js` — the client
|
|
12
|
+
* exit P2 established, which is what makes the move legal under
|
|
13
|
+
* `admin-kit-surface.md` R6 rather than putting `sales_channels`' admin client
|
|
14
|
+
* inside the kit.
|
|
15
|
+
*
|
|
16
|
+
* **Its copy is `core`'s, not `cms`'** (R-1). All four keys it reads had no
|
|
17
|
+
* other reader in the tree and moved to `core` under `scopePicker.*`.
|
|
18
|
+
*/
|
|
19
|
+
export interface ScopePickerValue {
|
|
20
|
+
salesChannelIds: string[];
|
|
21
|
+
languages: string[];
|
|
22
|
+
}
|
|
23
|
+
export interface ScopePickerProps {
|
|
24
|
+
value: ScopePickerValue;
|
|
25
|
+
onChange: (value: ScopePickerValue) => void;
|
|
26
|
+
}
|
|
27
|
+
export declare function ScopePicker({ value, onChange }: ScopePickerProps): ReactNode;
|
|
28
|
+
//# sourceMappingURL=ScopePicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScopePicker.d.ts","sourceRoot":"","sources":["../../../src/components/scope-picker/ScopePicker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6C,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAUlF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,gBAAgB,CAAC;IACxB,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAC7C;AAWD,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,gBAAgB,GAAG,SAAS,CAwK5E"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { Alert, AlertDescription } from '../../ui/alert.js';
|
|
4
|
+
import { Badge } from '../../ui/badge.js';
|
|
5
|
+
import { Card, CardContent, CardHeader, CardTitle } from '../../ui/card.js';
|
|
6
|
+
import { Checkbox } from '../../ui/checkbox.js';
|
|
7
|
+
import { Label } from '../../ui/label.js';
|
|
8
|
+
import { useTranslation } from '../../i18n/useTranslation.js';
|
|
9
|
+
import { fetchScopeSalesChannel, listScopeSalesChannels } from './sales-channels-api.js';
|
|
10
|
+
function languagesForChannel(channel, detailsByCode) {
|
|
11
|
+
const detail = detailsByCode[channel.code];
|
|
12
|
+
if (detail?.languages?.length)
|
|
13
|
+
return detail.languages;
|
|
14
|
+
return channel.defaultLanguage ? [channel.defaultLanguage] : [];
|
|
15
|
+
}
|
|
16
|
+
export function ScopePicker({ value, onChange }) {
|
|
17
|
+
const t = useTranslation('core');
|
|
18
|
+
const [channels, setChannels] = useState([]);
|
|
19
|
+
const [detailsByCode, setDetailsByCode] = useState({});
|
|
20
|
+
const [error, setError] = useState(null);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
let live = true;
|
|
23
|
+
listScopeSalesChannels()
|
|
24
|
+
.then((res) => {
|
|
25
|
+
if (live)
|
|
26
|
+
setChannels(res.items);
|
|
27
|
+
})
|
|
28
|
+
.catch((err) => {
|
|
29
|
+
if (live)
|
|
30
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
31
|
+
});
|
|
32
|
+
return () => {
|
|
33
|
+
live = false;
|
|
34
|
+
};
|
|
35
|
+
}, []);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
let cancelled = false;
|
|
38
|
+
const missing = channels.filter((channel) => value.salesChannelIds.includes(channel.id) && !detailsByCode[channel.code]);
|
|
39
|
+
if (missing.length === 0)
|
|
40
|
+
return;
|
|
41
|
+
void Promise.all(missing.map((channel) => fetchScopeSalesChannel(channel.code)))
|
|
42
|
+
.then((rows) => {
|
|
43
|
+
if (cancelled)
|
|
44
|
+
return;
|
|
45
|
+
setDetailsByCode((current) => ({
|
|
46
|
+
...current,
|
|
47
|
+
...Object.fromEntries(rows.map((row) => [row.code, row])),
|
|
48
|
+
}));
|
|
49
|
+
})
|
|
50
|
+
.catch((err) => {
|
|
51
|
+
if (!cancelled)
|
|
52
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
53
|
+
});
|
|
54
|
+
return () => {
|
|
55
|
+
cancelled = true;
|
|
56
|
+
};
|
|
57
|
+
}, [channels, detailsByCode, value.salesChannelIds]);
|
|
58
|
+
const selectedChannels = useMemo(() => channels.filter((channel) => value.salesChannelIds.includes(channel.id)), [channels, value.salesChannelIds]);
|
|
59
|
+
const allowedLanguages = useMemo(() => {
|
|
60
|
+
const out = new Set();
|
|
61
|
+
for (const channel of selectedChannels) {
|
|
62
|
+
for (const language of languagesForChannel(channel, detailsByCode)) {
|
|
63
|
+
out.add(language);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return Array.from(out).sort();
|
|
67
|
+
}, [detailsByCode, selectedChannels]);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
if (value.salesChannelIds.length === 0 || allowedLanguages.length === 0)
|
|
70
|
+
return;
|
|
71
|
+
const allowed = new Set(allowedLanguages);
|
|
72
|
+
const pruned = value.languages.filter((language) => allowed.has(language));
|
|
73
|
+
if (pruned.length === value.languages.length)
|
|
74
|
+
return;
|
|
75
|
+
onChange({
|
|
76
|
+
salesChannelIds: value.salesChannelIds,
|
|
77
|
+
languages: pruned,
|
|
78
|
+
});
|
|
79
|
+
}, [allowedLanguages, onChange, value.languages, value.salesChannelIds]);
|
|
80
|
+
const setChannel = useCallback((channelId, checked) => {
|
|
81
|
+
const channel = channels.find((item) => item.id === channelId);
|
|
82
|
+
const nextChannels = checked
|
|
83
|
+
? Array.from(new Set([...value.salesChannelIds, channelId]))
|
|
84
|
+
: value.salesChannelIds.filter((id) => id !== channelId);
|
|
85
|
+
const nextAllowed = new Set();
|
|
86
|
+
for (const selected of channels) {
|
|
87
|
+
if (!nextChannels.includes(selected.id))
|
|
88
|
+
continue;
|
|
89
|
+
for (const language of languagesForChannel(selected, detailsByCode)) {
|
|
90
|
+
nextAllowed.add(language);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
let nextLanguages = nextChannels.length === 0
|
|
94
|
+
? []
|
|
95
|
+
: value.languages.filter((language) => nextAllowed.has(language));
|
|
96
|
+
if (checked && channel && nextLanguages.length === 0) {
|
|
97
|
+
const defaults = languagesForChannel(channel, detailsByCode);
|
|
98
|
+
if (defaults[0])
|
|
99
|
+
nextLanguages = [defaults[0]];
|
|
100
|
+
}
|
|
101
|
+
onChange({ salesChannelIds: nextChannels, languages: nextLanguages });
|
|
102
|
+
}, [channels, detailsByCode, onChange, value.languages, value.salesChannelIds]);
|
|
103
|
+
const setLanguage = useCallback((language, checked) => {
|
|
104
|
+
onChange({
|
|
105
|
+
...value,
|
|
106
|
+
languages: checked
|
|
107
|
+
? Array.from(new Set([...value.languages, language]))
|
|
108
|
+
: value.languages.filter((item) => item !== language),
|
|
109
|
+
});
|
|
110
|
+
}, [onChange, value]);
|
|
111
|
+
const hasSelectedChannels = value.salesChannelIds.length > 0;
|
|
112
|
+
return (_jsxs(Card, { children: [_jsx(CardHeader, { children: _jsx(CardTitle, { className: "text-base", children: t('scopePicker.title') }) }), _jsxs(CardContent, { className: "space-y-4", children: [error ? (_jsx(Alert, { variant: "destructive", children: _jsx(AlertDescription, { children: error }) })) : null, _jsx("div", { className: "grid gap-2", children: channels.map((channel) => (_jsxs("label", { className: "flex items-center gap-2 text-sm", children: [_jsx(Checkbox, { checked: value.salesChannelIds.includes(channel.id), onChange: (event) => setChannel(channel.id, event.target.checked) }), _jsx("span", { children: channel.name['en-US'] ?? channel.code }), _jsx(Badge, { variant: "outline", className: "font-mono text-[10px]", children: channel.code })] }, channel.id))) }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { children: t('scopePicker.languages') }), _jsxs("div", { className: "flex flex-wrap gap-2", children: [allowedLanguages.map((language) => (_jsxs("label", { className: "flex items-center gap-2 rounded border px-3 py-2 text-sm", children: [_jsx(Checkbox, { checked: value.languages.includes(language), onChange: (event) => setLanguage(language, event.target.checked) }), _jsx("span", { children: language })] }, language))), !hasSelectedChannels ? (_jsx("p", { className: "text-sm text-muted-foreground", children: t('scopePicker.selectChannel') })) : allowedLanguages.length === 0 ? (_jsx("p", { className: "text-sm text-muted-foreground", children: t('scopePicker.loadingLanguages') })) : null] })] })] })] }));
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=ScopePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScopePicker.js","sourceRoot":"","sources":["../../../src/components/scope-picker/ScopePicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAElF,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AA6BzF,SAAS,mBAAmB,CAC1B,OAA4B,EAC5B,aAAiD;IAEjD,MAAM,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,MAAM,EAAE,SAAS,EAAE,MAAM;QAAE,OAAO,MAAM,CAAC,SAAS,CAAC;IACvD,OAAO,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EA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D,KAAC,KAAK,IAAC,OAAO,EAAC,SAAS,EAAC,SAAS,EAAC,uBAAuB,YACvD,OAAO,CAAC,IAAI,GACP,KARE,OAAO,CAAC,EAAE,CASd,CACT,CAAC,GACE,EAEN,eAAK,SAAS,EAAC,WAAW,aACxB,KAAC,KAAK,cAAE,CAAC,CAAC,uBAAuB,CAAC,GAAS,EAC3C,eAAK,SAAS,EAAC,sBAAsB,aAClC,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAClC,iBAEE,SAAS,EAAC,0DAA0D,aAEpE,KAAC,QAAQ,IACP,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAC3C,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAChE,EACF,yBAAO,QAAQ,GAAQ,KAPlB,QAAQ,CAQP,CACT,CAAC,EACD,CAAC,mBAAmB,CAAC,CAAC,CAAC,CACtB,YAAG,SAAS,EAAC,+BAA+B,YAAE,CAAC,CAAC,2BAA2B,CAAC,GAAK,CAClF,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAClC,YAAG,SAAS,EAAC,+BAA+B,YAAE,CAAC,CAAC,8BAA8B,CAAC,GAAK,CACrF,CAAC,CAAC,CAAC,IAAI,IACJ,IACF,IACM,IACT,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { SalesChannelDetail, SalesChannelListResponse } from '@endora-commerce/contracts';
|
|
2
|
+
/**
|
|
3
|
+
* The two sales-channel reads `ScopePicker` needs, built here (feature 091, P8).
|
|
4
|
+
*
|
|
5
|
+
* Until this component moved into the kit it called `sales_channels`' own admin
|
|
6
|
+
* API client, which is a reach out of the platform's frontend into a module's
|
|
7
|
+
* admin code — the one entry
|
|
8
|
+
* `backend/scripts/ledgers/cross-module-imports/cms.ts` held. The exit is the
|
|
9
|
+
* one P2 established for the three data-fetching pickers: name the endpoint and
|
|
10
|
+
* the published response type, which both sides already compile, and depend on
|
|
11
|
+
* no module's code. Both shapes are `@endora-commerce/contracts`', so nothing
|
|
12
|
+
* about them is duplicated — only the two `GET`s the picker needs out of that
|
|
13
|
+
* client's fifteen methods.
|
|
14
|
+
*/
|
|
15
|
+
/** Active channels, one large page — channels are few and unpaged in practice. */
|
|
16
|
+
export declare function listScopeSalesChannels(pageSize?: number): Promise<SalesChannelListResponse>;
|
|
17
|
+
/** One channel by its code, for the language list a summary does not carry. */
|
|
18
|
+
export declare function fetchScopeSalesChannel(code: string): Promise<SalesChannelDetail>;
|
|
19
|
+
//# sourceMappingURL=sales-channels-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sales-channels-api.d.ts","sourceRoot":"","sources":["../../../src/components/scope-picker/sales-channels-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAO/F;;;;;;;;;;;;GAYG;AAEH,kFAAkF;AAClF,wBAAgB,sBAAsB,CAAC,QAAQ,SAAM,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAKxF;AAED,+EAA+E;AAC/E,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAIhF"}
|