@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,89 @@
|
|
|
1
|
+
export class ApiError extends Error {
|
|
2
|
+
status;
|
|
3
|
+
envelope;
|
|
4
|
+
constructor(status, envelope) {
|
|
5
|
+
super(`${envelope.error.code}: ${envelope.error.message}`);
|
|
6
|
+
this.status = status;
|
|
7
|
+
this.envelope = envelope;
|
|
8
|
+
this.name = 'ApiError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export function createApiClient(options) {
|
|
12
|
+
const { baseUrl, apiKey, fetchFn = fetch } = options;
|
|
13
|
+
async function request(method, path, body, init = {}) {
|
|
14
|
+
const headers = new Headers(init.headers);
|
|
15
|
+
headers.set('Accept', 'application/json');
|
|
16
|
+
if (body !== undefined) {
|
|
17
|
+
headers.set('Content-Type', 'application/json');
|
|
18
|
+
}
|
|
19
|
+
if (apiKey) {
|
|
20
|
+
headers.set('Authorization', `Bearer ${apiKey}`);
|
|
21
|
+
}
|
|
22
|
+
const response = await fetchFn(`${baseUrl}${path}`, {
|
|
23
|
+
...init,
|
|
24
|
+
method,
|
|
25
|
+
headers,
|
|
26
|
+
credentials: apiKey ? 'omit' : 'include',
|
|
27
|
+
...(body === undefined ? {} : { body: JSON.stringify(body) }),
|
|
28
|
+
});
|
|
29
|
+
if (!response.ok) {
|
|
30
|
+
const envelope = (await response.json().catch(() => null));
|
|
31
|
+
if (envelope && 'error' in envelope) {
|
|
32
|
+
throw new ApiError(response.status, envelope);
|
|
33
|
+
}
|
|
34
|
+
throw new ApiError(response.status, {
|
|
35
|
+
error: { code: 'INTERNAL', message: `HTTP ${response.status}` },
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
if (response.status === 204) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
return (await response.json());
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
get: (path, init) => request('GET', path, undefined, init),
|
|
45
|
+
post: (path, body, init) => request('POST', path, body, init),
|
|
46
|
+
put: (path, body, init) => request('PUT', path, body, init),
|
|
47
|
+
patch: (path, body, init) => request('PATCH', path, body, init),
|
|
48
|
+
delete: (path, init) => request('DELETE', path, undefined, init),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The API origin this admin talks to, and the **one** place the environment
|
|
53
|
+
* variable behind it is read.
|
|
54
|
+
*
|
|
55
|
+
* Published (feature 091) because a screen that builds a URL the fetch client
|
|
56
|
+
* cannot make for it — a `<a download>` href, a form action — needs the same
|
|
57
|
+
* origin, and a module package cannot read `import.meta.env` for itself
|
|
58
|
+
* without acquiring `vite/client` types and a second copy of this fallback.
|
|
59
|
+
* Vite replaces the expression `import.meta.env.VITE_API_BASE_URL` at build
|
|
60
|
+
* time, so it is written **verbatim** here: a cast or an indirection is a
|
|
61
|
+
* chance for that replacement to stop happening in a way no type-check can
|
|
62
|
+
* see.
|
|
63
|
+
*/
|
|
64
|
+
export const apiBaseUrl = import.meta.env.VITE_API_BASE_URL ?? 'http://localhost:3001';
|
|
65
|
+
const inner = createApiClient({ baseUrl: apiBaseUrl });
|
|
66
|
+
const unauthorizedListeners = new Set();
|
|
67
|
+
export function onUnauthorized(listener) {
|
|
68
|
+
unauthorizedListeners.add(listener);
|
|
69
|
+
return () => {
|
|
70
|
+
unauthorizedListeners.delete(listener);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function trap(promise) {
|
|
74
|
+
return promise.catch((err) => {
|
|
75
|
+
if (err instanceof ApiError && err.status === 401) {
|
|
76
|
+
for (const l of unauthorizedListeners)
|
|
77
|
+
l();
|
|
78
|
+
}
|
|
79
|
+
throw err;
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
export const apiClient = {
|
|
83
|
+
get: (p, init) => trap(inner.get(p, init)),
|
|
84
|
+
post: (p, b, init) => trap(inner.post(p, b, init)),
|
|
85
|
+
put: (p, b, init) => trap(inner.put(p, b, init)),
|
|
86
|
+
patch: (p, b, init) => trap(inner.patch(p, b, init)),
|
|
87
|
+
delete: (p, init) => trap(inner.delete(p, init)),
|
|
88
|
+
};
|
|
89
|
+
//# sourceMappingURL=api-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../../src/lib/api-client.ts"],"names":[],"mappings":"AAyBA,MAAM,OAAO,QAAS,SAAQ,KAAK;IACxB,MAAM,CAAS;IACf,QAAQ,CAAgB;IACjC,YAAY,MAAc,EAAE,QAAuB;QACjD,KAAK,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF;AAUD,MAAM,UAAU,eAAe,CAAC,OAAyB;IACvD,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,KAAK,EAAE,GAAG,OAAO,CAAC;IAErD,KAAK,UAAU,OAAO,CAAI,MAAc,EAAE,IAAY,EAAE,IAAc,EAAE,OAAoB,EAAE;QAC5F,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,kBAAkB,CAAC,CAAC;QAC1C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QAClD,CAAC;QACD,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,MAAM,EAAE,CAAC,CAAC;QACnD,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,OAAO,GAAG,IAAI,EAAE,EAAE;YA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AAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IAClD,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IAChD,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;IACpD,MAAM,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;CACjD,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve an asset URL returned by the backend into one the admin can load.
|
|
3
|
+
*
|
|
4
|
+
* The Assets Library backend serves files at `/assets/file/:assetId`. When the
|
|
5
|
+
* `publicUrlBase` setting is left blank (the default, "use the request host"),
|
|
6
|
+
* the resolved URL is host-relative (e.g. `/assets/file/<id>`). The admin SPA
|
|
7
|
+
* runs on a different origin than the backend, so a host-relative URL resolves
|
|
8
|
+
* against the admin origin and 404s. Prefix such URLs with the API base so the
|
|
9
|
+
* browser fetches them from the backend.
|
|
10
|
+
*
|
|
11
|
+
* Absolute URLs (`http(s)://…`, `data:`, `blob:`) and **protocol-relative**
|
|
12
|
+
* ones (`//cdn.example.com/x.png`) are returned unchanged.
|
|
13
|
+
*
|
|
14
|
+
* **Published by feature 091's P4c.** It lived in `assets_library`' admin
|
|
15
|
+
* directory and was named by five other modules plus two `_shared` files, which
|
|
16
|
+
* is seven reaches into module code for a two-branch string function whose only
|
|
17
|
+
* input is the API origin the kit already publishes. Nothing about it is the
|
|
18
|
+
* owner's: `admin-component-contribution.md` Z1.1.
|
|
19
|
+
*
|
|
20
|
+
* **Two behaviours came from the ninth private copy, batch 10's** (feature 091).
|
|
21
|
+
* `settings`' `ImageSettingInput` carried its own implementation of this
|
|
22
|
+
* function — invisible to P4c, because a copy that no module reaches is not a
|
|
23
|
+
* cross-module reach — and it handled two cases this one did not: it trimmed,
|
|
24
|
+
* and it treated a protocol-relative URL as already absolute. The second is a
|
|
25
|
+
* defect rather than a preference: `//cdn.example.com/x.png` starts with `/`,
|
|
26
|
+
* so prefixing it produced `https://api.example.com//cdn.example.com/x.png`,
|
|
27
|
+
* which loads nothing. Both are folded in here rather than kept in a tenth
|
|
28
|
+
* copy, and neither can break a caller — a trailing space and a broken origin
|
|
29
|
+
* are not results anybody relies on.
|
|
30
|
+
*/
|
|
31
|
+
export declare function toAbsoluteAssetUrl(url: string | null | undefined): string;
|
|
32
|
+
//# sourceMappingURL=asset-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-url.d.ts","sourceRoot":"","sources":["../../src/lib/asset-url.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAMzE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { apiBaseUrl } from './api-client.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve an asset URL returned by the backend into one the admin can load.
|
|
4
|
+
*
|
|
5
|
+
* The Assets Library backend serves files at `/assets/file/:assetId`. When the
|
|
6
|
+
* `publicUrlBase` setting is left blank (the default, "use the request host"),
|
|
7
|
+
* the resolved URL is host-relative (e.g. `/assets/file/<id>`). The admin SPA
|
|
8
|
+
* runs on a different origin than the backend, so a host-relative URL resolves
|
|
9
|
+
* against the admin origin and 404s. Prefix such URLs with the API base so the
|
|
10
|
+
* browser fetches them from the backend.
|
|
11
|
+
*
|
|
12
|
+
* Absolute URLs (`http(s)://…`, `data:`, `blob:`) and **protocol-relative**
|
|
13
|
+
* ones (`//cdn.example.com/x.png`) are returned unchanged.
|
|
14
|
+
*
|
|
15
|
+
* **Published by feature 091's P4c.** It lived in `assets_library`' admin
|
|
16
|
+
* directory and was named by five other modules plus two `_shared` files, which
|
|
17
|
+
* is seven reaches into module code for a two-branch string function whose only
|
|
18
|
+
* input is the API origin the kit already publishes. Nothing about it is the
|
|
19
|
+
* owner's: `admin-component-contribution.md` Z1.1.
|
|
20
|
+
*
|
|
21
|
+
* **Two behaviours came from the ninth private copy, batch 10's** (feature 091).
|
|
22
|
+
* `settings`' `ImageSettingInput` carried its own implementation of this
|
|
23
|
+
* function — invisible to P4c, because a copy that no module reaches is not a
|
|
24
|
+
* cross-module reach — and it handled two cases this one did not: it trimmed,
|
|
25
|
+
* and it treated a protocol-relative URL as already absolute. The second is a
|
|
26
|
+
* defect rather than a preference: `//cdn.example.com/x.png` starts with `/`,
|
|
27
|
+
* so prefixing it produced `https://api.example.com//cdn.example.com/x.png`,
|
|
28
|
+
* which loads nothing. Both are folded in here rather than kept in a tenth
|
|
29
|
+
* copy, and neither can break a caller — a trailing space and a broken origin
|
|
30
|
+
* are not results anybody relies on.
|
|
31
|
+
*/
|
|
32
|
+
export function toAbsoluteAssetUrl(url) {
|
|
33
|
+
const trimmed = url?.trim() ?? '';
|
|
34
|
+
if (trimmed === '')
|
|
35
|
+
return '';
|
|
36
|
+
if (/^(https?:|data:|blob:)/i.test(trimmed) || trimmed.startsWith('//'))
|
|
37
|
+
return trimmed;
|
|
38
|
+
if (trimmed.startsWith('/'))
|
|
39
|
+
return `${apiBaseUrl.replace(/\/+$/, '')}${trimmed}`;
|
|
40
|
+
return trimmed;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=asset-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"asset-url.js","sourceRoot":"","sources":["../../src/lib/asset-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAA8B;IAC/D,MAAM,OAAO,GAAG,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAClC,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,EAAE,CAAC;IAC9B,IAAI,yBAAyB,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,OAAO,CAAC;IACxF,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC;IAClF,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Admin auth context. The session lives in the `b2b_admin_session` httpOnly
|
|
4
|
+
* cookie issued by `POST /api/v1/auth/admin/login` — a cookie distinct from the
|
|
5
|
+
* storefront's `b2b_session` so an admin and a customer can be signed in at the
|
|
6
|
+
* same time in one browser; this client polls
|
|
7
|
+
* `GET /api/v1/admin/me` on mount to learn whether a session exists and to
|
|
8
|
+
* fetch the current admin's role + permissions for permission-aware UI gates.
|
|
9
|
+
*
|
|
10
|
+
* ## Published by the kit since feature 091's P3
|
|
11
|
+
*
|
|
12
|
+
* `useAuth` is what a screen calls to gate a control the signed-in operator may
|
|
13
|
+
* not use, so a module package that could not name it rendered every control
|
|
14
|
+
* live to a read-only operator, who filled the form in and got a 403 on save.
|
|
15
|
+
* It stayed in `admin/src` through Phase 1b for a reason that was a measurement
|
|
16
|
+
* rather than a design question — 23 admin test files replaced this module at
|
|
17
|
+
* its `@/lib/auth` path, and `vi.mock` keys on a module id, so moving it here
|
|
18
|
+
* put the `useSurfaceVisibility` → `useAuth` seam inside the package where
|
|
19
|
+
* those mocks cannot reach it. P3 is the merge request that pays that.
|
|
20
|
+
*
|
|
21
|
+
* ## `apiClient` comes from `./api-client.js`, not from the `./lib` barrel
|
|
22
|
+
*
|
|
23
|
+
* The three components P2 published take it from `../../lib/index.js`, because
|
|
24
|
+
* a test outside the package substitutes their collaborator and `vi.mock` can
|
|
25
|
+
* only name a subpath the `exports` map declares. That reasoning does not reach
|
|
26
|
+
* this file, twice over. The collaborator a session test needs to substitute is
|
|
27
|
+
* the **payload**, not the transport, and `initial` below is the prop for it —
|
|
28
|
+
* the shape `ModulePresenceProvider` has published since feature 073. And this
|
|
29
|
+
* file is itself a member of that barrel, so naming it would be a cycle — and P3
|
|
30
|
+
* measured how that cycle resolves: a member importing `./index.js` under a
|
|
31
|
+
* `vi.mock` factory that calls `importActual` gets the **real** module back, so
|
|
32
|
+
* the stub is bypassed silently and the request goes out to whatever is
|
|
33
|
+
* listening on the API origin. A seam that fails that way is worse than none.
|
|
34
|
+
*/
|
|
35
|
+
export interface AdminMe {
|
|
36
|
+
adminUser: {
|
|
37
|
+
id: string;
|
|
38
|
+
email: string;
|
|
39
|
+
firstName: string;
|
|
40
|
+
lastName: string;
|
|
41
|
+
adminRoleId: string | null;
|
|
42
|
+
twoFactorEnabled: boolean;
|
|
43
|
+
status: 'active' | 'inactive';
|
|
44
|
+
/** Feature 019 — Admin UI preferred language; null = no preference saved (default to English). */
|
|
45
|
+
preferredLanguage: 'en' | 'pl' | null;
|
|
46
|
+
};
|
|
47
|
+
role: {
|
|
48
|
+
id: string;
|
|
49
|
+
code: string;
|
|
50
|
+
name: string;
|
|
51
|
+
permissions: string[];
|
|
52
|
+
} | null;
|
|
53
|
+
permissions: string[];
|
|
54
|
+
}
|
|
55
|
+
interface AuthState {
|
|
56
|
+
status: 'loading' | 'authenticated' | 'unauthenticated';
|
|
57
|
+
me: AdminMe | null;
|
|
58
|
+
/** Last error from a login attempt, surfaced by LoginPage. */
|
|
59
|
+
lastLoginError: string | null;
|
|
60
|
+
/** Feature 042 — set when login returned `mfaRequired`; LoginPage then
|
|
61
|
+
* renders the second-step code screen. */
|
|
62
|
+
mfaChallengeId: string | null;
|
|
63
|
+
}
|
|
64
|
+
interface AuthContextValue extends AuthState {
|
|
65
|
+
login(email: string, password: string): Promise<void>;
|
|
66
|
+
/** Feature 042 — complete the second step with a TOTP/recovery code. */
|
|
67
|
+
verifyMfa(code: string): Promise<void>;
|
|
68
|
+
/** Feature 042 — abandon the second step and return to the password form. */
|
|
69
|
+
cancelMfa(): void;
|
|
70
|
+
logout(): Promise<void>;
|
|
71
|
+
hasPermission(code: string): boolean;
|
|
72
|
+
refresh(): Promise<void>;
|
|
73
|
+
}
|
|
74
|
+
export interface AuthProviderProps {
|
|
75
|
+
/**
|
|
76
|
+
* A session already in hand, which makes the provider start `authenticated`
|
|
77
|
+
* and skip the boot fetch.
|
|
78
|
+
*
|
|
79
|
+
* The same prop `ModulePresenceProvider` has carried since feature 073, and
|
|
80
|
+
* for the same two callers: a host that has the projection already, and a
|
|
81
|
+
* test that wants the **real** provider — the real `hasPermission`, the real
|
|
82
|
+
* context, the real `useSurfaceVisibility` reading it — over a session it
|
|
83
|
+
* chose. Replacing the module instead is what P3 exists to stop; a permission
|
|
84
|
+
* gate asserted against a stub of the predicate asserts nothing.
|
|
85
|
+
*/
|
|
86
|
+
readonly initial?: AdminMe;
|
|
87
|
+
readonly children: ReactNode;
|
|
88
|
+
}
|
|
89
|
+
export declare function AuthProvider({ initial, children }: AuthProviderProps): ReactNode;
|
|
90
|
+
export declare function useAuth(): AuthContextValue;
|
|
91
|
+
export {};
|
|
92
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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AC;IAClB,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACxB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACrC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAID,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAC9B;AAED,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,iBAAiB,GAAG,SAAS,CAqJhF;AAED,wBAAgB,OAAO,IAAI,gBAAgB,CAI1C"}
|
package/dist/lib/auth.js
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from 'react';
|
|
3
|
+
import { ApiError, apiClient, onUnauthorized } from './api-client.js';
|
|
4
|
+
const AuthContext = createContext(null);
|
|
5
|
+
export function AuthProvider({ initial, children }) {
|
|
6
|
+
const [state, setState] = useState(initial === undefined
|
|
7
|
+
? {
|
|
8
|
+
status: 'loading',
|
|
9
|
+
me: null,
|
|
10
|
+
lastLoginError: null,
|
|
11
|
+
mfaChallengeId: null,
|
|
12
|
+
}
|
|
13
|
+
: {
|
|
14
|
+
status: 'authenticated',
|
|
15
|
+
me: initial,
|
|
16
|
+
lastLoginError: null,
|
|
17
|
+
mfaChallengeId: null,
|
|
18
|
+
});
|
|
19
|
+
// Feature 042 — holds the pending challenge id across renders so `verifyMfa`
|
|
20
|
+
// never reads a stale closure.
|
|
21
|
+
const challengeRef = useRef(null);
|
|
22
|
+
const refresh = useCallback(async () => {
|
|
23
|
+
try {
|
|
24
|
+
const res = await apiClient.get('/api/v1/admin/me');
|
|
25
|
+
setState({ status: 'authenticated', me: res.data, lastLoginError: null, mfaChallengeId: null });
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
if (err instanceof ApiError && err.status === 401) {
|
|
29
|
+
setState({ status: 'unauthenticated', me: null, lastLoginError: null, mfaChallengeId: null });
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
// Other errors — treat as unauthenticated so the user sees the login
|
|
33
|
+
// page and can retry; the stack trace is left in the console for ops.
|
|
34
|
+
// (The `eslint-disable-next-line no-console` this line carried in
|
|
35
|
+
// `admin/src` is redundant here: the kit's config allows `console.error`.)
|
|
36
|
+
console.error('Failed to load /admin/me', err);
|
|
37
|
+
setState({ status: 'unauthenticated', me: null, lastLoginError: null, mfaChallengeId: null });
|
|
38
|
+
}
|
|
39
|
+
}, []);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
// A seeded provider has its session already; refetching would overwrite it
|
|
42
|
+
// with whatever the transport answers, which for a test is nothing at all.
|
|
43
|
+
// `refresh()` stays available, so a caller that seeds can still re-read.
|
|
44
|
+
if (initial !== undefined)
|
|
45
|
+
return;
|
|
46
|
+
void refresh();
|
|
47
|
+
// `initial` is a boot-time prop; re-running on its identity would refetch
|
|
48
|
+
// on every parent render.
|
|
49
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
50
|
+
}, [refresh]);
|
|
51
|
+
useEffect(() => onUnauthorized(() => {
|
|
52
|
+
setState((prev) => prev.status === 'authenticated'
|
|
53
|
+
? {
|
|
54
|
+
status: 'unauthenticated',
|
|
55
|
+
me: null,
|
|
56
|
+
lastLoginError: 'Your session expired. Please sign in again.',
|
|
57
|
+
mfaChallengeId: null,
|
|
58
|
+
}
|
|
59
|
+
: prev);
|
|
60
|
+
}), []);
|
|
61
|
+
const login = useCallback(async (email, password) => {
|
|
62
|
+
try {
|
|
63
|
+
const res = await apiClient.post('/api/v1/auth/admin/login', { email, password });
|
|
64
|
+
const data = res.data;
|
|
65
|
+
if (data.status === 'mfaRequired') {
|
|
66
|
+
challengeRef.current = data.challengeId ?? null;
|
|
67
|
+
setState((prev) => ({ ...prev, lastLoginError: null, mfaChallengeId: data.challengeId ?? null }));
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (data.status === 'mfaSetupRequired') {
|
|
71
|
+
setState((prev) => ({
|
|
72
|
+
...prev,
|
|
73
|
+
lastLoginError: 'Two-factor authentication is required for your account. Please contact a platform administrator to finish setup.',
|
|
74
|
+
}));
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
await refresh();
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
const message = err instanceof ApiError ? err.envelope.error.message : 'Sign-in failed.';
|
|
81
|
+
setState((prev) => ({ ...prev, lastLoginError: message }));
|
|
82
|
+
}
|
|
83
|
+
}, [refresh]);
|
|
84
|
+
const verifyMfa = useCallback(async (code) => {
|
|
85
|
+
const challengeId = challengeRef.current;
|
|
86
|
+
if (!challengeId)
|
|
87
|
+
return;
|
|
88
|
+
try {
|
|
89
|
+
await apiClient.post('/api/v1/auth/admin/mfa/verify', { challengeId, code });
|
|
90
|
+
challengeRef.current = null;
|
|
91
|
+
setState((prev) => ({ ...prev, mfaChallengeId: null, lastLoginError: null }));
|
|
92
|
+
await refresh();
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
const message = err instanceof ApiError ? err.envelope.error.message : 'Verification failed.';
|
|
96
|
+
setState((prev) => ({ ...prev, lastLoginError: message }));
|
|
97
|
+
}
|
|
98
|
+
}, [refresh]);
|
|
99
|
+
const cancelMfa = useCallback(() => {
|
|
100
|
+
challengeRef.current = null;
|
|
101
|
+
setState((prev) => ({ ...prev, mfaChallengeId: null, lastLoginError: null }));
|
|
102
|
+
}, []);
|
|
103
|
+
const logout = useCallback(async () => {
|
|
104
|
+
try {
|
|
105
|
+
await apiClient.post('/api/v1/auth/admin/logout');
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
// Ignore logout errors — we still drop local state so the user
|
|
109
|
+
// returns to the login page.
|
|
110
|
+
}
|
|
111
|
+
setState({ status: 'unauthenticated', me: null, lastLoginError: null, mfaChallengeId: null });
|
|
112
|
+
}, []);
|
|
113
|
+
const value = useMemo(() => ({
|
|
114
|
+
...state,
|
|
115
|
+
login,
|
|
116
|
+
verifyMfa,
|
|
117
|
+
cancelMfa,
|
|
118
|
+
logout,
|
|
119
|
+
refresh,
|
|
120
|
+
hasPermission: (code) => {
|
|
121
|
+
const perms = state.me?.permissions ?? [];
|
|
122
|
+
return perms.includes('*') || perms.includes(code);
|
|
123
|
+
},
|
|
124
|
+
}), [state, login, verifyMfa, cancelMfa, logout, refresh]);
|
|
125
|
+
return _jsx(AuthContext.Provider, { value: value, children: children });
|
|
126
|
+
}
|
|
127
|
+
export function useAuth() {
|
|
128
|
+
const ctx = useContext(AuthContext);
|
|
129
|
+
if (!ctx)
|
|
130
|
+
throw new Error('useAuth must be used inside <AuthProvider>');
|
|
131
|
+
return ctx;
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/lib/auth.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,MAAM,EACN,QAAQ,GAET,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AA8EtE,MAAM,WAAW,GAAG,aAAa,CAA0B,IAAI,CAAC,CAAC;AAkBjE,MAAM,UAAU,YAAY,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAqB;IACnE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAChC,OAAO,KAAK,SAAS;QACnB,CAAC,CAAC;YACE,MAAM,EAAE,SAAS;YACjB,EAAE,EAAE,IAAI;YACR,cAAc,EAAE,IAAI;YACpB,cAAc,EAAE,IAAI;SACrB;QACH,CA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AG,UAAU,CAAC,WAAW,CAAC,CAAC;IACpC,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IACxE,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/lib/format.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAKrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/lib/format.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,cAAc,CAAC,GAA8B;IAC3D,IAAI,CAAC,GAAG;QAAE,OAAO,GAAG,CAAC;IACrB,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC;IACxB,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QAAE,OAAO,GAAG,CAAC;IAC1C,OAAO,CAAC,CAAC,cAAc,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@endora-commerce/admin-kit/lib` — The helpers an admin screen calls — the API client, the auth and module-presence
|
|
3
|
+
* contexts, the permission predicate, the page-size preference, formatting and the one
|
|
4
|
+
* `slugify`/fold owner.
|
|
5
|
+
*
|
|
6
|
+
* That sentence was written by Phase 1b and was **not true until P3**: the session cluster
|
|
7
|
+
* stayed in `admin/src` and this barrel published none of it, which is a header describing a
|
|
8
|
+
* package by what it was meant to hold. It holds it now.
|
|
9
|
+
*
|
|
10
|
+
* The membership is **derived, never designed**
|
|
11
|
+
* (`specs/091-module-owned-admin-surfaces/contracts/admin-kit-surface.md` §1): every
|
|
12
|
+
* `from '…'` specifier in the admin's module directories that resolves inside the admin
|
|
13
|
+
* source root and outside the importing file's own module directory, plus the transitive
|
|
14
|
+
* closure of those files, which is what has to live in one place for there to be one copy.
|
|
15
|
+
*
|
|
16
|
+
* The barrel is **explicit and holds no `export *`** (R2): a short published set reports
|
|
17
|
+
* more findings than a complete one, and its obvious repair is to widen the barrel
|
|
18
|
+
* silently. `check:admin-surface` refuses one and exits 2.
|
|
19
|
+
*
|
|
20
|
+
* Every binding here is the **only** copy in the process. `admin/src` keeps a re-export
|
|
21
|
+
* shim at each old path, so a `@/…` specifier and this subpath name one module record —
|
|
22
|
+
* proved by reference equality in `admin/test/kit/admin-kit-shims.test.ts`, not by a
|
|
23
|
+
* structural comparison, which a second React context would pass.
|
|
24
|
+
*/
|
|
25
|
+
export { resolveIcon } from './admin-actions/icon-map.js';
|
|
26
|
+
export { ApiError, apiBaseUrl, apiClient, onUnauthorized } from './api-client.js';
|
|
27
|
+
export { toAbsoluteAssetUrl } from './asset-url.js';
|
|
28
|
+
export { AuthProvider, useAuth } from './auth.js';
|
|
29
|
+
export type { AdminMe, AuthProviderProps } from './auth.js';
|
|
30
|
+
export { formatDateTime } from './format.js';
|
|
31
|
+
export { formatMoney, localeForCurrency } from './money.js';
|
|
32
|
+
export { invoiceEmailNotSentReason, issueInvoiceNotice, sendInvoiceEmailMessage } from './invoice-email-outcome.js';
|
|
33
|
+
export type { Translate } from './invoice-email-outcome.js';
|
|
34
|
+
export { getModulePresence, ModulePresenceProvider, setModuleActivation, useModulePresence } from './module-presence/index.js';
|
|
35
|
+
export type { ModulePresenceContextValue, ModulePresenceProviderProps } from './module-presence/index.js';
|
|
36
|
+
export { PAGE_SIZE_OPTIONS } from './page-size-options.js';
|
|
37
|
+
export type { PageSizeOption } from './page-size-options.js';
|
|
38
|
+
export { readableTextColor, statusBadgeStyle } from './status-color.js';
|
|
39
|
+
export { isSurfaceVisible, satisfiesPermission, useSurfaceVisibility } from './surface-visibility.js';
|
|
40
|
+
export type { GatedSurface, PermissionRequirement } from './surface-visibility.js';
|
|
41
|
+
export { normalize } from './text-normalization.js';
|
|
42
|
+
export { usePageSizePreference } from './use-page-size-preference.js';
|
|
43
|
+
export { useUnsavedChangesPrompt } from './use-unsaved-changes-prompt.js';
|
|
44
|
+
export { cn } from './utils.js';
|
|
45
|
+
export { randomUUID } from './uuid.js';
|
|
46
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAClD,YAAY,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACpH,YAAY,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/H,YAAY,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACtG,YAAY,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@endora-commerce/admin-kit/lib` — The helpers an admin screen calls — the API client, the auth and module-presence
|
|
3
|
+
* contexts, the permission predicate, the page-size preference, formatting and the one
|
|
4
|
+
* `slugify`/fold owner.
|
|
5
|
+
*
|
|
6
|
+
* That sentence was written by Phase 1b and was **not true until P3**: the session cluster
|
|
7
|
+
* stayed in `admin/src` and this barrel published none of it, which is a header describing a
|
|
8
|
+
* package by what it was meant to hold. It holds it now.
|
|
9
|
+
*
|
|
10
|
+
* The membership is **derived, never designed**
|
|
11
|
+
* (`specs/091-module-owned-admin-surfaces/contracts/admin-kit-surface.md` §1): every
|
|
12
|
+
* `from '…'` specifier in the admin's module directories that resolves inside the admin
|
|
13
|
+
* source root and outside the importing file's own module directory, plus the transitive
|
|
14
|
+
* closure of those files, which is what has to live in one place for there to be one copy.
|
|
15
|
+
*
|
|
16
|
+
* The barrel is **explicit and holds no `export *`** (R2): a short published set reports
|
|
17
|
+
* more findings than a complete one, and its obvious repair is to widen the barrel
|
|
18
|
+
* silently. `check:admin-surface` refuses one and exits 2.
|
|
19
|
+
*
|
|
20
|
+
* Every binding here is the **only** copy in the process. `admin/src` keeps a re-export
|
|
21
|
+
* shim at each old path, so a `@/…` specifier and this subpath name one module record —
|
|
22
|
+
* proved by reference equality in `admin/test/kit/admin-kit-shims.test.ts`, not by a
|
|
23
|
+
* structural comparison, which a second React context would pass.
|
|
24
|
+
*/
|
|
25
|
+
export { resolveIcon } from './admin-actions/icon-map.js';
|
|
26
|
+
export { ApiError, apiBaseUrl, apiClient, onUnauthorized } from './api-client.js';
|
|
27
|
+
export { toAbsoluteAssetUrl } from './asset-url.js';
|
|
28
|
+
export { AuthProvider, useAuth } from './auth.js';
|
|
29
|
+
export { formatDateTime } from './format.js';
|
|
30
|
+
export { formatMoney, localeForCurrency } from './money.js';
|
|
31
|
+
export { invoiceEmailNotSentReason, issueInvoiceNotice, sendInvoiceEmailMessage } from './invoice-email-outcome.js';
|
|
32
|
+
export { getModulePresence, ModulePresenceProvider, setModuleActivation, useModulePresence } from './module-presence/index.js';
|
|
33
|
+
export { PAGE_SIZE_OPTIONS } from './page-size-options.js';
|
|
34
|
+
export { readableTextColor, statusBadgeStyle } from './status-color.js';
|
|
35
|
+
export { isSurfaceVisible, satisfiesPermission, useSurfaceVisibility } from './surface-visibility.js';
|
|
36
|
+
export { normalize } from './text-normalization.js';
|
|
37
|
+
export { usePageSizePreference } from './use-page-size-preference.js';
|
|
38
|
+
export { useUnsavedChangesPrompt } from './use-unsaved-changes-prompt.js';
|
|
39
|
+
export { cn } from './utils.js';
|
|
40
|
+
export { randomUUID } from './uuid.js';
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAEpH,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/H,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEtG,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { InvoiceEmailNotSentReason, IssueInvoiceEmailOutcome, SendInvoiceEmailResult } from '@endora-commerce/contracts';
|
|
2
|
+
/**
|
|
3
|
+
* The words an operator reads about an invoice e-mail, for the three surfaces
|
|
4
|
+
* that can trigger one — issuing an invoice from the order, and re-sending one
|
|
5
|
+
* from the invoice list or detail — so the answer reads the same wherever it
|
|
6
|
+
* reaches them.
|
|
7
|
+
*
|
|
8
|
+
* **Published by feature 091, P8.** The file sat under `invoices`' admin
|
|
9
|
+
* directory and `orders`' order detail imported it, which is the one
|
|
10
|
+
* `cross-module-imports/orders.ts` key. Nothing here is `invoices`' code: the
|
|
11
|
+
* three outcome shapes are `@endora-commerce/contracts`', and the sentences are
|
|
12
|
+
* `core`'s.
|
|
13
|
+
*
|
|
14
|
+
* **That last part was already true when P8 opened, and is why this needed no
|
|
15
|
+
* key move.** `plan.md`'s P8 row rules that the three key families move to
|
|
16
|
+
* `core` because *"what crosses the seam is `invoices`' i18n namespace"*.
|
|
17
|
+
* Measured from the component rather than from the prefix (R-1 §9.2, the
|
|
18
|
+
* discipline P5a set): the file reads twelve keys — seven
|
|
19
|
+
* `invoices.emailNotSent.*`, `invoices.emailSent`, `invoices.emailNotSentNotice`
|
|
20
|
+
* and three `orderDetail.issueInvoice.*` — and all twelve are already in
|
|
21
|
+
* `core`'s bundle in both shipped languages, in neither `invoices`' nor
|
|
22
|
+
* `orders`'. All three call sites already hold a `useTranslation('core')`. The
|
|
23
|
+
* `invoices.` and `orderDetail.` prefixes are key names inside `core`, not
|
|
24
|
+
* namespaces, exactly as `pageBuilder.*` is after P5a.
|
|
25
|
+
*/
|
|
26
|
+
/** The scope-bound translator `useTranslation` hands out. */
|
|
27
|
+
export type Translate = (key: string, params?: Record<string, string | number>) => string;
|
|
28
|
+
/**
|
|
29
|
+
* The sentence for one of the seven reasons an invoice e-mail did not go out
|
|
30
|
+
* (issue #103 named them, issue #149 put them on the wire).
|
|
31
|
+
*/
|
|
32
|
+
export declare function invoiceEmailNotSentReason(reason: InvoiceEmailNotSentReason, t: Translate): string;
|
|
33
|
+
/**
|
|
34
|
+
* What to tell the operator who asked for a re-send, and whether it is good
|
|
35
|
+
* news. Both invoice surfaces reported `invoices.emailSent` unconditionally,
|
|
36
|
+
* over a response body that could already say the message had been suppressed.
|
|
37
|
+
*/
|
|
38
|
+
export declare function sendInvoiceEmailMessage(result: SendInvoiceEmailResult, t: Translate): {
|
|
39
|
+
ok: boolean;
|
|
40
|
+
message: string;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* What to tell the operator after "issue invoice", given what became of the
|
|
44
|
+
* notification.
|
|
45
|
+
*
|
|
46
|
+
* All three answers are distinct, and the middle one matters most: send-on-issue
|
|
47
|
+
* being switched off is a configured choice, so it reads as a plain "issued"
|
|
48
|
+
* rather than as a message that failed. A missing `email` field — an older
|
|
49
|
+
* server, or a response shape a caller did not read — falls back to the same
|
|
50
|
+
* plain confirmation, which is what the screen said before it could do better.
|
|
51
|
+
*/
|
|
52
|
+
export declare function issueInvoiceNotice(outcome: IssueInvoiceEmailOutcome | undefined, t: Translate): string;
|
|
53
|
+
//# sourceMappingURL=invoice-email-outcome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoice-email-outcome.d.ts","sourceRoot":"","sources":["../../src/lib/invoice-email-outcome.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACvB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,6DAA6D;AAC7D,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,MAAM,CAAC;AAE1F;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,yBAAyB,EAAE,CAAC,EAAE,SAAS,GAAG,MAAM,CAEjG;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,sBAAsB,EAC9B,CAAC,EAAE,SAAS,GACX;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAQlC;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,wBAAwB,GAAG,SAAS,EAC7C,CAAC,EAAE,SAAS,GACX,MAAM,CAQR"}
|