@ossy/consultancy 1.16.2 → 3.0.1

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/README.md CHANGED
@@ -1,12 +1,81 @@
1
1
  # @ossy/consultancy
2
2
 
3
- Consultancy feature package for the Ossy platform. Provides resource templates for managing employees, contracts, company information, and vacations.
3
+ Consultancy **feature package** for the Ossy platform — schemas and UI for employees, contracts, company information, vacations, and the **opportunity → proposal** sales pipeline.
4
4
 
5
- ## Resource Templates
5
+ ## What's included
6
6
 
7
- | Resource | ID |
8
- |----------|----|
9
- | Employee | `@ossy/consultancy/employee` |
10
- | Contract | `@ossy/consultancy/contract` |
11
- | Company Basic Info | `@ossy/consultancy/companyBasicInfo` |
12
- | Vacation | `@ossy/consultancy/vacation` |
7
+ ### Pages
8
+
9
+ | File | Page id | Default paths |
10
+ |---|---|---|
11
+ | `consultancy.page.jsx` | `consultancy/home` | `/consultancy` (en), `/konsultverksamhet` (sv) |
12
+
13
+ The home page shows company overview data (fiscal years, registration, VAT) via `@ossy/calendar`'s `useCompany` hook.
14
+
15
+ ### Schemas (ADR 0006)
16
+
17
+ Document types are defined in `*.schema.js`. Import canonical ids from `ConsultancySchema`.
18
+
19
+ | Schema | Id | Purpose |
20
+ |--------|-----|---------|
21
+ | Employee | `@ossy/consultancy/schema/employee` | Consultant employment records |
22
+ | Contract | `@ossy/consultancy/schema/contract` | Client contracts linked to employees |
23
+ | Company Basic Info | `@ossy/consultancy/schema/company-basic-info` | Company registration and VAT details |
24
+ | Vacation | `@ossy/consultancy/schema/vacation` | Employee vacation periods |
25
+ | Opportunity | `@ossy/consultancy/schema/opportunity` | Sales pipeline leads and qualification |
26
+ | Proposal | `@ossy/consultancy/schema/proposal` | Draft and sent proposals linked to opportunities |
27
+
28
+ Document instances are stored under `/@ossy/consultancy/` (see the `location` export in `locations.js`).
29
+
30
+ ### Opportunity → proposal pipeline
31
+
32
+ These schemas support platform automation workflows:
33
+
34
+ - **Opportunity** — tracks lead status (`new` → `qualified` → `proposal` → `won` / `lost` / `deferred`), fit scoring, contact details, and a link to a proposal via `linkedProposalId`.
35
+ - **Proposal** — references its parent opportunity via `opportunityId` and progresses through `draft` → `sent` → `accepted` / `rejected`.
36
+
37
+ ### Exports
38
+
39
+ | Export | Description |
40
+ |---|---|
41
+ | `ConsultancySchema` | Canonical schema id constants |
42
+ | `employeeSchema`, `contractSchema`, … | Schema definitions for manifest build |
43
+ | `location` | Workspace storage path (`/@ossy/consultancy/`) |
44
+ | `Definition` | Feature metadata for store/sidebar (`status: ['beta']`) |
45
+
46
+ ## Usage
47
+
48
+ ```bash
49
+ npm install @ossy/consultancy
50
+ npm run build
51
+ ```
52
+
53
+ `@ossy/app` discovers pages automatically via `"ossy": { "src": "./src" }` in `package.json`. Schemas are picked up from `*.schema.js` files at build time.
54
+
55
+ ```js
56
+ import { ConsultancySchema, employeeSchema } from '@ossy/consultancy'
57
+
58
+ ConsultancySchema.employee
59
+ // => '@ossy/consultancy/schema/employee'
60
+ ```
61
+
62
+ ## Migration from resource templates
63
+
64
+ This package migrated from `*.resource.js` to ADR 0006 schemas. Stored `resource.type` values changed:
65
+
66
+ | Before | After |
67
+ |--------|-------|
68
+ | `@ossy/consultancy/employee` | `@ossy/consultancy/schema/employee` |
69
+ | `@ossy/consultancy/contract` | `@ossy/consultancy/schema/contract` |
70
+ | `@ossy/consultancy/companyBasicInfo` | `@ossy/consultancy/schema/company-basic-info` |
71
+ | `@ossy/consultancy/vacation` | `@ossy/consultancy/schema/vacation` |
72
+
73
+ ## Dependencies
74
+
75
+ | Package | Role |
76
+ |---|---|
77
+ | `@ossy/schema` | Canonical id grammar and schema validation |
78
+ | `@ossy/calendar` | `DataLoader`, `useCompany` on overview page |
79
+ | `@ossy/design-system` | Layout primitives and `Page` component |
80
+ | `@ossy/router-react` | Page routing |
81
+ | `react` | UI |
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ossy/consultancy",
3
- "description": "Consultancy feature package — employee, contract, company, and vacation resource templates for Ossy consultants",
4
- "version": "1.16.2",
3
+ "description": "Consultancy feature package — schemas for employees, contracts, opportunities, and proposals",
4
+ "version": "3.0.1",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
7
7
  "module": "./src/index.js",
