@bcrumbs.net/inbox 0.0.64 → 0.0.65

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 (143) hide show
  1. package/assets/ar/inbox.json +37 -6
  2. package/assets/en/inbox.json +37 -6
  3. package/e2e/checkout/checkout.flows.d.ts +6 -0
  4. package/e2e/support/auth.d.ts +7 -3
  5. package/index.cjs.js +38317 -1108
  6. package/index.esm.js +38320 -1111
  7. package/package.json +1 -1
  8. package/src/app/ai/components/Crumby/CrumbyChatError.d.ts +9 -0
  9. package/src/app/ai/components/Crumby/CrumbyChatErrorBoundary.d.ts +13 -0
  10. package/src/app/ai/components/Crumby/CrumbyHeader.d.ts +9 -0
  11. package/src/app/ai/components/Crumby/CrumbyPageContext.d.ts +22 -0
  12. package/src/app/ai/components/Crumby/CrumbyRuntimeProvider.d.ts +9 -0
  13. package/src/app/ai/components/CrumbySettings/CrumbyEditsBanner.d.ts +14 -0
  14. package/src/app/ai/components/CrumbySettings/VoiceSettingsSection.d.ts +9 -0
  15. package/src/app/ai/components/playground/Button.d.ts +1 -1
  16. package/src/app/ai/components/playground/TooltipIconButton.d.ts +1 -1
  17. package/src/app/ai/components/sources/mediaTypeForFile.d.ts +8 -0
  18. package/src/app/ai/config/promptSettings.d.ts +31 -0
  19. package/src/app/ai/hooks/usePromptCopilot.d.ts +22 -0
  20. package/src/app/ai/tools/PromptEditorTool.d.ts +2 -0
  21. package/src/app/ai/types/index.d.ts +1 -1
  22. package/src/app/ai/utils/clientToolResubmit.d.ts +8 -0
  23. package/src/app/ai/utils/crumbyChatFetch.d.ts +15 -0
  24. package/src/app/auth/components/password-page/AuthPasswordPageLayout.d.ts +3 -1
  25. package/src/app/auth/components/password-page/PasswordSuccessView.d.ts +2 -1
  26. package/src/app/auth/config/authProvider.d.ts +20 -2
  27. package/src/app/auth/config/clerkAppearance.d.ts +51 -52
  28. package/src/app/auth/pages/Login.d.ts +1 -1
  29. package/src/app/auth/pages/Register.d.ts +1 -0
  30. package/src/app/billing/pages/GatewayWelcomePage.d.ts +4 -1
  31. package/src/app/broadcast/components/BroadcastAnalysisReciepientsHeader.d.ts +2 -1
  32. package/src/app/broadcast/components/BroadcastDetailsSection.d.ts +3 -1
  33. package/src/app/dashboard/components/AgentCard.d.ts +2 -1
  34. package/src/app/dashboard/components/AgentsCard.d.ts +4 -2
  35. package/src/app/dashboard/components/BroadcastDashboard.d.ts +3 -1
  36. package/src/app/dashboard/components/ChatsByLifeCycleCard.d.ts +13 -0
  37. package/src/app/dashboard/components/DashboardFilters.d.ts +27 -0
  38. package/src/app/dashboard/components/DashboardPdfCaptureArea.d.ts +11 -0
  39. package/src/app/dashboard/components/DashboardPdfExportButton.d.ts +7 -0
  40. package/src/app/dashboard/components/DashboardPdfHeader.d.ts +11 -0
  41. package/src/app/dashboard/components/DashboardSections.d.ts +7 -2
  42. package/src/app/dashboard/components/InboxDashboard.d.ts +3 -1
  43. package/src/app/dashboard/hooks/useDashboardPdfMeta.d.ts +31 -0
  44. package/src/app/dashboard/hooks/useDashboardTabsPdfExport.d.ts +26 -0
  45. package/src/app/dashboard/utils/dashboardReportExports.d.ts +16 -1
  46. package/src/app/dashboard/utils/exportDashboardPdf.d.ts +19 -0
  47. package/src/app/dashboard/utils/lifecycleStages.d.ts +53 -0
  48. package/src/app/dashboard/utils/reportHelpers.d.ts +9 -0
  49. package/src/app/gatewayHome/components/ChecklistStep.d.ts +15 -0
  50. package/src/app/gatewayHome/components/CreditBalanceCard.d.ts +6 -0
  51. package/src/app/gatewayHome/components/MessageStats.d.ts +5 -0
  52. package/src/app/gatewayHome/components/SetupChecklist.d.ts +11 -0
  53. package/src/app/gatewayHome/components/console/QuickstartConsole.d.ts +11 -0
  54. package/src/app/gatewayHome/components/console/RunRequestBar.d.ts +15 -0
  55. package/src/app/gatewayHome/components/console/consoleStyles.d.ts +77 -0
  56. package/src/app/gatewayHome/components/steps/ApiKeyStepBody.d.ts +8 -0
  57. package/src/app/gatewayHome/components/steps/ChannelStepBody.d.ts +3 -0
  58. package/src/app/gatewayHome/components/steps/MetaStepBody.d.ts +6 -0
  59. package/src/app/gatewayHome/components/steps/WebhookStepBody.d.ts +7 -0
  60. package/src/app/gatewayHome/components/styles.d.ts +29 -0
  61. package/src/app/gatewayHome/config/constants.d.ts +22 -0
  62. package/src/app/gatewayHome/hooks/useGatewaySetup.d.ts +59 -0
  63. package/src/app/gatewayHome/hooks/useMessageStats.d.ts +17 -0
  64. package/src/app/gatewayHome/hooks/useQuickstartRequest.d.ts +31 -0
  65. package/src/app/gatewayHome/hooks/useSendableTemplates.d.ts +9 -0
  66. package/src/app/gatewayHome/pages/GatewayHomePage.d.ts +1 -0
  67. package/src/app/gatewayHome/types/index.d.ts +21 -0
  68. package/src/app/gatewayHome/utils/buildRequestBody.d.ts +7 -0
  69. package/src/app/gatewayHome/utils/buildSnippet.d.ts +9 -0
  70. package/src/app/gatewayHome/utils/sendTestMessage.d.ts +3 -0
  71. package/src/app/gatewayHome/utils/setupStorage.d.ts +8 -0
  72. package/src/app/gatewayHome/utils/templateHasParameters.d.ts +6 -0
  73. package/src/app/generic/components/HeaderImageInput.d.ts +3 -1
  74. package/src/app/generic/components/MessagePreview.d.ts +1 -1
  75. package/src/app/generic/components/PreviewHeaderDocument.d.ts +5 -0
  76. package/src/app/generic/utils/chunkErrorRecovery.d.ts +7 -0
  77. package/src/app/generic/utils/onesignal.d.ts +13 -0
  78. package/src/app/inbox/calls/useIncomingCallAlerts.d.ts +2 -0
  79. package/src/app/inbox/components/Calls/ActiveCallControls.d.ts +6 -0
  80. package/src/app/inbox/components/Calls/IncomingCallBanner.d.ts +6 -0
  81. package/src/app/inbox/components/Chat/QuickReplyEmpty.d.ts +5 -0
  82. package/src/app/inbox/components/Chat/QuickReplyPickerMenu.d.ts +2 -2
  83. package/src/app/inbox/components/NewDetails/ClientSection.d.ts +3 -1
  84. package/src/app/inbox/components/NewDetails/SuggestedAssignee.d.ts +7 -0
  85. package/src/app/inbox/components/NewDetails/SuggestedStage.d.ts +13 -0
  86. package/src/app/inbox/components/NewDetails/SuggestedTags.d.ts +18 -0
  87. package/src/app/inbox/components/NewDetails/SuggestionItems.d.ts +16 -0
  88. package/src/app/inbox/constants/index.d.ts +1 -0
  89. package/src/app/inbox/context/CallSession.d.ts +16 -0
  90. package/src/app/inbox/context/SuggestionsContext.d.ts +25 -0
  91. package/src/app/inbox/hooks/useAgentSuggestions.d.ts +20 -0
  92. package/src/app/inbox/hooks/useApplySuggestion.d.ts +18 -0
  93. package/src/app/inbox/hooks/useConversationsPerodicFetch.d.ts +30 -0
  94. package/src/app/inbox/hooks/useIncomingCallAlerts.d.ts +2 -0
  95. package/src/app/inbox/hooks/useNewSortedEvents.d.ts +1 -1
  96. package/src/app/inbox/hooks/useQuickReplyPicker.d.ts +5 -3
  97. package/src/app/inbox/pages/InboxPage.d.ts +1 -1
  98. package/src/app/inbox/utils/callUi.d.ts +25 -0
  99. package/src/app/inbox/utils/convSuggestions.d.ts +59 -0
  100. package/src/app/inbox/utils/convSuggestionsStorage.d.ts +20 -0
  101. package/src/app/inbox/utils/sounds.d.ts +2 -0
  102. package/src/app/layout/hooks/useCallsEnabled.d.ts +1 -0
  103. package/src/app/layout/hooks/useGatewayPlanEnabled.d.ts +5 -0
  104. package/src/app/layout/hooks/useWebchatEnabled.d.ts +5 -0
  105. package/src/app/managemnet/components/channels/ChannelItem.d.ts +2 -1
  106. package/src/app/managemnet/components/channels/ChannelSettingsDrawer.d.ts +15 -0
  107. package/src/app/managemnet/components/channels/ShareChannelLinkDialog.d.ts +11 -0
  108. package/src/app/managemnet/components/channels/WebChatSnippetBlock.d.ts +7 -0
  109. package/src/app/managemnet/config/webchat.d.ts +5 -0
  110. package/src/app/managemnet/pages/connectChannel/ConnectChannel.d.ts +2 -0
  111. package/src/app/managemnet/pages/generalSettings/NoiseFilterSettings.d.ts +8 -0
  112. package/src/app/managemnet/pages/generalSettings/noiseFilterConstants.d.ts +24 -0
  113. package/src/app/managemnet/utils/webChatSnippet.d.ts +2 -0
  114. package/src/app/onboarding/components/OnboardingView.d.ts +3 -1
  115. package/src/app/onboarding/components/useOnboardingChecklist.d.ts +12 -9
  116. package/src/app/onboarding/constants/workspaceProfileOptions.d.ts +30 -0
  117. package/src/app/onboarding/utils/onboardingApi.d.ts +23 -0
  118. package/src/app/onboarding/utils/onboardingChecklistStorage.d.ts +42 -49
  119. package/src/app/resources/components/Integrations/ChannelDialogLayout.d.ts +6 -1
  120. package/src/app/resources/components/Integrations/RenderCorrectIntegrationFlow.d.ts +3 -1
  121. package/src/app/resources/components/Integrations/WebChat/index.d.ts +8 -0
  122. package/src/app/resources/components/Integrations/WhatsApp/index.d.ts +1 -0
  123. package/src/app/resources/hooks/useFBPagesHook.d.ts +4 -2
  124. package/src/app/resources/hooks/useWabaHook.d.ts +5 -4
  125. package/src/app/resources/utils/channelSetupTracking.d.ts +21 -0
  126. package/src/app/resources/utils/facebookSdk.d.ts +11 -0
  127. package/src/app/subscriptions/components/NewSubscription/OnboardingStepper.d.ts +2 -2
  128. package/src/app/subscriptions/components/NewSubscription/SubscriptionName.d.ts +2 -0
  129. package/src/app/subscriptions/components/NewSubscription/WorkspaceProfile.d.ts +18 -0
  130. package/src/app/subscriptions/components/NewSubscription/WorkspaceStepLayout.d.ts +5 -2
  131. package/src/app/subscriptions/hooks/useWorkspaceProfileSubmit.d.ts +12 -0
  132. package/src/app/subscriptions/utils/newWorkspaceContext.d.ts +8 -0
  133. package/src/assets/locales/translations.d.ts +319 -20
  134. package/src/config/constants.d.ts +1 -2
  135. package/src/graphql.autogenerated.d.ts +1907 -117
  136. package/src/testUtils/bcUiMock.d.ts +16 -0
  137. package/src/utils/colorPool.d.ts +1 -2
  138. package/src/utils/getActiveChannelList.d.ts +6 -1
  139. package/src/utils/globalHelper.d.ts +22 -0
  140. package/src/app/billing/pages/GuidePage.d.ts +0 -1
  141. package/src/app/contact/components/ImportProgressDialog.d.ts +0 -14
  142. package/src/app/managemnet/components/channels/EditChannelDialog.d.ts +0 -11
  143. package/src/app/onboarding/utils/onboardingChecklistPersistence.d.ts +0 -18
