@ciridae/voice-conversations-react 0.0.0-stage → 0.1.0-nightly.0.bootstrap

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 (100) hide show
  1. package/README.md +30 -2
  2. package/components/BrowserTalkButton.tsx +96 -0
  3. package/components/CallBanner.tsx +43 -0
  4. package/components/CallCaptions.tsx +38 -0
  5. package/components/CallEntry.tsx +89 -0
  6. package/components/CallTranscript.tsx +58 -0
  7. package/components/RecentCallEntries.tsx +211 -0
  8. package/components/describeBrowserTalkError.ts +39 -0
  9. package/components/formatCallClock.ts +9 -0
  10. package/components/useEndPresentCall.ts +45 -0
  11. package/components/voiceCall.css +225 -0
  12. package/dist/MalformedVoiceResponseError.d.ts +6 -0
  13. package/dist/MalformedVoiceResponseError.js +9 -0
  14. package/dist/NumberToCallQrCode.d.ts +12 -0
  15. package/dist/NumberToCallQrCode.js +29 -0
  16. package/dist/PhoneNumberDialog.d.ts +25 -0
  17. package/dist/PhoneNumberDialog.js +333 -0
  18. package/dist/PhoneNumbersAdminPanel.d.ts +11 -0
  19. package/dist/PhoneNumbersAdminPanel.js +85 -0
  20. package/dist/VoiceApiError.d.ts +18 -0
  21. package/dist/VoiceApiError.js +19 -0
  22. package/dist/VoiceRequestTimedOutError.d.ts +6 -0
  23. package/dist/VoiceRequestTimedOutError.js +9 -0
  24. package/dist/averageSpeechBinsIntoBands.d.ts +6 -0
  25. package/dist/averageSpeechBinsIntoBands.js +20 -0
  26. package/dist/browserApisForBrowserTalk.d.ts +17 -0
  27. package/dist/browserApisForBrowserTalk.js +42 -0
  28. package/dist/browserTalkError.d.ts +36 -0
  29. package/dist/browserTalkError.js +1 -0
  30. package/dist/chooseCallToShowCaptionsOf.d.ts +22 -0
  31. package/dist/chooseCallToShowCaptionsOf.js +26 -0
  32. package/dist/createBrowserTalk.d.ts +56 -0
  33. package/dist/createBrowserTalk.js +414 -0
  34. package/dist/createBrowserTalkErrorFollower.d.ts +17 -0
  35. package/dist/createBrowserTalkErrorFollower.js +76 -0
  36. package/dist/createCallPresenceWatcher.d.ts +25 -0
  37. package/dist/createCallPresenceWatcher.js +66 -0
  38. package/dist/createLiveCallCaptionsPoller.d.ts +24 -0
  39. package/dist/createLiveCallCaptionsPoller.js +58 -0
  40. package/dist/createVisibleTabPoller.d.ts +13 -0
  41. package/dist/createVisibleTabPoller.js +56 -0
  42. package/dist/deriveCallPresence.d.ts +23 -0
  43. package/dist/deriveCallPresence.js +58 -0
  44. package/dist/describePhoneNumberError.d.ts +7 -0
  45. package/dist/describePhoneNumberError.js +29 -0
  46. package/dist/entries/index.d.ts +26 -0
  47. package/dist/entries/index.js +22 -0
  48. package/dist/followBrowserTalkErrorAgainstPresence.d.ts +23 -0
  49. package/dist/followBrowserTalkErrorAgainstPresence.js +52 -0
  50. package/dist/formatPhoneNumberAsTyped.d.ts +31 -0
  51. package/dist/formatPhoneNumberAsTyped.js +85 -0
  52. package/dist/generated/index.d.ts +1 -0
  53. package/dist/generated/index.js +2 -0
  54. package/dist/generated/types.gen.d.ts +795 -0
  55. package/dist/generated/types.gen.js +2 -0
  56. package/dist/getBrowserTalkForThisTab.d.ts +3 -0
  57. package/dist/getBrowserTalkForThisTab.js +13 -0
  58. package/dist/getCallPresenceWatcherForThisTab.d.ts +3 -0
  59. package/dist/getCallPresenceWatcherForThisTab.js +9 -0
  60. package/dist/mapStartBrowserTalkFailureToBrowserTalkError.d.ts +7 -0
  61. package/dist/mapStartBrowserTalkFailureToBrowserTalkError.js +60 -0
  62. package/dist/parseVoiceApiResponses.d.ts +11 -0
  63. package/dist/parseVoiceApiResponses.js +344 -0
  64. package/dist/readCallSummaryUntilItHasDuration.d.ts +12 -0
  65. package/dist/readCallSummaryUntilItHasDuration.js +45 -0
  66. package/dist/readTheBrowsersTimeZone.d.ts +8 -0
  67. package/dist/readTheBrowsersTimeZone.js +17 -0
  68. package/dist/readTimestampMilliseconds.d.ts +8 -0
  69. package/dist/readTimestampMilliseconds.js +10 -0
  70. package/dist/requestEndOfCall.d.ts +7 -0
  71. package/dist/requestEndOfCall.js +11 -0
  72. package/dist/startBrowserTalkErrorFollowerForThisTab.d.ts +6 -0
  73. package/dist/startBrowserTalkErrorFollowerForThisTab.js +12 -0
  74. package/dist/useAdminPhoneNumbers.d.ts +47 -0
  75. package/dist/useAdminPhoneNumbers.js +76 -0
  76. package/dist/useBrowserTalk.d.ts +10 -0
  77. package/dist/useBrowserTalk.js +23 -0
  78. package/dist/useBrowserTalkErrorWhileItApplies.d.ts +10 -0
  79. package/dist/useBrowserTalkErrorWhileItApplies.js +13 -0
  80. package/dist/useCallPresence.d.ts +5 -0
  81. package/dist/useCallPresence.js +34 -0
  82. package/dist/useCallSummaries.d.ts +9 -0
  83. package/dist/useCallSummaries.js +22 -0
  84. package/dist/useCallSummary.d.ts +15 -0
  85. package/dist/useCallSummary.js +21 -0
  86. package/dist/useFinePointerWithHover.d.ts +10 -0
  87. package/dist/useFinePointerWithHover.js +19 -0
  88. package/dist/useLiveCallCaptions.d.ts +8 -0
  89. package/dist/useLiveCallCaptions.js +27 -0
  90. package/dist/useLiveCallCaptionsOfLatestCall.d.ts +13 -0
  91. package/dist/useLiveCallCaptionsOfLatestCall.js +23 -0
  92. package/dist/usePhoneNumber.d.ts +45 -0
  93. package/dist/usePhoneNumber.js +125 -0
  94. package/dist/voiceApiModels.d.ts +85 -0
  95. package/dist/voiceApiModels.js +1 -0
  96. package/dist/voiceConversationsApi.d.ts +44 -0
  97. package/dist/voiceConversationsApi.js +227 -0
  98. package/dist/voiceConversationsSettings.d.ts +20 -0
  99. package/dist/voiceConversationsSettings.js +26 -0
  100. package/package.json +41 -4
