shutro-erp 0.3.3 → 0.3.5
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/dist/account_portal/.kosh/bindings.js +1 -1
- package/dist/account_portal/.kosh/schema.d.ts +181 -3
- package/dist/account_portal/module.d.ts +359 -6
- package/dist/accounting/.kosh/bindings.js +1 -1
- package/dist/accounting/.kosh/schema.d.ts +181 -3
- package/dist/accounting/index.js +214 -2
- package/dist/accounting/module.d.ts +217 -5
- package/dist/accounting/module.js +23 -2
- package/dist/calendar/.kosh/bindings.d.ts +22 -0
- package/dist/calendar/.kosh/bindings.js +15 -0
- package/dist/calendar/.kosh/schema.d.ts +795 -0
- package/dist/calendar/demo.d.ts +6 -0
- package/dist/calendar/demo.js +24 -0
- package/dist/calendar/index.d.ts +3 -0
- package/dist/calendar/index.js +291 -0
- package/dist/calendar/module.d.ts +1705 -0
- package/dist/calendar/module.js +180 -0
- package/dist/cli/init.js +48 -0
- package/dist/cli/templates.d.ts +1 -1
- package/dist/cli/templates.js +137 -0
- package/dist/contacts/.kosh/bindings.js +1 -1
- package/dist/contacts/.kosh/schema.d.ts +205 -3
- package/dist/contacts/demo.js +30 -1
- package/dist/contacts/index.d.ts +1 -1
- package/dist/contacts/index.js +155 -9
- package/dist/contacts/module.d.ts +338 -2
- package/dist/contacts/module.js +82 -5
- package/dist/crm/.kosh/bindings.d.ts +22 -0
- package/dist/crm/.kosh/bindings.js +15 -0
- package/dist/crm/.kosh/schema.d.ts +799 -0
- package/dist/crm/demo.d.ts +6 -0
- package/dist/crm/demo.js +45 -0
- package/dist/crm/index.d.ts +3 -0
- package/dist/crm/index.js +361 -0
- package/dist/crm/module.d.ts +1843 -0
- package/dist/crm/module.js +207 -0
- package/dist/event/.kosh/bindings.d.ts +22 -0
- package/dist/event/.kosh/bindings.js +15 -0
- package/dist/event/.kosh/schema.d.ts +843 -0
- package/dist/event/demo.d.ts +6 -0
- package/dist/event/demo.js +65 -0
- package/dist/event/index.d.ts +14 -0
- package/dist/event/index.js +333 -0
- package/dist/event/mails.d.ts +15 -0
- package/dist/event/mails.js +112 -0
- package/dist/event/module.d.ts +2800 -0
- package/dist/event/module.js +323 -0
- package/dist/event/web/CheckInBox.d.ts +9 -0
- package/dist/event/web/CheckInBox.js +87 -0
- package/dist/event/web/index.d.ts +11 -0
- package/dist/event/web/index.js +16 -0
- package/dist/event/web/messages.d.ts +2 -0
- package/dist/event/web/messages.js +23 -0
- package/dist/event_account/.kosh/bindings.d.ts +22 -0
- package/dist/event_account/.kosh/bindings.js +15 -0
- package/dist/event_account/.kosh/schema.d.ts +1639 -0
- package/dist/event_account/index.d.ts +3 -0
- package/dist/event_account/index.js +28 -0
- package/dist/event_account/module.d.ts +6968 -0
- package/dist/event_account/module.js +90 -0
- package/dist/hr/.kosh/bindings.d.ts +22 -0
- package/dist/hr/.kosh/bindings.js +15 -0
- package/dist/hr/.kosh/schema.d.ts +878 -0
- package/dist/hr/demo.d.ts +6 -0
- package/dist/hr/demo.js +60 -0
- package/dist/hr/index.d.ts +3 -0
- package/dist/hr/index.js +483 -0
- package/dist/hr/module.d.ts +2611 -0
- package/dist/hr/module.js +350 -0
- package/dist/integrations/index.js +12 -0
- package/dist/integrations/web/OAuthAppsPage.d.ts +9 -0
- package/dist/integrations/web/OAuthAppsPage.js +79 -0
- package/dist/integrations/web/index.d.ts +1 -0
- package/dist/integrations/web/index.js +3 -0
- package/dist/integrations/web/messages.js +58 -0
- package/dist/l10n_bd/.kosh/bindings.js +1 -1
- package/dist/l10n_bd/.kosh/schema.d.ts +181 -3
- package/dist/l10n_bd/module.d.ts +359 -6
- package/dist/l10n_in/.kosh/bindings.js +1 -1
- package/dist/l10n_in/.kosh/schema.d.ts +181 -3
- package/dist/l10n_in/module.d.ts +380 -7
- package/dist/maintenance/.kosh/bindings.d.ts +22 -0
- package/dist/maintenance/.kosh/bindings.js +15 -0
- package/dist/maintenance/.kosh/schema.d.ts +911 -0
- package/dist/maintenance/demo.d.ts +6 -0
- package/dist/maintenance/demo.js +60 -0
- package/dist/maintenance/index.d.ts +3 -0
- package/dist/maintenance/index.js +422 -0
- package/dist/maintenance/module.d.ts +3545 -0
- package/dist/maintenance/module.js +446 -0
- package/dist/maintenance_stock/.kosh/bindings.d.ts +22 -0
- package/dist/maintenance_stock/.kosh/bindings.js +15 -0
- package/dist/maintenance_stock/.kosh/schema.d.ts +1371 -0
- package/dist/maintenance_stock/index.d.ts +9 -0
- package/dist/maintenance_stock/index.js +52 -0
- package/dist/maintenance_stock/module.d.ts +6953 -0
- package/dist/maintenance_stock/module.js +192 -0
- package/dist/messaging/web/index.js +1 -1
- package/dist/modules-sdk/index.d.ts +1 -1
- package/dist/modules-sdk/manifest.d.ts +70 -0
- package/dist/modules-sdk/manifest.js +35 -1
- package/dist/mrp/.kosh/bindings.d.ts +22 -0
- package/dist/mrp/.kosh/bindings.js +15 -0
- package/dist/mrp/.kosh/schema.d.ts +1378 -0
- package/dist/mrp/demo.d.ts +7 -0
- package/dist/mrp/demo.js +42 -0
- package/dist/mrp/index.d.ts +3 -0
- package/dist/mrp/index.js +392 -0
- package/dist/mrp/module.d.ts +8608 -0
- package/dist/mrp/module.js +695 -0
- package/dist/mrp_account/.kosh/bindings.d.ts +22 -0
- package/dist/mrp_account/.kosh/bindings.js +15 -0
- package/dist/mrp_account/.kosh/schema.d.ts +2106 -0
- package/dist/mrp_account/index.d.ts +3 -0
- package/dist/mrp_account/index.js +22 -0
- package/dist/mrp_account/module.d.ts +20840 -0
- package/dist/mrp_account/module.js +123 -0
- package/dist/notify/web/index.js +1 -1
- package/dist/payment/.kosh/bindings.js +1 -1
- package/dist/payment/.kosh/schema.d.ts +181 -3
- package/dist/payment/module.d.ts +359 -6
- package/dist/portal/.kosh/bindings.js +1 -1
- package/dist/portal/.kosh/schema.d.ts +205 -3
- package/dist/portal/module.d.ts +166 -2
- package/dist/pos/.kosh/bindings.d.ts +22 -0
- package/dist/pos/.kosh/bindings.js +15 -0
- package/dist/pos/.kosh/schema.d.ts +1690 -0
- package/dist/pos/accounting.d.ts +10 -0
- package/dist/pos/accounting.js +149 -0
- package/dist/pos/demo.d.ts +6 -0
- package/dist/pos/demo.js +90 -0
- package/dist/pos/index.d.ts +9 -0
- package/dist/pos/index.js +349 -0
- package/dist/pos/module.d.ts +9636 -0
- package/dist/pos/module.js +423 -0
- package/dist/pos/routes.d.ts +39 -0
- package/dist/pos/routes.js +368 -0
- package/dist/pos/web/Register.d.ts +9 -0
- package/dist/pos/web/Register.js +252 -0
- package/dist/pos/web/index.d.ts +11 -0
- package/dist/pos/web/index.js +16 -0
- package/dist/pos/web/messages.d.ts +2 -0
- package/dist/pos/web/messages.js +87 -0
- package/dist/pos_stock/.kosh/bindings.d.ts +22 -0
- package/dist/pos_stock/.kosh/bindings.js +15 -0
- package/dist/pos_stock/.kosh/schema.d.ts +2015 -0
- package/dist/pos_stock/index.d.ts +9 -0
- package/dist/pos_stock/index.js +35 -0
- package/dist/pos_stock/module.d.ts +11935 -0
- package/dist/pos_stock/module.js +115 -0
- package/dist/product/.kosh/bindings.js +1 -1
- package/dist/product/.kosh/schema.d.ts +178 -1
- package/dist/product/index.js +81 -4
- package/dist/product/module.d.ts +43 -1
- package/dist/product/module.js +9 -2
- package/dist/project/.kosh/bindings.js +1 -1
- package/dist/project/.kosh/schema.d.ts +181 -3
- package/dist/project/index.js +147 -7
- package/dist/project/module.d.ts +210 -2
- package/dist/project/module.js +52 -5
- package/dist/project_portal/.kosh/bindings.js +1 -1
- package/dist/project_portal/.kosh/schema.d.ts +181 -3
- package/dist/project_portal/module.d.ts +353 -4
- package/dist/purchase/.kosh/bindings.js +1 -1
- package/dist/purchase/.kosh/schema.d.ts +181 -3
- package/dist/purchase/index.js +163 -3
- package/dist/purchase/module.d.ts +215 -3
- package/dist/purchase/module.js +21 -3
- package/dist/purchase_account/.kosh/bindings.js +1 -1
- package/dist/purchase_account/.kosh/schema.d.ts +182 -3
- package/dist/purchase_account/index.js +26 -1
- package/dist/purchase_account/module.d.ts +393 -7
- package/dist/purchase_portal/.kosh/bindings.js +1 -1
- package/dist/purchase_portal/.kosh/schema.d.ts +181 -3
- package/dist/purchase_portal/module.d.ts +366 -5
- package/dist/purchase_stock/.kosh/bindings.d.ts +22 -0
- package/dist/purchase_stock/.kosh/bindings.js +15 -0
- package/dist/purchase_stock/.kosh/schema.d.ts +1310 -0
- package/dist/purchase_stock/index.d.ts +7 -0
- package/dist/purchase_stock/index.js +91 -0
- package/dist/purchase_stock/module.d.ts +6763 -0
- package/dist/purchase_stock/module.js +144 -0
- package/dist/purchase_stock_account/.kosh/bindings.d.ts +22 -0
- package/dist/purchase_stock_account/.kosh/bindings.js +15 -0
- package/dist/purchase_stock_account/.kosh/schema.d.ts +1959 -0
- package/dist/purchase_stock_account/index.d.ts +3 -0
- package/dist/purchase_stock_account/index.js +24 -0
- package/dist/purchase_stock_account/module.d.ts +35366 -0
- package/dist/purchase_stock_account/module.js +162 -0
- package/dist/recruitment/.kosh/bindings.d.ts +22 -0
- package/dist/recruitment/.kosh/bindings.js +15 -0
- package/dist/recruitment/.kosh/schema.d.ts +990 -0
- package/dist/recruitment/demo.d.ts +6 -0
- package/dist/recruitment/demo.js +45 -0
- package/dist/recruitment/index.d.ts +3 -0
- package/dist/recruitment/index.js +385 -0
- package/dist/recruitment/module.d.ts +3247 -0
- package/dist/recruitment/module.js +193 -0
- package/dist/recruitment/web/HireButton.d.ts +9 -0
- package/dist/recruitment/web/HireButton.js +32 -0
- package/dist/recruitment/web/index.d.ts +11 -0
- package/dist/recruitment/web/index.js +16 -0
- package/dist/recruitment/web/messages.d.ts +2 -0
- package/dist/recruitment/web/messages.js +19 -0
- package/dist/reporting/documents.d.ts +5 -0
- package/dist/reporting/documents.js +28 -1
- package/dist/reporting/index.d.ts +1 -1
- package/dist/reporting/index.js +4 -2
- package/dist/reporting/models.js +9 -0
- package/dist/reporting/overviews.d.ts +16 -0
- package/dist/reporting/overviews.js +56 -0
- package/dist/reporting/routes-documents.js +1 -1
- package/dist/reporting/routes.js +138 -80
- package/dist/reporting/web/DashboardView.d.ts +11 -0
- package/dist/reporting/web/DashboardView.js +2 -2
- package/dist/reporting/web/DesignerView.js +5 -0
- package/dist/reporting/web/Overview.d.ts +9 -0
- package/dist/reporting/web/Overview.js +53 -0
- package/dist/reporting/web/index.d.ts +1 -0
- package/dist/reporting/web/index.js +4 -1
- package/dist/reporting/web/messages.js +9 -0
- package/dist/sale_account/.kosh/bindings.js +1 -1
- package/dist/sale_account/.kosh/schema.d.ts +186 -3
- package/dist/sale_account/index.js +22 -1
- package/dist/sale_account/module.d.ts +461 -7
- package/dist/sale_portal/.kosh/bindings.js +1 -1
- package/dist/sale_portal/.kosh/schema.d.ts +185 -3
- package/dist/sale_portal/module.d.ts +434 -5
- package/dist/sale_project/.kosh/bindings.js +1 -1
- package/dist/sale_project/.kosh/schema.d.ts +187 -3
- package/dist/sale_project/module.d.ts +476 -6
- package/dist/sale_stock/.kosh/bindings.d.ts +22 -0
- package/dist/sale_stock/.kosh/bindings.js +15 -0
- package/dist/sale_stock/.kosh/schema.d.ts +1228 -0
- package/dist/sale_stock/index.d.ts +7 -0
- package/dist/sale_stock/index.js +84 -0
- package/dist/sale_stock/module.d.ts +6791 -0
- package/dist/sale_stock/module.js +146 -0
- package/dist/sales/.kosh/bindings.js +1 -1
- package/dist/sales/.kosh/schema.d.ts +185 -3
- package/dist/sales/index.js +191 -4
- package/dist/sales/module.d.ts +355 -3
- package/dist/sales/module.js +78 -3
- package/dist/server/api/metadata.d.ts +5 -0
- package/dist/server/api/metadata.js +5 -0
- package/dist/server/api/rest.js +64 -1
- package/dist/server/api/views.js +1 -0
- package/dist/server/app-settings.d.ts +7 -0
- package/dist/server/app-settings.js +10 -0
- package/dist/server/auth/base.js +85 -0
- package/dist/server/auth/oauth.d.ts +21 -0
- package/dist/server/auth/oauth.js +579 -0
- package/dist/server/auth/service.d.ts +4 -0
- package/dist/server/auth/service.js +17 -0
- package/dist/server/identity.d.ts +2 -0
- package/dist/server/images.d.ts +12 -0
- package/dist/server/images.js +139 -0
- package/dist/server/index.d.ts +2 -0
- package/dist/server/index.js +2 -0
- package/dist/server/server.d.ts +4 -0
- package/dist/server/server.js +9 -1
- package/dist/settings/app-settings.d.ts +2 -0
- package/dist/settings/app-settings.js +518 -0
- package/dist/settings/company.js +3 -1
- package/dist/settings/index.d.ts +1 -0
- package/dist/settings/index.js +15 -0
- package/dist/settings/people.js +32 -6
- package/dist/settings/web/AppSettingsPage.d.ts +11 -0
- package/dist/settings/web/AppSettingsPage.js +210 -0
- package/dist/settings/web/CompaniesPage.js +2 -2
- package/dist/settings/web/CompanyPage.js +13 -2
- package/dist/settings/web/ConnectedAppsPage.d.ts +7 -0
- package/dist/settings/web/ConnectedAppsPage.js +33 -0
- package/dist/settings/web/OverviewPage.js +28 -4
- package/dist/settings/web/PeoplePage.js +23 -18
- package/dist/settings/web/ProfilePage.js +9 -7
- package/dist/settings/web/index.d.ts +2 -0
- package/dist/settings/web/index.js +8 -0
- package/dist/settings/web/messages.js +146 -2
- package/dist/stock/.kosh/bindings.d.ts +22 -0
- package/dist/stock/.kosh/bindings.js +15 -0
- package/dist/stock/.kosh/schema.d.ts +1147 -0
- package/dist/stock/demo.d.ts +7 -0
- package/dist/stock/demo.js +55 -0
- package/dist/stock/index.d.ts +3 -0
- package/dist/stock/index.js +674 -0
- package/dist/stock/module.d.ts +6330 -0
- package/dist/stock/module.js +1325 -0
- package/dist/stock/web/ScanBox.d.ts +8 -0
- package/dist/stock/web/ScanBox.js +90 -0
- package/dist/stock/web/index.d.ts +11 -0
- package/dist/stock/web/index.js +16 -0
- package/dist/stock/web/messages.d.ts +2 -0
- package/dist/stock/web/messages.js +25 -0
- package/dist/stock_account/.kosh/bindings.d.ts +22 -0
- package/dist/stock_account/.kosh/bindings.js +15 -0
- package/dist/stock_account/.kosh/schema.d.ts +1875 -0
- package/dist/stock_account/index.d.ts +3 -0
- package/dist/stock_account/index.js +130 -0
- package/dist/stock_account/module.d.ts +10655 -0
- package/dist/stock_account/module.js +339 -0
- package/dist/storage/attachments.d.ts +5 -0
- package/dist/storage/attachments.js +12 -1
- package/dist/storage/models.js +3 -0
- package/dist/storage/routes.js +13 -2
- package/dist/todo/.kosh/bindings.d.ts +22 -0
- package/dist/todo/.kosh/bindings.js +15 -0
- package/dist/todo/.kosh/schema.d.ts +732 -0
- package/dist/todo/demo.d.ts +6 -0
- package/dist/todo/demo.js +35 -0
- package/dist/todo/index.d.ts +3 -0
- package/dist/todo/index.js +187 -0
- package/dist/todo/module.d.ts +1180 -0
- package/dist/todo/module.js +130 -0
- package/dist/trade_finance/.kosh/bindings.d.ts +22 -0
- package/dist/trade_finance/.kosh/bindings.js +15 -0
- package/dist/trade_finance/.kosh/schema.d.ts +884 -0
- package/dist/trade_finance/demo.d.ts +6 -0
- package/dist/trade_finance/demo.js +63 -0
- package/dist/trade_finance/index.d.ts +3 -0
- package/dist/trade_finance/index.js +413 -0
- package/dist/trade_finance/module.d.ts +3779 -0
- package/dist/trade_finance/module.js +505 -0
- package/dist/trade_finance_account/.kosh/bindings.d.ts +22 -0
- package/dist/trade_finance_account/.kosh/bindings.js +15 -0
- package/dist/trade_finance_account/.kosh/schema.d.ts +1711 -0
- package/dist/trade_finance_account/index.d.ts +3 -0
- package/dist/trade_finance_account/index.js +92 -0
- package/dist/trade_finance_account/module.d.ts +7928 -0
- package/dist/trade_finance_account/module.js +244 -0
- package/dist/trade_finance_purchase/.kosh/bindings.d.ts +22 -0
- package/dist/trade_finance_purchase/.kosh/bindings.js +15 -0
- package/dist/trade_finance_purchase/.kosh/schema.d.ts +1153 -0
- package/dist/trade_finance_purchase/index.d.ts +8 -0
- package/dist/trade_finance_purchase/index.js +50 -0
- package/dist/trade_finance_purchase/module.d.ts +4252 -0
- package/dist/trade_finance_purchase/module.js +44 -0
- package/dist/trade_finance_sale/.kosh/bindings.d.ts +22 -0
- package/dist/trade_finance_sale/.kosh/bindings.js +15 -0
- package/dist/trade_finance_sale/.kosh/schema.d.ts +1071 -0
- package/dist/trade_finance_sale/index.d.ts +8 -0
- package/dist/trade_finance_sale/index.js +50 -0
- package/dist/trade_finance_sale/module.d.ts +4280 -0
- package/dist/trade_finance_sale/module.js +44 -0
- package/dist/ui/api.d.ts +6 -1
- package/dist/ui/api.js +2 -1
- package/dist/ui/app.js +51 -17
- package/dist/ui/components/AppIcon.js +33 -1
- package/dist/ui/components/Avatar.d.ts +21 -0
- package/dist/ui/components/Avatar.js +71 -0
- package/dist/ui/components/primitives.d.ts +2 -0
- package/dist/ui/components/primitives.js +7 -1
- package/dist/ui/i18n/messages.d.ts +53 -0
- package/dist/ui/i18n/messages.js +98 -0
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.js +2 -0
- package/dist/ui/offline/queue.d.ts +5 -1
- package/dist/ui/offline/queue.js +2 -0
- package/dist/ui/registry.d.ts +12 -1
- package/dist/ui/registry.js +10 -1
- package/dist/ui/search/ViewTabs.d.ts +14 -0
- package/dist/ui/search/ViewTabs.js +42 -0
- package/dist/ui/shell/Consent.d.ts +5 -0
- package/dist/ui/shell/Consent.js +35 -0
- package/dist/ui/shell/Home.js +136 -16
- package/dist/ui/shell/Sidebar.js +15 -22
- package/dist/ui/views/FormView.js +98 -17
- package/dist/ui/views/KanbanView.d.ts +2 -0
- package/dist/ui/views/KanbanView.js +32 -3
- package/dist/ui/views/ListView.js +155 -31
- package/dist/ui/views/StatsRow.d.ts +14 -0
- package/dist/ui/views/StatsRow.js +88 -0
- package/dist/ui/views/widgets.d.ts +2 -1
- package/dist/ui/views/widgets.js +194 -1
- package/dist/views/builders.d.ts +19 -2
- package/dist/views/builders.js +21 -1
- package/dist/views/condition.d.ts +6 -0
- package/dist/views/condition.js +20 -0
- package/dist/views/documents.d.ts +8 -0
- package/dist/views/extend.d.ts +2 -2
- package/dist/views/extend.js +11 -1
- package/dist/views/index.d.ts +2 -2
- package/dist/views/index.js +2 -2
- package/dist/views/types.d.ts +52 -5
- package/dist/views/validate.js +39 -1
- package/dist/website/.kosh/bindings.d.ts +22 -0
- package/dist/website/.kosh/bindings.js +15 -0
- package/dist/website/.kosh/schema.d.ts +881 -0
- package/dist/website/demo.d.ts +6 -0
- package/dist/website/demo.js +115 -0
- package/dist/website/index.d.ts +9 -0
- package/dist/website/index.js +250 -0
- package/dist/website/module.d.ts +2987 -0
- package/dist/website/module.js +281 -0
- package/dist/website/render.d.ts +45 -0
- package/dist/website/render.js +102 -0
- package/dist/website/routes.d.ts +12 -0
- package/dist/website/routes.js +246 -0
- package/dist/website/web/PagePreview.d.ts +7 -0
- package/dist/website/web/PagePreview.js +33 -0
- package/dist/website/web/index.d.ts +11 -0
- package/dist/website/web/index.js +16 -0
- package/dist/website/web/messages.d.ts +2 -0
- package/dist/website/web/messages.js +15 -0
- package/dist/website_crm/.kosh/bindings.d.ts +22 -0
- package/dist/website_crm/.kosh/bindings.js +15 -0
- package/dist/website_crm/.kosh/schema.d.ts +966 -0
- package/dist/website_crm/index.d.ts +3 -0
- package/dist/website_crm/index.js +39 -0
- package/dist/website_crm/module.d.ts +2955 -0
- package/dist/website_crm/module.js +44 -0
- package/package.json +118 -1
package/dist/ui/i18n/messages.js
CHANGED
|
@@ -88,8 +88,12 @@ export const en = {
|
|
|
88
88
|
export: 'Export',
|
|
89
89
|
exportCsv: 'CSV (all columns)',
|
|
90
90
|
exportXlsx: 'Excel',
|
|
91
|
+
exportPdf: 'Print as PDF',
|
|
91
92
|
exportFailed: 'The export failed: {{reason}}',
|
|
92
93
|
columns: 'Columns',
|
|
94
|
+
pinned: 'Pinned at the start',
|
|
95
|
+
resetWidths: 'Reset column widths',
|
|
96
|
+
resize: 'Resize {{column}}',
|
|
93
97
|
density: 'Density',
|
|
94
98
|
statusOf: '{{field}}: {{state}}',
|
|
95
99
|
nextState: 'Next',
|
|
@@ -110,6 +114,7 @@ export const en = {
|
|
|
110
114
|
compact: 'Compact',
|
|
111
115
|
comfortable: 'Comfortable',
|
|
112
116
|
emptyTitle: 'Nothing here yet',
|
|
117
|
+
emptyNamed: 'No {{name}} yet',
|
|
113
118
|
emptyHint: 'Records matching the current search will appear here.',
|
|
114
119
|
emptyFiltered: 'No record matches the current search.',
|
|
115
120
|
moved: '{{name}} moved to {{column}}',
|
|
@@ -163,6 +168,19 @@ export const en = {
|
|
|
163
168
|
none: 'None',
|
|
164
169
|
lines: 'Lines',
|
|
165
170
|
addLine: 'Add a line',
|
|
171
|
+
nextStep: {
|
|
172
|
+
ready: 'Next step: {{step}}.',
|
|
173
|
+
before: 'Before {{step}}:',
|
|
174
|
+
missing_one: '{{count}} thing to fill in',
|
|
175
|
+
missing_other: '{{count}} things to fill in',
|
|
176
|
+
},
|
|
177
|
+
daysLeft: { today: 'Today', in: 'In {{count}} days', late: '{{count}} days late' },
|
|
178
|
+
image: {
|
|
179
|
+
choose: 'Choose a picture',
|
|
180
|
+
remove: 'Remove',
|
|
181
|
+
none: 'No picture',
|
|
182
|
+
saveFirst: 'Save the record first, then add its picture.',
|
|
183
|
+
},
|
|
166
184
|
removeLine: 'Remove line',
|
|
167
185
|
choose: 'Choose…',
|
|
168
186
|
pasted_one: '{{count}} cell pasted',
|
|
@@ -231,8 +249,34 @@ export const en = {
|
|
|
231
249
|
done: 'Mark done',
|
|
232
250
|
recent: 'Recently opened',
|
|
233
251
|
apps: 'Apps',
|
|
252
|
+
today: 'Today, {{date}}',
|
|
253
|
+
approve: 'Approve {{record}}',
|
|
254
|
+
review: 'Review',
|
|
255
|
+
dueToday: 'due today',
|
|
256
|
+
todo: 'Focus to-do',
|
|
257
|
+
meetings: 'Today’s meetings',
|
|
258
|
+
mentioned: '{{actor}} mentioned you on {{record}}',
|
|
259
|
+
saved: 'Your saved views',
|
|
234
260
|
},
|
|
235
261
|
toast: { region: 'Notifications', close: 'Close' },
|
|
262
|
+
image: {
|
|
263
|
+
choosePhoto: 'Change photo',
|
|
264
|
+
chooseLogo: 'Change logo',
|
|
265
|
+
remove: 'Remove',
|
|
266
|
+
hint: 'PNG, JPEG or WebP. It is made small (256 px) before it is sent.',
|
|
267
|
+
unreadable: 'This file is not an image the browser can read.',
|
|
268
|
+
},
|
|
269
|
+
oauth: {
|
|
270
|
+
title: '{{app}} wants to use your account',
|
|
271
|
+
as: 'Signed in as {{name}} ({{login}}).',
|
|
272
|
+
may: 'It will be able to:',
|
|
273
|
+
limits: 'Never more than you may do yourself. You can take this back at any time in Connected apps.',
|
|
274
|
+
back: 'You will go back to {{host}}.',
|
|
275
|
+
homepage: 'About the app',
|
|
276
|
+
already: 'You allowed this before.',
|
|
277
|
+
allow: 'Allow',
|
|
278
|
+
cancel: 'Cancel',
|
|
279
|
+
},
|
|
236
280
|
palette: {
|
|
237
281
|
switchCompany: 'Switch to {{name}}',
|
|
238
282
|
profile: 'Your profile',
|
|
@@ -281,6 +325,11 @@ export const en = {
|
|
|
281
325
|
custom: 'Custom filter',
|
|
282
326
|
remove: 'Remove {{facet}}',
|
|
283
327
|
or: 'or',
|
|
328
|
+
savedViews: 'Saved views',
|
|
329
|
+
allRecords: 'All',
|
|
330
|
+
moreViews_one: '{{count}} more',
|
|
331
|
+
moreViews_other: '{{count}} more',
|
|
332
|
+
shared: 'Shared',
|
|
284
333
|
},
|
|
285
334
|
};
|
|
286
335
|
export const bn = {
|
|
@@ -369,8 +418,12 @@ export const bn = {
|
|
|
369
418
|
export: 'এক্সপোর্ট',
|
|
370
419
|
exportCsv: 'CSV (সব কলাম)',
|
|
371
420
|
exportXlsx: 'এক্সেল',
|
|
421
|
+
exportPdf: 'PDF হিসেবে ছাপুন',
|
|
372
422
|
exportFailed: 'এক্সপোর্ট ব্যর্থ: {{reason}}',
|
|
373
423
|
columns: 'কলাম',
|
|
424
|
+
pinned: 'শুরুতে আটকানো',
|
|
425
|
+
resetWidths: 'কলামের প্রস্থ মুছুন',
|
|
426
|
+
resize: '{{column}} প্রস্থ বদলান',
|
|
374
427
|
density: 'ঘনত্ব',
|
|
375
428
|
statusOf: '{{field}}: {{state}}',
|
|
376
429
|
nextState: 'পরবর্তী',
|
|
@@ -391,6 +444,7 @@ export const bn = {
|
|
|
391
444
|
compact: 'সংক্ষিপ্ত',
|
|
392
445
|
comfortable: 'স্বাভাবিক',
|
|
393
446
|
emptyTitle: 'এখানে এখনো কিছু নেই',
|
|
447
|
+
emptyNamed: 'এখনো কোনো {{name}} নেই',
|
|
394
448
|
emptyHint: 'বর্তমান খোঁজের সাথে মেলা রেকর্ড এখানে দেখা যাবে।',
|
|
395
449
|
emptyFiltered: 'বর্তমান খোঁজের সাথে কোনো রেকর্ড মেলেনি।',
|
|
396
450
|
moved: '{{name}} {{column}}-এ সরানো হয়েছে',
|
|
@@ -441,6 +495,19 @@ export const bn = {
|
|
|
441
495
|
none: 'কিছু না',
|
|
442
496
|
lines: 'লাইন',
|
|
443
497
|
addLine: 'লাইন যোগ করুন',
|
|
498
|
+
nextStep: {
|
|
499
|
+
ready: 'পরের ধাপ: {{step}}।',
|
|
500
|
+
before: '{{step}}-এর আগে:',
|
|
501
|
+
missing_one: '{{count}}টি ঘর পূরণ করতে হবে',
|
|
502
|
+
missing_other: '{{count}}টি ঘর পূরণ করতে হবে',
|
|
503
|
+
},
|
|
504
|
+
daysLeft: { today: 'আজ', in: '{{count}} দিনে', late: '{{count}} দিন দেরি' },
|
|
505
|
+
image: {
|
|
506
|
+
choose: 'ছবি বাছুন',
|
|
507
|
+
remove: 'সরান',
|
|
508
|
+
none: 'ছবি নেই',
|
|
509
|
+
saveFirst: 'আগে রেকর্ডটি সংরক্ষণ করুন, তারপর ছবি যোগ করুন।',
|
|
510
|
+
},
|
|
444
511
|
removeLine: 'লাইন সরান',
|
|
445
512
|
choose: 'বেছে নিন…',
|
|
446
513
|
pasted_one: '{{count}}টি ঘর পেস্ট হয়েছে',
|
|
@@ -509,8 +576,34 @@ export const bn = {
|
|
|
509
576
|
done: 'সম্পন্ন',
|
|
510
577
|
recent: 'সম্প্রতি খোলা',
|
|
511
578
|
apps: 'অ্যাপস',
|
|
579
|
+
today: 'আজ, {{date}}',
|
|
580
|
+
approve: '{{record}} অনুমোদন করুন',
|
|
581
|
+
review: 'দেখুন',
|
|
582
|
+
dueToday: 'আজকের',
|
|
583
|
+
todo: 'Focus করণীয়',
|
|
584
|
+
meetings: 'আজকের সভা',
|
|
585
|
+
mentioned: '{{actor}} আপনাকে {{record}}-এ উল্লেখ করেছেন',
|
|
586
|
+
saved: 'আপনার সংরক্ষিত ভিউ',
|
|
512
587
|
},
|
|
513
588
|
toast: { region: 'বিজ্ঞপ্তি', close: 'বন্ধ করুন' },
|
|
589
|
+
image: {
|
|
590
|
+
choosePhoto: 'ছবি বদলান',
|
|
591
|
+
chooseLogo: 'লোগো বদলান',
|
|
592
|
+
remove: 'সরান',
|
|
593
|
+
hint: 'PNG, JPEG বা WebP। পাঠানোর আগে ছোট (২৫৬ px) করা হয়।',
|
|
594
|
+
unreadable: 'এই ফাইলটি ব্রাউজার পড়তে পারে এমন ছবি নয়।',
|
|
595
|
+
},
|
|
596
|
+
oauth: {
|
|
597
|
+
title: '{{app}} আপনার অ্যাকাউন্ট ব্যবহার করতে চায়',
|
|
598
|
+
as: '{{name}} ({{login}}) হিসেবে সাইন ইন করা।',
|
|
599
|
+
may: 'এটি যা করতে পারবে:',
|
|
600
|
+
limits: 'আপনি নিজে যা পারেন তার বেশি কখনো নয়। যেকোনো সময় সংযুক্ত অ্যাপস থেকে ফিরিয়ে নিতে পারেন।',
|
|
601
|
+
back: 'আপনি {{host}}-এ ফিরে যাবেন।',
|
|
602
|
+
homepage: 'অ্যাপ সম্পর্কে',
|
|
603
|
+
already: 'আপনি আগে এটি অনুমতি দিয়েছিলেন।',
|
|
604
|
+
allow: 'অনুমতি দিন',
|
|
605
|
+
cancel: 'বাতিল',
|
|
606
|
+
},
|
|
514
607
|
palette: {
|
|
515
608
|
switchCompany: '{{name}}-এ যান',
|
|
516
609
|
profile: 'আপনার প্রোফাইল',
|
|
@@ -559,6 +652,11 @@ export const bn = {
|
|
|
559
652
|
custom: 'নিজস্ব ফিল্টার',
|
|
560
653
|
remove: '{{facet}} সরান',
|
|
561
654
|
or: 'অথবা',
|
|
655
|
+
savedViews: 'সংরক্ষিত ভিউ',
|
|
656
|
+
allRecords: 'সব',
|
|
657
|
+
moreViews_one: 'আরও {{count}}টি',
|
|
658
|
+
moreViews_other: 'আরও {{count}}টি',
|
|
659
|
+
shared: 'শেয়ার করা',
|
|
562
660
|
},
|
|
563
661
|
};
|
|
564
662
|
export const ar = {
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { Registry } from './registry.js';
|
|
|
10
10
|
export { ApiError, type ApiOptions, type AppEntry, type CurrentUser, createKoshApi, type KoshApi, type ListQuery, type MenuNode, NetworkError, type Problem, type Row, type ServedView, type Versioned, type ViewField, } from './api.js';
|
|
11
11
|
export { KoshApp, type KoshAppProps, useLanguage } from './app.js';
|
|
12
12
|
export { AppIcon } from './components/AppIcon.js';
|
|
13
|
+
export * from './components/Avatar.js';
|
|
13
14
|
export * from './components/primitives.js';
|
|
14
15
|
export { type KoshContextValue, KoshProvider, type ThemeChoice, useKosh, useTheme, } from './context.js';
|
|
15
16
|
export { type DesignContextValue, DesignProvider, type DesignSpot, useDesign, } from './design.js';
|
|
@@ -40,3 +41,4 @@ export declare const PACKAGE: {
|
|
|
40
41
|
readonly name: string;
|
|
41
42
|
readonly rfc: string;
|
|
42
43
|
};
|
|
44
|
+
export { DateField } from './views/DateField.js';
|
package/dist/ui/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import { registerDefaultWidgets } from './views/widgets.js';
|
|
|
14
14
|
export { ApiError, createKoshApi, NetworkError, } from './api.js';
|
|
15
15
|
export { KoshApp, useLanguage } from './app.js';
|
|
16
16
|
export { AppIcon } from './components/AppIcon.js';
|
|
17
|
+
export * from './components/Avatar.js';
|
|
17
18
|
export * from './components/primitives.js';
|
|
18
19
|
export { KoshProvider, useKosh, useTheme, } from './context.js';
|
|
19
20
|
export { DesignProvider, useDesign, } from './design.js';
|
|
@@ -51,3 +52,4 @@ export const PACKAGE = Object.freeze({
|
|
|
51
52
|
name: 'shutro-erp/ui',
|
|
52
53
|
rfc: 'RFC 0007',
|
|
53
54
|
});
|
|
55
|
+
export { DateField } from './views/DateField.js';
|
|
@@ -11,8 +11,12 @@ export type ChangeStatus = 'pending' | 'conflict' | 'refused';
|
|
|
11
11
|
export interface QueuedChange {
|
|
12
12
|
readonly id: string;
|
|
13
13
|
readonly at: number;
|
|
14
|
-
|
|
14
|
+
/** A record created or updated through the generated API, or a module's route replayed as sent (`request`). */
|
|
15
|
+
readonly kind: 'create' | 'update' | 'request';
|
|
15
16
|
readonly model: string;
|
|
17
|
+
/** `request` only: the method and path, with `values` as the body. */
|
|
18
|
+
readonly method?: 'POST' | 'PATCH' | 'PUT' | undefined;
|
|
19
|
+
readonly path?: string | undefined;
|
|
16
20
|
/** The list's label, for people (e.g. "Contacts"). */
|
|
17
21
|
readonly modelLabel: string;
|
|
18
22
|
readonly recordId: number | null;
|
package/dist/ui/offline/queue.js
CHANGED
|
@@ -127,6 +127,8 @@ export class OfflineQueue {
|
|
|
127
127
|
try {
|
|
128
128
|
if (item.kind === 'create')
|
|
129
129
|
await this.api.create(item.model, { ...item.values });
|
|
130
|
+
else if (item.kind === 'request')
|
|
131
|
+
await this.api.call(item.method ?? 'POST', item.path ?? '', { ...item.values });
|
|
130
132
|
else
|
|
131
133
|
await this.api.update(item.model, item.recordId, { ...item.values }, item.etag);
|
|
132
134
|
return 'synced';
|
package/dist/ui/registry.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export interface WidgetProps {
|
|
|
17
17
|
/** Absent in display-only contexts (list cells, cards). */
|
|
18
18
|
readonly onChange?: (value: unknown) => void;
|
|
19
19
|
readonly invalid?: boolean;
|
|
20
|
+
/** The record's model, on forms (an image widget attaches its file to the record). */
|
|
21
|
+
readonly model?: string;
|
|
20
22
|
}
|
|
21
23
|
/** Props of a registered node component (`{ kind: 'component', component: 'approvals.Panel' }`). */
|
|
22
24
|
export interface NodeComponentProps {
|
|
@@ -96,6 +98,9 @@ export interface PageProps {
|
|
|
96
98
|
readonly api: KoshApi;
|
|
97
99
|
/** The action's label. */
|
|
98
100
|
readonly label?: string;
|
|
101
|
+
/** The app and action the page was opened from (a client action's page; absent for user pages). */
|
|
102
|
+
readonly app?: string;
|
|
103
|
+
readonly action?: string;
|
|
99
104
|
}
|
|
100
105
|
export declare class RegistryError extends Error {
|
|
101
106
|
constructor(problem: string);
|
|
@@ -124,9 +129,13 @@ export declare class Registry {
|
|
|
124
129
|
/** The widget for a node: its `widget`, else the field kind, else plain text. */
|
|
125
130
|
widget(node: FieldNode, field: ViewField): ComponentType<WidgetProps>;
|
|
126
131
|
component(name: string): ComponentType<NodeComponentProps> | undefined;
|
|
127
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* An item of the shell's header, before the language and theme menus (`notify.Bell`). With `home`, it is also in
|
|
134
|
+
* the home page's corner, next to the account menu (notifications, messages).
|
|
135
|
+
*/
|
|
128
136
|
registerHeaderItem(name: string, component: ComponentType<HeaderItemProps>, options?: {
|
|
129
137
|
readonly replace?: boolean;
|
|
138
|
+
readonly home?: boolean;
|
|
130
139
|
}): this;
|
|
131
140
|
/**
|
|
132
141
|
* A personal page every signed-in user reaches from the user menu, outside any app (`settings.ApiKeys`):
|
|
@@ -147,6 +156,8 @@ export declare class Registry {
|
|
|
147
156
|
headerItems(): readonly {
|
|
148
157
|
readonly name: string;
|
|
149
158
|
readonly component: ComponentType<HeaderItemProps>;
|
|
159
|
+
/** Also on the home page. */
|
|
160
|
+
readonly home: boolean;
|
|
150
161
|
}[];
|
|
151
162
|
/** A control next to every search box (the AI assistant's "Ask"). */
|
|
152
163
|
registerSearchAssist(name: string, component: ComponentType<SearchAssistProps>, options?: {
|
package/dist/ui/registry.js
CHANGED
|
@@ -55,8 +55,16 @@ export class Registry {
|
|
|
55
55
|
component(name) {
|
|
56
56
|
return this.#entries.component.get(name);
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
#homeItems = new Set();
|
|
59
|
+
/**
|
|
60
|
+
* An item of the shell's header, before the language and theme menus (`notify.Bell`). With `home`, it is also in
|
|
61
|
+
* the home page's corner, next to the account menu (notifications, messages).
|
|
62
|
+
*/
|
|
59
63
|
registerHeaderItem(name, component, options = {}) {
|
|
64
|
+
if (options.home === true)
|
|
65
|
+
this.#homeItems.add(name);
|
|
66
|
+
else
|
|
67
|
+
this.#homeItems.delete(name);
|
|
60
68
|
return this.#add('header', name, component, options.replace === true);
|
|
61
69
|
}
|
|
62
70
|
#userPageLabels = new Map();
|
|
@@ -83,6 +91,7 @@ export class Registry {
|
|
|
83
91
|
return [...this.#entries.header].map(([name, component]) => ({
|
|
84
92
|
name,
|
|
85
93
|
component: component,
|
|
94
|
+
home: this.#homeItems.has(name),
|
|
86
95
|
}));
|
|
87
96
|
}
|
|
88
97
|
/** A control next to every search box (the AI assistant's "Ask"). */
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Saved views as tabs (RFC 0018 §4.3): above the search, *All* and the saved searches of this model and view type —
|
|
3
|
+
* the user's own and the shared ones —, the one matching the current search marked. A tab applies its search; more
|
|
4
|
+
* than a handful go into a *More* menu. Saving and the full list stay in the search bar's favorites menu; with
|
|
5
|
+
* nothing saved, there are no tabs.
|
|
6
|
+
*/
|
|
7
|
+
import { type SearchState } from '../../search/index.js';
|
|
8
|
+
import type { ReactElement } from 'react';
|
|
9
|
+
export declare function ViewTabs({ model, viewType, state, onChange, }: {
|
|
10
|
+
readonly model: string;
|
|
11
|
+
readonly viewType: string;
|
|
12
|
+
readonly state: SearchState;
|
|
13
|
+
readonly onChange: (state: SearchState) => void;
|
|
14
|
+
}): ReactElement | null;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Saved views as tabs (RFC 0018 §4.3): above the search, *All* and the saved searches of this model and view type —
|
|
4
|
+
* the user's own and the shared ones —, the one matching the current search marked. A tab applies its search; more
|
|
5
|
+
* than a handful go into a *More* menu. Saving and the full list stay in the search bar's favorites menu; with
|
|
6
|
+
* nothing saved, there are no tabs.
|
|
7
|
+
*/
|
|
8
|
+
import { encodeSearch } from '../../search/index.js';
|
|
9
|
+
import { useQuery } from '@tanstack/react-query';
|
|
10
|
+
import { ChevronDown, Users } from 'lucide-react';
|
|
11
|
+
import { useTranslation } from 'react-i18next';
|
|
12
|
+
import { Button, Menu, MenuContent, MenuItem, MenuTrigger } from '../components/primitives.js';
|
|
13
|
+
import { useKosh } from '../context.js';
|
|
14
|
+
import { cn } from '../lib/cn.js';
|
|
15
|
+
/** Tabs shown before the rest go into *More*. */
|
|
16
|
+
const VISIBLE = 6;
|
|
17
|
+
/** The search without its order: a tab matches whatever the columns are sorted by. */
|
|
18
|
+
const key = (state) => encodeSearch({ ...state, order: [] });
|
|
19
|
+
export function ViewTabs({ model, viewType, state, onChange, }) {
|
|
20
|
+
const { api } = useKosh();
|
|
21
|
+
const { t } = useTranslation();
|
|
22
|
+
// The search bar's favorites query: one request, one cache.
|
|
23
|
+
const favorites = useQuery({
|
|
24
|
+
queryKey: ['saved-views', model],
|
|
25
|
+
queryFn: () => api.list('kosh.saved_view', {
|
|
26
|
+
filter: { targetModel: model },
|
|
27
|
+
fields: ['name', 'state', 'shared', 'viewType'],
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
const views = (favorites.data?.items ?? []).filter((v) => v['viewType'] === viewType || v['viewType'] === null);
|
|
31
|
+
if (views.length === 0)
|
|
32
|
+
return null;
|
|
33
|
+
const current = key(state);
|
|
34
|
+
const stateOf = (v) => v['state'] ?? {};
|
|
35
|
+
const active = views.find((v) => key(stateOf(v)) === current);
|
|
36
|
+
const tab = (label, selected, apply, shared = false) => (_jsxs(Button, { size: "sm", variant: "ghost", "aria-current": selected ? 'true' : undefined, onClick: apply, className: cn('h-8 rounded-none border-b-2 border-transparent px-3 text-muted-foreground hover:text-foreground', selected && 'border-primary font-medium text-foreground'), children: [label, shared ? _jsx(Users, { className: "size-3.5 opacity-60", "aria-label": t('search.shared') }) : null] }));
|
|
37
|
+
const shown = views.slice(0, VISIBLE);
|
|
38
|
+
const more = views.slice(VISIBLE);
|
|
39
|
+
return (_jsxs("nav", { "aria-label": t('search.savedViews'), className: "-mb-1 flex items-end gap-1 border-b", children: [tab(t('search.allRecords'), current === '' && active === undefined, () => onChange({})), shown.map((v) => (_jsx("span", { className: "contents", children: tab(String(v['name']), v === active, () => onChange(stateOf(v)), v['shared'] === true) }, v.id))), more.length === 0 ? null : (_jsxs(Menu, { children: [_jsx(MenuTrigger, { asChild: true, children: _jsxs(Button, { size: "sm", variant: "ghost", className: cn('h-8 rounded-none border-b-2 border-transparent px-3 text-muted-foreground', active !== undefined && more.includes(active) && 'border-primary text-foreground'), children: [active !== undefined && more.includes(active)
|
|
40
|
+
? String(active['name'])
|
|
41
|
+
: t('search.moreViews', { count: more.length }), _jsx(ChevronDown, { className: "size-3.5", "aria-hidden": true })] }) }), _jsx(MenuContent, { align: "start", children: more.map((v) => (_jsx(MenuItem, { onSelect: () => onChange(stateOf(v)), children: String(v['name']) }, v.id))) })] }))] }));
|
|
42
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The OAuth consent page (RFC 0017 §5.2), at `/oauth/authorize`: an app asks to act for the signed-in user. It names
|
|
4
|
+
* the app, where it sends the user back, and what it may do in words; *Allow* or *Cancel* — either returns to the
|
|
5
|
+
* app. The server checks the request (registered redirect, allowed scopes, PKCE) before anything is shown; signed out,
|
|
6
|
+
* the person signs in and comes back here.
|
|
7
|
+
*/
|
|
8
|
+
import { useMutation, useQuery } from '@tanstack/react-query';
|
|
9
|
+
import { ExternalLink, ShieldCheck } from 'lucide-react';
|
|
10
|
+
import { useTranslation } from 'react-i18next';
|
|
11
|
+
import { ApiError } from '../api.js';
|
|
12
|
+
import { Alert, Button, Card, Spinner } from '../components/primitives.js';
|
|
13
|
+
export function Consent({ api }) {
|
|
14
|
+
const { t } = useTranslation();
|
|
15
|
+
const search = window.location.search;
|
|
16
|
+
const params = Object.fromEntries(new URLSearchParams(search));
|
|
17
|
+
const me = useQuery({ queryKey: ['me'], queryFn: () => api.me(), retry: false });
|
|
18
|
+
const screen = useQuery({
|
|
19
|
+
queryKey: ['oauth', 'consent', search],
|
|
20
|
+
queryFn: () => api.call('GET', `/api/v1/oauth/authorize${search}`),
|
|
21
|
+
enabled: me.isSuccess,
|
|
22
|
+
retry: false,
|
|
23
|
+
});
|
|
24
|
+
const decide = useMutation({
|
|
25
|
+
mutationFn: (decision) => api.call('POST', '/api/v1/oauth/authorize', { ...params, decision }),
|
|
26
|
+
onSuccess: ({ redirect }) => window.location.assign(redirect),
|
|
27
|
+
});
|
|
28
|
+
if (me.error instanceof ApiError && me.error.status === 401) {
|
|
29
|
+
// Signed out: sign in, then back here with the same request.
|
|
30
|
+
window.location.assign(`/login?next=${encodeURIComponent(`/oauth/authorize${search}`)}`);
|
|
31
|
+
return _jsx(Spinner, { label: t('app.loading') });
|
|
32
|
+
}
|
|
33
|
+
const error = me.error ?? screen.error ?? decide.error;
|
|
34
|
+
return (_jsx("main", { className: "grid min-h-screen place-items-center bg-background p-4", children: _jsx(Card, { className: "grid w-full max-w-md gap-5 p-6", children: error !== null ? (_jsx(Alert, { children: error instanceof ApiError ? error.message : String(error) })) : screen.data === undefined || me.data === undefined ? (_jsx(Spinner, { label: t('app.loading') })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "grid gap-1", children: [_jsx("span", { "aria-hidden": true, className: "mb-2 grid size-10 place-items-center rounded-lg bg-accent text-accent-foreground", children: _jsx(ShieldCheck, { className: "size-5" }) }), _jsx("h1", { className: "text-xl font-semibold", children: t('oauth.title', { app: screen.data.app.name }) }), _jsx("p", { className: "text-sm text-muted-foreground", children: t('oauth.as', { name: me.data.name, login: me.data.login }) })] }), _jsxs("div", { className: "grid gap-2", children: [_jsx("h2", { className: "text-sm font-medium", children: t('oauth.may') }), _jsx("ul", { className: "grid gap-1.5 rounded-md border p-3 text-sm", children: screen.data.scopes.map((s) => (_jsxs("li", { className: "flex items-center gap-2", children: [_jsx(ShieldCheck, { className: "size-4 text-success", "aria-hidden": true }), s.label] }, s.scope))) }), _jsx("p", { className: "text-xs text-muted-foreground", children: t('oauth.limits') })] }), _jsxs("p", { className: "text-sm text-muted-foreground", children: [t('oauth.back', { host: screen.data.redirectHost }), screen.data.app.homepage === null ? null : (_jsxs(_Fragment, { children: [' ', _jsxs("a", { className: "inline-flex items-center gap-1 text-primary underline", href: screen.data.app.homepage, target: "_blank", rel: "noreferrer noopener", children: [t('oauth.homepage'), _jsx(ExternalLink, { className: "size-3", "aria-hidden": true })] })] }))] }), screen.data.alreadyAllowed ? _jsx(Alert, { tone: "info", children: t('oauth.already') }) : null, _jsxs("div", { className: "flex justify-end gap-2", children: [_jsx(Button, { busy: decide.isPending && decide.variables === 'deny', onClick: () => decide.mutate('deny'), children: t('oauth.cancel') }), _jsx(Button, { variant: "primary", busy: decide.isPending && decide.variables === 'allow', onClick: () => decide.mutate('allow'), children: t('oauth.allow') })] })] })) }) }));
|
|
35
|
+
}
|