@@ -0,0 +1,59 @@
1
+ import { IntegrationState } from '../../../graphql.autogenerated';
2
+ import { type LocalSetupChoices } from '../utils/setupStorage';
3
+ import type { SetupStepId, SetupStepStatus } from '../types';
4
+ /**
5
+ * Derives the Gateway checklist from live data:
6
+ * - channel / apiKey / webhook: the workspace has at least one of them
7
+ * - firstMessage: the credit wallet recorded at least one send attempt
8
+ * - meta / webhook skip: the user's choice, kept per workspace in the browser
9
+ * Setup counts as complete once an API key exists and a message was attempted.
10
+ */
11
+ export declare function useGatewaySetup(workspaceId: number): {
12
+ statuses: Record<SetupStepId, SetupStepStatus>;
13
+ nextStep: SetupStepId | null;
14
+ isComplete: boolean;
15
+ loaded: boolean;
16
+ creditWallet: {
17
+ __typename?: "CreditWalletView" | undefined;
18
+ workspaceId: number;
19
+ balanceMicroUsd: string;
20
+ pendingMicroUsd: string;
21
+ remainingMicroUsd: string;
22
+ remainingCredits: number;
23
+ remainingMessages: number;
24
+ lifetimePurchasedMicroUsd: string;
25
+ lifetimeUsedMicroUsd: string;
26
+ lifetimeAttemptCount: string;
27
+ pendingAttempts: string;
28
+ usedAttempts: string;
29
+ usedMicroUsd: string;
30
+ usedCredits: number;
31
+ } | null;
32
+ webhookUrl: string;
33
+ integrations: {
34
+ __typename?: "Integration" | undefined;
35
+ workspaceId: number;
36
+ id: string;
37
+ name: string;
38
+ identifier?: string | null | undefined;
39
+ type: import("../../../graphql.autogenerated").IntegrationType;
40
+ properties?: any;
41
+ state: IntegrationState;
42
+ createdAt: any;
43
+ deletedAt?: any;
44
+ patchedAt?: any;
45
+ callingEnabled?: boolean | null | undefined;
46
+ }[];
47
+ setChoice: (step: keyof LocalSetupChoices, status: SetupStepStatus) => void;
48
+ markDone: (step: SetupStepId) => void;
49
+ refetchApiKeys: (variables?: Partial<import("../../../graphql.autogenerated").Exact<{
50
+ input: import("../../../graphql.autogenerated").ApiKeysInput;
51
+ }>> | undefined) => Promise<import("@apollo/client").ApolloQueryResult<import("../../../graphql.autogenerated").ApiKeysQuery>>;
52
+ refetchWebhooks: (variables?: Partial<import("../../../graphql.autogenerated").Exact<{
53
+ input: import("../../../graphql.autogenerated").WebhooksInput;
54
+ }>> | undefined) => Promise<import("@apollo/client").ApolloQueryResult<import("../../../graphql.autogenerated").WebhooksQuery>>;
55
+ refetchWallet: (variables?: Partial<import("../../../graphql.billing.autogenerated").Exact<{
56
+ input: import("../../../graphql.billing.autogenerated").CreditWalletInput;
57
+ }>> | undefined) => Promise<import("@apollo/client").ApolloQueryResult<import("../../../graphql.billing.autogenerated").CreditWalletQuery>>;
58
+ };
59
+ export type GatewaySetup = ReturnType<typeof useGatewaySetup>;
@@ -0,0 +1,17 @@
1
+ export type DailyMessageCount = {
2
+ /** UTC midnight of the day. */
3
+ date: Date;
4
+ count: number;
5
+ };
6
+ /**
7
+ * Messages in the last 30 days, delivery rate, and a per-day series for the last 14 days.
8
+ * Days are UTC. Past days come from the hourly report (up to the end of yesterday) and
9
+ * today comes from the live `messageReportToday` query, so no hour is counted twice.
10
+ */
11
+ export declare function useMessageStats(workspaceId: number): {
12
+ loading: boolean;
13
+ totalMessages: number;
14
+ /** 0..1, or null when no outgoing message has a status yet. */
15
+ deliveredRate: number | null;
16
+ daily: DailyMessageCount[];
17
+ };
@@ -0,0 +1,31 @@
1
+ /// <reference types="react" />
2
+ import type { IntegrationFragment } from '../../../graphql.autogenerated';
3
+ import type { ChannelKind, RequestKind, RunResult } from '../types';
4
+ type QuickstartOptions = {
5
+ workspaceId: number;
6
+ apiKeyToken: string | null;
7
+ integrations: IntegrationFragment[];
8
+ onSent: (to: string, result: RunResult) => void;
9
+ };
10
+ /** State and actions behind the Quickstart console: what to send, where, and running it. */
11
+ export declare function useQuickstartRequest({ workspaceId, apiKeyToken, integrations, onSent }: QuickstartOptions): {
12
+ kind: RequestKind;
13
+ setKind: import("react").Dispatch<import("react").SetStateAction<RequestKind>>;
14
+ channel: ChannelKind;
15
+ setChannel: import("react").Dispatch<import("react").SetStateAction<ChannelKind>>;
16
+ availableChannels: Partial<Record<ChannelKind, IntegrationFragment>>;
17
+ templates: import("../types").TemplateOption[];
18
+ template: import("../types").TemplateOption;
19
+ setTemplateName: import("react").Dispatch<import("react").SetStateAction<string>>;
20
+ to: string;
21
+ setTo: import("react").Dispatch<import("react").SetStateAction<string>>;
22
+ apiKeyInput: string;
23
+ setApiKeyInput: import("react").Dispatch<import("react").SetStateAction<string>>;
24
+ needsApiKey: boolean;
25
+ body: Record<string, unknown> | null;
26
+ disabledReason: string | null;
27
+ running: boolean;
28
+ result: RunResult | null;
29
+ run: () => Promise<void>;
30
+ };
31
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { TemplateOption } from '../types';
2
+ /**
3
+ * Approved WhatsApp templates that need no parameters, so the console can send them as-is.
4
+ * The list query has no components, so each template's details are fetched (and cached by Apollo).
5
+ */
6
+ export declare function useSendableTemplates(workspaceId: number, integrationId?: string): {
7
+ templates: TemplateOption[];
8
+ loading: boolean;
9
+ };
@@ -0,0 +1 @@
1
+ export default function GatewayHomePage(): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ export type RequestKind = 'text' | 'template' | 'image' | 'webhook';
2
+ export type ChannelKind = 'whatsapp' | 'instagram' | 'facebook' | 'telegram';
3
+ export type SnippetLang = 'cURL' | 'Node.js' | 'Python' | 'PHP' | 'Java' | 'C#' | 'Go';
4
+ export type SetupStepId = 'channel' | 'apiKey' | 'webhook' | 'meta' | 'firstMessage';
5
+ export type SetupStepStatus = 'pending' | 'done' | 'skipped';
6
+ export type TemplateOption = {
7
+ name: string;
8
+ language: string;
9
+ };
10
+ export type MessageRequestInput = {
11
+ workspaceId: number;
12
+ integrationId?: string;
13
+ to: string;
14
+ kind: Exclude<RequestKind, 'webhook'>;
15
+ template?: TemplateOption;
16
+ };
17
+ export type RunResult = {
18
+ status: number;
19
+ ok: boolean;
20
+ body: string;
21
+ };
@@ -0,0 +1,7 @@
1
+ import type { MessageRequestInput } from '../types';
2
+ /** Keeps digits only: the REST API expects the number without "+" or spaces. */
3
+ export declare function normalizePhone(value: string): string;
4
+ /** Body for POST /core/v1/messages — mirrors SendMessageRequestDto in core. */
5
+ export declare function buildRequestBody(input: MessageRequestInput): Record<string, unknown>;
6
+ /** Sample INCOMING_MESSAGE payload as documented in bc-api-docs (apis/webhooks). */
7
+ export declare function buildWebhookPayload(workspaceId: number, to: string): Record<string, unknown>;
@@ -0,0 +1,9 @@
1
+ import type { SnippetLang } from '../types';
2
+ type SnippetInput = {
3
+ url: string;
4
+ /** Sent raw in the Authorization header; omitted for webhook simulations. */
5
+ apiKey?: string;
6
+ body: Record<string, unknown>;
7
+ };
8
+ export declare function buildSnippet(lang: SnippetLang, input: SnippetInput): string;
9
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { RunResult } from '../types';
2
+ /** Sends the exact request shown in the Quickstart console (the API allows CORS). */
3
+ export declare function sendTestMessage(apiKey: string, body: Record<string, unknown>): Promise<RunResult>;
@@ -0,0 +1,8 @@
1
+ import type { SetupStepStatus } from '../types';
2
+ /** Choices for optional steps that have no server-side record (skip / done on Meta). */
3
+ export type LocalSetupChoices = {
4
+ webhook?: SetupStepStatus;
5
+ meta?: SetupStepStatus;
6
+ };
7
+ export declare function readSetupChoices(workspaceId: number): LocalSetupChoices;
8
+ export declare function writeSetupChoices(workspaceId: number, choices: LocalSetupChoices): void;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * True when a WhatsApp template needs values at send time: text/URL placeholders,
3
+ * a media or location header, a code button, or an authentication (OTP) template.
4
+ * The Quickstart console sends templates without components, so those would fail.
5
+ */
6
+ export declare function templateHasParameters(rawComponents: unknown, category?: string | null): boolean;
@@ -1,9 +1,11 @@
1
1
  import React from 'react';
