glitchgrab 1.63.0 → 1.64.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 +28 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +43 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -10
- package/dist/index.mjs.map +1 -1
- package/dist/server.d.mts +238 -2
- package/dist/server.d.ts +238 -2
- package/dist/server.js +153 -2
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +145 -2
- package/dist/server.mjs.map +1 -1
- package/dist/{types-Dp5Sh_hd.d.mts → types-Dw587jLi.d.mts} +5 -1
- package/dist/{types-Dp5Sh_hd.d.ts → types-Dw587jLi.d.ts} +5 -1
- package/package.json +1 -1
package/dist/server.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ReportType, m as ReportSeverity, l as ReportResult } from './types-
|
|
1
|
+
import { n as ReportType, m as ReportSeverity, l as ReportResult } from './types-Dw587jLi.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. */
|
|
@@ -898,6 +898,9 @@ type LineCallerResult = {
|
|
|
898
898
|
* `CALLERS_OFF` (the line's owner switched it off), `CALLER_CAP` (10 per line).
|
|
899
899
|
* Never throws.
|
|
900
900
|
*
|
|
901
|
+
* `ownerId` = seat them on that customer's own line (#716 — one line per
|
|
902
|
+
* PracticeStacks firm). Omitted = the project's line.
|
|
903
|
+
*
|
|
901
904
|
* ```ts
|
|
902
905
|
* const r = await addLineCaller({ email: admin.email, name: admin.name });
|
|
903
906
|
* if (r.ok) openMyPhones(r.numbers);
|
|
@@ -907,7 +910,240 @@ declare function addLineCaller(caller: {
|
|
|
907
910
|
email: string;
|
|
908
911
|
name: string;
|
|
909
912
|
phone?: string;
|
|
913
|
+
ownerId?: string;
|
|
910
914
|
}, options?: CallsOptions): Promise<LineCallerResult>;
|
|
915
|
+
/** Fields every `call.*` webhook carries (#716). `refKey`/`ownerId` are null when not set. */
|
|
916
|
+
interface CallWebhookBase {
|
|
917
|
+
callId: string;
|
|
918
|
+
repoId: string | null;
|
|
919
|
+
lineId: string | null;
|
|
920
|
+
direction: "outbound" | "inbound" | null;
|
|
921
|
+
/** The other party, E.164. */
|
|
922
|
+
peer: string | null;
|
|
923
|
+
/** What you passed to {@link placeCall}. */
|
|
924
|
+
refKey: string | null;
|
|
925
|
+
/** The customer whose line carried the call. */
|
|
926
|
+
ownerId: string | null;
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
* The body Glitchgrab POSTs to your webhook for a phone call, signed with
|
|
930
|
+
* `X-Glitchgrab-Signature: sha256=<hex HMAC of the raw body>`. Narrow on `event`.
|
|
931
|
+
*/
|
|
932
|
+
type CallWebhook = {
|
|
933
|
+
event: "call.started";
|
|
934
|
+
timestamp: string;
|
|
935
|
+
data: CallWebhookBase & {
|
|
936
|
+
ringing: string;
|
|
937
|
+
};
|
|
938
|
+
} | {
|
|
939
|
+
event: "call.answered";
|
|
940
|
+
timestamp: string;
|
|
941
|
+
data: CallWebhookBase & {
|
|
942
|
+
answeredAt: string;
|
|
943
|
+
};
|
|
944
|
+
} | {
|
|
945
|
+
event: "call.completed";
|
|
946
|
+
timestamp: string;
|
|
947
|
+
data: CallWebhookBase & {
|
|
948
|
+
/** RECORDED = they talked; NO_ANSWER (+ missedBy); FAILED. */
|
|
949
|
+
status: string;
|
|
950
|
+
missedBy: "operator" | "customer" | null;
|
|
951
|
+
durationSec: number | null;
|
|
952
|
+
hangupCause: string | null;
|
|
953
|
+
};
|
|
954
|
+
} | {
|
|
955
|
+
event: "call.recording_ready";
|
|
956
|
+
timestamp: string;
|
|
957
|
+
data: Omit<CallWebhookBase, "lineId"> & {
|
|
958
|
+
durationSec: number | null;
|
|
959
|
+
};
|
|
960
|
+
} | {
|
|
961
|
+
event: "call.summary_ready";
|
|
962
|
+
timestamp: string;
|
|
963
|
+
data: Pick<CallWebhookBase, "callId" | "repoId" | "refKey" | "ownerId"> & {
|
|
964
|
+
/** "phone", "bot" or "extension". */
|
|
965
|
+
recorder: string;
|
|
966
|
+
title: string | null;
|
|
967
|
+
summary: string | null;
|
|
968
|
+
};
|
|
969
|
+
};
|
|
970
|
+
/** `phone.*` webhooks for a customer's automatic line (#716). Same signing as {@link CallWebhook}. */
|
|
971
|
+
type PhoneLineWebhook = {
|
|
972
|
+
event: "phone.kyc_status";
|
|
973
|
+
timestamp: string;
|
|
974
|
+
data: {
|
|
975
|
+
ownerId: string;
|
|
976
|
+
status: string;
|
|
977
|
+
reason: string | null;
|
|
978
|
+
};
|
|
979
|
+
} | {
|
|
980
|
+
event: "phone.line_ready";
|
|
981
|
+
timestamp: string;
|
|
982
|
+
data: {
|
|
983
|
+
ownerId: string;
|
|
984
|
+
number: string;
|
|
985
|
+
lineId: string;
|
|
986
|
+
};
|
|
987
|
+
};
|
|
988
|
+
type PlaceCallResult = {
|
|
989
|
+
ok: true;
|
|
990
|
+
callId: string;
|
|
991
|
+
ringing: string;
|
|
992
|
+
ringNumbers: string[];
|
|
993
|
+
from: string;
|
|
994
|
+
} | {
|
|
995
|
+
ok: false;
|
|
996
|
+
error: string;
|
|
997
|
+
code?: string;
|
|
998
|
+
};
|
|
999
|
+
/**
|
|
1000
|
+
* Start a recorded call from your own screen (#716) — Glitchgrab rings
|
|
1001
|
+
* `operator`'s verified phone from the line, then bridges to `to`. No
|
|
1002
|
+
* follow-up is created; use {@link dialFollowUp} for that.
|
|
1003
|
+
*
|
|
1004
|
+
* `ownerId` = call from that customer's own line (one line per PracticeStacks
|
|
1005
|
+
* firm); the operator must be seated on it ({@link addLineCaller} with the
|
|
1006
|
+
* same `ownerId`). `refKey` = your own key for what the call is about — every
|
|
1007
|
+
* `call.*` webhook (`call.started`, `call.answered`, `call.completed`,
|
|
1008
|
+
* `call.recording_ready`, `call.summary_ready`) carries it back with `ownerId`.
|
|
1009
|
+
* Check your own permissions before calling this. Refusals carry `code`:
|
|
1010
|
+
* `NOT_ON_LINE`, `NO_VERIFIED_NUMBER`, `RING_PHONE_NOT_YOURS`. Never throws.
|
|
1011
|
+
*
|
|
1012
|
+
* ```ts
|
|
1013
|
+
* const r = await placeCall({
|
|
1014
|
+
* operator: { email: staff.email },
|
|
1015
|
+
* to: client.phone,
|
|
1016
|
+
* ownerId: firm.id,
|
|
1017
|
+
* refKey: client.id,
|
|
1018
|
+
* }); // GLITCHGRAB_CALLS_KEY=ggc_…
|
|
1019
|
+
* ```
|
|
1020
|
+
*/
|
|
1021
|
+
declare function placeCall(call: {
|
|
1022
|
+
operator: FollowUpOperator;
|
|
1023
|
+
to: string;
|
|
1024
|
+
ownerId?: string;
|
|
1025
|
+
refKey?: string;
|
|
1026
|
+
title?: string;
|
|
1027
|
+
ringPhone?: string;
|
|
1028
|
+
}, options?: CallsOptions): Promise<PlaceCallResult>;
|
|
1029
|
+
interface PhoneLineInfo {
|
|
1030
|
+
number: string;
|
|
1031
|
+
label: string | null;
|
|
1032
|
+
active: boolean;
|
|
1033
|
+
/** People seated on it; anyone else gets `NOT_ON_LINE`. */
|
|
1034
|
+
callers: number;
|
|
1035
|
+
}
|
|
1036
|
+
/** Where a customer's automatic line is up to (#716). */
|
|
1037
|
+
interface PhoneLineRequest {
|
|
1038
|
+
/** Plivo's KYC status: submitted | accepted | rejected | suspended | expired. */
|
|
1039
|
+
kycStatus: string;
|
|
1040
|
+
/** Why Plivo rejected it — show it to the firm so they can fix and resubmit. */
|
|
1041
|
+
kycReason: string | null;
|
|
1042
|
+
/** The firm agreed to the monthly charge ({@link enableCalling}). */
|
|
1043
|
+
enabled: boolean;
|
|
1044
|
+
/** NONE | BUYING | BOUGHT | FAILED (retried automatically). */
|
|
1045
|
+
buyState: string;
|
|
1046
|
+
buyError: string | null;
|
|
1047
|
+
number: string | null;
|
|
1048
|
+
}
|
|
1049
|
+
interface PhoneLineStatus {
|
|
1050
|
+
line: PhoneLineInfo | null;
|
|
1051
|
+
/** Null when no KYC was submitted for this customer. */
|
|
1052
|
+
request: PhoneLineRequest | null;
|
|
1053
|
+
}
|
|
1054
|
+
/**
|
|
1055
|
+
* A customer's phone line and, when you submitted their KYC, how far the
|
|
1056
|
+
* automatic purchase has got (#716) — for the firm's "Calling" settings:
|
|
1057
|
+
* no request → "Submit KYC"; `kycStatus: "rejected"` → show `kycReason`;
|
|
1058
|
+
* accepted but `enabled: false` → "Turn on calling (₹… /month)"; `line` set →
|
|
1059
|
+
* ready. `ownerId` omitted = the project's own line. `null` only on failure
|
|
1060
|
+
* (no key, network). Never throws.
|
|
1061
|
+
*/
|
|
1062
|
+
declare function getPhoneLine(params?: {
|
|
1063
|
+
ownerId?: string;
|
|
1064
|
+
}, options?: CallsOptions): Promise<PhoneLineStatus | null>;
|
|
1065
|
+
type LineRequestResult = {
|
|
1066
|
+
ok: true;
|
|
1067
|
+
request: PhoneLineRequest;
|
|
1068
|
+
} | {
|
|
1069
|
+
ok: false;
|
|
1070
|
+
error: string;
|
|
1071
|
+
code?: string;
|
|
1072
|
+
};
|
|
1073
|
+
/**
|
|
1074
|
+
* Submit a customer's KYC so they get their own phone number (#716). Plivo
|
|
1075
|
+
* reviews it (usually minutes, sometimes a day); the `phone.kyc_status`
|
|
1076
|
+
* webhook says when. Rejected → fix and call again. Certificates: PDF, JPG or
|
|
1077
|
+
* PNG, under 4 MB together; they go straight to Plivo, Glitchgrab keeps no
|
|
1078
|
+
* copy. Refusals carry `code`: `KYC_PENDING`, `KYC_DONE`, `BAD_FILE`,
|
|
1079
|
+
* `PROVIDER`. Nothing is bought until {@link enableCalling}. Never throws.
|
|
1080
|
+
*/
|
|
1081
|
+
declare function submitPhoneKyc(kyc: {
|
|
1082
|
+
ownerId: string;
|
|
1083
|
+
/** Legal name, as on the certificates. */
|
|
1084
|
+
businessName: string;
|
|
1085
|
+
email: string;
|
|
1086
|
+
addressLine1: string;
|
|
1087
|
+
city: string;
|
|
1088
|
+
state: string;
|
|
1089
|
+
/** 6-digit PIN code. */
|
|
1090
|
+
postalCode: string;
|
|
1091
|
+
registrationCertificate: Blob;
|
|
1092
|
+
gstCertificate: Blob;
|
|
1093
|
+
}, options?: CallsOptions): Promise<LineRequestResult>;
|
|
1094
|
+
/**
|
|
1095
|
+
* The firm turned calling on and agreed to the monthly charge for its own
|
|
1096
|
+
* number (#716). `agreedBy` (who agreed) and the time are kept as the billing
|
|
1097
|
+
* record. Once the KYC is accepted — now or later — Glitchgrab rents the
|
|
1098
|
+
* number and creates the line (`phone.line_ready` webhook); then seat staff
|
|
1099
|
+
* with {@link addLineCaller} and the same `ownerId`. `areaCode` = STD code to
|
|
1100
|
+
* search under ("20" Pune), else any free Indian number. Never throws.
|
|
1101
|
+
*/
|
|
1102
|
+
declare function enableCalling(params: {
|
|
1103
|
+
ownerId: string;
|
|
1104
|
+
agreedBy: string;
|
|
1105
|
+
areaCode?: string;
|
|
1106
|
+
}, options?: CallsOptions): Promise<LineRequestResult>;
|
|
1107
|
+
/**
|
|
1108
|
+
* The firm turned calling off (#716): its line stops ringing and calling at
|
|
1109
|
+
* once, consent is cleared, and Navibyte is told to release the number.
|
|
1110
|
+
* {@link enableCalling} again switches the same line back on. Never throws.
|
|
1111
|
+
*/
|
|
1112
|
+
declare function disableCalling(params: {
|
|
1113
|
+
ownerId: string;
|
|
1114
|
+
}, options?: CallsOptions): Promise<LineRequestResult>;
|
|
1115
|
+
interface RegisteredWebhook {
|
|
1116
|
+
id: string;
|
|
1117
|
+
url: string;
|
|
1118
|
+
events: string[];
|
|
1119
|
+
}
|
|
1120
|
+
/**
|
|
1121
|
+
* Register your backend's webhook from code (#716) — scoped to this project,
|
|
1122
|
+
* no Settings clicks. https and a public host only. The `secret` comes back
|
|
1123
|
+
* once: verify every delivery's `X-Glitchgrab-Signature` (`sha256=` HMAC of the
|
|
1124
|
+
* raw body) with it. Same URL twice → refused; remove it first to rotate.
|
|
1125
|
+
* Never throws.
|
|
1126
|
+
*/
|
|
1127
|
+
declare function registerWebhook(webhook: {
|
|
1128
|
+
url: string;
|
|
1129
|
+
events: string[];
|
|
1130
|
+
}, options?: CallsOptions): Promise<{
|
|
1131
|
+
ok: true;
|
|
1132
|
+
webhook: RegisteredWebhook;
|
|
1133
|
+
secret: string;
|
|
1134
|
+
} | {
|
|
1135
|
+
ok: false;
|
|
1136
|
+
error: string;
|
|
1137
|
+
}>;
|
|
1138
|
+
/** This project's webhooks, without secrets. `[]` on any failure. Never throws. */
|
|
1139
|
+
declare function listWebhooks(options?: CallsOptions): Promise<RegisteredWebhook[]>;
|
|
1140
|
+
/** Remove one of this project's webhooks. Never throws. */
|
|
1141
|
+
declare function removeWebhook(id: string, options?: CallsOptions): Promise<{
|
|
1142
|
+
ok: true;
|
|
1143
|
+
} | {
|
|
1144
|
+
ok: false;
|
|
1145
|
+
error: string;
|
|
1146
|
+
}>;
|
|
911
1147
|
/**
|
|
912
1148
|
* Take a caller your key added off the line, with the phones kept for them —
|
|
913
1149
|
* e.g. when they leave your admin team. Someone the line's owner added →
|
|
@@ -978,4 +1214,4 @@ declare function testRingNumber(id: string, options?: CallsOptions): Promise<Rin
|
|
|
978
1214
|
verified: boolean;
|
|
979
1215
|
}>>;
|
|
980
1216
|
|
|
981
|
-
export { type Booking, type BookingAnswer, type BookingClientNotice, type BookingMutationResult, type BookingNotifyRecipient, type BookingQuestion, type BookingQuestionInput, type BookingSettings, type BookingSettingsChanges, type BookingSettingsResult, type BookingSettingsState, type BookingWorkingHours, type Call, type CallAudio, type CallListItem, type CallMoment, type CallParticipant, type CallsOptions, type CaptureServerErrorsOptions, type DeleteCallResult, type FollowUp, type FollowUpBooking, type FollowUpCall, type FollowUpDetail, type FollowUpDue, type FollowUpNote, type FollowUpOperator, type FollowUpWriteResult, type GetCallOptions, type Guide, type GuideReadOptions, type GuideSummary, type Lead, type LineCallerResult, type ListBookingsOptions, type ListCallsOptions, type ListLeadsOptions, type OperatorRingNumber, type OperatorRingNumbersResult, ReportResult, ReportSeverity, ReportType, type RingErrorCode, type RingNumber, type RingNumberList, type RingNumberWriteResult, type ServerReportOptions, type ServerReporterConfig, type ServerReporterIdentity, type SignSessionOptions, addFollowUpNote, addLineCaller, addRingNumber, cancelBooking, captureServerErrors, configureServerReporter, deleteCall, dialFollowUp, discardBookingQuestionsDraft, editFollowUpNote, escapeJsonForScript, getBookingSettings, getCall, getFollowUp, getGuide, getOperatorRingNumbers, listBookings, listCalls, listFollowUps, listGuides, listLeads, listRingNumbers, publishBookingQuestions, removeLineCaller, removeRingNumber, reportServerError, rescheduleBooking, resetServerReporter, setFollowUpBooking, signSession, testRingNumber, updateBookingSettings, updateRingNumber };
|
|
1217
|
+
export { type Booking, type BookingAnswer, type BookingClientNotice, type BookingMutationResult, type BookingNotifyRecipient, type BookingQuestion, type BookingQuestionInput, type BookingSettings, type BookingSettingsChanges, type BookingSettingsResult, type BookingSettingsState, type BookingWorkingHours, type Call, type CallAudio, type CallListItem, type CallMoment, type CallParticipant, type CallWebhook, type CallsOptions, type CaptureServerErrorsOptions, type DeleteCallResult, type FollowUp, type FollowUpBooking, type FollowUpCall, type FollowUpDetail, type FollowUpDue, type FollowUpNote, type FollowUpOperator, type FollowUpWriteResult, type GetCallOptions, type Guide, type GuideReadOptions, type GuideSummary, type Lead, type LineCallerResult, type LineRequestResult, type ListBookingsOptions, type ListCallsOptions, type ListLeadsOptions, type OperatorRingNumber, type OperatorRingNumbersResult, type PhoneLineInfo, type PhoneLineRequest, type PhoneLineStatus, type PhoneLineWebhook, type PlaceCallResult, type RegisteredWebhook, ReportResult, ReportSeverity, ReportType, type RingErrorCode, type RingNumber, type RingNumberList, type RingNumberWriteResult, type ServerReportOptions, type ServerReporterConfig, type ServerReporterIdentity, type SignSessionOptions, addFollowUpNote, addLineCaller, addRingNumber, cancelBooking, captureServerErrors, configureServerReporter, deleteCall, dialFollowUp, disableCalling, discardBookingQuestionsDraft, editFollowUpNote, enableCalling, escapeJsonForScript, getBookingSettings, getCall, getFollowUp, getGuide, getOperatorRingNumbers, getPhoneLine, listBookings, listCalls, listFollowUps, listGuides, listLeads, listRingNumbers, listWebhooks, placeCall, publishBookingQuestions, registerWebhook, removeLineCaller, removeRingNumber, removeWebhook, reportServerError, rescheduleBooking, resetServerReporter, setFollowUpBooking, signSession, submitPhoneKyc, testRingNumber, updateBookingSettings, updateRingNumber };
|
package/dist/server.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ReportType, m as ReportSeverity, l as ReportResult } from './types-
|
|
1
|
+
import { n as ReportType, m as ReportSeverity, l as ReportResult } from './types-Dw587jLi.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. */
|
|
@@ -898,6 +898,9 @@ type LineCallerResult = {
|
|
|
898
898
|
* `CALLERS_OFF` (the line's owner switched it off), `CALLER_CAP` (10 per line).
|
|
899
899
|
* Never throws.
|
|
900
900
|
*
|
|
901
|
+
* `ownerId` = seat them on that customer's own line (#716 — one line per
|
|
902
|
+
* PracticeStacks firm). Omitted = the project's line.
|
|
903
|
+
*
|
|
901
904
|
* ```ts
|
|
902
905
|
* const r = await addLineCaller({ email: admin.email, name: admin.name });
|
|
903
906
|
* if (r.ok) openMyPhones(r.numbers);
|
|
@@ -907,7 +910,240 @@ declare function addLineCaller(caller: {
|
|
|
907
910
|
email: string;
|
|
908
911
|
name: string;
|
|
909
912
|
phone?: string;
|
|
913
|
+
ownerId?: string;
|
|
910
914
|
}, options?: CallsOptions): Promise<LineCallerResult>;
|
|
915
|
+
/** Fields every `call.*` webhook carries (#716). `refKey`/`ownerId` are null when not set. */
|
|
916
|
+
interface CallWebhookBase {
|
|
917
|
+
callId: string;
|
|
918
|
+
repoId: string | null;
|
|
919
|
+
lineId: string | null;
|
|
920
|
+
direction: "outbound" | "inbound" | null;
|
|
921
|
+
/** The other party, E.164. */
|
|
922
|
+
peer: string | null;
|
|
923
|
+
/** What you passed to {@link placeCall}. */
|
|
924
|
+
refKey: string | null;
|
|
925
|
+
/** The customer whose line carried the call. */
|
|
926
|
+
ownerId: string | null;
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
* The body Glitchgrab POSTs to your webhook for a phone call, signed with
|
|
930
|
+
* `X-Glitchgrab-Signature: sha256=<hex HMAC of the raw body>`. Narrow on `event`.
|
|
931
|
+
*/
|
|
932
|
+
type CallWebhook = {
|
|
933
|
+
event: "call.started";
|
|
934
|
+
timestamp: string;
|
|
935
|
+
data: CallWebhookBase & {
|
|
936
|
+
ringing: string;
|
|
937
|
+
};
|
|
938
|
+
} | {
|
|
939
|
+
event: "call.answered";
|
|
940
|
+
timestamp: string;
|
|
941
|
+
data: CallWebhookBase & {
|
|
942
|
+
answeredAt: string;
|
|
943
|
+
};
|
|
944
|
+
} | {
|
|
945
|
+
event: "call.completed";
|
|
946
|
+
timestamp: string;
|
|
947
|
+
data: CallWebhookBase & {
|
|
948
|
+
/** RECORDED = they talked; NO_ANSWER (+ missedBy); FAILED. */
|
|
949
|
+
status: string;
|
|
950
|
+
missedBy: "operator" | "customer" | null;
|
|
951
|
+
durationSec: number | null;
|
|
952
|
+
hangupCause: string | null;
|
|
953
|
+
};
|
|
954
|
+
} | {
|
|
955
|
+
event: "call.recording_ready";
|
|
956
|
+
timestamp: string;
|
|
957
|
+
data: Omit<CallWebhookBase, "lineId"> & {
|
|
958
|
+
durationSec: number | null;
|
|
959
|
+
};
|
|
960
|
+
} | {
|
|
961
|
+
event: "call.summary_ready";
|
|
962
|
+
timestamp: string;
|
|
963
|
+
data: Pick<CallWebhookBase, "callId" | "repoId" | "refKey" | "ownerId"> & {
|
|
964
|
+
/** "phone", "bot" or "extension". */
|
|
965
|
+
recorder: string;
|
|
966
|
+
title: string | null;
|
|
967
|
+
summary: string | null;
|
|
968
|
+
};
|
|
969
|
+
};
|
|
970
|
+
/** `phone.*` webhooks for a customer's automatic line (#716). Same signing as {@link CallWebhook}. */
|
|
971
|
+
type PhoneLineWebhook = {
|
|
972
|
+
event: "phone.kyc_status";
|
|
973
|
+
timestamp: string;
|
|
974
|
+
data: {
|
|
975
|
+
ownerId: string;
|
|
976
|
+
status: string;
|
|
977
|
+
reason: string | null;
|
|
978
|
+
};
|
|
979
|
+
} | {
|
|
980
|
+
event: "phone.line_ready";
|
|
981
|
+
timestamp: string;
|
|
982
|
+
data: {
|
|
983
|
+
ownerId: string;
|
|
984
|
+
number: string;
|
|
985
|
+
lineId: string;
|
|
986
|
+
};
|
|
987
|
+
};
|
|
988
|
+
type PlaceCallResult = {
|
|
989
|
+
ok: true;
|
|
990
|
+
callId: string;
|
|
991
|
+
ringing: string;
|
|
992
|
+
ringNumbers: string[];
|
|
993
|
+
from: string;
|
|
994
|
+
} | {
|
|
995
|
+
ok: false;
|
|
996
|
+
error: string;
|
|
997
|
+
code?: string;
|
|
998
|
+
};
|
|
999
|
+
/**
|
|
1000
|
+
* Start a recorded call from your own screen (#716) — Glitchgrab rings
|
|
1001
|
+
* `operator`'s verified phone from the line, then bridges to `to`. No
|
|
1002
|
+
* follow-up is created; use {@link dialFollowUp} for that.
|
|
1003
|
+
*
|
|
1004
|
+
* `ownerId` = call from that customer's own line (one line per PracticeStacks
|
|
1005
|
+
* firm); the operator must be seated on it ({@link addLineCaller} with the
|
|
1006
|
+
* same `ownerId`). `refKey` = your own key for what the call is about — every
|
|
1007
|
+
* `call.*` webhook (`call.started`, `call.answered`, `call.completed`,
|
|
1008
|
+
* `call.recording_ready`, `call.summary_ready`) carries it back with `ownerId`.
|
|
1009
|
+
* Check your own permissions before calling this. Refusals carry `code`:
|
|
1010
|
+
* `NOT_ON_LINE`, `NO_VERIFIED_NUMBER`, `RING_PHONE_NOT_YOURS`. Never throws.
|
|
1011
|
+
*
|
|
1012
|
+
* ```ts
|
|
1013
|
+
* const r = await placeCall({
|
|
1014
|
+
* operator: { email: staff.email },
|
|
1015
|
+
* to: client.phone,
|
|
1016
|
+
* ownerId: firm.id,
|
|
1017
|
+
* refKey: client.id,
|
|
1018
|
+
* }); // GLITCHGRAB_CALLS_KEY=ggc_…
|
|
1019
|
+
* ```
|
|
1020
|
+
*/
|
|
1021
|
+
declare function placeCall(call: {
|
|
1022
|
+
operator: FollowUpOperator;
|
|
1023
|
+
to: string;
|
|
1024
|
+
ownerId?: string;
|
|
1025
|
+
refKey?: string;
|
|
1026
|
+
title?: string;
|
|
1027
|
+
ringPhone?: string;
|
|
1028
|
+
}, options?: CallsOptions): Promise<PlaceCallResult>;
|
|
1029
|
+
interface PhoneLineInfo {
|
|
1030
|
+
number: string;
|
|
1031
|
+
label: string | null;
|
|
1032
|
+
active: boolean;
|
|
1033
|
+
/** People seated on it; anyone else gets `NOT_ON_LINE`. */
|
|
1034
|
+
callers: number;
|
|
1035
|
+
}
|
|
1036
|
+
/** Where a customer's automatic line is up to (#716). */
|
|
1037
|
+
interface PhoneLineRequest {
|
|
1038
|
+
/** Plivo's KYC status: submitted | accepted | rejected | suspended | expired. */
|
|
1039
|
+
kycStatus: string;
|
|
1040
|
+
/** Why Plivo rejected it — show it to the firm so they can fix and resubmit. */
|
|
1041
|
+
kycReason: string | null;
|
|
1042
|
+
/** The firm agreed to the monthly charge ({@link enableCalling}). */
|
|
1043
|
+
enabled: boolean;
|
|
1044
|
+
/** NONE | BUYING | BOUGHT | FAILED (retried automatically). */
|
|
1045
|
+
buyState: string;
|
|
1046
|
+
buyError: string | null;
|
|
1047
|
+
number: string | null;
|
|
1048
|
+
}
|
|
1049
|
+
interface PhoneLineStatus {
|
|
1050
|
+
line: PhoneLineInfo | null;
|
|
1051
|
+
/** Null when no KYC was submitted for this customer. */
|
|
1052
|
+
request: PhoneLineRequest | null;
|
|
1053
|
+
}
|
|
1054
|
+
/**
|
|
1055
|
+
* A customer's phone line and, when you submitted their KYC, how far the
|
|
1056
|
+
* automatic purchase has got (#716) — for the firm's "Calling" settings:
|
|
1057
|
+
* no request → "Submit KYC"; `kycStatus: "rejected"` → show `kycReason`;
|
|
1058
|
+
* accepted but `enabled: false` → "Turn on calling (₹… /month)"; `line` set →
|
|
1059
|
+
* ready. `ownerId` omitted = the project's own line. `null` only on failure
|
|
1060
|
+
* (no key, network). Never throws.
|
|
1061
|
+
*/
|
|
1062
|
+
declare function getPhoneLine(params?: {
|
|
1063
|
+
ownerId?: string;
|
|
1064
|
+
}, options?: CallsOptions): Promise<PhoneLineStatus | null>;
|
|
1065
|
+
type LineRequestResult = {
|
|
1066
|
+
ok: true;
|
|
1067
|
+
request: PhoneLineRequest;
|
|
1068
|
+
} | {
|
|
1069
|
+
ok: false;
|
|
1070
|
+
error: string;
|
|
1071
|
+
code?: string;
|
|
1072
|
+
};
|
|
1073
|
+
/**
|
|
1074
|
+
* Submit a customer's KYC so they get their own phone number (#716). Plivo
|
|
1075
|
+
* reviews it (usually minutes, sometimes a day); the `phone.kyc_status`
|
|
1076
|
+
* webhook says when. Rejected → fix and call again. Certificates: PDF, JPG or
|
|
1077
|
+
* PNG, under 4 MB together; they go straight to Plivo, Glitchgrab keeps no
|
|
1078
|
+
* copy. Refusals carry `code`: `KYC_PENDING`, `KYC_DONE`, `BAD_FILE`,
|
|
1079
|
+
* `PROVIDER`. Nothing is bought until {@link enableCalling}. Never throws.
|
|
1080
|
+
*/
|
|
1081
|
+
declare function submitPhoneKyc(kyc: {
|
|
1082
|
+
ownerId: string;
|
|
1083
|
+
/** Legal name, as on the certificates. */
|
|
1084
|
+
businessName: string;
|
|
1085
|
+
email: string;
|
|
1086
|
+
addressLine1: string;
|
|
1087
|
+
city: string;
|
|
1088
|
+
state: string;
|
|
1089
|
+
/** 6-digit PIN code. */
|
|
1090
|
+
postalCode: string;
|
|
1091
|
+
registrationCertificate: Blob;
|
|
1092
|
+
gstCertificate: Blob;
|
|
1093
|
+
}, options?: CallsOptions): Promise<LineRequestResult>;
|
|
1094
|
+
/**
|
|
1095
|
+
* The firm turned calling on and agreed to the monthly charge for its own
|
|
1096
|
+
* number (#716). `agreedBy` (who agreed) and the time are kept as the billing
|
|
1097
|
+
* record. Once the KYC is accepted — now or later — Glitchgrab rents the
|
|
1098
|
+
* number and creates the line (`phone.line_ready` webhook); then seat staff
|
|
1099
|
+
* with {@link addLineCaller} and the same `ownerId`. `areaCode` = STD code to
|
|
1100
|
+
* search under ("20" Pune), else any free Indian number. Never throws.
|
|
1101
|
+
*/
|
|
1102
|
+
declare function enableCalling(params: {
|
|
1103
|
+
ownerId: string;
|
|
1104
|
+
agreedBy: string;
|
|
1105
|
+
areaCode?: string;
|
|
1106
|
+
}, options?: CallsOptions): Promise<LineRequestResult>;
|
|
1107
|
+
/**
|
|
1108
|
+
* The firm turned calling off (#716): its line stops ringing and calling at
|
|
1109
|
+
* once, consent is cleared, and Navibyte is told to release the number.
|
|
1110
|
+
* {@link enableCalling} again switches the same line back on. Never throws.
|
|
1111
|
+
*/
|
|
1112
|
+
declare function disableCalling(params: {
|
|
1113
|
+
ownerId: string;
|
|
1114
|
+
}, options?: CallsOptions): Promise<LineRequestResult>;
|
|
1115
|
+
interface RegisteredWebhook {
|
|
1116
|
+
id: string;
|
|
1117
|
+
url: string;
|
|
1118
|
+
events: string[];
|
|
1119
|
+
}
|
|
1120
|
+
/**
|
|
1121
|
+
* Register your backend's webhook from code (#716) — scoped to this project,
|
|
1122
|
+
* no Settings clicks. https and a public host only. The `secret` comes back
|
|
1123
|
+
* once: verify every delivery's `X-Glitchgrab-Signature` (`sha256=` HMAC of the
|
|
1124
|
+
* raw body) with it. Same URL twice → refused; remove it first to rotate.
|
|
1125
|
+
* Never throws.
|
|
1126
|
+
*/
|
|
1127
|
+
declare function registerWebhook(webhook: {
|
|
1128
|
+
url: string;
|
|
1129
|
+
events: string[];
|
|
1130
|
+
}, options?: CallsOptions): Promise<{
|
|
1131
|
+
ok: true;
|
|
1132
|
+
webhook: RegisteredWebhook;
|
|
1133
|
+
secret: string;
|
|
1134
|
+
} | {
|
|
1135
|
+
ok: false;
|
|
1136
|
+
error: string;
|
|
1137
|
+
}>;
|
|
1138
|
+
/** This project's webhooks, without secrets. `[]` on any failure. Never throws. */
|
|
1139
|
+
declare function listWebhooks(options?: CallsOptions): Promise<RegisteredWebhook[]>;
|
|
1140
|
+
/** Remove one of this project's webhooks. Never throws. */
|
|
1141
|
+
declare function removeWebhook(id: string, options?: CallsOptions): Promise<{
|
|
1142
|
+
ok: true;
|
|
1143
|
+
} | {
|
|
1144
|
+
ok: false;
|
|
1145
|
+
error: string;
|
|
1146
|
+
}>;
|
|
911
1147
|
/**
|
|
912
1148
|
* Take a caller your key added off the line, with the phones kept for them —
|
|
913
1149
|
* e.g. when they leave your admin team. Someone the line's owner added →
|
|
@@ -978,4 +1214,4 @@ declare function testRingNumber(id: string, options?: CallsOptions): Promise<Rin
|
|
|
978
1214
|
verified: boolean;
|
|
979
1215
|
}>>;
|
|
980
1216
|
|
|
981
|
-
export { type Booking, type BookingAnswer, type BookingClientNotice, type BookingMutationResult, type BookingNotifyRecipient, type BookingQuestion, type BookingQuestionInput, type BookingSettings, type BookingSettingsChanges, type BookingSettingsResult, type BookingSettingsState, type BookingWorkingHours, type Call, type CallAudio, type CallListItem, type CallMoment, type CallParticipant, type CallsOptions, type CaptureServerErrorsOptions, type DeleteCallResult, type FollowUp, type FollowUpBooking, type FollowUpCall, type FollowUpDetail, type FollowUpDue, type FollowUpNote, type FollowUpOperator, type FollowUpWriteResult, type GetCallOptions, type Guide, type GuideReadOptions, type GuideSummary, type Lead, type LineCallerResult, type ListBookingsOptions, type ListCallsOptions, type ListLeadsOptions, type OperatorRingNumber, type OperatorRingNumbersResult, ReportResult, ReportSeverity, ReportType, type RingErrorCode, type RingNumber, type RingNumberList, type RingNumberWriteResult, type ServerReportOptions, type ServerReporterConfig, type ServerReporterIdentity, type SignSessionOptions, addFollowUpNote, addLineCaller, addRingNumber, cancelBooking, captureServerErrors, configureServerReporter, deleteCall, dialFollowUp, discardBookingQuestionsDraft, editFollowUpNote, escapeJsonForScript, getBookingSettings, getCall, getFollowUp, getGuide, getOperatorRingNumbers, listBookings, listCalls, listFollowUps, listGuides, listLeads, listRingNumbers, publishBookingQuestions, removeLineCaller, removeRingNumber, reportServerError, rescheduleBooking, resetServerReporter, setFollowUpBooking, signSession, testRingNumber, updateBookingSettings, updateRingNumber };
|
|
1217
|
+
export { type Booking, type BookingAnswer, type BookingClientNotice, type BookingMutationResult, type BookingNotifyRecipient, type BookingQuestion, type BookingQuestionInput, type BookingSettings, type BookingSettingsChanges, type BookingSettingsResult, type BookingSettingsState, type BookingWorkingHours, type Call, type CallAudio, type CallListItem, type CallMoment, type CallParticipant, type CallWebhook, type CallsOptions, type CaptureServerErrorsOptions, type DeleteCallResult, type FollowUp, type FollowUpBooking, type FollowUpCall, type FollowUpDetail, type FollowUpDue, type FollowUpNote, type FollowUpOperator, type FollowUpWriteResult, type GetCallOptions, type Guide, type GuideReadOptions, type GuideSummary, type Lead, type LineCallerResult, type LineRequestResult, type ListBookingsOptions, type ListCallsOptions, type ListLeadsOptions, type OperatorRingNumber, type OperatorRingNumbersResult, type PhoneLineInfo, type PhoneLineRequest, type PhoneLineStatus, type PhoneLineWebhook, type PlaceCallResult, type RegisteredWebhook, ReportResult, ReportSeverity, ReportType, type RingErrorCode, type RingNumber, type RingNumberList, type RingNumberWriteResult, type ServerReportOptions, type ServerReporterConfig, type ServerReporterIdentity, type SignSessionOptions, addFollowUpNote, addLineCaller, addRingNumber, cancelBooking, captureServerErrors, configureServerReporter, deleteCall, dialFollowUp, disableCalling, discardBookingQuestionsDraft, editFollowUpNote, enableCalling, escapeJsonForScript, getBookingSettings, getCall, getFollowUp, getGuide, getOperatorRingNumbers, getPhoneLine, listBookings, listCalls, listFollowUps, listGuides, listLeads, listRingNumbers, listWebhooks, placeCall, publishBookingQuestions, registerWebhook, removeLineCaller, removeRingNumber, removeWebhook, reportServerError, rescheduleBooking, resetServerReporter, setFollowUpBooking, signSession, submitPhoneKyc, testRingNumber, updateBookingSettings, updateRingNumber };
|