@ossy/consultancy 1.16.2 → 1.16.3

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 (`statuses: ['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": "1.16.3",
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": "^1.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": "a0d89185a17f8de8ce328c3a648c108ff1d61d8f"
31
34
  }
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,5 +1,5 @@
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'
@@ -8,44 +8,31 @@ import { moduleStatusTags } from './moduleStatus.js'
8
8
  export const metadata = {
9
9
  id: 'consultancy/home',
10
10
  path: {
11
- sv: '/oversikt',
12
- en: '/overview',
11
+ sv: '/konsultverksamhet',
12
+ en: '/consultancy',
13
13
  },
14
14
  }
15
15
 
16
16
  export const ConsultancyPage = () => {
17
17
  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 />} />
18
+ const statusTags = moduleStatusTags(Definition)
45
19
 
20
+ return (
21
+ <Page
22
+ title="consultancy.home.title"
23
+ near={statusTags.length > 0 ? <Tags tags={statusTags} size="s" /> : undefined}
24
+ description="consultancy.home.description"
25
+ far={(
26
+ <Button variant="cta" disabled prefix="add">
27
+ {t('design-system.add')}
28
+ </Button>
29
+ )}
30
+ >
31
+ <View gap="m">
32
+ <Text variant="heading-secondary" as="h2" text="design-system.overview" />
33
+ <DataLoader content={<Overview />} />
46
34
  </View>
47
-
48
- </View>
35
+ </Page>
49
36
  )
50
37
  }
51
38
 
@@ -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
+ }
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,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
- }