@opencxh/domain 1.171.0 → 1.172.2

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.
Files changed (101) hide show
  1. package/dist/entities/activity/blocks.d.ts +30 -30
  2. package/dist/entities/activity/catalog.d.ts +63 -86
  3. package/dist/entities/activity/descriptor.d.ts +31 -32
  4. package/dist/entities/activity/index.d.ts +2 -2
  5. package/dist/entities/activity/preview.d.ts +7 -7
  6. package/dist/entities/activity/resolve.d.ts +37 -38
  7. package/dist/entities/activity/types.d.ts +34 -34
  8. package/dist/entities/ai-account/types.d.ts +3 -3
  9. package/dist/entities/ai-account/vendors.d.ts +25 -32
  10. package/dist/entities/ai-budget/types.d.ts +12 -8
  11. package/dist/entities/ai-conversation/types.d.ts +12 -12
  12. package/dist/entities/ai-profile/types.d.ts +21 -26
  13. package/dist/entities/ai-settings/types.d.ts +12 -13
  14. package/dist/entities/analytics/dashboard.d.ts +1 -1
  15. package/dist/entities/analytics/index.d.ts +4 -4
  16. package/dist/entities/analytics/source.d.ts +1 -1
  17. package/dist/entities/analytics/usage.d.ts +23 -28
  18. package/dist/entities/artifact/blocks.d.ts +54 -69
  19. package/dist/entities/artifact/markdown.d.ts +2 -3
  20. package/dist/entities/artifact/types.d.ts +47 -55
  21. package/dist/entities/assignment/types.d.ts +74 -88
  22. package/dist/entities/calendar-event/types.d.ts +1 -1
  23. package/dist/entities/channel/index.d.ts +1 -1
  24. package/dist/entities/channel/signature.d.ts +8 -9
  25. package/dist/entities/communication/index.d.ts +1 -1
  26. package/dist/entities/communication/message-template.d.ts +1 -1
  27. package/dist/entities/company/types.d.ts +1 -1
  28. package/dist/entities/contact/index.d.ts +1 -1
  29. package/dist/entities/contact/provider.d.ts +2 -1
  30. package/dist/entities/contact/types.d.ts +1 -10
  31. package/dist/entities/custom-field-def/types.d.ts +14 -14
  32. package/dist/entities/external-identity/types.d.ts +45 -50
  33. package/dist/entities/interaction/index.d.ts +1 -1
  34. package/dist/entities/interaction/types.d.ts +44 -47
  35. package/dist/entities/live-lens/types.d.ts +39 -44
  36. package/dist/entities/mcp/types.d.ts +53 -57
  37. package/dist/entities/memory/alias.d.ts +7 -7
  38. package/dist/entities/memory/browse.d.ts +21 -21
  39. package/dist/entities/memory/ingest.d.ts +26 -17
  40. package/dist/entities/memory/item.d.ts +53 -58
  41. package/dist/entities/memory/kind.d.ts +26 -26
  42. package/dist/entities/memory/query.d.ts +49 -51
  43. package/dist/entities/playbook/actor.d.ts +20 -19
  44. package/dist/entities/playbook/assignment.d.ts +54 -63
  45. package/dist/entities/playbook/index.d.ts +2 -2
  46. package/dist/entities/playbook/labels.d.ts +4 -4
  47. package/dist/entities/playbook/trigger-vars.d.ts +14 -15
  48. package/dist/entities/playbook/types.d.ts +173 -303
  49. package/dist/entities/resource-reminder/types.d.ts +8 -9
  50. package/dist/entities/scope/actor.d.ts +16 -0
  51. package/dist/entities/{note → scope}/index.d.ts +1 -0
  52. package/dist/entities/scope/scope.test.d.ts +1 -0
  53. package/dist/entities/scope/types.d.ts +53 -0
  54. package/dist/entities/task/types.d.ts +1 -1
  55. package/dist/entities/time-entry/duration.d.ts +11 -11
  56. package/dist/entities/time-entry/types.d.ts +60 -60
  57. package/dist/entities/time-entry/work-type.d.ts +21 -24
  58. package/dist/entities/topic/examples.d.ts +26 -27
  59. package/dist/entities/topic/scope.d.ts +11 -12
  60. package/dist/entities/topic/types.d.ts +28 -28
  61. package/dist/entities/user/types.d.ts +24 -28
  62. package/dist/entities/webhook/types.d.ts +6 -6
  63. package/dist/entities/work/keys.d.ts +25 -26
  64. package/dist/entities/work/ladder.d.ts +48 -52
  65. package/dist/entities/work/types.d.ts +109 -115
  66. package/dist/index.cjs +6 -6
  67. package/dist/index.d.ts +29 -33
  68. package/dist/index.js +1391 -1254
  69. package/dist/platform/account.d.ts +34 -38
  70. package/dist/platform/ai-tools.d.ts +48 -52
  71. package/dist/platform/api.d.ts +9 -8
  72. package/dist/platform/author.d.ts +7 -9
  73. package/dist/platform/capabilities.d.ts +3 -3
  74. package/dist/platform/communication.d.ts +163 -204
  75. package/dist/platform/context.d.ts +8 -8
  76. package/dist/platform/identity.d.ts +16 -19
  77. package/dist/platform/kernel.d.ts +1 -1
  78. package/dist/platform/manifest.d.ts +2 -2
  79. package/dist/platform/media.d.ts +13 -15
  80. package/dist/platform/permission.d.ts +39 -0
  81. package/dist/platform/permission.test.d.ts +1 -0
  82. package/dist/platform/presence.d.ts +30 -30
  83. package/dist/platform/provider.d.ts +14 -76
  84. package/dist/platform/resource-source.d.ts +43 -45
  85. package/dist/platform/resource.d.ts +17 -23
  86. package/dist/platform/scope.d.ts +36 -62
  87. package/dist/platform/services.d.ts +4 -4
  88. package/dist/platform/settings.d.ts +0 -14
  89. package/dist/platform/storage.d.ts +2 -2
  90. package/dist/platform/sync-source.d.ts +196 -216
  91. package/dist/platform/transcript-cadence.d.ts +37 -41
  92. package/dist/platform/ui.d.ts +6 -6
  93. package/dist/text/endpoint.d.ts +11 -27
  94. package/package.json +3 -5
  95. package/dist/entities/note/types.d.ts +0 -14
  96. package/dist/entities/shopify/index.d.ts +0 -1
  97. package/dist/entities/shopify/types.d.ts +0 -79
  98. package/dist/platform/lifecycle.d.ts +0 -13
  99. package/dist/platform/reactive.d.ts +0 -13
  100. package/dist/platform/sdk.d.ts +0 -182
  101. package/dist/platform/service-registry.d.ts +0 -13
