@gemies/sdk 10.16.0 → 10.18.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @gemies/sdk
2
2
 
3
+ ## 10.18.0
4
+
5
+ ### A gemie's phone
6
+
7
+ `@gemies/sdk/calls` gains `CallWire.provider`, the `GemiePhoneState` of `GET /calls/phone/:gemieId`
8
+ (the line, its "Gemie phone credit", the plan's fixed monthly allowance and the owner's monthly
9
+ limit), and the error codes `rate_not_available`, `phone_credit_required`, `phone_spend_cap_reached`
10
+ and `emergency_number_not_supported`. Emergency calls are not supported: show
11
+ `GemiePhoneState.emergencyCalls.notice` where a phone is set up. Credit-pack checkout takes an
12
+ optional `gemieId` to top up a gemie's phone credit instead of the buyer's own.
13
+
14
+ ## 10.17.0
15
+
16
+ ### Phone calls are switched on per country
17
+
18
+ `@gemies/sdk/calls` gains the `pstn_not_enabled` error code (phone calls are not available in that
19
+ country yet), and `CallChannelsState.own_number.status` is now `available` or `not_configured`.
20
+
3
21
  ## 10.16.0
4
22
 
5
23
  ### Phone calls a person approves
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gemies/sdk",
3
- "version": "10.16.0",
3
+ "version": "10.18.0",
4
4
  "description": "The Gemies SDK: the conversation runtime, chat UI, voice calls and dictation for Oxy apps that talk to a gemie",
5
5
  "main": "src/index.ts",
6
6
  "react-native": "src/index.ts",
package/src/calls.ts CHANGED
@@ -46,6 +46,9 @@ export const CALL_END_REASONS = [
46
46
  ] as const;
47
47
  export type CallEndReason = (typeof CALL_END_REASONS)[number];
48
48
 
49
+ export const CALL_PROVIDERS = ['livekit', 'twilio'] as const;
50
+ export type CallProvider = (typeof CALL_PROVIDERS)[number];
51
+
49
52
  export const CALL_SPEAKERS = ['gemie', 'user', 'third_party'] as const;
50
53
  export type CallSpeaker = (typeof CALL_SPEAKERS)[number];
51
54
 
@@ -65,6 +68,11 @@ export const CALL_ERROR_CODES = [
65
68
  'number_unavailable',
66
69
  'credits_exhausted',
67
70
  'provider_error',
71
+ 'pstn_not_enabled',
72
+ 'rate_not_available',
73
+ 'phone_credit_required',
74
+ 'phone_spend_cap_reached',
75
+ 'emergency_number_not_supported',
68
76
  ] as const;
69
77
  export type CallErrorCode = (typeof CALL_ERROR_CODES)[number];
70
78
 
@@ -87,6 +95,8 @@ export interface CallWire {
87
95
  readonly direction: CallDirection;
88
96
  readonly status: CallStatus;
89
97
  readonly endReason: CallEndReason | null;
98
+ /** The telephony provider a phone call runs on; `null` on `app`. */
99
+ readonly provider: CallProvider | null;
90
100
  /** The gemie; `null` is Alia. */
91
101
  readonly agentId: string | null;
92
102
  readonly agentName: string | null;
@@ -128,7 +138,7 @@ export interface CallChannelsState {
128
138
  readonly status: 'available' | 'caller_id_required' | 'not_configured';
129
139
  readonly phoneNumber: string | null;
130
140
  };
131
- readonly own_number: { readonly status: 'not_enabled' };
141
+ readonly own_number: { readonly status: 'available' | 'not_configured' };
132
142
  }
133
143
 
134
144
  /** `GET /calls/caller-id`'s `callerId`: the number the person calls from. */
@@ -148,3 +158,58 @@ export interface StartedCallerIdVerification {
148
158
  readonly phoneNumber: string;
149
159
  readonly expiresAt: string;
150
160
  }
161
+
162
+ /* ------------------------------- a gemie's phone ------------------------------- */
163
+
164
+ export const GEMIE_PHONE_LINE_STATUSES = ['none', 'active', 'paused', 'cancelled'] as const;
165
+ export type GemiePhoneLineStatus = (typeof GEMIE_PHONE_LINE_STATUSES)[number];
166
+
167
+ export interface GemiePhoneRate {
168
+ /** ISO country of the other end. */
169
+ readonly country: string;
170
+ readonly destinationType: 'landline' | 'mobile' | 'inbound';
171
+ /** VAT included, in euros. */
172
+ readonly eurPerMinute: number;
173
+ }
174
+
175
+ export interface GemiePhoneLedgerEntry {
176
+ readonly id: string;
177
+ readonly kind: 'top_up' | 'usage' | 'line_fee' | 'allowance';
178
+ /** Credits added (positive) or spent (negative). */
179
+ readonly credits: number;
180
+ readonly description: string;
181
+ readonly at: string;
182
+ }
183
+
184
+ /**
185
+ * `GET /calls/phone/:gemieId`: a gemie's phone as its owner reads it. The line, the "Gemie phone
186
+ * credit", what the plan includes each month, and the owner's own monthly limit.
187
+ */
188
+ export interface GemiePhoneState {
189
+ readonly gemieId: string;
190
+ readonly line: {
191
+ readonly phoneNumber: string | null;
192
+ readonly status: GemiePhoneLineStatus;
193
+ readonly paidThrough: string | null;
194
+ /** VAT included, in euros a month; null when no price is set. */
195
+ readonly monthlyFeeEur: number | null;
196
+ readonly feeWaivedByPlan: boolean;
197
+ };
198
+ readonly credit: { readonly credits: number; readonly held: number };
199
+ readonly allowance: {
200
+ /** A fixed number of minutes a month; 0 when the plan includes none. */
201
+ readonly includedMinutes: number;
202
+ readonly usedMinutes: number;
203
+ readonly remainingMinutes: number;
204
+ readonly resetsAt: string;
205
+ };
206
+ readonly spendCap: {
207
+ /** The owner's monthly limit on what this gemie's phone draws from its credit; null: none. */
208
+ readonly monthlyCapCredits: number | null;
209
+ readonly spentCredits: number;
210
+ };
211
+ readonly rates: readonly GemiePhoneRate[];
212
+ /** Always false: show `notice` where a phone is set up. */
213
+ readonly emergencyCalls: { readonly supported: false; readonly notice: string };
214
+ readonly ledger: readonly GemiePhoneLedgerEntry[];
215
+ }