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