@@ -1,75 +1,71 @@
1
1
  import { TranscriptSegment } from './media';
2
2
  /**
3
- * Wanneer is er genoeg nieuw gezegd om opnieuw te gaan kijken?
3
+ * When has enough new been said to go looking again?
4
4
  *
5
- * Dit is de héle beslissing achter een live-meelezende assistent, en met opzet puur: geen
6
- * model, geen klok, geen store. Comms bepaalt *wanneer* (hier), de ai-app bepaalt *wat*.
5
+ * This is the *whole* decision behind a live-listening assistant, and deliberately pure: no model,
6
+ * no clock, no store. Comms decides *when* (here), the ai app decides *what*.
7
7
  *
8
- * De twee valkuilen die de drempels hieronder afdekken:
8
+ * The two traps the thresholds below cover:
9
9
  *
10
- * - **Te vaak.** De transcribe-route wordt elke ~3 seconden per actief gesprek geraakt. Zonder
11
- * vloer is dat 20 zoekrondes per minuut per gesprek, waarvan de meeste hetzelfde antwoord
12
- * opleveren omdat er één woord bij is gekomen.
13
- * - **Te gretig.** "Ja." en "Klopt." zijn nieuwe uitingen maar geen nieuw onderwerp. Daarom
14
- * telt niet alleen tijd, maar ook of de zoekvraag wérkelijk verschoven is.
10
+ * - **Too often.** The transcribe route is hit every ~3 seconds per active call. Without a floor
11
+ * that is 20 search rounds a minute per call, most of them returning the same answer because one
12
+ * word was added.
13
+ * - **Too eager.** "Ja." and "Klopt." are new utterances but not a new topic. So not only time
14
+ * counts, but whether the query has really shifted.
15
15
  *
16
- * De vergelijking gebeurt tegen de vorige **uitgevoerde** zoekvraag, niet tegen het vorige
17
- * venster: anders schuift het onderwerp mee met het venster en vuurt hij eeuwig door.
16
+ * The comparison runs against the previously **executed** query, not against the previous window:
17
+ * otherwise the topic slides along with the window and it fires forever.
18
18
  */
19
- /** Hoeveel gesprek er in de zoekvraag gaat. Ouder dan dit is niet meer waar het over gaat. */
19
+ /** How much conversation goes into the query. Older than this is no longer what it is about. */
20
20
  export declare const CADENCE_WINDOW_MS = 60000;