@@ -0,0 +1,44 @@
1
+ import type { AdminAddedPhoneNumber, AdminListedPhoneNumber, CallId, CallCaptionsSoFar, CallSummary, CurrentCall, MemberPhoneNumber, PhoneNumberUploadReport, StartBrowserTalkRequest, BrowserTalkStarted } from "./voiceApiModels.js";
2
+ /**
3
+ * The member and admin routes over plain `fetch`, never the host's generated client, so a host
4
+ * interceptor that signs out on 401 never sees a passed-through provider 401 (design R7).
5
+ *
6
+ * A keepalive End is sent from `pagehide`, where an awaited token refresh may never resume, so it
7
+ * goes out synchronously with the auth headers of the last voice request. Every voice request
8
+ * refreshes them, and a live call reads presence every 2 s and captions every 1 s, so they are at
9
+ * most a few seconds old. A cookie-authenticated host is covered by `fetchCredentials` alone.
10
+ *
11
+ * Every read (`GET`), its `getAuthHeaders` call and its body included, fails with
12
+ * `VoiceRequestTimedOutError` when it has not finished within `VOICE_REQUEST_TIMEOUT_MS`, so one
13
+ * stuck token refresh, stalled fetch or stalled body fails into the caller's error path instead of
14
+ * stopping a tab's polling for good. Writes are not bounded: a browser talk start may wait on the backend's
15
+ * own session-create window, and abandoning it would leave a call this tab cannot end.
16
+ */
17
+ export declare const VOICE_REQUEST_TIMEOUT_MS = 30000;
18
+ export declare function postStartBrowserTalk(request: StartBrowserTalkRequest): Promise<BrowserTalkStarted>;
19
+ /** `end_requested`: the holder will close it; `already_ended`: it was over before this request. */
20
+ export type EndCallOutcome = "end_requested" | "already_ended";
21
+ /**
22
+ * `keepalive` is for a tab that is closing: the request is sent before this function first awaits,
23
+ * with the last known auth headers, and the browser delivers it after the page is gone.
24
+ */
25
+ export declare function postEndCall(callId: CallId, delivery: "keepalive" | "normal"): Promise<EndCallOutcome>;
26
+ export declare function getCurrentCall(): Promise<CurrentCall>;
27
+ export declare function getCallSummary(callId: CallId): Promise<CallSummary>;
28
+ export declare function getCallCaptions(callId: CallId): Promise<CallCaptionsSoFar>;
29
+ /** The signed-in member's saved number, or `{ phone_number: null }`. */
30
+ export declare function getOwnPhoneNumber(): Promise<MemberPhoneNumber>;
31
+ /** Saves the member's own number as typed; the backend removes spaces and dashes and checks E.164. */
32
+ export declare function putOwnPhoneNumber(typedPhoneNumber: string): Promise<MemberPhoneNumber>;
33
+ export declare function deleteOwnPhoneNumber(): Promise<void>;
34
+ /**
35
+ * Every saved number, read page by page until the last. A failed or malformed page fails the
36
+ * whole read, so a caller never shows part of the list as all of it.
37
+ */
38
+ export declare function getEveryAdminPhoneNumber(): Promise<AdminListedPhoneNumber[]>;
39
+ /** An admin removes one person's number by their Auth user id; 204 whether or not they had one. */
40
+ export declare function deleteAdminPhoneNumber(memberUserId: string): Promise<void>;
41
+ /** An admin adds one person's number; `member` is their email or Auth user id. */
42
+ export declare function postAdminPhoneNumber(member: string, typedPhoneNumber: string): Promise<AdminAddedPhoneNumber>;
43
+ /** An admin uploads a CSV with `email` and `phone_number` columns; every row is reported. */
44
+ export declare function postAdminPhoneNumberCsv(csv: Blob | string): Promise<PhoneNumberUploadReport>;
@@ -0,0 +1,227 @@
1
+ import { VoiceApiError } from "./VoiceApiError.js";
2
+ import { parseAdminAddedPhoneNumber, parseAdminPhoneNumbersPage, parseCallCaptions, parseCallSummary, parseCurrentCall, parseMemberPhoneNumber, parsePhoneNumberUploadReport, parseBrowserTalkStarted, parseVoiceErrorBody, } from "./parseVoiceApiResponses.js";
3
+ import { readVoiceConversationsSettings, } from "./voiceConversationsSettings.js";
4
+ import { MalformedVoiceResponseError } from "./MalformedVoiceResponseError.js";
5
+ import { VoiceRequestTimedOutError } from "./VoiceRequestTimedOutError.js";
6
+ /**
7
+ * The member and admin routes over plain `fetch`, never the host's generated client, so a host
8
+ * interceptor that signs out on 401 never sees a passed-through provider 401 (design R7).
9
+ *
10
+ * A keepalive End is sent from `pagehide`, where an awaited token refresh may never resume, so it
11
+ * goes out synchronously with the auth headers of the last voice request. Every voice request
12
+ * refreshes them, and a live call reads presence every 2 s and captions every 1 s, so they are at
13
+ * most a few seconds old. A cookie-authenticated host is covered by `fetchCredentials` alone.
14
+ *
15
+ * Every read (`GET`), its `getAuthHeaders` call and its body included, fails with
16
+ * `VoiceRequestTimedOutError` when it has not finished within `VOICE_REQUEST_TIMEOUT_MS`, so one
17
+ * stuck token refresh, stalled fetch or stalled body fails into the caller's error path instead of
18
+ * stopping a tab's polling for good. Writes are not bounded: a browser talk start may wait on the backend's
19
+ * own session-create window, and abandoning it would leave a call this tab cannot end.
20
+ */
21
+ export const VOICE_REQUEST_TIMEOUT_MS = 30000;
22
+ const HTTP_CREATED = 201;
23
+ const HTTP_ACCEPTED = 202;
24
+ const HTTP_NO_CONTENT = 204;
25
+ export async function postStartBrowserTalk(request) {
26
+ const route = "POST /browser-talks";
27
+ const response = await sendVoiceRequest("/browser-talks", {
28
+ method: "POST",
29
+ body: JSON.stringify(request),
30
+ });
31
+ if (response.status !== HTTP_CREATED)
32
+ throw await readVoiceApiError(route, response);
33
+ return parseBrowserTalkStarted(await readJsonBody(route, response));
34
+ }
35
+ /**
36
+ * `keepalive` is for a tab that is closing: the request is sent before this function first awaits,
37
+ * with the last known auth headers, and the browser delivers it after the page is gone.
38
+ */
39
+ export async function postEndCall(callId, delivery) {
40
+ const route = "POST /calls/{call_id}/end";
41
+ const path = `/calls/${encodeURIComponent(callId)}/end`;
42
+ const response = await (delivery === "keepalive"
43
+ ? sendVoiceRequestWithLastAuthHeaders(path, { method: "POST", keepalive: true })
44
+ : sendVoiceRequest(path, { method: "POST" }));
45
+ if (response.status === HTTP_ACCEPTED)
46
+ return "end_requested";
47
+ if (response.status === HTTP_NO_CONTENT)
48
+ return "already_ended";
49
+ throw await readVoiceApiError(route, response);
50
+ }
51
+ export async function getCurrentCall() {
52
+ const route = "GET /calls/current";
53
+ return readVoiceRoute(route, "/calls/current", async (response) => {
54
+ if (!response.ok)
55
+ throw await readVoiceApiError(route, response);
56
+ return parseCurrentCall(await readJsonBody(route, response));
57
+ });
58
+ }
59
+ export async function getCallSummary(callId) {
60
+ const route = "GET /calls/{call_id}";
61
+ return readVoiceRoute(route, `/calls/${encodeURIComponent(callId)}`, async (response) => {
62
+ if (!response.ok)
63
+ throw await readVoiceApiError(route, response);
64
+ return parseCallSummary(await readJsonBody(route, response));
65
+ });
66
+ }
67
+ export async function getCallCaptions(callId) {
68
+ const route = "GET /calls/{call_id}/captions";
69
+ return readVoiceRoute(route, `/calls/${encodeURIComponent(callId)}/captions`, async (response) => {
70
+ if (!response.ok)
71
+ throw await readVoiceApiError(route, response);
72
+ return parseCallCaptions(await readJsonBody(route, response));
73
+ });
74
+ }
75
+ /** The signed-in member's saved number, or `{ phone_number: null }`. */
76
+ export async function getOwnPhoneNumber() {
77
+ const route = "GET /me/phone-number";
78
+ return readVoiceRoute(route, "/me/phone-number", async (response) => {
79
+ if (!response.ok)
80
+ throw await readVoiceApiError(route, response);
81
+ return parseMemberPhoneNumber(route, await readJsonBody(route, response));
82
+ });
83
+ }
84
+ /** Saves the member's own number as typed; the backend removes spaces and dashes and checks E.164. */
85
+ export async function putOwnPhoneNumber(typedPhoneNumber) {
86
+ const route = "PUT /me/phone-number";
87
+ const response = await sendVoiceRequest("/me/phone-number", {
88
+ method: "PUT",
89
+ body: JSON.stringify({ phone_number: typedPhoneNumber }),
90
+ });
91
+ if (!response.ok)
92
+ throw await readVoiceApiError(route, response);
93
+ return parseMemberPhoneNumber(route, await readJsonBody(route, response));
94
+ }
95
+ export async function deleteOwnPhoneNumber() {
96
+ const route = "DELETE /me/phone-number";
97
+ const response = await sendVoiceRequest("/me/phone-number", { method: "DELETE" });
98
+ if (response.status !== HTTP_NO_CONTENT)
99
+ throw await readVoiceApiError(route, response);
100
+ }
101
+ /**
102
+ * Every saved number, read page by page until the last. A failed or malformed page fails the
103
+ * whole read, so a caller never shows part of the list as all of it.
104
+ */
105
+ export async function getEveryAdminPhoneNumber() {
106
+ const route = "GET /admin/phone-numbers";
107
+ const listed = [];
108
+ const seenCursors = new Set();
109
+ let after = null;
110
+ for (;;) {
111
+ const query = after === null ? "" : `?after=${encodeURIComponent(after)}`;
112
+ const page = await readVoiceRoute(route, `/admin/phone-numbers${query}`, async (response) => {
113
+ if (!response.ok)
114
+ throw await readVoiceApiError(route, response);
115
+ return parseAdminPhoneNumbersPage(await readJsonBody(route, response));
116
+ });
117
+ listed.push(...page.phone_numbers);
118
+ if (page.next_after === null)
119
+ return listed;
120
+ // A cursor sent twice would read the same pages forever.
121
+ if (seenCursors.has(page.next_after))
122
+ throw new MalformedVoiceResponseError(route, "body.next_after");
123
+ seenCursors.add(page.next_after);
124
+ after = page.next_after;
125
+ }
126
+ }
127
+ /** An admin removes one person's number by their Auth user id; 204 whether or not they had one. */
128
+ export async function deleteAdminPhoneNumber(memberUserId) {
129
+ const route = "DELETE /admin/phone-numbers/{member_user_id}";
130
+ const response = await sendVoiceRequest(`/admin/phone-numbers/${encodeURIComponent(memberUserId)}`, {
131
+ method: "DELETE",
132
+ });
133
+ if (response.status !== HTTP_NO_CONTENT)
134
+ throw await readVoiceApiError(route, response);
135
+ }
136
+ /** An admin adds one person's number; `member` is their email or Auth user id. */
137
+ export async function postAdminPhoneNumber(member, typedPhoneNumber) {
138
+ const route = "POST /admin/phone-numbers";
139
+ const response = await sendVoiceRequest("/admin/phone-numbers", {
140
+ method: "POST",
141
+ body: JSON.stringify({ member, phone_number: typedPhoneNumber }),
142
+ });
143
+ if (!response.ok)
144
+ throw await readVoiceApiError(route, response);
145
+ return parseAdminAddedPhoneNumber(await readJsonBody(route, response));
146
+ }
147
+ /** An admin uploads a CSV with `email` and `phone_number` columns; every row is reported. */
148
+ export async function postAdminPhoneNumberCsv(csv) {
149
+ const route = "POST /admin/phone-numbers/csv";
150
+ const response = await sendVoiceRequest("/admin/phone-numbers/csv", { method: "POST", body: csv }, "text/csv");
151
+ if (!response.ok)
152
+ throw await readVoiceApiError(route, response);
153
+ return parsePhoneNumberUploadReport(await readJsonBody(route, response));
154
+ }
155
+ /** The auth headers of the last voice request, for the settings that produced them. */
156
+ let lastAuthHeaders = null;
157
+ async function sendVoiceRequest(path, init, bodyContentType = "application/json") {
158
+ const settings = readVoiceConversationsSettings();
159
+ const authHeaders = await settings.getAuthHeaders();
160
+ // A read that timed out while its headers were awaited must not replace a later read's.
161
+ if (!init.signal?.aborted)
162
+ lastAuthHeaders = { settings, headers: authHeaders };
163
+ return fetchVoiceRoute(settings, authHeaders, path, init, bodyContentType);
164
+ }
165
+ /**
166
+ * A `GET` and the read of its answer, `getAuthHeaders` and the body included, within
167
+ * `VOICE_REQUEST_TIMEOUT_MS`; past it the fetch is aborted and `VoiceRequestTimedOutError` thrown.
168
+ */
169
+ async function readVoiceRoute(route, path, readAnswer) {
170
+ const abort = new AbortController();
171
+ let timer;
172
+ const timedOut = new Promise((_, reject) => {
173
+ timer = setTimeout(() => {
174
+ // Rejected before the abort, so the caller sees the timeout, not the fetch's AbortError.
175
+ reject(new VoiceRequestTimedOutError(route, VOICE_REQUEST_TIMEOUT_MS));
176
+ abort.abort();
177
+ }, VOICE_REQUEST_TIMEOUT_MS);
178
+ });
179
+ const read = async () => readAnswer(await sendVoiceRequest(path, { method: "GET", signal: abort.signal }));
180
+ try {
181
+ return await Promise.race([read(), timedOut]);
182
+ }
183
+ finally {
184
+ clearTimeout(timer);
185
+ }
186
+ }
187
+ /** Calls `fetch` before returning, so a `pagehide` listener can send it while the page unloads. */
188
+ function sendVoiceRequestWithLastAuthHeaders(path, init) {
189
+ const settings = readVoiceConversationsSettings();
190
+ let authHeaders = {};
191
+ if (lastAuthHeaders?.settings === settings)
192
+ authHeaders = lastAuthHeaders.headers;
193
+ else
194
+ console.warn(`No voice request has authenticated yet; sending ${init.method ?? "GET"} ${path} with fetch credentials only`);
195
+ return fetchVoiceRoute(settings, authHeaders, path, init, "application/json");
196
+ }
197
+ function fetchVoiceRoute(settings, authHeaders, path, init, bodyContentType) {
198
+ const headers = { Accept: "application/json", ...authHeaders };
199
+ if (init.body !== undefined)
200
+ headers["Content-Type"] = bodyContentType;
201
+ return fetch(`${settings.routePrefix}${path}`, {
202
+ ...init,
203
+ headers,
204
+ credentials: settings.fetchCredentials,
205
+ });
206
+ }
207
+ async function readJsonBody(route, response) {
208
+ try {
209
+ return await response.json();
210
+ }
211
+ catch {
212
+ throw new MalformedVoiceResponseError(route, "body");
213
+ }
214
+ }
215
+ async function readVoiceApiError(route, response) {
216
+ let body = null;
217
+ try {
218
+ body = await response.json();
219
+ }
220
+ catch {
221
+ // Not JSON: a host or proxy page, which the error below reports as the host's refusal.
222
+ }
223
+ const parsed = parseVoiceErrorBody(body);
224
+ if (parsed === null)
225
+ console.warn(`${route} answered ${String(response.status)} without the package's error body; reporting it as the host's refusal`);
226
+ return new VoiceApiError(route, response.status, parsed?.error.source ?? "host", parsed?.error.code ?? null, parsed?.error.call_id ?? null, parsed?.error.source === "voice_conversations" ? parsed.error.message : null);
227
+ }
@@ -0,0 +1,20 @@
1
+ /** How the hooks reach the host's backend. The host owns the URL and the authentication. */
2
+ export interface VoiceConversationsSettings {
3
+ /** Where the backend mounted the package routes, for example `/api/voice-conversations`. */
4
+ routePrefix: string;
5
+ /**
6
+ * Headers that authenticate the member on each request, such as a bearer token. The End sent
7
+ * when the tab closes reuses the last headers returned, up to a few seconds old, so a token must
8
+ * stay valid for at least that long after this returns it.
9
+ */
10
+ getAuthHeaders: () => Promise<Record<string, string>>;
11
+ /** `fetch` credentials mode, for hosts that authenticate with a cookie. */
12
+ fetchCredentials: RequestCredentials;
13
+ }
14
+ export type VoiceConversationsSettingsInput = Pick<VoiceConversationsSettings, "routePrefix"> & Partial<Omit<VoiceConversationsSettings, "routePrefix">>;
15
+ export declare class VoiceConversationsNotConfiguredError extends Error {
16
+ constructor();
17
+ }
18
+ /** Configure the hooks once, at app start, before any hook mounts. */
19
+ export declare function configureVoiceConversations(settings: VoiceConversationsSettingsInput): void;
20
+ export declare function readVoiceConversationsSettings(): VoiceConversationsSettings;
@@ -0,0 +1,26 @@
1
+ export class VoiceConversationsNotConfiguredError extends Error {
2
+ constructor() {
3
+ super("Call configureVoiceConversations(...) before using the voice conversation hooks");
4
+ this.name = "VoiceConversationsNotConfiguredError";
5
+ }
6
+ }
7
+ let configuredSettings = null;
8
+ /** Configure the hooks once, at app start, before any hook mounts. */
9
+ export function configureVoiceConversations(settings) {
10
+ configuredSettings = {
11
+ routePrefix: removeTrailingSlashes(settings.routePrefix),
12
+ getAuthHeaders: settings.getAuthHeaders ?? (() => Promise.resolve({})),
13
+ fetchCredentials: settings.fetchCredentials ?? "same-origin",
14
+ };
15
+ }
16
+ export function readVoiceConversationsSettings() {
17
+ if (configuredSettings === null)
18
+ throw new VoiceConversationsNotConfiguredError();
19
+ return configuredSettings;
20
+ }
21
+ function removeTrailingSlashes(routePrefix) {
22
+ let end = routePrefix.length;
23
+ while (end > 0 && routePrefix[end - 1] === "/")
24
+ end--;
25
+ return routePrefix.slice(0, end);
26
+ }
package/package.json CHANGED
@@ -1,6 +1,43 @@
1
1
  {
2
- "name": "@ciridae/voice-conversations-react",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
2
+ "name": "@ciridae/voice-conversations-react",
3
+ "version": "0.1.0-nightly.0.bootstrap",
4
+ "type": "module",
5
+ "private": false,
6
+ "description": "React hooks for Ciridae voice conversations: browser talks, call presence, live call captions, and a drop-in phone number dialog.",
7
+ "engines": {
8
+ "node": ">=22.18"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/ciridae-ai/ciridae.git",
13
+ "directory": "packages/voice-conversations-react"
14
+ },
15
+ "homepage": "https://github.com/ciridae-ai/ciridae#readme",
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "exports": {
20
+ "./package.json": "./package.json",
21
+ ".": {
22
+ "types": "./dist/entries/index.d.ts",
23
+ "default": "./dist/entries/index.js"
24
+ }
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "components",
29
+ "README.md"
30
+ ],
31
+ "peerDependencies": {
32
+ "@types/react": ">=18",
33
+ "react": ">=18"
34
+ },
35
+ "peerDependenciesMeta": {
36
+ "@types/react": {
37
+ "optional": true
38
+ }
39
+ },
40
+ "dependencies": {
41
+ "uqr": "0.1.3"
42
+ }
6
43
  }