glitchgrab 1.65.2 → 1.66.1

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/dist/server.mjs CHANGED
@@ -360,6 +360,8 @@ function readCallListItem(value) {
360
360
  if (!isRecord(value) || typeof value.id !== "string") return null;
361
361
  return {
362
362
  id: value.id,
363
+ pageUrl: stringOrNull(value.pageUrl),
364
+ recordingPageUrl: stringOrNull(value.recordingPageUrl),
363
365
  title: stringOrNull(value.title),
364
366
  startsAt: stringOrNull(value.startsAt),
365
367
  endsAt: stringOrNull(value.endsAt),
@@ -445,6 +447,28 @@ async function deleteCall(id, options = {}) {
445
447
  return { deleted: false, error: "Could not delete the call" };
446
448
  }
447
449
  }
450
+ async function createCallIssueSession(callId, options = {}) {
451
+ try {
452
+ const wanted = typeof callId === "string" ? callId.trim() : "";
453
+ if (!wanted) return { ok: false, error: "No call id" };
454
+ const key = callsKey(options);
455
+ if (!key) return { ok: false, error: NO_KEY_ERROR };
456
+ const { data, error } = await callSdkApi("/api/v1/sdk/calls/issue-session", key, options, {
457
+ method: "POST",
458
+ body: { callId: wanted, ...options.reporter ? { reporter: options.reporter } : {} },
459
+ cache: "no-store"
460
+ });
461
+ if (error !== null) return { ok: false, error };
462
+ if (!isRecord(data) || typeof data.token !== "string") return { ok: false, error: "Unexpected response" };
463
+ return {
464
+ ok: true,
465
+ token: data.token,
466
+ expiresInSeconds: typeof data.expiresInSeconds === "number" ? data.expiresInSeconds : 900
467
+ };
468
+ } catch (e) {
469
+ return { ok: false, error: "Could not start the issue session" };
470
+ }
471
+ }
448
472
  var WEEKDAY = /^[1-7]$/;
449
473
  function readQuestionList(value) {
450
474
  if (!Array.isArray(value)) return null;
@@ -453,6 +477,7 @@ function readQuestionList(value) {
453
477
  return {
454
478
  id: (_a = stringOrNull(row.id)) != null ? _a : "",
455
479
  label: (_b = stringOrNull(row.label)) != null ? _b : "",
480
+ type: row.type === "text" ? "text" : "choice",
456
481
  options: Array.isArray(row.options) ? row.options.filter((option) => typeof option === "string") : [],
457
482
  required: row.required !== false
458
483
  };
@@ -555,7 +580,8 @@ function readBooking(value) {
555
580
  return {
556
581
  id: (_a2 = stringOrNull(row.id)) != null ? _a2 : "",
557
582
  question: (_b2 = stringOrNull(row.question)) != null ? _b2 : "",
558
- answer: (_c2 = stringOrNull(row.answer)) != null ? _c2 : ""
583
+ answer: (_c2 = stringOrNull(row.answer)) != null ? _c2 : "",
584
+ ...row.type === "text" ? { type: "text" } : {}
559
585
  };
560
586
  }).filter((row) => row.answer !== "") : [],
561
587
  status: (_f = stringOrNull(value.status)) != null ? _f : "CONFIRMED",
@@ -742,6 +768,8 @@ function readFollowUpDetail(value) {
742
768
  var _a2;
743
769
  return {
744
770
  id: c.id,
771
+ pageUrl: stringOrNull(c.pageUrl),
772
+ recordingPageUrl: stringOrNull(c.recordingPageUrl),
745
773
  status: stringOrNull(c.status),
746
774
  direction: stringOrNull(c.direction),
747
775
  at: (_a2 = stringOrNull(c.at)) != null ? _a2 : "",
@@ -1103,6 +1131,7 @@ export {
1103
1131
  cancelBooking,
1104
1132
  captureServerErrors,
1105
1133
  configureServerReporter,
1134
+ createCallIssueSession,
1106
1135
  deleteCall,
1107
1136
  dialFollowUp,
1108
1137
  disableCalling,