21
- /** Ondergrens tussen twee rondes, ongeacht hoeveel er gezegd is. */
21
+ /** Lower bound between two rounds, however much was said. */
22
22
  export declare const CADENCE_FLOOR_MS = 8000;
23
- /** Minder dan dit aantal nieuwe definitieve uitingen is nog geen nieuw onderwerp. */
23
+ /** Fewer than this many new final utterances is not a new topic yet. */
24
24
  export declare const CADENCE_MIN_NEW_SEGMENTS = 2;
25
- /** Onder dit aandeel nieuwe woorden gaat het nog over hetzelfde. */
25
+ /** Below this share of new words it is still about the same thing. */
26
26
  export declare const CADENCE_MIN_NOVELTY = 0.4;
27
- /** De losse woorden waar een zoekvraag op rust: kleine letters, zonder ruis, zonder dubbelen. */
27
+ /** The individual words a query rests on: lowercase, no noise, no duplicates. */
28
28
  export declare function extractTerms(text: string): string[];
29
29
  /**
30
- * Welk deel van waar het nú over gaat, is nog niet opgezocht? 1 is volledig nieuw, 0 is
31
- * precies dezelfde vraag.
30
+ * Which part of what it is about right now has not been looked up yet? 1 is entirely new, 0 is
31
+ * exactly the same question.
32
32
  *
33
- * Bewust asymmetrisch, en niet Jaccard. Het venster groeit terwijl de vorige zoekvraag
34
- * blijft staan, en Jaccard straft die groei af: hoe langer het gesprek over één onderwerp
35
- * doorgaat, hoe lager de symmetrische overlap wordt, tot hij alsnog vuurt. Dat is exact de
36
- * "vuurt eeuwig door"-fout die de vergelijking moest voorkomen. De vraag die telt is
37
- * eenzijdig: staat er iets nieuws op tafel?
33
+ * Deliberately asymmetric, and not Jaccard. The window grows while the previous query stays put,
34
+ * and Jaccard punishes that growth: the longer a conversation stays on one topic, the lower the
35
+ * symmetric overlap gets, until it fires anyway — exactly the "fires forever" bug the comparison
36
+ * had to prevent. The question that counts is one-sided: is there something new on the table?
38
37
  */
39
38
  export declare function novelty(current: readonly string[], previous: readonly string[]): number;
40
39
  /**
41
- * De laatste ~60 seconden gesproken tekst, schoongemaakt.
40
+ * The last ~60 seconds of spoken text, cleaned up.
42
41
  *
43
- * Het venster wordt gemeten vanaf de **laatste uiting**, niet vanaf de serverklok:
44
- * `startedAt`/`endedAt` van een segment komen van de transcriptieprovider en hoeven niet
45
- * dezelfde oorsprong te hebben als `Date.now()` hier. Onderling verschil is wél
46
- * betrouwbaar, en dat is alles wat een venster nodig heeft.
42
+ * The window is measured from the **last utterance**, not from the server clock: a segment's
43
+ * `startedAt`/`endedAt` come from the transcription provider and need not share an origin with
44
+ * `Date.now()` here. Their difference *is* reliable, and that is all a window needs.
47
45
  *
48
- * Partiële segmenten blijven eruit: die veranderen nog terwijl je ze leest.
46
+ * Partial segments stay out: those still change while you read them.
49
47
  */
50
48
  export declare function buildWindow(segments: readonly TranscriptSegment[], windowMs?: number): {
51
49
  text: string;
52
50
  segmentCount: number;
53
51
  };
54
52
  /**
55
- * Hoeveel getoonde sleutels we bijhouden. Een gesprek van een half uur kan er honderden
56
- * opleveren en de rij wordt bij elke flush in zijn geheel herschreven, dus dit is geen
57
- * geheugen maar een venster: wat eruit valt mag opnieuw verschijnen.
53
+ * How many shown keys we keep. A half-hour call can produce hundreds and the row is rewritten
54
+ * whole on every flush, so this is not memory but a window: what falls out may appear again.
58
55
  */
59
56
  export declare const MAX_SHOWN_KEYS = 60;
60
57
  /**
61
- * Wat dit gesprek al te zien heeft gekregen, plus wat er net bij kwam — zonder dubbelen en
62
- * begrensd. De oudste sleutels vallen eruit, want de nieuwste zijn de kaarten die nu op het
63
- * scherm staan.
58
+ * What this conversation has already been shown, plus what just came in — deduplicated and
59
+ * bounded. The oldest keys fall out, because the newest are the cards on screen right now.
64
60
  */
65
61
  export declare function mergeShownKeys(existing: readonly string[], shown: readonly string[], max?: number): string[];