@@ -21,11 +21,14 @@
21
21
  "/src",
22
22
  "README.md"
23
23
  ],
24
+ "dependencies": {
25
+ "@ossy/schema": "^3.0.1"
26
+ },
24
27
  "peerDependencies": {
25
28
  "@ossy/calendar": "*",
26
29
  "@ossy/design-system": "*",
27
30
  "@ossy/router-react": "*",
28
31
  "react": "*"
29
32
  },
30
- "gitHead": "2b8745d57fee8b6c08787e2755b4df489291a5cd"
33
+ "gitHead": "4a70ec216448680d2fddc57b2a8a0077489720ae"
31
34
  }
package/src/Definition.js CHANGED
@@ -3,5 +3,5 @@ export const Definition = {
3
3
  title: 'Consultancy',
4
4
  description: 'Consultancy information and service presentation views.',
5
5
  icon: 'abstract',
6
- statuses: ['beta'],
6
+ status: ['beta'],
7
7
  }
package/src/Overview.jsx CHANGED
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { Title, View, Text, Separator } from '@ossy/design-system'
2
+ import { View, Text, Separator } from '@ossy/design-system'
3
3
  import { useCompany } from '@ossy/calendar'
4
4
 
5
5
  export const Overview = () => {
@@ -26,7 +26,7 @@ export const Overview = () => {
26
26
  boxSizing: 'border-box',
27
27
  }}
28
28
  >
29
- <Title variant="tertiary">Fiscal years</Title>
29
+ <Text variant="heading-tertiary" as="h3">Fiscal years</Text>
30
30
  <Separator />
31
31
  <View gap="s" style={{ flexGrow: 1 }}>
32
32
 
@@ -54,7 +54,7 @@ export const Overview = () => {
54
54
  boxSizing: 'border-box',
55
55
  }}
56
56
  >
57
- <Title variant="tertiary">{company.name}</Title>
57
+ <Text variant="heading-tertiary" as="h3">{company.name}</Text>
58
58
  <Separator />
59
59
  <View gap="s" style={{ flexGrow: 1 }}>
60
60
 
@@ -0,0 +1,18 @@
1
+ import { ConsultancySchema } from './schema-ids.js'
2
+
3
+ export default {
4
+ name: 'Company Basic Info',
5
+ id: ConsultancySchema.companyBasicInfo,
6
+ categoryName: 'Consultancy',
7
+ icon: 'organisation',
8
+ fields: [
9
+ { name: 'name', type: 'text' },
10
+ { name: 'registrationDate', type: 'text' },
11
+ { name: 'vatNumber', type: 'text' },
12
+ { name: 'vatRegistredFrom', type: 'text' },
13
+ { name: 'vatPaymentResponsibilityFrom', type: 'text' },
14
+ { name: 'vatPaymentPeriod', type: 'text' },
15
+ { name: 'financialYearStart', type: 'text' },
16
+ { name: 'financialYearEnd', type: 'text' },
17
+ ],
18
+ }
@@ -1,51 +1,39 @@
1
1
  import React from 'react'
