@opencxh/domain 1.55.0 → 1.57.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.
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Billing domain types for the organization app. Provider-agnostic by design:
3
+ * we never store raw card data (PCI) — only a provider name and the provider's
4
+ * external token/id, plus a few display-only fields. A real payment provider
5
+ * (Stripe, Mollie, …) gets wired in later behind these fields.
6
+ */
7
+ export type PaymentMethodType = "card" | "sepa_direct_debit" | "paypal" | "other";
8
+ export interface PaymentMethod {
9
+ id: string;
10
+ organizationId: string;
11
+ /** Provider key, e.g. "stripe" | "mollie". Free-form until a provider is wired in. */
12
+ provider: string;
13
+ /** The provider's payment-method token/id (never raw card data). */
14
+ externalId?: string;
15
+ type: PaymentMethodType;
16
+ /** Display-only card metadata. */
17
+ brand?: string;
18
+ last4?: string;
19
+ expiryMonth?: number;
20
+ expiryYear?: number;
21
+ holderName?: string;
22
+ /** Whether this is the default method for the organization. */
23
+ isDefault: boolean;
24
+ }
25
+ export type PlanInterval = "month" | "year";
26
+ export interface Plan {
27
+ id: string;
28
+ organizationId: string;
29
+ name: string;
30
+ description?: string;
31
+ /** Amount in the major currency unit (e.g. 49.99). */
32
+ price: number;
33
+ /** ISO 4217 currency code, e.g. "EUR". */
34
+ currency: string;
35
+ interval: PlanInterval;
36
+ features: string[];
37
+ /** Whether the plan can be subscribed to. */
38
+ active: boolean;
39
+ }
40
+ export type SubscriptionStatus = "active" | "trialing" | "past_due" | "canceled" | "incomplete";
41
+ export interface Subscription {
42
+ id: string;
43
+ organizationId: string;
44
+ planId?: string;
45
+ status: SubscriptionStatus;
46
+ /** Payment method used to bill this subscription. */
47
+ paymentMethodId?: string;
48
+ /** ISO date strings for the current billing period. */
49
+ currentPeriodStart?: string;
50
+ currentPeriodEnd?: string;
51
+ cancelAtPeriodEnd?: boolean;
52
+ }
@@ -1 +1,2 @@
1
+ export * from './billing';
1
2
  export * from './types';
@@ -1,3 +1,22 @@
1
+ export interface OrganizationAddress {
2
+ street?: string;
3
+ houseNumber?: string;
4
+ postalCode?: string;
5
+ city?: string;
6
+ country?: string;
7
+ }
8
+ export interface OrganizationBilling {
9
+ companyName?: string;
10
+ /** BTW / VAT number */
11
+ vatNumber?: string;
12
+ /** Kamer van Koophandel (Chamber of Commerce) number */
13
+ kvkNumber?: string;
14
+ billingEmail?: string;
15
+ /** When true, billing uses the organization's primary address. */
16
+ sameAsAddress?: boolean;
17
+ /** Separate billing address (only used when sameAsAddress is false). */
18
+ billingAddress?: OrganizationAddress;
19
+ }
1
20
  export interface Organization {
2
21
  id: string;
3
22
  name: string;
@@ -8,4 +27,21 @@ export interface Organization {
8
27
  domain: string;
9
28
  defaultApp?: string;
10
29
  permissions?: string[];
30
+ /** Tenant slug, mirrored from system.tenants. */
31
+ slug?: string;
32
+ /** Parent tenant id (for child organizations under this account). */
33
+ parentId?: string;
34
+ description?: string;
35
+ address?: OrganizationAddress;
36
+ billing?: OrganizationBilling;
37
+ /** Small company logo stored inline as a base64 data-URI. */
38
+ logo?: string;
39
+ }
40
+ /**
41
+ * Recursive tenant hierarchy node returned by `system.tenants/tree`.
42
+ * The root node has an `undefined` id; every other node carries a tenant id.
43
+ */
44
+ export interface TenantNode {
45
+ id?: string;
46
+ children?: Record<string, TenantNode>;
11
47
  }
@@ -3,4 +3,13 @@ export interface User {
3
3
  name: string;
4
4
  email: string;
5
5
  availableOrganizations: string[];
6
+ /** Mirrored from system.users. */
7
+ firstName?: string;
8
+ lastName?: string;
9
+ /** Roles for the current tenant, sourced from system.rbac (not our DB). */
10
+ roles?: string[];
11
+ displayName?: string;
12
+ avatarUrl?: string;
13
+ locale?: string;
14
+ timezone?: string;
6
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencxh/domain",
3
- "version": "1.55.0",
3
+ "version": "1.57.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",