66
- /** Wat er van de vorige ronde bewaard is. Leeg betekent "nog nooit gekeken". */
62
+ /** What was kept from the previous round. Empty means "never looked yet". */
67
63
  export interface CadenceState {
68
- /** Serverklok van de vorige ronde — alleen voor de vloer. */
64
+ /** Server clock of the previous round — only for the floor. */
69
65
  lastTriggerAt?: number;
70
- /** Aantal definitieve uitingen op dat moment — alleen voor "hoeveel is er bij gekomen". */
66
+ /** Number of final utterances at that moment — only for "how much was added". */
71
67
  lastSegmentCount?: number;
72
- /** De vorige uitgevoerde zoekvraag, waar de onderwerpwissel tegen gemeten wordt. */
68
+ /** The previously executed query, which the topic shift is measured against. */
73
69
  lastQueryTerms?: string[];
74
70
  }
75
71
  export type CadenceDecision = {
@@ -82,8 +78,8 @@ export type CadenceDecision = {
82
78
  segmentCount: number;
83
79
  };
84
80
  /**
85
- * Vier poorten, van goedkoop naar duur — de eerste die dichtblijft, is het antwoord.
86
- * `reason` is er zodat een gesprek dat níets oplevert te verklaren is zonder een debugger.
81
+ * Four gates, cheap to expensive — the first one that stays shut is the answer. `reason` exists so
82
+ * a conversation yielding nothing can be explained without a debugger.
87
83
  */
88
84
  export declare function decideCadence(input: {
89
85
  segments: readonly TranscriptSegment[];
@@ -5,8 +5,8 @@ export interface ModalConfig {
5
5
  id: string;
6
6
  displayName: string;
7
7
  resource: string;
8
- size?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl';
9
- position?: 'center' | 'top' | 'bottom' | 'left' | 'right' | 'corner' | 'sidebar';
8
+ size?: "sm" | "md" | "lg" | "xl" | "2xl" | "3xl";
9
+ position?: "center" | "top" | "bottom" | "left" | "right" | "corner" | "sidebar";
10
10
  props?: Record<string, any>;
11
11
  hideHeader?: boolean;
12
12
  }
@@ -22,7 +22,7 @@ export interface DockConfig {
22
22
  id: string;
23
23
  displayName: string;
24
24
  resource: string;
25
- size?: 'sm' | 'md' | 'lg' | 'xl';
25
+ size?: "sm" | "md" | "lg" | "xl";
26
26
  props?: Record<string, any>;
27
27
  hideHeader?: boolean;
28
28
  /**
@@ -98,7 +98,7 @@ export interface SettingsPageConfig {
98
98
  export interface ToastConfig {
99
99
  id: string;
100
100
  title?: string;
101
- type: 'success' | 'error' | 'warning' | 'info';
101
+ type: "success" | "error" | "warning" | "info";
102
102
  message?: string;
103
103
  duration?: number;
104
104
  /**
@@ -117,14 +117,14 @@ export interface ToastConfig {
117
117
  label: string;
118
118
  onClick: () => void;
119
119
  /** Visual emphasis of the action button. Defaults to `secondary`. */
120
- variant?: 'primary' | 'secondary';
120
+ variant?: "primary" | "secondary";
121
121
  }[];
122
122
  }
123
123
  /**
124
124
  * Well-known context kinds, kept for autocomplete; any app may declare its own
125
125
  * kind (e.g. "contact") via a context provider, so the type stays open.
126
126
  */
127
- export type ExtensionContext = 'global' | 'call' | 'interaction' | (string & {});
127
+ export type ExtensionContext = "global" | "call" | "interaction" | (string & {});
128
128
  export interface ExtensionConfig {
129
129
  id: string;
130
130
  slot: string;
@@ -1,18 +1,12 @@
1
1
  /**
2
2
  * One normalisation for communication endpoints — phone numbers, e-mail addresses
3
- * and the lookup keys built from them.
4
- *
5
- * Before this module there were five copies of `resource.replace(/[\s()-]/g, "")`
6
- * spread over eylo-voip, microsoft and three comms services, plus a sixth variant
7
- * with `+31` hardcoded. None of them turned a national number into an international
8
- * one, so `0882112121` never matched `+31882112121`. Every lookup key in the platform
9
- * has to be produced here, or the write side and the read side drift apart and the
10
- * index is worthless.
3
+ * and the lookup keys built from them. Every lookup key in the platform must be
4
+ * produced here, or the write and read sides drift apart and the index is worthless
5
+ * (ad-hoc copies never mapped `0882112121` onto `+31882112121`).
11
6
  *
12
7
  * Deliberately dependency-free: `libphonenumber-js` is ~145 kB for a rule we express
13
- * in a table. The honest cost is that we cannot validate per-country number *plans*,
14
- * only plausible lengths — so we reject implausible input instead of forcing it, and
15
- * callers keep the raw value for display.
8
+ * in a table. Cost: we validate plausible lengths, not per-country number plans — so
9
+ * we reject implausible input instead of forcing it; callers keep the raw value for display.
16
10
  */
17
11
  /** A dialling plan entry: enough to normalise, not enough to validate a number plan. */
18
12
  export interface PhoneRegion {
@@ -40,17 +34,9 @@ export declare const DEFAULT_PHONE_REGION = "NL";
40
34
  export declare function looksLikeEmail(value: string | undefined | null): boolean;
41
35
  /**
42
36
  * Turn any written form of a phone number into `+<callingCode><nsn>`, or `null` when
43
- * it cannot be resolved without guessing.
44
- *
45
- * | input | output |
46
- * |---|---|
47
- * | `+31 88 211 2121` | `+31882112121` |
48
- * | `0031882112121` | `+31882112121` |
49
- * | `088 211 2121` (region NL) | `+31882112121` |
50
- * | `882112121` | `null` — ambiguous, we do not guess |
51
- *
52
- * Resolution order for the region: an explicit `+` or `00` wins, then `defaultRegion`
53
- * (the organisation setting, or the region of the channel the call came in on).
37
+ * it cannot be resolved without guessing (a bare `882112121` is ambiguous → null).
38
+ * Region resolution: explicit `+`/`00` wins, then `defaultRegion` (organisation
39
+ * setting, or the region of the receiving channel).
54
40
  */
55
41
  export declare function toE164(raw: string | undefined | null, defaultRegion?: string): string | null;
56
42
  /**
@@ -86,11 +72,9 @@ export declare const PUBLIC_EMAIL_DOMAINS: Set<string>;
86
72
  /** True when a domain is consumer mail and must never identify a company. */
87
73
  export declare function isPublicEmailDomain(domain: string | undefined | null): boolean;
88
74
  /**
89
- * Does normalising this scheme need a phone region?
90
- *
91
- * Worth asking before resolving one: the region lives on the organisation, so fetching it
92
- * is a cross-app round trip, while an e-mail address has no region at all. A mail-only
93
- * lookup that resolves the region anyway pays for four internal RPCs it never uses.
75
+ * Does normalising this scheme need a phone region? Check before resolving one:
76
+ * the region lives on the organisation, so fetching it is a cross-app round trip
77
+ * a mail-only lookup would pay for nothing.
94
78
  */
95
79
  export declare function needsPhoneRegion(scheme: string | undefined | null): boolean;
96
80
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencxh/domain",
3
- "version": "1.171.0",
3
+ "version": "1.172.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -22,10 +22,8 @@
22
22
  "typecheck": "tsc --noEmit",
23
23
  "test": "vitest",
24
24
  "test:run": "vitest run",
25
- "test:watch": "vitest --watch"
26
- },
27
- "peerDependencies": {
28
- "rxjs": "^7.8.2"
25
+ "test:watch": "vitest --watch",
26
+ "lint": "biome check ."
29
27
  },
30
28
  "devDependencies": {
31
29
  "typescript": "6.0.3",
@@ -1,14 +0,0 @@
1
- /**
2
- * Data model for a single Note.
3
- */
4
- export interface Note {
5
- id: string;
6
- organizationId: string;
7
- interactionId: string;
8
- serviceName: string;
9
- authorId: string;
10
- authorDisplayName: string;
11
- content: string;
12
- createdAt: Date;
13
- updatedAt: Date;
14
- }
@@ -1 +0,0 @@
1
- export * from './types';
@@ -1,79 +0,0 @@
1
- /**
2
- * Shopify DTO's — gedeeld tussen de shopify-server (mapping uit Admin API),
3
- * platform-api (typed client) en de frontend-tool. Geen Shopify-SDK-types
4
- * lekken naar consumers; dit is de smalle, stabiele contractlaag.
5
- */
6
- export interface ShopifyCustomer {
7
- id: string;
8
- firstName?: string;
9
- lastName?: string;
10
- email?: string;
11
- phone?: string;
12
- ordersCount?: number;
13
- totalSpent?: string;
14
- currency?: string;
15
- /** Klant sinds — ISO-datum uit Shopify. */
16
- createdAt?: string;
17
- /** Shopify-klantlabels ("wholesale", "net-30"): segment, betaaltermijn, wat de shop erin zet. */
18
- tags?: string[];
19
- defaultAddress?: ShopifyAddress;
20
- }
21
- export interface ShopifyLineItem {
22
- title: string;
23
- variantTitle?: string;
24
- quantity: number;
25
- price: string;
26
- }
27
- export interface ShopifyTracking {
28
- company?: string;
29
- number?: string;
30
- url?: string;
31
- }
32
- export interface ShopifyAddress {
33
- name?: string;
34
- address1?: string;
35
- address2?: string;
36
- zip?: string;
37
- city?: string;
38
- province?: string;
39
- country?: string;
40
- phone?: string;
41
- }
42
- export interface ShopifyOrder {
43
- id: string;
44
- /** Human order-name, bv. "#1001". */
45
- name: string;
46
- createdAt: string;
47
- financialStatus?: string;
48
- fulfillmentStatus?: string;
49
- totalPrice: string;
50
- /** Opsplitsing van het totaal. Optioneel: oudere orders leveren niet elk veld. */
51
- subtotalPrice?: string;
52
- totalShipping?: string;
53
- totalTax?: string;
54
- currency: string;
55
- lineItems: ShopifyLineItem[];
56
- shippingAddress?: ShopifyAddress;
57
- tracking: ShopifyTracking[];
58
- note?: string;
59
- /** Deep-link naar de order in de Shopify-admin (nieuw tabblad). */
60
- adminUrl: string;
61
- }
62
- export interface ShopifyOrderEvent {
63
- id: string;
64
- createdAt: string;
65
- /** Mensvriendelijke omschrijving van het event. */
66
- message: string;
67
- /** Shopify "verb" (bv. "confirmed", "fulfilled", "sale"). */
68
- verb?: string;
69
- }
70
- export interface ShopifyLookupResult {
71
- /** False = geen verbonden/enabled shop voor deze org (admin moet koppelen). */
72
- connected: boolean;
73
- /** De shop waar dit uit komt, bv. "leufgens-shop.myshopify.com". */
74
- shopDomain?: string;
75
- customer: ShopifyCustomer | null;
76
- /** Deep-link naar de klant in de Shopify-admin. */
77
- customerAdminUrl?: string;
78
- orders: ShopifyOrder[];
79
- }
@@ -1,13 +0,0 @@
1
- export interface AppLifecycle {
2
- /** * On-load: Registreer services, menu-items en andere metadata.
3
- * Wordt éénmalig uitgevoerd bij het laden van de JS.
4
- */
5
- setup: () => void;
6
- /** * On-mount: Render de UI in de meegeleverde container.
7
- * Wordt uitgevoerd wanneer de gebruiker naar de app navigeert.
8
- */
9
- mount: (container: HTMLElement, props?: any) => void;
10
- /** * On-unmount: Ruim eventuele listeners of DOM-elementen op.
11
- */
12
- unmount: (container: HTMLElement) => void;
13
- }
@@ -1,13 +0,0 @@
1
- export interface Subscriber<T> {
2
- next: (value?: T) => void;
3
- error?: (err: any) => void;
4
- complete?: () => void;
5
- }
6
- export interface Observable<T> {
7
- subscribe(subscriber: Subscriber<T>): () => void;
8
- }
9
- export interface Result<T> {
10
- success: boolean;
11
- value?: T;
12
- error?: any;
13
- }
@@ -1,182 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import { InvokeOptions, SSEMessage } from './api';
3
- import { IncomingCallDecision } from './call-lines';
4
- import { CommsAccount, Session } from './communication';
5
- import { PlatformConfig, PlatformContext } from './kernel';
6
- import { AudioPipelineOptions, AudioSegment, MediaPermissionKind, MediaPermissionState, MediaPermissionStatus, TranscriptSegment } from './media';
7
- import { ServiceCallOptions, ServiceMap } from './services';
8
- import { DeepPartial, DeviceList, UserSettings } from './settings';
9
- import { ExtensionConfig, ToastConfig } from './ui';
10
- type ServiceKey<S extends ServiceMap> = keyof S;
11
- export type ParamsOf<S extends ServiceMap, K extends ServiceKey<S>> = S[K]['params'];
12
- export type PayloadOf<S extends ServiceMap, K extends ServiceKey<S>> = S[K]['payload'];
13
- export type ResponseOf<S extends ServiceMap, K extends ServiceKey<S>> = S[K]['response'];
14
- export type SSEHandlerOf<S extends ServiceMap, K extends ServiceKey<S>> = (payload: SSEMessage<PayloadOf<S, K>>) => Promise<void>;
15
- export interface InternalSDK<LocalServices extends ServiceMap = {}, TranslationKeys extends string = string, ModalKeys extends string = string, ExtensionKeys extends string = string> {
16
- readonly context: PlatformContext;
17
- readonly config: PlatformConfig;
18
- readonly services: {
19
- execute<K extends ServiceKey<LocalServices>>(key: K, options: ServiceCallOptions<ParamsOf<LocalServices, K>, PayloadOf<LocalServices, K>>): Promise<ResponseOf<LocalServices, K>>;
20
- observe<K extends ServiceKey<LocalServices>>(key: K, options: ServiceCallOptions<ParamsOf<LocalServices, K>, PayloadOf<LocalServices, K>>): Observable<ResponseOf<LocalServices, K>>;
21
- };
22
- readonly http: {
23
- invoke<R = any>(options: InvokeOptions): Promise<R>;
24
- };
25
- readonly router: {
26
- /** Relative to the app's own `/apps/{appName}` prefix. */
27
- navigate(path: string, options?: any): void;
28
- /**
29
- * Straight to a shell path, no prefix.
30
- *
31
- * For the app's `public: true` routes: those hang off the manifest's
32
- * `publicBasePath` (`/help/…`), so the app prefix would point at a page
33
- * that does not exist.
34
- */
35
- navigateAbsolute(path: string, options?: any): void;
36
- /**
37
- * Terug naar de vorige pagina — de echte, inclusief die van een andere app.
38
- *
39
- * Waarom dit hier hoort en niet per app: elk detailscherm heeft een terugknop, en zonder
40
- * gedeelde vorm wordt dat overal een vaste route ("terug" = altijd de lijst) die liegt zodra
41
- * je van een bord of uit een gesprek komt.
42
- *
43
- * `fallback` is app-relatief, net als {@link navigate}, en geldt alleen als er geen vorige
44
- * pagina ín deze sessie is — dat is precies het geval bij een koud geopende deeplink. Geef je
45
- * er geen, dan gebeurt er niets: uit het product lopen is geen taak van een terugknop.
46
- */
47
- back(fallback?: string): void;
48
- /** Is er een vorige pagina in deze sessie? Voor een knop die zichzelf wil verbergen. */
49
- canGoBack(): boolean;
50
- currentPath(): string;
51
- path$: Observable<string>;
52
- };
53
- readonly resources: {
54
- get<T = any>(appName: string, resourceKey: string): Promise<T>;
55
- };
56
- readonly localization: {
57
- /**
58
- * Vertaal een sleutel.
59
- *
60
- * Zonder `:` is het een sleutel van deze app zelf. Mét `:` is hij al genamespaced
61
- * (`"helpdesk:ticket.added.text"`) en wordt hij ongewijzigd opgezocht — nodig om tekst
62
- * te tonen die een andere app meestuurde bij iets wat wij renderen.
63
- */
64
- t(key: TranslationKeys | `${string}:${string}`, params?: Record<string, any>): string;
65
- /**
66
- * De actieve taal ("nl" | "en").
67
- *
68
- * Nodig zodra een app zélf iets moet opmaken in plaats van een sleutel op te
69
- * zoeken: `Intl.ListFormat` voor een opsomming, `toLocaleTimeString` voor een
70
- * tijd. Zonder dit viel dat terug op `navigator.language`, die niet meebeweegt
71
- * als de gebruiker de taal in de app omzet.
72
- */
73
- readonly currentLocale: string;
74
- };
75
- readonly ui: {
76
- modals: {
77
- open(key: ModalKeys, props?: any): void;
78
- close(key: ModalKeys): void;
79
- };
80
- docks: {
81
- open(key: string, props?: any): void;
82
- close(key: string): void;
83
- minimize(key: string, minimized?: boolean): void;
84
- expand(key: string, expanded?: boolean): void;
85
- };
86
- settings: {
87
- open(initialPageId?: string): void;
88
- close(): void;
89
- };
90
- toasts: {
91
- show(config: ToastConfig): void;
92
- close(id: string): void;
93
- };
94
- extensions: {
95
- getForSlot(slot: string): Observable<ExtensionConfig[]>;
96
- };
97
- };
98
- readonly communication: {
99
- sessions$: Observable<Session[]>;
100
- accounts$: Observable<CommsAccount[]>;
101
- activeSession$: Observable<Session | null>;
102
- /**
103
- * Routeert een TransportOp naar de provider die de gegeven session bezit.
104
- * Vervangt de losse hangupSession/handleSessionAction APIs.
105
- */
106
- dispatchSessionOp(sessionId: string, op: import('./communication').TransportOp): Promise<void>;
107
- /**
108
- * Initieert een nieuwe outbound sessie via `session.invite`. Sugar
109
- * voor `dispatchSessionOp` op het juiste provider; sessieId bestaat
110
- * pas na invite.
111
- */
112
- invite(target: string, accountId: string): Promise<void>;
113
- interceptStream(sessionId: string, callback: (stream: MediaStream) => void): Promise<() => void>;
114
- setActiveSession(sessionId: string): Promise<void>;
115
- /**
116
- * Mag dit inkomende gesprek rinkelen? Een transport-provider vraagt dit zodra
117
- * een invite binnenkomt, vóór het een sessie aanmaakt: het beleid ("zit ik al
118
- * in een gesprek") kijkt over providers heen, de provider vertaalt alleen het
119
- * antwoord naar zijn protocol (SIP 486 bijvoorbeeld).
120
- */
121
- admitIncomingCall(options?: {
122
- exceptSessionId?: string;
123
- }): Promise<IncomingCallDecision>;
124
- registerAccount(organizationId: string, userId: string, providerId: string, config: any): Promise<CommsAccount>;
125
- transcripts: {
126
- ingest(segments: TranscriptSegment[]): void;
127
- byCallSession$(sessionId: string): Observable<TranscriptSegment[]>;
128
- deltas$(sessionId: string): Observable<TranscriptSegment[]>;
129
- partials$(sessionId: string): Observable<TranscriptSegment>;
130
- persist(sessionId: string): Promise<void>;
131
- clear(sessionId: string): void;
132
- /**
133
- * `opts.from` is de index waar `segments` in het transcript begint: `0` is het hele
134
- * transcript, hoger maakt het een delta op wat de ontvanger al heeft. Zonder dat stuurde
135
- * elke flush (elke ~3s) de complete array opnieuw.
136
- */
137
- setPersister(fn: (sessionId: string, segments: TranscriptSegment[], opts: {
138
- finalize: boolean;
139
- from: number;
140
- }) => Promise<void>): void;
141
- };
142
- };
143
- readonly media: {
144
- localStream$: Observable<MediaStream | null>;
145
- audioSegments$: Observable<AudioSegment>;
146
- devices$: Observable<DeviceList>;
147
- permissions$: Observable<MediaPermissionStatus>;
148
- emitAudioSegment(segment: AudioSegment): void;
149
- configureAudioPipeline(opts: Partial<AudioPipelineOptions>): void;
150
- setAudioPipelineEnabled(enabled: boolean): void;
151
- setSessionAudioEnabled(sessionId: string, enabled: boolean): void;
152
- isSessionAudioPaused(sessionId: string): boolean;
153
- setInputDevice(deviceId: string): Promise<void>;
154
- acquireMicStream(deviceId?: string): Promise<MediaStream>;
155
- deviceChanges$: Observable<string>;
156
- toggleMute(mute?: boolean): void;
157
- attachProviderStream(sessionId: string, stream: MediaStream): void;
158
- detachStream(sessionId: string): void;
159
- setAudioOutput(deviceId: string): Promise<void>;
160
- getInputDevices(): MediaDeviceInfo[];
161
- getOutputDevices(): MediaDeviceInfo[];
162
- enumerateDevices(): Promise<void>;
163
- checkPermission(kind: MediaPermissionKind): Promise<MediaPermissionState>;
164
- requestPermission(kind: MediaPermissionKind): Promise<MediaPermissionState>;
165
- ensurePermission(kind: MediaPermissionKind): Promise<boolean>;
166
- refreshPermissions(): Promise<MediaPermissionStatus>;
167
- };
168
- readonly settings: {
169
- settings$: Observable<UserSettings>;
170
- get(): UserSettings;
171
- update(partial: DeepPartial<UserSettings>): void;
172
- getIceServers(): RTCIceServer[];
173
- getAudioInputDeviceId(): string;
174
- setAudioInputDeviceId(deviceId: string): void;
175
- getAudioOutputDeviceId(): string;
176
- setAudioOutputDeviceId(deviceId: string): void;
177
- getVideoDeviceId(): string;
178
- setVideoDeviceId(deviceId: string): void;
179
- setIceServers(servers: RTCIceServer[]): void;
180
- };
181
- }
182
- export {};
@@ -1,13 +0,0 @@
1
- import { Observable } from './reactive';
2
- export interface Command<TParams = any, TResponse = any> {
3
- params: TParams;
4
- response: TResponse;
5
- }
6
- export interface Query<TParams = any, TResponse = any> {
7
- params: TParams;
8
- response: TResponse;
9
- }
10
- export interface ServiceRegistry<TCommands extends Record<string, Command> = any, TQueries extends Record<string, Query> = any> {
11
- execute<K extends keyof TCommands>(name: K, params: TCommands[K]["params"]): Promise<TCommands[K]["response"]>;
12
- observe<K extends keyof TQueries>(name: K, params: TQueries[K]["params"]): Observable<TQueries[K]["response"]>;
13
- }