@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,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The sentence for one of the seven reasons an invoice e-mail did not go out
|
|
3
|
+
* (issue #103 named them, issue #149 put them on the wire).
|
|
4
|
+
*/
|
|
5
|
+
export function invoiceEmailNotSentReason(reason, t) {
|
|
6
|
+
return t(`invoices.emailNotSent.${reason}`);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* What to tell the operator who asked for a re-send, and whether it is good
|
|
10
|
+
* news. Both invoice surfaces reported `invoices.emailSent` unconditionally,
|
|
11
|
+
* over a response body that could already say the message had been suppressed.
|
|
12
|
+
*/
|
|
13
|
+
export function sendInvoiceEmailMessage(result, t) {
|
|
14
|
+
if (result.ok)
|
|
15
|
+
return { ok: true, message: t('invoices.emailSent') };
|
|
16
|
+
return {
|
|
17
|
+
ok: false,
|
|
18
|
+
message: t('invoices.emailNotSentNotice', {
|
|
19
|
+
reason: invoiceEmailNotSentReason(result.reason, t),
|
|
20
|
+
}),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* What to tell the operator after "issue invoice", given what became of the
|
|
25
|
+
* notification.
|
|
26
|
+
*
|
|
27
|
+
* All three answers are distinct, and the middle one matters most: send-on-issue
|
|
28
|
+
* being switched off is a configured choice, so it reads as a plain "issued"
|
|
29
|
+
* rather than as a message that failed. A missing `email` field — an older
|
|
30
|
+
* server, or a response shape a caller did not read — falls back to the same
|
|
31
|
+
* plain confirmation, which is what the screen said before it could do better.
|
|
32
|
+
*/
|
|
33
|
+
export function issueInvoiceNotice(outcome, t) {
|
|
34
|
+
if (outcome?.status === 'sent')
|
|
35
|
+
return t('orderDetail.issueInvoice.doneEmailSent');
|
|
36
|
+
if (outcome?.status === 'not_sent') {
|
|
37
|
+
return t('orderDetail.issueInvoice.doneEmailNotSent', {
|
|
38
|
+
reason: invoiceEmailNotSentReason(outcome.reason, t),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return t('orderDetail.issueInvoice.done');
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=invoice-email-outcome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoice-email-outcome.js","sourceRoot":"","sources":["../../src/lib/invoice-email-outcome.ts"],"names":[],"mappings":"AAkCA;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAiC,EAAE,CAAY;IACvF,OAAO,CAAC,CAAC,yBAAyB,MAAM,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,MAA8B,EAC9B,CAAY;IAEZ,IAAI,MAAM,CAAC,EAAE;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,oBAAoB,CAAC,EAAE,CAAC;IACrE,OAAO;QACL,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,CAAC,CAAC,6BAA6B,EAAE;YACxC,MAAM,EAAE,yBAAyB,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;SACpD,CAAC;KACH,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAA6C,EAC7C,CAAY;IAEZ,IAAI,OAAO,EAAE,MAAM,KAAK,MAAM;QAAE,OAAO,CAAC,CAAC,wCAAwC,CAAC,CAAC;IACnF,IAAI,OAAO,EAAE,MAAM,KAAK,UAAU,EAAE,CAAC;QACnC,OAAO,CAAC,CAAC,2CAA2C,EAAE;YACpD,MAAM,EAAE,yBAAyB,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;SACrD,CAAC,CAAC;IACL,CAAC;IACD,OAAO,CAAC,CAAC,+BAA+B,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { AdminModulePresenceResponse, ModulePresence } from '@endora-commerce/contracts';
|
|
3
|
+
/**
|
|
4
|
+
* The effective enabled-set, fetched once and read by every admin surface —
|
|
5
|
+
* feature 073, FR-031.
|
|
6
|
+
*
|
|
7
|
+
* Constitution XVII: a module that is off contributes no sidebar entry, palette
|
|
8
|
+
* action, widget, tab or settings group. Both frontends resolve that from the
|
|
9
|
+
* server's projection; nothing here recombines the two axes, because `present`
|
|
10
|
+
* arrives precomputed. That is what makes "off means absent" one decision
|
|
11
|
+
* rather than several implementations that can disagree.
|
|
12
|
+
*
|
|
13
|
+
* Mirrors `AdminActionsProvider`: fetched on mount, refreshable on demand, no
|
|
14
|
+
* lifecycle pub/sub bridge on the admin side (there is none today). The one
|
|
15
|
+
* caller that changes presence — the activation control — calls `refresh()`
|
|
16
|
+
* itself, so an operator sees their own flip take effect immediately.
|
|
17
|
+
*
|
|
18
|
+
* **Fail-closed while unresolved.** Until the first response lands, `isPresent`
|
|
19
|
+
* answers `false` for a module it has not heard of, so a surface belonging to a
|
|
20
|
+
* switched-off module never flashes on screen before disappearing. The one
|
|
21
|
+
* exception is a failed fetch: an admin whose presence request errored would
|
|
22
|
+
* otherwise be left with an empty sidebar and no way to diagnose it, so a
|
|
23
|
+
* failure degrades to "show everything" and the gated routes 503 honestly.
|
|
24
|
+
*/
|
|
25
|
+
export interface ModulePresenceContextValue {
|
|
26
|
+
modules: ModulePresence[];
|
|
27
|
+
/** `true` when the module is effectively present, i.e. safe to advertise. */
|
|
28
|
+
isPresent: (moduleId: string) => boolean;
|
|
29
|
+
/** The full record, for a surface that must render the two axes differently. */
|
|
30
|
+
presenceOf: (moduleId: string) => ModulePresence | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* The serving process is TTL-refreshing because its pub/sub link is
|
|
33
|
+
* unhealthy, so this projection may lag a flip made elsewhere. Only the
|
|
34
|
+
* platform screen renders it — every other surface would only be able to
|
|
35
|
+
* report the staleness, not do anything about it.
|
|
36
|
+
*/
|
|
37
|
+
degraded: boolean;
|
|
38
|
+
isLoading: boolean;
|
|
39
|
+
error: Error | null;
|
|
40
|
+
refresh: () => Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
export interface ModulePresenceProviderProps {
|
|
43
|
+
/** Optional pre-supplied projection; tests use this to skip the boot fetch. */
|
|
44
|
+
initial?: AdminModulePresenceResponse;
|
|
45
|
+
children: ReactNode;
|
|
46
|
+
}
|
|
47
|
+
export declare function ModulePresenceProvider(props: ModulePresenceProviderProps): ReactNode;
|
|
48
|
+
export declare function useModulePresence(): ModulePresenceContextValue;
|
|
49
|
+
//# sourceMappingURL=ModulePresenceProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModulePresenceProvider.d.ts","sourceRoot":"","sources":["../../../src/lib/module-presence/ModulePresenceProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,2BAA2B,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG9F;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,6EAA6E;IAC7E,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;IACzC,gFAAgF;IAChF,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,cAAc,GAAG,SAAS,CAAC;IAC7D;;;;;OAKG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAID,MAAM,WAAW,2BAA2B;IAC1C,+EAA+E;IAC/E,OAAO,CAAC,EAAE,2BAA2B,CAAC;IACtC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,GAAG,SAAS,CA8DpF;AAED,wBAAgB,iBAAiB,IAAI,0BAA0B,CAQ9D"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useState, } from 'react';
|
|
3
|
+
import { getModulePresence } from './api.js';
|
|
4
|
+
const ModulePresenceContext = createContext(null);
|
|
5
|
+
export function ModulePresenceProvider(props) {
|
|
6
|
+
const { initial, children } = props;
|
|
7
|
+
const [modules, setModules] = useState(initial?.modules ?? []);
|
|
8
|
+
const [degraded, setDegraded] = useState(initial?.degraded ?? false);
|
|
9
|
+
const [isLoading, setIsLoading] = useState(initial == null);
|
|
10
|
+
const [error, setError] = useState(null);
|
|
11
|
+
const [tick, setTick] = useState(0);
|
|
12
|
+
const refresh = useCallback(async () => {
|
|
13
|
+
setTick((n) => n + 1);
|
|
14
|
+
}, []);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (initial != null && tick === 0)
|
|
17
|
+
return;
|
|
18
|
+
let cancelled = false;
|
|
19
|
+
setIsLoading(true);
|
|
20
|
+
void (async () => {
|
|
21
|
+
try {
|
|
22
|
+
const res = await getModulePresence();
|
|
23
|
+
if (cancelled)
|
|
24
|
+
return;
|
|
25
|
+
setModules(res.modules);
|
|
26
|
+
setDegraded(res.degraded);
|
|
27
|
+
setError(null);
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
if (!cancelled)
|
|
31
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
32
|
+
if (import.meta.env.DEV) {
|
|
33
|
+
console.warn('[module-presence] fetch failed', err);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
finally {
|
|
37
|
+
if (!cancelled)
|
|
38
|
+
setIsLoading(false);
|
|
39
|
+
}
|
|
40
|
+
})();
|
|
41
|
+
return () => {
|
|
42
|
+
cancelled = true;
|
|
43
|
+
};
|
|
44
|
+
// `initial` is a boot-time prop; re-running on its identity would refetch
|
|
45
|
+
// on every parent render.
|
|
46
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
47
|
+
}, [tick]);
|
|
48
|
+
const value = useMemo(() => {
|
|
49
|
+
const byId = new Map(modules.map((m) => [m.id, m]));
|
|
50
|
+
// A failed fetch leaves an operator with no projection at all. Hiding
|
|
51
|
+
// everything would be indistinguishable from a broken deployment, so this
|
|
52
|
+
// one case degrades open and lets the gated routes answer for themselves.
|
|
53
|
+
const unresolved = error !== null && modules.length === 0;
|
|
54
|
+
return {
|
|
55
|
+
modules,
|
|
56
|
+
isPresent: (moduleId) => byId.get(moduleId)?.present ?? unresolved,
|
|
57
|
+
presenceOf: (moduleId) => byId.get(moduleId),
|
|
58
|
+
degraded,
|
|
59
|
+
isLoading,
|
|
60
|
+
error,
|
|
61
|
+
refresh,
|
|
62
|
+
};
|
|
63
|
+
}, [modules, degraded, isLoading, error, refresh]);
|
|
64
|
+
return (_jsx(ModulePresenceContext.Provider, { value: value, children: children }));
|
|
65
|
+
}
|
|
66
|
+
export function useModulePresence() {
|
|
67
|
+
const ctx = useContext(ModulePresenceContext);
|
|
68
|
+
if (!ctx) {
|
|
69
|
+
throw new Error('[module-presence] useModulePresence called outside <ModulePresenceProvider>; wrap your app tree first.');
|
|
70
|
+
}
|
|
71
|
+
return ctx;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=ModulePresenceProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModulePresenceProvider.js","sourceRoot":"","sources":["../../../src/lib/module-presence/ModulePresenceProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,QAAQ,GAET,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AA2C7C,MAAM,qBAAqB,GAAG,aAAa,CAAoC,IAAI,CAAC,CAAC;AAQrF,MAAM,UAAU,sBAAsB,CAAC,KAAkC;IACvE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACpC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAmB,OAAO,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;IACjF,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,OAAO,EAAE,QAAQ,IAAI,KAAK,CAAC,CAAC;IACrE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC;IAC5D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IACvD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEpC,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,IAAmB,EAAE;QACpD,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,IAAI,IAAI,IAAI,IAAI,KAAK,CAAC;YAAE,OAAO;QAC1C,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,YAAY,CAAC,IAAI,CAAC,CAAC;QACnB,KAAK,CAAC,KAAK,IAAI,EAAE;YACf,IAAI,CAAC;gBACH,MAAM,GAAG,GAAG,MAAM,iBAAiB,EAAE,CAAC;gBACtC,IAAI,SAAS;oBAAE,OAAO;gBACtB,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACxB,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAC1B,QAAQ,CAAC,IAAI,CAAC,CAAC;YACjB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,CAAC,SAAS;oBAAE,QAAQ,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBAC9E,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;oBACxB,OAAO,CAAC,IAAI,CAAC,gCAAgC,EAAE,GAAG,CAAC,CAAC;gBACtD,CAAC;YACH,CAAC;oBAAS,CAAC;gBACT,IAAI,CAAC,SAAS;oBAAE,YAAY,CAAC,KAAK,CAAC,CAAC;YACtC,CAAC;QACH,CAAC,CAAC,EAAE,CAAC;QACL,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,IAAI,CAAC;QACnB,CAAC,CAAC;QACF,0EAA0E;QAC1E,0BAA0B;QAC1B,uDAAuD;IACzD,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,MAAM,KAAK,GAAG,OAAO,CAA6B,GAAG,EAAE;QACrD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACpD,sEAAsE;QACtE,0EAA0E;QAC1E,0EAA0E;QAC1E,MAAM,UAAU,GAAG,KAAK,KAAK,IAAI,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC;QAC1D,OAAO;YACL,OAAO;YACP,SAAS,EAAE,CAAC,QAAgB,EAAW,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,OAAO,IAAI,UAAU;YACnF,UAAU,EAAE,CAAC,QAAgB,EAA8B,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC;YAChF,QAAQ;YACR,SAAS;YACT,KAAK;YACL,OAAO;SACR,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IAEnD,OAAO,CACL,KAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACzC,QAAQ,GACsB,CAClC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,MAAM,GAAG,GAAG,UAAU,CAAC,qBAAqB,CAAC,CAAC;IAC9C,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,wGAAwG,CACzG,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { AdminModulePresenceResponse, ModuleActivationResponse } from '@endora-commerce/contracts';
|
|
2
|
+
/**
|
|
3
|
+
* The effective enabled-set, as the server computed it — feature 073.
|
|
4
|
+
*
|
|
5
|
+
* Deliberately a bare fetch, mirroring the admin-actions client: the provider
|
|
6
|
+
* owns caching and refresh, and there is no React Query / SWR layer in this app.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getModulePresence(): Promise<AdminModulePresenceResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* Flip one module's operator activation. The audited Command behind this
|
|
11
|
+
* endpoint is the only door: the ordinary settings write path refuses an
|
|
12
|
+
* activation code.
|
|
13
|
+
*/
|
|
14
|
+
export declare function setModuleActivation(moduleId: string, active: boolean): Promise<ModuleActivationResponse>;
|
|
15
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/lib/module-presence/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,wBAAwB,EACzB,MAAM,4BAA4B,CAAC;AASpC;;;;;GAKG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,2BAA2B,CAAC,CAE9E;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,wBAAwB,CAAC,CAKnC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// `../api-client.js`, not the `./lib` barrel the P2 components take it from.
|
|
2
|
+
// That rule is about a collaborator a test outside the package substitutes, and
|
|
3
|
+
// it cannot reach a file the barrel itself exports: measured in P3, a member
|
|
4
|
+
// importing `../index.js` under a `vi.mock` factory that calls `importActual`
|
|
5
|
+
// resolves to the **real** module — the stub is bypassed and the request goes
|
|
6
|
+
// out for real. The seam for this provider is its `initial` prop instead.
|
|
7
|
+
import { apiClient } from '../api-client.js';
|
|
8
|
+
/**
|
|
9
|
+
* The effective enabled-set, as the server computed it — feature 073.
|
|
10
|
+
*
|
|
11
|
+
* Deliberately a bare fetch, mirroring the admin-actions client: the provider
|
|
12
|
+
* owns caching and refresh, and there is no React Query / SWR layer in this app.
|
|
13
|
+
*/
|
|
14
|
+
export async function getModulePresence() {
|
|
15
|
+
return apiClient.get('/api/v1/admin/module-presence');
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Flip one module's operator activation. The audited Command behind this
|
|
19
|
+
* endpoint is the only door: the ordinary settings write path refuses an
|
|
20
|
+
* activation code.
|
|
21
|
+
*/
|
|
22
|
+
export async function setModuleActivation(moduleId, active) {
|
|
23
|
+
return apiClient.post(`/api/v1/admin/modules/${encodeURIComponent(moduleId)}/activation`, { active });
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/lib/module-presence/api.ts"],"names":[],"mappings":"AAIA,6EAA6E;AAC7E,gFAAgF;AAChF,6EAA6E;AAC7E,8EAA8E;AAC9E,8EAA8E;AAC9E,0EAA0E;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,OAAO,SAAS,CAAC,GAAG,CAA8B,+BAA+B,CAAC,CAAC;AACrF,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,QAAgB,EAChB,MAAe;IAEf,OAAO,SAAS,CAAC,IAAI,CACnB,yBAAyB,kBAAkB,CAAC,QAAQ,CAAC,aAAa,EAClE,EAAE,MAAM,EAAE,CACX,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/module-presence/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,GACjC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/module-presence/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,iBAAiB,GAGlB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locale-aware money formatting for the admin panel.
|
|
3
|
+
*
|
|
4
|
+
* Amounts must render in the conventions of their currency's home country —
|
|
5
|
+
* e.g. PLN as `1234,56 zł` (comma decimal separator, `zł` suffix, `pl-PL`),
|
|
6
|
+
* USD as `$1,234.56` (`en-US`). Admin lists show records from many Sales
|
|
7
|
+
* Channels side by side, each carrying its own currency, so the locale is
|
|
8
|
+
* derived per amount from the currency itself rather than from the admin UI
|
|
9
|
+
* language. Pass an explicit `locale` to override (e.g. the channel's
|
|
10
|
+
* `defaultLanguage`).
|
|
11
|
+
*/
|
|
12
|
+
export declare function localeForCurrency(currency: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Format a decimal money amount as a localized currency string.
|
|
15
|
+
*
|
|
16
|
+
* @param amount decimal amount (not minor units), e.g. `1234.56`
|
|
17
|
+
* @param currency ISO-4217 code, e.g. `PLN`
|
|
18
|
+
* @param locale optional BCP-47 locale; defaults to the currency's home
|
|
19
|
+
* locale so PLN renders as `1234,56 zł` regardless.
|
|
20
|
+
*/
|
|
21
|
+
export declare function formatMoney(amount: number, currency: string, locale?: string): string;
|
|
22
|
+
//# sourceMappingURL=money.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"money.d.ts","sourceRoot":"","sources":["../../src/lib/money.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAqBH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAQrF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locale-aware money formatting for the admin panel.
|
|
3
|
+
*
|
|
4
|
+
* Amounts must render in the conventions of their currency's home country —
|
|
5
|
+
* e.g. PLN as `1234,56 zł` (comma decimal separator, `zł` suffix, `pl-PL`),
|
|
6
|
+
* USD as `$1,234.56` (`en-US`). Admin lists show records from many Sales
|
|
7
|
+
* Channels side by side, each carrying its own currency, so the locale is
|
|
8
|
+
* derived per amount from the currency itself rather than from the admin UI
|
|
9
|
+
* language. Pass an explicit `locale` to override (e.g. the channel's
|
|
10
|
+
* `defaultLanguage`).
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Representative BCP-47 locale per ISO-4217 currency. Keeps the number and
|
|
14
|
+
* symbol conventions aligned with the currency's home country.
|
|
15
|
+
*/
|
|
16
|
+
const LOCALE_BY_CURRENCY = {
|
|
17
|
+
PLN: 'pl-PL',
|
|
18
|
+
EUR: 'de-DE',
|
|
19
|
+
USD: 'en-US',
|
|
20
|
+
GBP: 'en-GB',
|
|
21
|
+
CHF: 'de-CH',
|
|
22
|
+
CZK: 'cs-CZ',
|
|
23
|
+
SEK: 'sv-SE',
|
|
24
|
+
NOK: 'nb-NO',
|
|
25
|
+
DKK: 'da-DK',
|
|
26
|
+
HUF: 'hu-HU',
|
|
27
|
+
RON: 'ro-RO',
|
|
28
|
+
UAH: 'uk-UA',
|
|
29
|
+
};
|
|
30
|
+
export function localeForCurrency(currency) {
|
|
31
|
+
return LOCALE_BY_CURRENCY[currency.toUpperCase()] ?? 'en-US';
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Format a decimal money amount as a localized currency string.
|
|
35
|
+
*
|
|
36
|
+
* @param amount decimal amount (not minor units), e.g. `1234.56`
|
|
37
|
+
* @param currency ISO-4217 code, e.g. `PLN`
|
|
38
|
+
* @param locale optional BCP-47 locale; defaults to the currency's home
|
|
39
|
+
* locale so PLN renders as `1234,56 zł` regardless.
|
|
40
|
+
*/
|
|
41
|
+
export function formatMoney(amount, currency, locale) {
|
|
42
|
+
const loc = locale && locale.trim() !== '' ? locale : localeForCurrency(currency);
|
|
43
|
+
try {
|
|
44
|
+
return new Intl.NumberFormat(loc, { style: 'currency', currency }).format(amount);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// Unknown/invalid currency code — fall back to a plain number + code.
|
|
48
|
+
return `${amount.toFixed(2)} ${currency}`;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=money.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"money.js","sourceRoot":"","sources":["../../src/lib/money.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;GAGG;AACH,MAAM,kBAAkB,GAA2B;IACjD,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;CACb,CAAC;AAEF,MAAM,UAAU,iBAAiB,CAAC,QAAgB;IAChD,OAAO,kBAAkB,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,OAAO,CAAC;AAC/D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,QAAgB,EAAE,MAAe;IAC3E,MAAM,GAAG,GAAG,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAClF,IAAI,CAAC;QACH,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACpF,CAAC;IAAC,MAAM,CAAC;QACP,sEAAsE;QACtE,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,CAAC;IAC5C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The page sizes every paginated admin list offers.
|
|
3
|
+
*
|
|
4
|
+
* It is a module of its own because the **constant** is design-system and the
|
|
5
|
+
* **preference** is application state. `usePageSizePreference` reads the signed-in
|
|
6
|
+
* admin's id to key its `localStorage` entry, so it belongs to the admin application
|
|
7
|
+
* and stays there (see the package README, *What Phase 1b does not publish*);
|
|
8
|
+
* `PaginationFooter` only needs the list of numbers to render its dropdown. Splitting
|
|
9
|
+
* them is what lets the footer be published without dragging the session with it, and
|
|
10
|
+
* it keeps exactly one list: the admin's hook re-exports these names rather than
|
|
11
|
+
* declaring a second array the dropdown and the validation could disagree about.
|
|
12
|
+
*/
|
|
13
|
+
export declare const PAGE_SIZE_OPTIONS: readonly [5, 10, 20, 50, 100, 500];
|
|
14
|
+
export type PageSizeOption = (typeof PAGE_SIZE_OPTIONS)[number];
|
|
15
|
+
//# sourceMappingURL=page-size-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-size-options.d.ts","sourceRoot":"","sources":["../../src/lib/page-size-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,oCAAqC,CAAC;AAEpE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The page sizes every paginated admin list offers.
|
|
3
|
+
*
|
|
4
|
+
* It is a module of its own because the **constant** is design-system and the
|
|
5
|
+
* **preference** is application state. `usePageSizePreference` reads the signed-in
|
|
6
|
+
* admin's id to key its `localStorage` entry, so it belongs to the admin application
|
|
7
|
+
* and stays there (see the package README, *What Phase 1b does not publish*);
|
|
8
|
+
* `PaginationFooter` only needs the list of numbers to render its dropdown. Splitting
|
|
9
|
+
* them is what lets the footer be published without dragging the session with it, and
|
|
10
|
+
* it keeps exactly one list: the admin's hook re-exports these names rather than
|
|
11
|
+
* declaring a second array the dropdown and the validation could disagree about.
|
|
12
|
+
*/
|
|
13
|
+
export const PAGE_SIZE_OPTIONS = [5, 10, 20, 50, 100, 500];
|
|
14
|
+
//# sourceMappingURL=page-size-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-size-options.js","sourceRoot":"","sources":["../../src/lib/page-size-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,CAAU,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A status badge's colours, computed from the hex an operator picked (feature
|
|
3
|
+
* 091, batch 8).
|
|
4
|
+
*
|
|
5
|
+
* Published out of `admin/src/modules/orders/orderStatusColor.ts`, which
|
|
6
|
+
* `returns` imported for the return workflow's own status badges —
|
|
7
|
+
* `backend/scripts/ledgers/cross-module-imports/returns.ts` recorded the reach
|
|
8
|
+
* and its retiring condition offered two exits, of which this is the first:
|
|
9
|
+
* *"the helper is generic and moves into the kit"*. It is: two pure functions
|
|
10
|
+
* over a hex string, with no `orders` vocabulary and no request.
|
|
11
|
+
*
|
|
12
|
+
* **Renamed, and the rename is the point.** `orderStatusBadgeStyle` in the kit
|
|
13
|
+
* would be a kit symbol named after a module, which is R6's rule wearing a
|
|
14
|
+
* different hat — `returns` calls it about return statuses and `orders` about
|
|
15
|
+
* order statuses, and the function cannot tell. The old spelling survives at
|
|
16
|
+
* the old path as a re-export shim, so `orders`' own four call sites are
|
|
17
|
+
* unchanged.
|
|
18
|
+
*
|
|
19
|
+
* `ORDER_STATUS_DEFAULT_COLOR` stays `@endora-commerce/contracts`' and is
|
|
20
|
+
* imported from there rather than re-exported here: it is the platform's
|
|
21
|
+
* fallback for an unset colour, both callers already compile that package, and
|
|
22
|
+
* a second name for one constant is two things that can disagree.
|
|
23
|
+
*/
|
|
24
|
+
import type { CSSProperties } from 'react';
|
|
25
|
+
/**
|
|
26
|
+
* Black or white text for a given background hex, chosen by perceived
|
|
27
|
+
* luminance so the status label stays legible on any picked colour.
|
|
28
|
+
*/
|
|
29
|
+
export declare function readableTextColor(hex: string): string;
|
|
30
|
+
/** Inline style for a status badge: solid background + auto-contrast text. */
|
|
31
|
+
export declare function statusBadgeStyle(color: string | null | undefined): CSSProperties;
|
|
32
|
+
//# sourceMappingURL=status-color.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-color.d.ts","sourceRoot":"","sources":["../../src/lib/status-color.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAS3C;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQrD;AAED,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,aAAa,CAGhF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ORDER_STATUS_DEFAULT_COLOR } from '@endora-commerce/contracts';
|
|
2
|
+
const HEX = /^#[0-9a-fA-F]{6}$/;
|
|
3
|
+
function normalizeHex(color) {
|
|
4
|
+
return color && HEX.test(color.trim()) ? color.trim() : ORDER_STATUS_DEFAULT_COLOR;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Black or white text for a given background hex, chosen by perceived
|
|
8
|
+
* luminance so the status label stays legible on any picked colour.
|
|
9
|
+
*/
|
|
10
|
+
export function readableTextColor(hex) {
|
|
11
|
+
const value = normalizeHex(hex).slice(1);
|
|
12
|
+
const int = Number.parseInt(value, 16);
|
|
13
|
+
const r = (int >> 16) & 0xff;
|
|
14
|
+
const g = (int >> 8) & 0xff;
|
|
15
|
+
const b = int & 0xff;
|
|
16
|
+
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
17
|
+
return luminance > 0.6 ? '#1f2937' : '#ffffff';
|
|
18
|
+
}
|
|
19
|
+
/** Inline style for a status badge: solid background + auto-contrast text. */
|
|
20
|
+
export function statusBadgeStyle(color) {
|
|
21
|
+
const hex = normalizeHex(color);
|
|
22
|
+
return { backgroundColor: hex, color: readableTextColor(hex), borderColor: 'transparent' };
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=status-color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-color.js","sourceRoot":"","sources":["../../src/lib/status-color.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAExE,MAAM,GAAG,GAAG,mBAAmB,CAAC;AAEhC,SAAS,YAAY,CAAC,KAAgC;IACpD,OAAO,KAAK,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,0BAA0B,CAAC;AACrF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACzC,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACvC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC;IAC5B,MAAM,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;IACrB,MAAM,SAAS,GAAG,CAAC,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;IAC5D,OAAO,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;AACjD,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,gBAAgB,CAAC,KAAgC;IAC/D,MAAM,GAAG,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IAChC,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,KAAK,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC;AAC7F,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One predicate for "may this operator see this destination at all", shared by
|
|
3
|
+
* every static index the admin renders: the sidebar, the ⌘K palette's Navigate
|
|
4
|
+
* group and the dashboard's quick actions.
|
|
5
|
+
*
|
|
6
|
+
* Issue #230. The three surfaces used to answer the question three times. The
|
|
7
|
+
* sidebar checked a permission and module presence, the palette checked only
|
|
8
|
+
* module presence — its item type had no field for a permission, so no amount
|
|
9
|
+
* of data could have gated it — and the quick-action card checked only module
|
|
10
|
+
* presence too. The result was a palette that advertised screens the operator's
|
|
11
|
+
* role cannot open, which Principle XVI item 2 forbids in as many words ("so
|
|
12
|
+
* the palette never advertises a 403").
|
|
13
|
+
*
|
|
14
|
+
* Keeping the predicate here rather than in `AppShell.tsx` is the anti-drift
|
|
15
|
+
* measure: `HomePage` cannot reach into a component module for it, so a copy is
|
|
16
|
+
* what it would otherwise have grown, and a copy is what drifts.
|
|
17
|
+
*
|
|
18
|
+
* Published by the kit since feature 091's P3, which is what extends that
|
|
19
|
+
* anti-drift argument to a module **package**: a packaged screen could name
|
|
20
|
+
* neither this file nor `useAuth`, so its only way to gate a control was to
|
|
21
|
+
* grow the copy this comment exists to prevent.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* A permission code, or a set of codes any one of which suffices.
|
|
25
|
+
*
|
|
26
|
+
* The array form exists because the routes have it: `/api/v1/admin/organizations`
|
|
27
|
+
* is gated by `requireAdminAny(['customers:read', 'customers:manage'])`
|
|
28
|
+
* (`packages/modules/organizations/src/backend/routes.admin.ts:169`). Naming only the
|
|
29
|
+
* first of those in the UI hides the screen from a role that holds the second —
|
|
30
|
+
* the failure mode this issue exists to remove, pointed the other way.
|
|
31
|
+
*/
|
|
32
|
+
export type PermissionRequirement = string | readonly string[];
|
|
33
|
+
/**
|
|
34
|
+
* The gating half of a navigation entry, a palette entry or a quick action.
|
|
35
|
+
* Each surface's own item type carries its label, icon and route on top of it.
|
|
36
|
+
*/
|
|
37
|
+
export interface GatedSurface {
|
|
38
|
+
/**
|
|
39
|
+
* The module that owns the destination, or `null` for a surface the admin
|
|
40
|
+
* shell owns itself (the dashboard, `/platform/modules`). Feature 073 /
|
|
41
|
+
* FR-031: presence is resolved from the server's effective enabled-set.
|
|
42
|
+
*/
|
|
43
|
+
readonly module?: string | null;
|
|
44
|
+
/**
|
|
45
|
+
* The permission the destination's own route enforces — read from the route,
|
|
46
|
+
* never copied from a neighbouring entry. Unset means the destination has no
|
|
47
|
+
* gate beyond being an authenticated admin.
|
|
48
|
+
*/
|
|
49
|
+
readonly requiredPermission?: PermissionRequirement;
|
|
50
|
+
}
|
|
51
|
+
/** Whether `hasPermission` satisfies the requirement (any-of for the array form). */
|
|
52
|
+
export declare function satisfiesPermission(requirement: PermissionRequirement | undefined, hasPermission: (code: string) => boolean): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* The full predicate: permission first, then module presence.
|
|
55
|
+
*
|
|
56
|
+
* Both axes **hide** rather than disable. For module presence that was already
|
|
57
|
+
* the rule (feature 073); extending it to permission is a deliberate choice and
|
|
58
|
+
* not merely the cheaper branch — see the comment on `PALETTE_ITEMS` in
|
|
59
|
+
* `AppShell.tsx` for the reasoning and its accessibility consequence.
|
|
60
|
+
*/
|
|
61
|
+
export declare function isSurfaceVisible(surface: GatedSurface, deps: {
|
|
62
|
+
hasPermission: (code: string) => boolean;
|
|
63
|
+
isModulePresent: (moduleId: string) => boolean;
|
|
64
|
+
}): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Hook form, so the three call sites are one expression each and cannot drift
|
|
67
|
+
* into three slightly different filters again.
|
|
68
|
+
*/
|
|
69
|
+
export declare function useSurfaceVisibility(): (surface: GatedSurface) => boolean;
|
|
70
|
+
//# sourceMappingURL=surface-visibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface-visibility.d.ts","sourceRoot":"","sources":["../../src/lib/surface-visibility.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;AAE/D;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;;;OAIG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,qBAAqB,CAAC;CACrD;AAED,qFAAqF;AACrF,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,qBAAqB,GAAG,SAAS,EAC9C,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GACvC,OAAO,CAOT;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE;IACJ,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACzC,eAAe,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;CAChD,GACA,OAAO,CAKT;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAQzE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useCallback } from 'react';
|
|
2
|
+
import { useAuth } from './auth.js';
|
|
3
|
+
import { useModulePresence } from './module-presence/index.js';
|
|
4
|
+
/** Whether `hasPermission` satisfies the requirement (any-of for the array form). */
|
|
5
|
+
export function satisfiesPermission(requirement, hasPermission) {
|
|
6
|
+
if (requirement === undefined)
|
|
7
|
+
return true;
|
|
8
|
+
if (typeof requirement === 'string')
|
|
9
|
+
return hasPermission(requirement);
|
|
10
|
+
// An empty array would mean "no code can satisfy this", which is never what
|
|
11
|
+
// an author means; treat it as ungated rather than silently hiding a screen.
|
|
12
|
+
if (requirement.length === 0)
|
|
13
|
+
return true;
|
|
14
|
+
return requirement.some((code) => hasPermission(code));
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The full predicate: permission first, then module presence.
|
|
18
|
+
*
|
|
19
|
+
* Both axes **hide** rather than disable. For module presence that was already
|
|
20
|
+
* the rule (feature 073); extending it to permission is a deliberate choice and
|
|
21
|
+
* not merely the cheaper branch — see the comment on `PALETTE_ITEMS` in
|
|
22
|
+
* `AppShell.tsx` for the reasoning and its accessibility consequence.
|
|
23
|
+
*/
|
|
24
|
+
export function isSurfaceVisible(surface, deps) {
|
|
25
|
+
return (satisfiesPermission(surface.requiredPermission, deps.hasPermission) &&
|
|
26
|
+
(surface.module == null || deps.isModulePresent(surface.module)));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Hook form, so the three call sites are one expression each and cannot drift
|
|
30
|
+
* into three slightly different filters again.
|
|
31
|
+
*/
|
|
32
|
+
export function useSurfaceVisibility() {
|
|
33
|
+
const { hasPermission } = useAuth();
|
|
34
|
+
const { isPresent } = useModulePresence();
|
|
35
|
+
return useCallback((surface) => isSurfaceVisible(surface, { hasPermission, isModulePresent: isPresent }), [hasPermission, isPresent]);
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=surface-visibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface-visibility.js","sourceRoot":"","sources":["../../src/lib/surface-visibility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAuD/D,qFAAqF;AACrF,MAAM,UAAU,mBAAmB,CACjC,WAA8C,EAC9C,aAAwC;IAExC,IAAI,WAAW,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAC3C,IAAI,OAAO,WAAW,KAAK,QAAQ;QAAE,OAAO,aAAa,CAAC,WAAW,CAAC,CAAC;IACvE,4EAA4E;IAC5E,6EAA6E;IAC7E,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1C,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;AACzD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAqB,EACrB,IAGC;IAED,OAAO,CACL,mBAAmB,CAAC,OAAO,CAAC,kBAAkB,EAAE,IAAI,CAAC,aAAa,CAAC;QACnE,CAAC,OAAO,CAAC,MAAM,IAAI,IAAI,IAAI,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CACjE,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,MAAM,EAAE,SAAS,EAAE,GAAG,iBAAiB,EAAE,CAAC;IAC1C,OAAO,WAAW,CAChB,CAAC,OAAqB,EAAW,EAAE,CACjC,gBAAgB,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC,EAC1E,CAAC,aAAa,EAAE,SAAS,CAAC,CAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fold a string so two spellings of the same word compare equal.
|
|
3
|
+
*
|
|
4
|
+
* **This is a general text utility, not palette machinery.** It lived under
|
|
5
|
+
* `lib/admin-actions/` until issue #236, which under-sold it as one consumer's
|
|
6
|
+
* private helper and invited the next author to write their own: by then the
|
|
7
|
+
* page-builder drawer, the combobox and the multi-select had each grown a copy
|
|
8
|
+
* that looked right and was not. The admin has two kinds of caller, and both
|
|
9
|
+
* need the same fold:
|
|
10
|
+
*
|
|
11
|
+
* - **search predicates** — the ⌘K palette, the page-builder drawer, the
|
|
12
|
+
* combobox / multi-select pickers, the category tree filter. Fold both the
|
|
13
|
+
* query and the haystack, then `includes`.
|
|
14
|
+
* - **slug and code generators** — `PageEditor`, `BlockEditor`,
|
|
15
|
+
* `BlogPostEditor`. Fold first, then collapse whatever is left to `-` / `_`.
|
|
16
|
+
*
|
|
17
|
+
* **The fold itself is not written here.** Since issue #240 it is
|
|
18
|
+
* `foldDiacritics` from `@endora-commerce/contracts` — the same implementation the backend
|
|
19
|
+
* writes `organizations.name_search` with. This file had grown its own copy of
|
|
20
|
+
* the map for the same reason the four private copies grew: the shared one was
|
|
21
|
+
* correct but named after a single caller (`normalizeOrganizationName`), so
|
|
22
|
+
* nobody looking for a diacritic fold found it. What is left here is the one
|
|
23
|
+
* thing that is genuinely the admin's policy: the trim.
|
|
24
|
+
*
|
|
25
|
+
* What `foldDiacritics` does, in order: decompose (NFD), strip the combining
|
|
26
|
+
* marks, map the letters NFD leaves standing (`Ł ł Ø ø Đ đ Ð ð Þ þ ß Æ æ Œ œ`),
|
|
27
|
+
* lowercase. Step three is the one the obvious
|
|
28
|
+
* `normalize('NFD').replace(/\p{Diacritic}/gu, '')` one-liner is missing, and
|
|
29
|
+
* without it the fold silently does nothing to every Polish word carrying an
|
|
30
|
+
* `ł` (`płatności`, `Nagłówek`).
|
|
31
|
+
*
|
|
32
|
+
* Then, here: **trim.** Surrounding whitespace is noise in every caller — a
|
|
33
|
+
* search query with a leading space matched nothing at all before this step
|
|
34
|
+
* existed (Postel's Law — accept what was typed), and a slug generator strips
|
|
35
|
+
* its own edge separators anyway. Trimming here means no caller has to
|
|
36
|
+
* remember; four of the six had not. The shared fold deliberately leaves
|
|
37
|
+
* whitespace alone, because what counts as one space differs by caller:
|
|
38
|
+
* `normalizeOrganizationName` also collapses internal runs, since it writes a
|
|
39
|
+
* column a `$like` reads.
|
|
40
|
+
*
|
|
41
|
+
* Edge cases worth knowing:
|
|
42
|
+
* - `ß` folds to `ss` and `æ`/`œ` to `ae`/`oe`. The private copy this file
|
|
43
|
+
* carried until issue #240 left all three standing; adopting the shared map
|
|
44
|
+
* changed 19 code points in total, 15 of them this way. The other four are
|
|
45
|
+
* `Ħ ħ Ŧ ŧ` (Maltese, Northern Sami), which the private map folded to `h`/`t`
|
|
46
|
+
* and the shared one leaves alone. They are **not** silently re-added here:
|
|
47
|
+
* the shared map is the one the backend writes a persisted search column
|
|
48
|
+
* with, so growing it re-folds new rows differently from old ones — a data
|
|
49
|
+
* migration (issue #240's report names it), not a line in this file.
|
|
50
|
+
* - Matching behaves like a case-insensitive substring test, not full Unicode
|
|
51
|
+
* case folding.
|
|
52
|
+
* - A whitespace-only string folds to the empty string, so callers that treat
|
|
53
|
+
* an empty query as "match everything" get that for free.
|
|
54
|
+
*/
|
|
55
|
+
export declare function normalize(input: string): string;
|
|
56
|
+
//# sourceMappingURL=text-normalization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-normalization.d.ts","sourceRoot":"","sources":["../../src/lib/text-normalization.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|