glitchgrab 1.55.0 → 1.57.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/README.md +29 -0
- package/dist/index.d.mts +10 -3
- package/dist/index.d.ts +10 -3
- package/dist/index.js +98 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +97 -2
- package/dist/index.mjs.map +1 -1
- package/dist/server.d.mts +46 -2
- package/dist/server.d.ts +46 -2
- package/dist/server.js +48 -0
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +47 -0
- package/dist/server.mjs.map +1 -1
- package/dist/{types-DcDF1mXc.d.mts → types-DfVtKZcp.d.mts} +26 -1
- package/dist/{types-DcDF1mXc.d.ts → types-DfVtKZcp.d.ts} +26 -1
- package/package.json +1 -1
package/dist/server.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as ReportType, k as ReportSeverity, j as ReportResult } from './types-DfVtKZcp.mjs';
|
|
2
2
|
import 'react';
|
|
3
3
|
|
|
4
4
|
/** Who to attribute the report to. A server has no signed-in user, so this is the job or service. */
|
|
@@ -506,5 +506,49 @@ declare function cancelBooking(id: string, reason?: string, options?: CallsOptio
|
|
|
506
506
|
* Never throws: a value JSON cannot represent (circular, `undefined`) becomes `null`.
|
|
507
507
|
*/
|
|
508
508
|
declare function escapeJsonForScript(value: unknown): string;
|
|
509
|
+
/** One lead. One per phone number per project; a repeat submission updates it. */
|
|
510
|
+
interface Lead {
|
|
511
|
+
id: string;
|
|
512
|
+
name: string;
|
|
513
|
+
/** Digits only, country code included. */
|
|
514
|
+
phone: string;
|
|
515
|
+
email: string | null;
|
|
516
|
+
company: string | null;
|
|
517
|
+
address: string | null;
|
|
518
|
+
/** What your form passed as `source`, e.g. `"demo"`. */
|
|
519
|
+
source: string;
|
|
520
|
+
metadata: Record<string, string | number | boolean> | null;
|
|
521
|
+
/** The page the lead was left on. */
|
|
522
|
+
pageUrl: string | null;
|
|
523
|
+
/** How many times this phone submitted. */
|
|
524
|
+
submissions: number;
|
|
525
|
+
/** First submission. */
|
|
526
|
+
createdAt: string;
|
|
527
|
+
/** Latest submission. */
|
|
528
|
+
updatedAt: string;
|
|
529
|
+
/** The demo this lead went on to book, matched by phone or email. */
|
|
530
|
+
booking: {
|
|
531
|
+
id: string;
|
|
532
|
+
startsAt: string;
|
|
533
|
+
status: string;
|
|
534
|
+
} | null;
|
|
535
|
+
}
|
|
536
|
+
interface ListLeadsOptions extends CallsOptions {
|
|
537
|
+
/** Only leads with this `source`. */
|
|
538
|
+
source?: string;
|
|
539
|
+
/** Only leads first left at or after this time. */
|
|
540
|
+
since?: Date | string;
|
|
541
|
+
/** Up to 200. Defaults to 100. */
|
|
542
|
+
limit?: number;
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* The project's leads, newest first. Never throws — an empty list on any
|
|
546
|
+
* failure.
|
|
547
|
+
*
|
|
548
|
+
* ```ts
|
|
549
|
+
* const leads = await listLeads({ source: "demo" }); // GLITCHGRAB_CALLS_KEY=ggc_…
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
552
|
+
declare function listLeads(options?: ListLeadsOptions): Promise<Lead[]>;
|
|
509
553
|
|
|
510
|
-
export { type Booking, type BookingClientNotice, type BookingMutationResult, type BookingNotifyRecipient, type BookingSettings, type BookingSettingsResult, type BookingSettingsState, type BookingWorkingHours, type Call, type CallAudio, type CallListItem, type CallMoment, type CallParticipant, type CallsOptions, type CaptureServerErrorsOptions, type DeleteCallResult, type GetCallOptions, type Guide, type GuideReadOptions, type GuideSummary, type ListBookingsOptions, type ListCallsOptions, ReportResult, ReportSeverity, ReportType, type ServerReportOptions, type ServerReporterConfig, type ServerReporterIdentity, type SignSessionOptions, cancelBooking, captureServerErrors, configureServerReporter, deleteCall, escapeJsonForScript, getBookingSettings, getCall, getGuide, listBookings, listCalls, listGuides, reportServerError, rescheduleBooking, resetServerReporter, signSession, updateBookingSettings };
|
|
554
|
+
export { type Booking, type BookingClientNotice, type BookingMutationResult, type BookingNotifyRecipient, type BookingSettings, type BookingSettingsResult, type BookingSettingsState, type BookingWorkingHours, type Call, type CallAudio, type CallListItem, type CallMoment, type CallParticipant, type CallsOptions, type CaptureServerErrorsOptions, type DeleteCallResult, type GetCallOptions, type Guide, type GuideReadOptions, type GuideSummary, type Lead, type ListBookingsOptions, type ListCallsOptions, type ListLeadsOptions, ReportResult, ReportSeverity, ReportType, type ServerReportOptions, type ServerReporterConfig, type ServerReporterIdentity, type SignSessionOptions, cancelBooking, captureServerErrors, configureServerReporter, deleteCall, escapeJsonForScript, getBookingSettings, getCall, getGuide, listBookings, listCalls, listGuides, listLeads, reportServerError, rescheduleBooking, resetServerReporter, signSession, updateBookingSettings };
|
package/dist/server.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as ReportType, k as ReportSeverity, j as ReportResult } from './types-DfVtKZcp.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
|
|
4
4
|
/** Who to attribute the report to. A server has no signed-in user, so this is the job or service. */
|
|
@@ -506,5 +506,49 @@ declare function cancelBooking(id: string, reason?: string, options?: CallsOptio
|
|
|
506
506
|
* Never throws: a value JSON cannot represent (circular, `undefined`) becomes `null`.
|
|
507
507
|
*/
|
|
508
508
|
declare function escapeJsonForScript(value: unknown): string;
|
|
509
|
+
/** One lead. One per phone number per project; a repeat submission updates it. */
|
|
510
|
+
interface Lead {
|
|
511
|
+
id: string;
|
|
512
|
+
name: string;
|
|
513
|
+
/** Digits only, country code included. */
|
|
514
|
+
phone: string;
|
|
515
|
+
email: string | null;
|
|
516
|
+
company: string | null;
|
|
517
|
+
address: string | null;
|
|
518
|
+
/** What your form passed as `source`, e.g. `"demo"`. */
|
|
519
|
+
source: string;
|
|
520
|
+
metadata: Record<string, string | number | boolean> | null;
|
|
521
|
+
/** The page the lead was left on. */
|
|
522
|
+
pageUrl: string | null;
|
|
523
|
+
/** How many times this phone submitted. */
|
|
524
|
+
submissions: number;
|
|
525
|
+
/** First submission. */
|
|
526
|
+
createdAt: string;
|
|
527
|
+
/** Latest submission. */
|
|
528
|
+
updatedAt: string;
|
|
529
|
+
/** The demo this lead went on to book, matched by phone or email. */
|
|
530
|
+
booking: {
|
|
531
|
+
id: string;
|
|
532
|
+
startsAt: string;
|
|
533
|
+
status: string;
|
|
534
|
+
} | null;
|
|
535
|
+
}
|
|
536
|
+
interface ListLeadsOptions extends CallsOptions {
|
|
537
|
+
/** Only leads with this `source`. */
|
|
538
|
+
source?: string;
|
|
539
|
+
/** Only leads first left at or after this time. */
|
|
540
|
+
since?: Date | string;
|
|
541
|
+
/** Up to 200. Defaults to 100. */
|
|
542
|
+
limit?: number;
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* The project's leads, newest first. Never throws — an empty list on any
|
|
546
|
+
* failure.
|
|
547
|
+
*
|
|
548
|
+
* ```ts
|
|
549
|
+
* const leads = await listLeads({ source: "demo" }); // GLITCHGRAB_CALLS_KEY=ggc_…
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
552
|
+
declare function listLeads(options?: ListLeadsOptions): Promise<Lead[]>;
|
|
509
553
|
|
|
510
|
-
export { type Booking, type BookingClientNotice, type BookingMutationResult, type BookingNotifyRecipient, type BookingSettings, type BookingSettingsResult, type BookingSettingsState, type BookingWorkingHours, type Call, type CallAudio, type CallListItem, type CallMoment, type CallParticipant, type CallsOptions, type CaptureServerErrorsOptions, type DeleteCallResult, type GetCallOptions, type Guide, type GuideReadOptions, type GuideSummary, type ListBookingsOptions, type ListCallsOptions, ReportResult, ReportSeverity, ReportType, type ServerReportOptions, type ServerReporterConfig, type ServerReporterIdentity, type SignSessionOptions, cancelBooking, captureServerErrors, configureServerReporter, deleteCall, escapeJsonForScript, getBookingSettings, getCall, getGuide, listBookings, listCalls, listGuides, reportServerError, rescheduleBooking, resetServerReporter, signSession, updateBookingSettings };
|
|
554
|
+
export { type Booking, type BookingClientNotice, type BookingMutationResult, type BookingNotifyRecipient, type BookingSettings, type BookingSettingsResult, type BookingSettingsState, type BookingWorkingHours, type Call, type CallAudio, type CallListItem, type CallMoment, type CallParticipant, type CallsOptions, type CaptureServerErrorsOptions, type DeleteCallResult, type GetCallOptions, type Guide, type GuideReadOptions, type GuideSummary, type Lead, type ListBookingsOptions, type ListCallsOptions, type ListLeadsOptions, ReportResult, ReportSeverity, ReportType, type ServerReportOptions, type ServerReporterConfig, type ServerReporterIdentity, type SignSessionOptions, cancelBooking, captureServerErrors, configureServerReporter, deleteCall, escapeJsonForScript, getBookingSettings, getCall, getGuide, listBookings, listCalls, listGuides, listLeads, reportServerError, rescheduleBooking, resetServerReporter, signSession, updateBookingSettings };
|
package/dist/server.js
CHANGED
|
@@ -31,6 +31,7 @@ __export(server_exports, {
|
|
|
31
31
|
listBookings: () => listBookings,
|
|
32
32
|
listCalls: () => listCalls,
|
|
33
33
|
listGuides: () => listGuides,
|
|
34
|
+
listLeads: () => listLeads,
|
|
34
35
|
reportServerError: () => reportServerError,
|
|
35
36
|
rescheduleBooking: () => rescheduleBooking,
|
|
36
37
|
resetServerReporter: () => resetServerReporter,
|
|
@@ -619,6 +620,52 @@ function escapeJsonForScript(value) {
|
|
|
619
620
|
return "null";
|
|
620
621
|
}
|
|
621
622
|
}
|
|
623
|
+
function readLead(value) {
|
|
624
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
625
|
+
if (!isRecord(value) || typeof value.id !== "string") return null;
|
|
626
|
+
const metadata = isRecord(value.metadata) ? value.metadata : null;
|
|
627
|
+
const booking = isRecord(value.booking) && typeof value.booking.id === "string" ? {
|
|
628
|
+
id: value.booking.id,
|
|
629
|
+
startsAt: (_a = stringOrNull(value.booking.startsAt)) != null ? _a : "",
|
|
630
|
+
status: (_b = stringOrNull(value.booking.status)) != null ? _b : "CONFIRMED"
|
|
631
|
+
} : null;
|
|
632
|
+
return {
|
|
633
|
+
id: value.id,
|
|
634
|
+
name: (_c = stringOrNull(value.name)) != null ? _c : "",
|
|
635
|
+
phone: (_d = stringOrNull(value.phone)) != null ? _d : "",
|
|
636
|
+
email: stringOrNull(value.email),
|
|
637
|
+
company: stringOrNull(value.company),
|
|
638
|
+
address: stringOrNull(value.address),
|
|
639
|
+
source: (_e = stringOrNull(value.source)) != null ? _e : "",
|
|
640
|
+
metadata,
|
|
641
|
+
pageUrl: stringOrNull(value.pageUrl),
|
|
642
|
+
submissions: typeof value.submissions === "number" ? value.submissions : 1,
|
|
643
|
+
createdAt: (_f = stringOrNull(value.createdAt)) != null ? _f : "",
|
|
644
|
+
updatedAt: (_g = stringOrNull(value.updatedAt)) != null ? _g : "",
|
|
645
|
+
booking
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
async function listLeads(options = {}) {
|
|
649
|
+
try {
|
|
650
|
+
const key = callsKey(options);
|
|
651
|
+
if (!key) return [];
|
|
652
|
+
const query = new URLSearchParams();
|
|
653
|
+
if (options.source) query.set("source", options.source);
|
|
654
|
+
if (options.since) {
|
|
655
|
+
const since = options.since instanceof Date ? options.since : new Date(options.since);
|
|
656
|
+
if (!Number.isNaN(since.getTime())) query.set("since", since.toISOString());
|
|
657
|
+
}
|
|
658
|
+
setNumber(query, "limit", options.limit);
|
|
659
|
+
const qs = query.toString();
|
|
660
|
+
const { data } = await callSdkApi(`/api/v1/sdk/leads${qs ? `?${qs}` : ""}`, key, options, {
|
|
661
|
+
cache: "no-store"
|
|
662
|
+
});
|
|
663
|
+
if (!Array.isArray(data)) return [];
|
|
664
|
+
return data.map(readLead).filter((lead) => lead !== null);
|
|
665
|
+
} catch (e) {
|
|
666
|
+
return [];
|
|
667
|
+
}
|
|
668
|
+
}
|
|
622
669
|
// Annotate the CommonJS export names for ESM import in node:
|
|
623
670
|
0 && (module.exports = {
|
|
624
671
|
cancelBooking,
|
|
@@ -632,6 +679,7 @@ function escapeJsonForScript(value) {
|
|
|
632
679
|
listBookings,
|
|
633
680
|
listCalls,
|
|
634
681
|
listGuides,
|
|
682
|
+
listLeads,
|
|
635
683
|
reportServerError,
|
|
636
684
|
rescheduleBooking,
|
|
637
685
|
resetServerReporter,
|