2
+ type HeaderMediaKind = 'image' | 'document';
2
3
  type HeaderImageInputProps = {
3
4
  value: string;
4
5
  onChange: (value: string) => void;
5
6
  hint?: string;
6
7
  layout?: 'row' | 'column';
8
+ mediaKind?: HeaderMediaKind;
7
9
  };
8
- declare const _default: React.MemoExoticComponent<({ value, onChange, hint, layout }: HeaderImageInputProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
10
+ declare const _default: React.MemoExoticComponent<({ value, onChange, hint, layout, mediaKind }: HeaderImageInputProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
9
11
  export default _default;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  interface MessageComponent {
3
3
  type: 'HEADER' | 'BODY' | 'BUTTONS' | 'FOOTER';
4
- format?: 'TEXT' | 'IMAGE' | string;
4
+ format?: 'TEXT' | 'IMAGE' | 'DOCUMENT' | string;
5
5
  text?: string;
6
6
  example?: {
7
7
  header_handle?: string[];
@@ -0,0 +1,5 @@
1
+ declare const PreviewHeaderDocument: ({ src, showPlaceholder }: {
2
+ src: string;
3
+ showPlaceholder?: boolean;
4
+ }) => import("@emotion/react/jsx-runtime").JSX.Element | null;
5
+ export default PreviewHeaderDocument;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Reports a recovery when this page load followed a guarded reload. Call it once
3
+ * the app shell has loaded, which proves the reloaded chunks are healthy.
4
+ */
5
+ export declare function reportChunkRecoveryIfReloaded(): void;
6
+ /** Registers the global chunk-failure listeners. Call once at startup. */
7
+ export declare function setupChunkErrorRecovery(): void;
@@ -0,0 +1,13 @@
1
+ import OneSignal from 'react-onesignal';
2
+ type OneSignalInitOptions = Parameters<typeof OneSignal.init>[0];
3
+ /**
4
+ * Start OneSignal. Best effort: a blocked or failed OneSignal script must not
5
+ * break app startup (for example with Firefox tracking protection or an ad blocker).
6
+ */
7
+ export declare function initOneSignal(options: OneSignalInitOptions): Promise<void>;
8
+ /**
9
+ * Register the signed-in user with OneSignal for push notifications. Best effort:
10
+ * a blocked or failed OneSignal script must not break sign-in.
11
+ */
12
+ export declare function registerOneSignalUser(userId: string, email?: string): Promise<void>;
13
+ export {};
@@ -0,0 +1,2 @@
1
+ import { Conversation } from '../../../graphql.autogenerated';
2
+ export declare function useIncomingCallAlerts(convs: Conversation[] | null | undefined, onOpen: (conv: Conversation) => void, selectedConvId?: string): void;
@@ -0,0 +1,6 @@
1
+ import { type PortalCall } from '../../utils/callUi';
2
+ type Props = {
3
+ call?: PortalCall | null;
4
+ };
5
+ export declare function ActiveCallControls({ call }: Props): import("@emotion/react/jsx-runtime").JSX.Element | null;
6
+ export {};
@@ -0,0 +1,6 @@
1
+ import { type PortalCall } from '../../utils/callUi';
2
+ type Props = {
3
+ call?: PortalCall | null;
4
+ };
5
+ export declare function IncomingCallBanner({ call }: Props): import("@emotion/react/jsx-runtime").JSX.Element | null;
6
+ export {};
@@ -0,0 +1,5 @@
1
+ interface QuickReplyEmptyProps {
2
+ filtered: boolean;
3
+ }
4
+ declare const QuickReplyEmpty: ({ filtered }: QuickReplyEmptyProps) => import("@emotion/react/jsx-runtime").JSX.Element;
5
+ export default QuickReplyEmpty;
@@ -5,10 +5,10 @@ export interface QuickReplyPickerMenuProps {
5
5
  anchor: QuickReplyPickerAnchor;
6
6
  items: QuickReplyPickerItem[];
7
7
  highlightedIndex: number;
8
- emptyLabel: string;
9
8
  menuRef?: Ref<HTMLDivElement>;
10
9
  onHighlight: (index: number) => void;
11
10
  onSelect: (item: QuickReplyPickerItem) => void;
11
+ filtered: boolean;
12
12
  }
13
- declare const QuickReplyPickerMenu: ({ anchor, items, highlightedIndex, emptyLabel, menuRef, onHighlight, onSelect, }: QuickReplyPickerMenuProps) => import("@emotion/react/jsx-runtime").JSX.Element;
13
+ declare const QuickReplyPickerMenu: ({ anchor, items, highlightedIndex, menuRef, onHighlight, onSelect, filtered, }: QuickReplyPickerMenuProps) => import("@emotion/react/jsx-runtime").JSX.Element;
14
14
  export default QuickReplyPickerMenu;
@@ -6,6 +6,8 @@ interface ClientSectionProps {
6
6
  tagsLoading: boolean;
7
7
  refetchTags: () => void;
8
8
  onBackToList?: () => void;
9
+ /** Changing this value refetches the client (e.g. after an AI suggestion is applied). */
10
+ refreshKey?: number;
9
11
  }
10
- declare const ClientSection: ({ conv, clientTags, conversationTags, tagsLoading, refetchTags, onBackToList, }: ClientSectionProps) => import("@emotion/react/jsx-runtime").JSX.Element;
12
+ declare const ClientSection: ({ conv, clientTags, conversationTags, tagsLoading, refetchTags, onBackToList, refreshKey, }: ClientSectionProps) => import("@emotion/react/jsx-runtime").JSX.Element;
11
13
  export default ClientSection;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Suggested assignee shown under the contact's suggested life cycle: the agent who handled most of
3
+ * this contact's previous conversations (not AI). Shown only when the conversation is unassigned or
4
+ * assigned to a different live agent. Clicking it assigns the open conversation.
5
+ */
6
+ declare const SuggestedAssignee: () => import("@emotion/react/jsx-runtime").JSX.Element | null;
7
+ export default SuggestedAssignee;
@@ -0,0 +1,13 @@
1
+ import { type SuggestionScope } from '../../utils/convSuggestions';
2
+ type Props = {
3
+ /** 'conv' suggests the conversation life cycle; 'client' suggests the contact lifecycle. */
4
+ scope: SuggestionScope;
5
+ currentStageId?: string | null;
6
+ disabled?: boolean;
7
+ };
8
+ /**
9
+ * AI-suggested life cycle shown under the conversation or contact tags. Clicking it sets the stage
10
+ * through the same mutation (and, for conversations, the same timeline note) as a manual change.
11
+ */
12
+ declare const SuggestedStage: ({ scope, currentStageId, disabled }: Props) => import("@emotion/react/jsx-runtime").JSX.Element | null;
13
+ export default SuggestedStage;
@@ -0,0 +1,18 @@
1
+ import { ReactNode } from 'react';
2
+ import { type SuggestionScope } from '../../utils/convSuggestions';
3
+ type Props = {
4
+ scope: SuggestionScope;
5
+ /** Tags already on the conversation or contact; suggestions for these are hidden. */
6
+ appliedTags: string[];
7
+ /** The tag input's own add handler, so suggested tags behave exactly like picked ones. */
8
+ onAdd: (tag: string) => Promise<void>;
9
+ disabled?: boolean;
10
+ };
11
+ /** A "✦ <label>" row shown under an input; shared by suggested tags and the suggested life cycle. */
12
+ export declare const SuggestedRow: ({ label, children }: {
13
+ label: string;
14
+ children: ReactNode;
15
+ }) => import("@emotion/react/jsx-runtime").JSX.Element;
16
+ /** AI-suggested tags shown under a tag input; clicking one adds it, × dismisses it. */
17
+ declare const SuggestedTags: ({ scope, appliedTags, onAdd, disabled }: Props) => import("@emotion/react/jsx-runtime").JSX.Element | null;
18
+ export default SuggestedTags;
@@ -0,0 +1,16 @@
1
+ type SuggestionMeta = {
2
+ /** Model confidence (0-1); omitted for rule-based suggestions such as the assignee. */
3
+ confidence?: number;
4
+ reason: string;
5
+ };
6
+ type SuggestedTagChipProps = SuggestionMeta & {
7
+ tag: string;
8
+ /** True while this suggestion is being applied. */
9
+ applying: boolean;
10
+ disabled: boolean;
11
+ onApply: () => void;
12
+ onDismiss: () => void;
13
+ };
14
+ /** A suggestion styled like an added tag (dashed, faded): click to apply, × to dismiss. */
15
+ export declare const SuggestedTagChip: ({ tag, applying, disabled, onApply, onDismiss, ...meta }: SuggestedTagChipProps) => import("@emotion/react/jsx-runtime").JSX.Element;
16
+ export {};
@@ -15,6 +15,7 @@ export declare const WABA_TEMPLATE_COSTS: {
15
15
  UTILITY: number;
16
16
  AUTHENTIC: number;
17
17
  };
18
+ export declare const META_TEMPLATES_URL = "https://business.facebook.com/latest/whatsapp_manager/message_templates";
18
19
  export declare const CONVERSATIONS_LIMIT = 300;
19
20
  export declare const WhatsappLanguageCodes: {
20
21
  ar: string;
@@ -0,0 +1,16 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { LocalCallState, PortalCall } from '../utils/callUi';
3
+ type CallSessionValue = {
4
+ activeCallId: string | null;
5
+ localCall: LocalCallState | null;
6
+ muted: boolean;
7
+ answer: (call: PortalCall) => Promise<void>;
8
+ reject: (call: PortalCall) => Promise<void>;
9
+ hangup: (call: PortalCall) => Promise<void>;
10
+ toggleMute: () => Promise<void>;
11
+ };
12
+ export declare function CallSessionProvider({ children }: {
13
+ children: ReactNode;
14
+ }): import("@emotion/react/jsx-runtime").JSX.Element;
15
+ export declare function useCallSession(): CallSessionValue;
16
+ export {};
@@ -0,0 +1,25 @@
1
+ import { ReactNode } from 'react';
2
+ import { Agent, Conversation } from '../../../graphql.autogenerated';
3
+ import useAgentSuggestions from '../hooks/useAgentSuggestions';
4
+ import useApplySuggestion from '../hooks/useApplySuggestion';
5
+ type SuggestionsContextValue = {
6
+ conv: Conversation;
7
+ agents: Agent[];
8
+ suggestions: ReturnType<typeof useAgentSuggestions>;
9
+ apply: ReturnType<typeof useApplySuggestion>;
10
+ };
11
+ type Props = {
12
+ conv: Conversation;
13
+ agents: Agent[];
14
+ onConvUpdate?: () => void;
15
+ onClientUpdate?: () => void;
16
+ children: ReactNode;
17
+ };
18
+ /**
19
+ * Loads AI suggestions once per open conversation and shares them with the inline suggestions:
20
+ * tags and life cycle under the conversation and contact tags, and the assignee under the contact.
21
+ */
22
+ export declare const SuggestionsProvider: ({ conv, agents, onConvUpdate, onClientUpdate, children }: Props) => import("@emotion/react/jsx-runtime").JSX.Element;
23
+ /** Null outside a SuggestionsProvider (e.g. contact pages), so consumers simply render nothing. */
24
+ export declare const useSuggestionsContext: () => SuggestionsContextValue | null;
25
+ export {};
@@ -0,0 +1,20 @@
1
+ import { ClientSuggestionsPayload, Conversation, ConvSuggestionsPayload } from '../../../graphql.autogenerated';
2
+ type Props = {
3
+ conv: Conversation;
4
+ /** Turn off fetching (e.g. ended conversations); cached suggestions are still shown. */
5
+ autoFetch: boolean;
6
+ };
7
+ /**
8
+ * Loads AI suggestions for the open conversation and its client.
9
+ * Fetches automatically after a few customer messages and again every few new ones; results and
10
+ * dismissals are cached per conversation in localStorage, so reopening a conversation (or reloading)
11
+ * does not ask again until new customer messages arrive or the cache expires.
12
+ * Keyed on primitives because `conv` gets a new identity on every inbox poll.
13
+ */
14
+ declare const useAgentSuggestions: ({ conv, autoFetch }: Props) => {
15
+ conversation: ConvSuggestionsPayload | null;
16
+ client: ClientSuggestionsPayload | null;
17
+ hidden: Set<string>;
18
+ hide: (key: string) => void;
19
+ };
20
+ export default useAgentSuggestions;
@@ -0,0 +1,18 @@
1
+ import { Conversation } from '../../../graphql.autogenerated';
2
+ type Props = {
3
+ conv: Conversation;
4
+ onConvUpdate?: () => void;
5
+ onClientUpdate?: () => void;
6
+ };
7
+ /**
8
+ * Applies one AI stage / assignee / lifecycle suggestion through the same mutations and audit notes as
9
+ * the manual editors. Suggested tags are added by the tag inputs' own handlers (SuggestedTags).
10
+ * `applying` holds the key of the suggestion in flight; each apply resolves to true on success.
11
+ */
12
+ declare const useApplySuggestion: ({ conv, onConvUpdate, onClientUpdate }: Props) => {
13
+ applying: string | null;
14
+ applyConvStage: (stageId: string, stage: string) => Promise<boolean>;
15
+ applyAssignee: (agentId: string, agentName: string) => Promise<boolean>;
16
+ applyClientStage: (stageId: string, stage: string) => Promise<boolean>;
17
+ };
18
+ export default useApplySuggestion;
@@ -24,6 +24,7 @@ declare function useConversationsPeriodicFetch(selectedConvId?: string, onSelect
24
24
  broadcastName?: string | null | undefined;
25
25
  sourceType?: string | null | undefined;
26
26
  sourceUrl?: string | null | undefined;
27
+ sentiment?: import("../../../graphql.autogenerated").ConversationSentiment | null | undefined;
27
28
  integrationSwitches?: {
28
29
  __typename?: "ConvIntegrationSwitch" | undefined;
29
30
  fromIntegrationId: string;
@@ -46,6 +47,7 @@ declare function useConversationsPeriodicFetch(selectedConvId?: string, onSelect
46
47
  externalMessageId?: string | null | undefined;
47
48
  tags?: string[] | null | undefined;
48
49
  createdAt: any;
50
+ transcript?: string | null | undefined;
49
51
  context?: {
50
52
  __typename?: "MessageContext" | undefined;
51
53
  replyToId?: string | null | undefined;
@@ -75,6 +77,34 @@ declare function useConversationsPeriodicFetch(selectedConvId?: string, onSelect
75
77
  assignDate?: any;
76
78
  isAi?: boolean | null | undefined;
77
79
  } | null)[] | null | undefined;
80
+ activeCall?: {
81
+ __typename?: "Call" | undefined;
82
+ id: string;
83
+ status: import("../../../graphql.autogenerated").CallStatus;
84
+ handler: import("../../../graphql.autogenerated").CallHandler;
85
+ direction: import("../../../graphql.autogenerated").CallDirection;
86
+ roomName?: string | null | undefined;
87
+ startedAt: any;
88
+ answeredAt?: any;
89
+ duration?: number | null | undefined;
90
+ assigneeId?: string | null | undefined;
91
+ aiId?: string | null | undefined;
92
+ convId: string;
93
+ clientId: string;
94
+ workspaceId: number;
95
+ integrationId: string;
96
+ } | null | undefined;
97
+ classificationRuns?: {
98
+ __typename?: "ConversationClassificationRun" | undefined;
99
+ mode: string;
100
+ convInboundCount: number;
101
+ assignedToAgent: boolean;
102
+ humanDecisionWins: boolean;
103
+ status: string;
104
+ tag?: string | null | undefined;
105
+ error?: string | null | undefined;
106
+ createdAt: any;
107
+ }[] | null | undefined;
78
108
  }[] | null | undefined;
79
109
  loading: boolean;
80
110
  refetch: () => void;
@@ -0,0 +1,2 @@
1
+ import { Conversation } from '../../../graphql.autogenerated';
2
+ export declare function useIncomingCallAlerts(convs: Conversation[] | null | undefined, onOpen: (conv: Conversation) => void, selectedConvId?: string): void;
@@ -7,7 +7,7 @@ export type EventType = {
7
7
  timestamp: number;
8
8
  formattedDate: string;
9
9
  formattedTime: string;
10
- type: 'assignee' | 'note' | 'start' | 'end' | 'switch';
10
+ type: 'assignee' | 'note' | 'start' | 'end' | 'switch' | 'classify';
11
11
  noteType?: NoteType;
12
12
  content: string;
13
13
  Icon: React.ReactNode;
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import { Dispatch, SetStateAction } from 'react';
2
2
  import { QuickReplyPickerItem } from '../utils/quickReplyPicker';
3
3
  export interface UseQuickReplyPickerOptions {
4
4
  workspaceId: number | undefined;
@@ -6,12 +6,14 @@ export interface UseQuickReplyPickerOptions {
6
6
  enabled: boolean;
7
7
  noteMode: boolean;
8
8
  onSelect: (content: string) => void;
9
+ composerDraft: string;
10
+ setComposerDraft: Dispatch<SetStateAction<string>>;
9
11
  }
10
- export declare function useQuickReplyPicker({ workspaceId, conversationId, enabled, noteMode, onSelect, }: UseQuickReplyPickerOptions): {
12
+ export declare function useQuickReplyPicker({ workspaceId, conversationId, enabled, noteMode, onSelect, composerDraft, setComposerDraft, }: UseQuickReplyPickerOptions): {
11
13
  isOpen: boolean;
12
14
  filteredItems: QuickReplyPickerItem[];
13
15
  highlightedIndex: number;
14
- setHighlightedIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
16
+ setHighlightedIndex: Dispatch<SetStateAction<number>>;
15
17
  onComposerInputChange: (text: string) => void;
16
18
  selectItem: (item: QuickReplyPickerItem) => void;
17
19
  dismiss: () => void;
@@ -1,2 +1,2 @@
1
1
  export declare const InboxPage: () => import("@emotion/react/jsx-runtime").JSX.Element;
2
- export default InboxPage;
2
+ export default function InboxPageRoot(): import("@emotion/react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ export type PortalCall = {
2
+ id: string;
3
+ status: string;
4
+ handler: string;
5
+ workspaceId: number;
6
+ convId: string;
7
+ answeredAt?: string | null;
8
+ };
9
+ export declare function isRingingCall(call?: {
10
+ status?: string | null;
11
+ } | null, enabled?: boolean): boolean;
12
+ export declare function isLiveCall(call?: {
13
+ status?: string | null;
14
+ } | null, enabled?: boolean): boolean;
15
+ export type LocalCallState = {
16
+ id: string;
17
+ status: string;
18
+ answeredAt?: string | null;
19
+ };
20
+ export declare function presentCall<T extends {
21
+ id: string;
22
+ status: string;
23
+ answeredAt?: string | null;
24
+ }>(call: T | null | undefined, local: LocalCallState | null): T | null | undefined;
25
+ export declare function formatCallElapsed(answeredAt?: string | null, now?: number): string;
@@ -0,0 +1,59 @@
1
+ /** First automatic suggestions run once the customer has sent this many messages. */
2
+ export declare const MIN_CUSTOMER_MESSAGES_FOR_SUGGESTIONS = 3;
3
+ /** Suggestions refresh automatically after this many new customer messages. */
4
+ export declare const SUGGESTIONS_REFRESH_EVERY = 5;
5
+ type CountableMessage = {
6
+ isAgent?: boolean | null;
7
+ type?: string | null;
8
+ };
9
+ /** Customer text and voice messages: the content the suggestion model can actually read. */
10
+ export declare const countCustomerMessages: (messages: CountableMessage[] | null | undefined) => number;
11
+ /**
12
+ * Groups message counts so suggestions refresh every few customer messages, not on every poll.
13
+ * Returns 0 while the conversation is too short for useful suggestions.
14
+ */
15
+ export declare const getSuggestionsBucket: (customerMessages: number) => number;
16
+ type TagLike = {
17
+ tag: string;
18
+ };
19
+ type StageLike = {
20
+ stageId: string;
21
+ };
22
+ type AssigneeLike = {
23
+ agentId: string;
24
+ };
25
+ type SuggestionsLike<T extends TagLike, S extends StageLike, A extends AssigneeLike> = {
26
+ tags: T[];
27
+ stage?: S | null;
28
+ assignee?: A | null;
29
+ };
30
+ export type SuggestionScope = 'conv' | 'client';
31
+ type CurrentState = {
32
+ scope: SuggestionScope;
33
+ tags?: string[] | null;
34
+ stageId?: string | null;
35
+ assigneeId?: string | null;
36
+ /** Keys of suggestions the agent dismissed or already applied in this session. */
37
+ hidden?: Set<string>;
38
+ };
39
+ /** Stable keys for one suggestion, scoped so a conversation and client tag with the same name differ. */
40
+ export declare const suggestionKey: {
41
+ tag: (scope: SuggestionScope, tag: string) => string;
42
+ stage: (scope: SuggestionScope, stageId: string) => string;
43
+ assignee: (agentId: string) => string;
44
+ };
45
+ /**
46
+ * Hides suggestions that were applied (the conversation or client already has them)
47
+ * or hidden by the agent, so the card stays in sync with polling without a refetch.
48
+ */
49
+ export declare const pendingSuggestions: <T extends TagLike, S extends StageLike, A extends AssigneeLike>(suggestions: SuggestionsLike<T, S, A> | null | undefined, { scope, tags, stageId, assigneeId, hidden }: CurrentState) => {
50
+ tags: T[];
51
+ stage: S | null;
52
+ assignee: A | null;
53
+ };
54
+ export declare const hasPendingSuggestions: (pending: {
55
+ tags: unknown[];
56
+ stage?: unknown;
57
+ assignee?: unknown;
58
+ }) => boolean;
59
+ export {};