2
- import { Title, Text, View, Tags, Button, useLocale } from '@ossy/design-system'
2
+ import { Text, View, Button, Page, useLocale, Tags } from '@ossy/design-system'
3
3
  import { Overview } from './Overview.jsx'
4
4
  import { DataLoader } from '@ossy/calendar'
5
5
  import { Definition } from '@ossy/consultancy'
6
- import { moduleStatusTags } from './moduleStatus.js'
7
6
 
8
7
  export const metadata = {
9
8
  id: 'consultancy/home',
10
9
  path: {
11
- sv: '/oversikt',
12
- en: '/overview',
10
+ sv: '/konsultverksamhet',
11
+ en: '/consultancy',
13
12
  },
14
13
  }
15
14
 
16
15
  export const ConsultancyPage = () => {
17
16
  const { t } = useLocale()
18
- return (
19
- <View gap="m" surface="primary" style={{ padding: 'var(--space-m) var(--space-l)', height: '100%', overflowY: 'auto' }}>
20
-
21
- <View inset="s" gap="s" style={{ flexShrink: 0 }}>
22
-
23
- <View layout="row" justifyContent="space-between" alignItems="center">
24
- <View layout='row' gap="s" alignItems="center">
25
- <Title>{t('consultancy.home.title')}</Title>
26
- {moduleStatusTags(Definition).length > 0 && (
27
- <Tags tags={moduleStatusTags(Definition)} size="s" />
28
- )}
29
- </View>
30
- <Button variant="cta" disabled={true} prefix="add">
31
- {t('design-system.add')}
32
- </Button>
33
- </View>
34
-
35
- <Text style={{ maxWidth: '400px' }}>
36
- {t('consultancy.home.description')}
37
- </Text>
38
-
39
- </View>
40
-
41
- <View gap="m" inset="s">
42
- <Title variant="secondary">{t('design-system.overview')}</Title>
43
-
44
- <DataLoader content={<Overview />} />
17
+ const statusTags = (Definition.status ?? [])
18
+ .map((s) => ({ beta: 'Beta', 'coming-soon': 'Coming Soon' }[s]))
19
+ .filter(Boolean)
45
20
 
21
+ return (
22
+ <Page
23
+ title="consultancy.home.title"
24
+ near={statusTags.length > 0 ? <Tags tags={statusTags} size="s" /> : undefined}
25
+ description="consultancy.home.description"
26
+ far={(
27
+ <Button variant="cta" disabled prefix="add">
28
+ {t('design-system.add')}
29
+ </Button>
30
+ )}
31
+ >
32
+ <View gap="m">
33
+ <Text variant="heading-secondary" as="h2" text="design-system.overview" />
34
+ <DataLoader content={<Overview />} />
46
35
  </View>
47
-
48
- </View>
36
+ </Page>
49
37
  )
50
38
  }
51
39
 
@@ -0,0 +1,18 @@
1
+ import { ConsultancySchema } from './schema-ids.js'
2
+
3
+ export default {
4
+ name: 'Contract',
5
+ id: ConsultancySchema.contract,
6
+ categoryName: 'Consultancy',
7
+ icon: 'file-document',
8
+ fields: [
9
+ { name: 'employeeId', type: 'text' },
10
+ { name: 'clientName', type: 'text' },
11
+ { name: 'hourlyCompensation', type: 'number' },
12
+ { name: 'startDate', type: 'text' },
13
+ { name: 'endDate', type: 'text' },
14
+ { name: 'noticePeriodInDays', type: 'number' },
15
+ { name: 'paymentTermsDueDate', type: 'select', options: ['net30'] },
16
+ { name: 'paymentTermsInvoiceDate', type: 'select', options: ['dayAfterServicePeriodEnd', 'sameDayAsServicePeriodEnd'] },
17
+ ],
18
+ }
@@ -0,0 +1,16 @@
1
+ import { ConsultancySchema } from './schema-ids.js'
2
+
3
+ export default {
4
+ name: 'Employee',
5
+ id: ConsultancySchema.employee,
6
+ categoryName: 'Consultancy',
7
+ icon: 'user-add',
8
+ fields: [
9
+ { name: 'name', type: 'text' },
10
+ { name: 'monthlySalary', type: 'number' },
11
+ { name: 'workHoursPerDay', type: 'number' },
12
+ { name: 'holidayDays', type: 'number' },
13
+ { name: 'startDate', type: 'text' },
14
+ { name: 'endDate', type: 'text' },
15
+ ],
16
+ }
@@ -1,5 +1,47 @@
1
1
  {
2
2
  "consultancy/home.documentTitle": "Consultancy",
3
- "consultancy.home.title": "Consultancy",
4
- "consultancy.home.description": "Consultancy overview"
3
+ "consultancy/home.title": "Consultancy",
4
+ "consultancy/home.description": "Consultancy overview",
5
+ "@ossy/consultancy/schema/contract.employeeId.label": "Employee",
6
+ "@ossy/consultancy/schema/contract.clientName.label": "Client name",
7
+ "@ossy/consultancy/schema/contract.hourlyCompensation.label": "Hourly compensation",
8
+ "@ossy/consultancy/schema/contract.startDate.label": "Start date",
9
+ "@ossy/consultancy/schema/contract.endDate.label": "End date",
10
+ "@ossy/consultancy/schema/contract.noticePeriodInDays.label": "Notice period (days)",
11
+ "@ossy/consultancy/schema/contract.paymentTermsDueDate.label": "Payment terms due date",
12
+ "@ossy/consultancy/schema/contract.paymentTermsInvoiceDate.label": "Payment terms invoice date",
13
+ "@ossy/consultancy/schema/employee.name.label": "Name",
14
+ "@ossy/consultancy/schema/employee.monthlySalary.label": "Monthly salary",
15
+ "@ossy/consultancy/schema/employee.workHoursPerDay.label": "Work hours per day",
16
+ "@ossy/consultancy/schema/employee.holidayDays.label": "Holiday days",
17
+ "@ossy/consultancy/schema/employee.startDate.label": "Start date",
18
+ "@ossy/consultancy/schema/employee.endDate.label": "End date",
19
+ "@ossy/consultancy/schema/opportunity.title.label": "Title",
20
+ "@ossy/consultancy/schema/opportunity.source.label": "Source",
21
+ "@ossy/consultancy/schema/opportunity.status.label": "Status",
22
+ "@ossy/consultancy/schema/opportunity.summary.label": "Summary",
23
+ "@ossy/consultancy/schema/opportunity.fitScore.label": "Fit score",
24
+ "@ossy/consultancy/schema/opportunity.nextAction.label": "Next action",
25
+ "@ossy/consultancy/schema/opportunity.contactEmail.label": "Contact email",
26
+ "@ossy/consultancy/schema/opportunity.contactName.label": "Contact name",
27
+ "@ossy/consultancy/schema/opportunity.linkedProposalId.label": "Linked proposal",
28
+ "@ossy/consultancy/schema/opportunity.feedRef.label": "Feed reference",
29
+ "@ossy/consultancy/schema/proposal.opportunityId.label": "Opportunity",
30
+ "@ossy/consultancy/schema/proposal.title.label": "Title",
31
+ "@ossy/consultancy/schema/proposal.status.label": "Status",
32
+ "@ossy/consultancy/schema/proposal.scope.label": "Scope",
33
+ "@ossy/consultancy/schema/proposal.rate.label": "Rate",
34
+ "@ossy/consultancy/schema/proposal.timeline.label": "Timeline",
35
+ "@ossy/consultancy/schema/proposal.body.label": "Body",
36
+ "@ossy/consultancy/schema/vacation.employeeId.label": "Employee",
37
+ "@ossy/consultancy/schema/vacation.start.label": "Start",
38
+ "@ossy/consultancy/schema/vacation.end.label": "End",
39
+ "@ossy/consultancy/schema/company-basic-info.name.label": "Name",
40
+ "@ossy/consultancy/schema/company-basic-info.registrationDate.label": "Registration date",
41
+ "@ossy/consultancy/schema/company-basic-info.vatNumber.label": "VAT number",
42
+ "@ossy/consultancy/schema/company-basic-info.vatRegistredFrom.label": "VAT registered from",
43
+ "@ossy/consultancy/schema/company-basic-info.vatPaymentResponsibilityFrom.label": "VAT payment responsibility from",
44
+ "@ossy/consultancy/schema/company-basic-info.vatPaymentPeriod.label": "VAT payment period",
45
+ "@ossy/consultancy/schema/company-basic-info.financialYearStart.label": "Financial year start",
46
+ "@ossy/consultancy/schema/company-basic-info.financialYearEnd.label": "Financial year end"
5
47
  }
package/src/index.js CHANGED
@@ -1,6 +1,9 @@
1
1
  export { location } from './locations.js'
2
- export { default as employeeResource } from './employee.resource.js'
3
- export { default as contractResource } from './contract.resource.js'
4
- export { default as companyBasicInfoResource } from './company-basic-info.resource.js'
5
- export { default as vacationResource } from './vacation.resource.js'
2
+ export { ConsultancySchema } from './schema-ids.js'
3
+ export { default as employeeSchema } from './employee.schema.js'
4
+ export { default as contractSchema } from './contract.schema.js'
5
+ export { default as companyBasicInfoSchema } from './company-basic-info.schema.js'
6
+ export { default as vacationSchema } from './vacation.schema.js'
7
+ export { default as opportunitySchema } from './opportunity.schema.js'
8
+ export { default as proposalSchema } from './proposal.schema.js'
6
9
  export { Definition } from './Definition.js'
@@ -0,0 +1,20 @@
1
+ import { ConsultancySchema } from './schema-ids.js'
2
+
3
+ export default {
4
+ name: 'Opportunity',
5
+ id: ConsultancySchema.opportunity,
6
+ categoryName: 'Consultancy',
7
+ icon: 'target',
8
+ fields: [
9
+ { name: 'title', type: 'text' },
10
+ { name: 'source', type: 'text' },
11
+ { name: 'status', type: 'select', options: ['new', 'qualified', 'proposal', 'won', 'lost', 'deferred'] },
12
+ { name: 'summary', type: 'text' },
13
+ { name: 'fitScore', type: 'number' },
14
+ { name: 'nextAction', type: 'text' },
15
+ { name: 'contactEmail', type: 'text' },
16
+ { name: 'contactName', type: 'text' },
17
+ { name: 'linkedProposalId', type: 'text' },
18
+ { name: 'feedRef', type: 'text' },
19
+ ],
20
+ }
@@ -0,0 +1,17 @@
1
+ import { ConsultancySchema } from './schema-ids.js'
2
+
3
+ export default {
4
+ name: 'Proposal',
5
+ id: ConsultancySchema.proposal,
6
+ categoryName: 'Consultancy',
7
+ icon: 'file-document',
8
+ fields: [
9
+ { name: 'opportunityId', type: 'text' },
10
+ { name: 'title', type: 'text' },
11
+ { name: 'status', type: 'select', options: ['draft', 'sent', 'accepted', 'rejected'] },
12
+ { name: 'scope', type: 'text' },
13
+ { name: 'rate', type: 'text' },
14
+ { name: 'timeline', type: 'text' },
15
+ { name: 'body', type: 'text' },
16
+ ],
17
+ }
@@ -0,0 +1,9 @@
1
+ /** Canonical schema ids for @ossy/consultancy (ADR 0006). */
2
+ export const ConsultancySchema = Object.freeze({
3
+ companyBasicInfo: '@ossy/consultancy/schema/company-basic-info',
4
+ contract: '@ossy/consultancy/schema/contract',
5
+ employee: '@ossy/consultancy/schema/employee',
6
+ vacation: '@ossy/consultancy/schema/vacation',
7
+ opportunity: '@ossy/consultancy/schema/opportunity',
8
+ proposal: '@ossy/consultancy/schema/proposal',
9
+ })
@@ -0,0 +1,12 @@
1
+ import { ConsultancySchema } from './schema-ids.js'
2
+
3
+ export default {
4
+ name: 'Vacation',
5
+ id: ConsultancySchema.vacation,
6
+ categoryName: 'Consultancy',
7
+ fields: [
8
+ { name: 'employeeId', type: 'text' },
9
+ { name: 'start', type: 'text' },
10
+ { name: 'end', type: 'text' },
11
+ ],
12
+ }
@@ -1,40 +0,0 @@
1
- export default {
2
- name: 'Company Basic Info',
3
- id: '@ossy/consultancy/companyBasicInfo',
4
- categoryName: 'Consultancy',
5
- icon: 'organisation',
6
- fields: [
7
- {
8
- name: 'name',
9
- type: 'text',
10
- },
11
- {
12
- name: 'registrationDate',
13
- type: 'text',
14
- },
15
- {
16
- name: 'vatNumber',
17
- type: 'text',
18
- },
19
- {
20
- name: 'vatRegistredFrom',
21
- type: 'text',
22
- },
23
- {
24
- name: 'vatPaymentResponsibilityFrom',
25
- type: 'text',
26
- },
27
- {
28
- name: 'vatPaymentPeriod',
29
- type: 'text',
30
- },
31
- {
32
- name: 'financialYearStart',
33
- type: 'text',
34
- },
35
- {
36
- name: 'financialYearEnd',
37
- type: 'text',
38
- },
39
- ],
40
- }
@@ -1,42 +0,0 @@
1
- export default {
2
- name: 'Contract',
3
- id: '@ossy/consultancy/contract',
4
- categoryName: 'Consultancy',
5
- icon: 'file-document',
6
- fields: [
7
- {
8
- name: 'employeeId',
9
- type: 'text',
10
- },
11
- {
12
- name: 'clientName',
13
- type: 'text',
14
- },
15
- {
16
- name: 'hourlyCompensation',
17
- type: 'number',
18
- },
19
- {
20
- name: 'startDate',
21
- type: 'text',
22
- },
23
- {
24
- name: 'endDate',
25
- type: 'text',
26
- },
27
- {
28
- name: 'noticePeriodInDays',
29
- type: 'number',
30
- },
31
- {
32
- name: 'paymentTermsDueDate',
33
- type: 'select',
34
- options: ['net30'],
35
- },
36
- {
37
- name: 'paymentTermsInvoiceDate',
38
- type: 'select',
39
- options: ['dayAfterServicePeriodEnd', 'sameDayAsServicePeriodEnd'],
40
- },
41
- ],
42
- }
@@ -1,32 +0,0 @@
1
- export default {
2
- name: 'Employee',
3
- id: '@ossy/consultancy/employee',
4
- categoryName: 'Consultancy',
5
- icon: 'user-add',
6
- fields: [
7
- {
8
- name: 'name',
9
- type: 'text',
10
- },
11
- {
12
- name: 'monthlySalary',
13
- type: 'number',
14
- },
15
- {
16
- name: 'workHoursPerDay',
17
- type: 'number',
18
- },
19
- {
20
- name: 'holidayDays',
21
- type: 'number',
22
- },
23
- {
24
- name: 'startDate',
25
- type: 'text',
26
- },
27
- {
28
- name: 'endDate',
29
- type: 'text',
30
- },
31
- ],
32
- }
@@ -1,95 +0,0 @@
1
- /**
2
- * Module lifecycle & visibility helpers.
3
- *
4
- * - `statuses` is a string[] on each Definition (e.g. `['beta']`, `['beta', 'internal']`).
5
- * - Legacy single `status` is still read for compatibility.
6
- * - Optional workspace gating via `workspaceServiceKey` or `workspaceServiceKeys` + `workspaceServiceRequirement`.
7
- */
8
-
9
- export const MODULE_STATUS = {
10
- beta: 'beta',
11
- comingSoon: 'coming-soon',
12
- stable: 'stable',
13
- /** When present, the module is omitted from the primary sidebar. */
14
- hidden: 'hidden',
15
- }
16
-
17
- const STATUS_TO_TAG_LABEL = {
18
- [MODULE_STATUS.beta]: 'Beta',
19
- [MODULE_STATUS.comingSoon]: 'Coming Soon',
20
- [MODULE_STATUS.stable]: null,
21
- [MODULE_STATUS.hidden]: null,
22
- }
23
-
24
- /** Status values that exclude a module from the sidebar (in addition to workspace gating). */
25
- const SIDEBAR_HIDE_STATUSES = new Set([MODULE_STATUS.hidden])
26
-
27
- /**
28
- * Normalize legacy `definition.status` and `definition.statuses` into one array.
29
- * @param {{ status?: string, statuses?: string[] }} definition
30
- * @returns {string[]}
31
- */
32
- export function moduleStatuses(definition) {
33
- const fromArray = Array.isArray(definition?.statuses) ? definition.statuses : []
34
- const fromLegacy = definition?.status && typeof definition.status === 'string' ? [definition.status] : []
35
- if (fromArray.length) return [...new Set(fromArray)]
36
- if (fromLegacy.length) return [...new Set(fromLegacy)]
37
- return []
38
- }
39
-
40
- /**
41
- * @param {{ status?: string, statuses?: string[] }} definition
42
- * @returns {string[]} labels for `<Tags tags={...} />` (stable/hidden emit none)
43
- */
44
- export function moduleStatusTags(definition) {
45
- const labels = []
46
- for (const s of moduleStatuses(definition)) {
47
- const label = STATUS_TO_TAG_LABEL[s]
48
- if (label) labels.push(label)
49
- }
50
- return [...new Set(labels)]
51
- }
52
-
53
- /**
54
- * @param {{ status?: string, statuses?: string[] }} definition
55
- * @returns {boolean}
56
- */
57
- export function isHiddenFromSidebar(definition) {
58
- if (!definition) return true
59
- return moduleStatuses(definition).some(s => SIDEBAR_HIDE_STATUSES.has(s))
60
- }
61
-
62
- /**
63
- * @param {Record<string, boolean> | undefined} services workspace.services
64
- * @param {{ workspaceServiceKey?: string, workspaceServiceKeys?: string[], workspaceServiceRequirement?: 'all' | 'any' }} definition
65
- * @returns {boolean}
66
- */
67
- export function workspaceAllowsModule(services, definition) {
68
- if (!definition) return false
69
- const keys = definition.workspaceServiceKeys?.length
70
- ? definition.workspaceServiceKeys
71
- : definition.workspaceServiceKey
72
- ? [definition.workspaceServiceKey]
73
- : null
74
- if (!keys?.length) return true
75
- const mode = definition.workspaceServiceRequirement || 'all'
76
- const map = services || {}
77
- /** Treat missing keys as allowed (legacy workspaces); only explicit `false` from disable turns a service off. */
78
- const flags = keys.map(k => map[k] !== false)
79
- return mode === 'any' ? flags.some(Boolean) : flags.every(Boolean)
80
- }
81
-
82
- /**
83
- * Router ref for a module’s default page: `@<moduleId>/home`
84
- * @param {string} moduleId — matches `Definition.module.id` / folder name
85
- */
86
- export function moduleHomeRef(moduleId) {
87
- return `@${moduleId}/home`
88
- }
89
-
90
- /**
91
- * @param {{ requiresModules?: Array<{ id: string, label: string, href: string }> }} definition
92
- */
93
- export function moduleRequiresModules(definition) {
94
- return definition?.requiresModules ?? []
95
- }
@@ -1,19 +0,0 @@
1
- export default {
2
- name: 'Vacation',
3
- id: '@ossy/consultancy/vacation',
4
- categoryName: 'Consultancy',
5
- fields: [
6
- {
7
- name: 'employeeId',
8
- type: 'text',
9
- },
10
- {
11
- name: 'start',
12
- type: 'text',
13
- },
14
- {
15
- name: 'end',
16
- type: 'text',
17
- },
18
- ],
19
- }