@bcrumbs.net/inbox 0.0.69 → 0.0.70
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/index.cjs.js +530 -295
- package/index.esm.js +530 -295
- package/package.json +1 -1
- package/src/app/automation/components/AutomationAudienceSummary.d.ts +10 -0
- package/src/app/automation/components/AutomationInfoHeader.d.ts +17 -0
- package/src/app/automation/components/AutomationList.d.ts +8 -0
- package/src/app/automation/components/AutomationListTable.d.ts +16 -0
- package/src/app/automation/components/AutomationMessageSection.d.ts +12 -0
- package/src/app/automation/components/AutomationOccurrencesFilters.d.ts +13 -0
- package/src/app/automation/components/AutomationOccurrencesHeader.d.ts +10 -0
- package/src/app/automation/components/AutomationOccurrencesStats.d.ts +8 -0
- package/src/app/automation/components/AutomationOccurrencesTable.d.ts +11 -0
- package/src/app/automation/components/AutomationOverview.d.ts +10 -0
- package/src/app/automation/components/AutomationScheduleSection.d.ts +15 -0
- package/src/app/automation/components/AutomationStateBadge.d.ts +11 -0
- package/src/app/automation/components/AutomationTriggerSection.d.ts +14 -0
- package/src/app/automation/constants.d.ts +31 -0
- package/src/app/automation/hooks/useAutomationAudience.d.ts +20 -0
- package/src/app/automation/hooks/useAutomationStateActions.d.ts +11 -0
- package/src/app/automation/hooks/useAutomationSubmit.d.ts +28 -0
- package/src/app/automation/hooks/useAutomationTemplate.d.ts +29 -0
- package/src/app/automation/pages/AutomationInfo.d.ts +2 -0
- package/src/app/automation/pages/AutomationList.d.ts +2 -0
- package/src/app/automation/pages/AutomationOccurrences.d.ts +2 -0
- package/src/app/automation/types.d.ts +7 -0
- package/src/app/automation/utils/automationForm.d.ts +49 -0
- package/src/app/automation/utils/occurrences.d.ts +14 -0
- package/src/app/automation/utils/stateCounts.d.ts +17 -0
- package/src/app/broadcast/components/BroadcastDetailsSection.d.ts +5 -1
- package/src/app/broadcast/components/BroadcastInfoTemplateMessagePreview.d.ts +4 -2
- package/src/app/broadcast/components/BroadcastRecipientsSection.d.ts +3 -1
- package/src/app/inbox/hooks/useAutoAssignOnSend.d.ts +7 -0
- package/src/app/inbox/hooks/useMyAgent.d.ts +2 -0
- package/src/app/layout/constants/subMenu.d.ts +13 -0
- package/src/app/layout/hooks/useAutomationsEnabled.d.ts +9 -0
- package/src/assets/locales/translations.d.ts +137 -0
- package/src/graphql.autogenerated.d.ts +1064 -2
package/package.json
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutomationAudiencePreview } from '../../../graphql.autogenerated';
|
|
3
|
+
type AutomationAudienceSummaryProps = {
|
|
4
|
+
preview?: Pick<AutomationAudiencePreview, 'matchingCount' | 'dueCount'>;
|
|
5
|
+
loading: boolean;
|
|
6
|
+
/** An active automation messages due contacts on its next run, not on activation. */
|
|
7
|
+
isActive?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const _default: React.MemoExoticComponent<({ preview, loading, isActive }: AutomationAudienceSummaryProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type AutomationInfoHeaderProps = {
|
|
3
|
+
isEditMode: boolean;
|
|
4
|
+
/** Active automations only get a single "Save changes" button. */
|
|
5
|
+
isActive: boolean;
|
|
6
|
+
/** Paused automations stay paused when saved, so the first button reads "Save changes". */
|
|
7
|
+
isPaused: boolean;
|
|
8
|
+
loading: boolean;
|
|
9
|
+
disabledSave: boolean;
|
|
10
|
+
/** Tooltip shown when activation is blocked, e.g. by the usage limit. */
|
|
11
|
+
activateDisabledReason?: string;
|
|
12
|
+
onCancel: () => void;
|
|
13
|
+
onSaveDraft: () => void;
|
|
14
|
+
onSaveAndActivate: () => void;
|
|
15
|
+
};
|
|
16
|
+
declare const _default: React.MemoExoticComponent<({ isEditMode, isActive, isPaused, loading, disabledSave, activateDisabledReason, onCancel, onSaveDraft, onSaveAndActivate, }: AutomationInfoHeaderProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutomationStateChange } from '../utils/stateCounts';
|
|
3
|
+
type AutomationListProps = {
|
|
4
|
+
/** Called after any create/state change so the overview counters refresh. */
|
|
5
|
+
onChanged: (change?: AutomationStateChange) => void;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: React.MemoExoticComponent<({ onChanged }: AutomationListProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutomationFragment } from '../../../graphql.autogenerated';
|
|
3
|
+
import { AutomationStateChange } from '../utils/stateCounts';
|
|
4
|
+
type AutomationListTableProps = {
|
|
5
|
+
automations: AutomationFragment[];
|
|
6
|
+
loading?: boolean;
|
|
7
|
+
hasMore?: boolean;
|
|
8
|
+
onLoadMore?: () => void;
|
|
9
|
+
loadingMore?: boolean;
|
|
10
|
+
removeItem: (id: string) => void;
|
|
11
|
+
updateItem: (id: string, updates: Partial<AutomationFragment>) => void;
|
|
12
|
+
/** Called after any state change so dependent counters can refresh. */
|
|
13
|
+
onChanged: (change?: AutomationStateChange) => void;
|
|
14
|
+
};
|
|
15
|
+
declare const _default: React.MemoExoticComponent<({ automations, loading, hasMore, onLoadMore, loadingMore, removeItem, updateItem, onChanged, }: AutomationListTableProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useAutomationTemplate } from '../hooks/useAutomationTemplate';
|
|
3
|
+
import { RenderDroplistField, RenderField } from '../types';
|
|
4
|
+
type AutomationMessageSectionProps = {
|
|
5
|
+
renderField: RenderField;
|
|
6
|
+
renderDroplistField: RenderDroplistField;
|
|
7
|
+
integrationId: string;
|
|
8
|
+
templateName: string;
|
|
9
|
+
template: ReturnType<typeof useAutomationTemplate>;
|
|
10
|
+
};
|
|
11
|
+
declare const _default: React.MemoExoticComponent<({ renderField, renderDroplistField, integrationId, templateName, template, }: AutomationMessageSectionProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutomationOccurrenceStatus } from '../../../graphql.autogenerated';
|
|
3
|
+
import { OccurrenceRange } from '../utils/occurrences';
|
|
4
|
+
type AutomationOccurrencesFiltersProps = {
|
|
5
|
+
searchQuery: string;
|
|
6
|
+
onSearchChange: (query: string) => void;
|
|
7
|
+
status?: AutomationOccurrenceStatus;
|
|
8
|
+
onStatusChange: (status?: AutomationOccurrenceStatus) => void;
|
|
9
|
+
range: OccurrenceRange;
|
|
10
|
+
onRangeChange: (range: OccurrenceRange) => void;
|
|
11
|
+
};
|
|
12
|
+
declare const _default: React.MemoExoticComponent<({ searchQuery, onSearchChange, status, onStatusChange, range, onRangeChange, }: AutomationOccurrencesFiltersProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
13
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutomationFragment } from '../../../graphql.autogenerated';
|
|
3
|
+
type AutomationOccurrencesHeaderProps = {
|
|
4
|
+
automation?: AutomationFragment;
|
|
5
|
+
loading: boolean;
|
|
6
|
+
changingState: boolean;
|
|
7
|
+
onToggleState: () => void;
|
|
8
|
+
};
|
|
9
|
+
declare const _default: React.MemoExoticComponent<({ automation, loading, changingState, onToggleState, }: AutomationOccurrencesHeaderProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutomationOccurrenceStats } from '../../../graphql.autogenerated';
|
|
3
|
+
type AutomationOccurrencesStatsProps = {
|
|
4
|
+
stats?: Omit<AutomationOccurrenceStats, '__typename'>;
|
|
5
|
+
loading: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: React.MemoExoticComponent<({ stats, loading }: AutomationOccurrencesStatsProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutomationOccurrenceFragment } from '../../../graphql.autogenerated';
|
|
3
|
+
type AutomationOccurrencesTableProps = {
|
|
4
|
+
occurrences: AutomationOccurrenceFragment[];
|
|
5
|
+
loading?: boolean;
|
|
6
|
+
hasMore?: boolean;
|
|
7
|
+
onLoadMore?: () => void;
|
|
8
|
+
loadingMore?: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare const _default: React.MemoExoticComponent<({ occurrences, loading, hasMore, onLoadMore, loadingMore, }: AutomationOccurrencesTableProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutomationStateChange } from '../utils/stateCounts';
|
|
3
|
+
type AutomationOverviewProps = {
|
|
4
|
+
/** Changes whenever the list mutates, so counts refresh. */
|
|
5
|
+
refreshKey?: number;
|
|
6
|
+
/** The list change behind the latest refreshKey, shown on the counters until the refetch returns. */
|
|
7
|
+
pendingChange?: AutomationStateChange;
|
|
8
|
+
};
|
|
9
|
+
declare const _default: React.MemoExoticComponent<({ refreshKey, pendingChange }: AutomationOverviewProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutomationReentryPolicy, AutomationTriggerType } from '../../../graphql.autogenerated';
|
|
3
|
+
import { RenderDroplistField, RenderField } from '../types';
|
|
4
|
+
type AutomationScheduleSectionProps = {
|
|
5
|
+
renderField: RenderField;
|
|
6
|
+
renderDroplistField: RenderDroplistField;
|
|
7
|
+
triggerType: AutomationTriggerType;
|
|
8
|
+
reentryPolicy: AutomationReentryPolicy;
|
|
9
|
+
sendWeekdays: string[];
|
|
10
|
+
setSendWeekdays: (weekdays: string[]) => void;
|
|
11
|
+
/** True when only contacts with a conversation in the last 90 days count (import_contacts off). */
|
|
12
|
+
recentInboundRule: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare const _default: React.MemoExoticComponent<({ renderField, renderDroplistField, triggerType, reentryPolicy, sendWeekdays, setSendWeekdays, recentInboundRule, }: AutomationScheduleSectionProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutomationState } from '../../../graphql.autogenerated';
|
|
3
|
+
type AutomationStateBadgeProps = {
|
|
4
|
+
state: AutomationState;
|
|
5
|
+
/** When set, a warning icon with this text is shown next to the badge. */
|
|
6
|
+
lastError?: string | null;
|
|
7
|
+
/** A deleted automation shows "Deleted" instead of its last state. */
|
|
8
|
+
deleted?: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare const _default: React.MemoExoticComponent<({ state, lastError, deleted }: AutomationStateBadgeProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutomationTriggerType } from '../../../graphql.autogenerated';
|
|
3
|
+
import { RenderDroplistField, RenderField } from '../types';
|
|
4
|
+
type AutomationTriggerSectionProps = {
|
|
5
|
+
renderField: RenderField;
|
|
6
|
+
renderDroplistField: RenderDroplistField;
|
|
7
|
+
triggerType: AutomationTriggerType;
|
|
8
|
+
delayDays: string;
|
|
9
|
+
delayHours: string;
|
|
10
|
+
/** True when only contacts with a conversation in the last 90 days count (import_contacts off). */
|
|
11
|
+
recentInboundRule: boolean;
|
|
12
|
+
};
|
|
13
|
+
declare const _default: React.MemoExoticComponent<({ renderField, renderDroplistField, triggerType, delayDays, delayHours, recentInboundRule, }: AutomationTriggerSectionProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AutomationReentryPolicy, AutomationTriggerType } from '../../graphql.autogenerated';
|
|
2
|
+
/** Mirrors core limits in AutomationsService. */
|
|
3
|
+
export declare const AUTOMATION_MAX_DELAY_DAYS = 365;
|
|
4
|
+
export declare const AUTOMATION_MAX_LATENESS_DAYS = 30;
|
|
5
|
+
export declare const AUTOMATION_DEFAULT_LATENESS_DAYS = 1;
|
|
6
|
+
export declare const AUTOMATION_DEFAULT_COOLDOWN_DAYS = 30;
|
|
7
|
+
export declare const AUTOMATION_LIST_PAGE_SIZE = 15;
|
|
8
|
+
export declare const AUTOMATION_OCCURRENCES_PAGE_SIZE = 20;
|
|
9
|
+
/** Default range of the occurrences page stats and table. */
|
|
10
|
+
export declare const AUTOMATION_OCCURRENCES_DEFAULT_RANGE_DAYS = 30;
|
|
11
|
+
/** Form field names. name/integrationId/templateName/clientStageId/country match the reused broadcast sections. */
|
|
12
|
+
export declare enum AutomationFormFields {
|
|
13
|
+
name = "name",
|
|
14
|
+
integrationId = "integrationId",
|
|
15
|
+
templateName = "templateName",
|
|
16
|
+
clientStageId = "clientStageId",
|
|
17
|
+
country = "country",
|
|
18
|
+
triggerType = "triggerType",
|
|
19
|
+
delayDays = "delayDays",
|
|
20
|
+
delayHours = "delayHours",
|
|
21
|
+
maxLatenessDays = "maxLatenessDays",
|
|
22
|
+
reentryPolicy = "reentryPolicy",
|
|
23
|
+
reentryCooldownDays = "reentryCooldownDays",
|
|
24
|
+
timezone = "timezone",
|
|
25
|
+
sendWindowStart = "sendWindowStart",
|
|
26
|
+
sendWindowEnd = "sendWindowEnd"
|
|
27
|
+
}
|
|
28
|
+
export declare const AUTOMATION_TRIGGER_TYPES: AutomationTriggerType[];
|
|
29
|
+
export declare const AUTOMATION_REENTRY_POLICIES: AutomationReentryPolicy[];
|
|
30
|
+
/** Badge colours for automation states, keyed like bc-ui StateToColorMap. */
|
|
31
|
+
export declare const AUTOMATION_STATE_COLOR_KEY: Record<string, string>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AutomationScheduleValues } from '../utils/automationForm';
|
|
2
|
+
type UseAutomationAudienceProps = {
|
|
3
|
+
/** Set when editing, so contacts the automation already handled are left out of the due count. */
|
|
4
|
+
automationId?: string;
|
|
5
|
+
selectedTags: string[];
|
|
6
|
+
clientStageId: string;
|
|
7
|
+
country: string;
|
|
8
|
+
scheduleValues: AutomationScheduleValues;
|
|
9
|
+
};
|
|
10
|
+
/** Contact counts and sample contacts for the automation conditions. */
|
|
11
|
+
export declare const useAutomationAudience: ({ automationId, selectedTags, clientStageId, country, scheduleValues, }: UseAutomationAudienceProps) => {
|
|
12
|
+
preview: {
|
|
13
|
+
__typename?: "AutomationAudiencePreview" | undefined;
|
|
14
|
+
matchingCount: number;
|
|
15
|
+
dueCount: number;
|
|
16
|
+
} | undefined;
|
|
17
|
+
loadingPreview: boolean;
|
|
18
|
+
sampleContacts: import("../../generic/hooks/usePaginatedQuery").UsePaginatedQueryResult<any>;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AutomationFragment } from '../../../graphql.autogenerated';
|
|
2
|
+
/**
|
|
3
|
+
* Activate / pause / delete with the shared error toast.
|
|
4
|
+
* Each action resolves to the updated automation, or undefined when it failed.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useAutomationStateActions: () => {
|
|
7
|
+
activate: (id: string) => Promise<AutomationFragment | undefined>;
|
|
8
|
+
pause: (id: string) => Promise<AutomationFragment | undefined>;
|
|
9
|
+
remove: (id: string) => Promise<boolean | undefined>;
|
|
10
|
+
loading: boolean;
|
|
11
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BCValidationTypes } from '@bcrumbs.net/bc-ui';
|
|
2
|
+
import { AutomationState } from '../../../graphql.autogenerated';
|
|
3
|
+
import { AutomationFormFields as Fields } from '../constants';
|
|
4
|
+
import { AutomationScheduleValues } from '../utils/automationForm';
|
|
5
|
+
type TemplateState = {
|
|
6
|
+
templateLang?: string;
|
|
7
|
+
requiredParameters: string[];
|
|
8
|
+
areAllParametersFilled: boolean;
|
|
9
|
+
getSubmissionComponents: () => unknown[];
|
|
10
|
+
};
|
|
11
|
+
type UseAutomationSubmitProps = {
|
|
12
|
+
id?: string;
|
|
13
|
+
currentState?: AutomationState;
|
|
14
|
+
value: (field: Fields) => string;
|
|
15
|
+
validateField: (key: string, validationType: BCValidationTypes) => boolean;
|
|
16
|
+
resetValidationStates: () => void;
|
|
17
|
+
selectedTags: string[];
|
|
18
|
+
scheduleValues: AutomationScheduleValues;
|
|
19
|
+
template: TemplateState;
|
|
20
|
+
/** True when only contacts with a conversation in the last 90 days count (import_contacts off). */
|
|
21
|
+
recentInboundRule: boolean;
|
|
22
|
+
};
|
|
23
|
+
/** Validates the form, saves the automation and optionally activates it. */
|
|
24
|
+
export declare const useAutomationSubmit: ({ id, currentState, value, validateField, resetValidationStates, selectedTags, scheduleValues, template, recentInboundRule, }: UseAutomationSubmitProps) => {
|
|
25
|
+
submit: (activate: boolean) => Promise<void>;
|
|
26
|
+
saving: boolean;
|
|
27
|
+
};
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AutomationFragment } from '../../../graphql.autogenerated';
|
|
3
|
+
type UseAutomationTemplateProps = {
|
|
4
|
+
integrationId: string;
|
|
5
|
+
templateName: string;
|
|
6
|
+
/** Automation being edited: its saved parameters fill the template inputs once. */
|
|
7
|
+
savedAutomation?: Pick<AutomationFragment, 'id' | 'templateLang' | 'templateComponents'>;
|
|
8
|
+
};
|
|
9
|
+
/** Channel + template selection state shared with the broadcast details section. */
|
|
10
|
+
export declare const useAutomationTemplate: ({ integrationId, templateName, savedAutomation }: UseAutomationTemplateProps) => {
|
|
11
|
+
templatesData: import("../../../graphql.autogenerated").WabaMessageTemplatesQuery | undefined;
|
|
12
|
+
loadingTemplates: boolean;
|
|
13
|
+
integrationsData: import("../../../graphql.autogenerated").IntegrationsQuery | undefined;
|
|
14
|
+
loadingIntegrations: boolean;
|
|
15
|
+
refreshTemplates: () => void;
|
|
16
|
+
templateLang: any;
|
|
17
|
+
templateDetailsData: import("../../../graphql.autogenerated").WabaMessageTemplateDetailsQuery | undefined;
|
|
18
|
+
loadingTemplateDetails: boolean;
|
|
19
|
+
parameterValues: Record<string, string>;
|
|
20
|
+
setParameterValues: import("react").Dispatch<import("react").SetStateAction<Record<string, string>>>;
|
|
21
|
+
onParameterChange: (key: string, value: string) => void;
|
|
22
|
+
requiredParameters: string[];
|
|
23
|
+
areAllParametersFilled: boolean;
|
|
24
|
+
wabaTemplate: any;
|
|
25
|
+
components: any;
|
|
26
|
+
setInitialParameters: (savedComponents: any[]) => void;
|
|
27
|
+
getSubmissionComponents: () => any[];
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { useBCForm } from '@bcrumbs.net/bc-ui';
|
|
2
|
+
type BCFormActions = ReturnType<typeof useBCForm>[1];
|
|
3
|
+
/** `renderField` returned by useBCForm. */
|
|
4
|
+
export type RenderField = BCFormActions['renderField'];
|
|
5
|
+
/** `renderDroplistField` returned by useBCForm. */
|
|
6
|
+
export type RenderDroplistField = BCFormActions['renderDroplistField'];
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { TFunction } from 'i18next';
|
|
2
|
+
import { AutomationFragment, AutomationReentryPolicy, AutomationTriggerType } from '../../../graphql.autogenerated';
|
|
3
|
+
export declare const MINUTES_PER_HOUR = 60;
|
|
4
|
+
export declare const MINUTES_PER_DAY: number;
|
|
5
|
+
export type DelayParts = {
|
|
6
|
+
days: number;
|
|
7
|
+
hours: number;
|
|
8
|
+
};
|
|
9
|
+
export type AutomationScheduleValues = {
|
|
10
|
+
triggerType: AutomationTriggerType;
|
|
11
|
+
delayDays: string;
|
|
12
|
+
delayHours: string;
|
|
13
|
+
maxLatenessDays: string;
|
|
14
|
+
reentryPolicy: AutomationReentryPolicy;
|
|
15
|
+
reentryCooldownDays: string;
|
|
16
|
+
timezone: string;
|
|
17
|
+
sendWindowStart: string;
|
|
18
|
+
sendWindowEnd: string;
|
|
19
|
+
sendWeekdays: string[];
|
|
20
|
+
};
|
|
21
|
+
export declare const splitDelayMinutes: (minutes: number | null | undefined) => DelayParts;
|
|
22
|
+
export declare const toDelayMinutes: (days: string | number, hours: string | number) => number;
|
|
23
|
+
/** 'HH:mm' -> minutes from midnight. Empty or invalid input -> undefined. */
|
|
24
|
+
export declare const timeToMinutes: (value: string | null | undefined) => number | undefined;
|
|
25
|
+
/** Minutes from midnight -> 'HH:mm'. */
|
|
26
|
+
export declare const minutesToTime: (value: number | null | undefined) => string;
|
|
27
|
+
/** Human sentence for a trigger, e.g. "3 days and 2 hours after the contact is created". */
|
|
28
|
+
export declare const formatTriggerSummary: (t: TFunction, { triggerType, delayMinutes }: Pick<AutomationFragment, 'triggerType' | 'delayMinutes'>) => string;
|
|
29
|
+
/** Re-entry options other than "once" only make sense when the trigger date can change. */
|
|
30
|
+
export declare const isReentryPolicyAllowed: (triggerType: AutomationTriggerType, policy: AutomationReentryPolicy) => boolean;
|
|
31
|
+
/** Builds the trigger/schedule part of the create/patch input from form values. */
|
|
32
|
+
export declare const buildScheduleInput: (values: AutomationScheduleValues) => {
|
|
33
|
+
triggerType: AutomationTriggerType;
|
|
34
|
+
delayMinutes: number;
|
|
35
|
+
maxLatenessDays: number;
|
|
36
|
+
reentryPolicy: AutomationReentryPolicy;
|
|
37
|
+
reentryCooldownDays: number | null;
|
|
38
|
+
timezone: string;
|
|
39
|
+
sendWindowStart: number | null;
|
|
40
|
+
sendWindowEnd: number | null;
|
|
41
|
+
sendWeekdays: string[];
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* With the 90-day recent-conversation rule on, a contact past that age drops out of the audience,
|
|
45
|
+
* so a "last conversation started" delay of 90 days or more can never send. Mirrors core validation.
|
|
46
|
+
*/
|
|
47
|
+
export declare const isDelayAfterConversationTooLong: (triggerType: AutomationTriggerType, delayMinutes: number, recentInboundRule: boolean) => boolean;
|
|
48
|
+
/** True when only one end of the send window is set, or start is not before end. */
|
|
49
|
+
export declare const isSendWindowInvalid: (start: string, end: string) => boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AutomationOccurrenceFragment } from '../../../graphql.autogenerated';
|
|
2
|
+
export declare enum OccurrenceRange {
|
|
3
|
+
last7Days = "last7Days",
|
|
4
|
+
last30Days = "last30Days",
|
|
5
|
+
last90Days = "last90Days",
|
|
6
|
+
allTime = "allTime"
|
|
7
|
+
}
|
|
8
|
+
/** Start (local midnight) of the range, as an ISO string; undefined for all time. */
|
|
9
|
+
export declare const getOccurrenceRangeStart: (range: OccurrenceRange, now?: Date) => string | undefined;
|
|
10
|
+
/** Status shown in the occurrences table: the delivery status once sent, otherwise the occurrence status. */
|
|
11
|
+
export type OccurrenceDisplayStatus = 'queued' | 'sent' | 'delivered' | 'read' | 'failed';
|
|
12
|
+
export declare const getOccurrenceDisplayStatus: (occurrence: Pick<AutomationOccurrenceFragment, 'status' | 'messageStatus'>) => OccurrenceDisplayStatus;
|
|
13
|
+
/** Key into bc-ui StateToColorMap for a display status. */
|
|
14
|
+
export declare const OCCURRENCE_STATUS_COLOR_KEY: Record<OccurrenceDisplayStatus, string>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AutomationFragment, AutomationState } from '../../../graphql.autogenerated';
|
|
2
|
+
export type AutomationStateCountItem = {
|
|
3
|
+
state: AutomationState;
|
|
4
|
+
count: number;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* The fields an activate/pause result changes. Mutation results have no sent count or last
|
|
8
|
+
* occurrence, so merging the whole result would blank those columns.
|
|
9
|
+
*/
|
|
10
|
+
export declare const pickStateFields: ({ state, activatedAt, lastError, patchedAt, }: AutomationFragment) => Pick<AutomationFragment, 'state' | 'activatedAt' | 'lastError' | 'patchedAt'>;
|
|
11
|
+
/** One automation moving between states in the list: `to` is unset on delete, `from` on create. */
|
|
12
|
+
export type AutomationStateChange = {
|
|
13
|
+
from?: AutomationState;
|
|
14
|
+
to?: AutomationState;
|
|
15
|
+
};
|
|
16
|
+
/** Applies a list change to the overview counters, so they update before the counts refetch. Never below zero. */
|
|
17
|
+
export declare const applyStateChange: (counts: AutomationStateCountItem[], change?: AutomationStateChange) => AutomationStateCountItem[];
|
|
@@ -12,6 +12,10 @@ interface BroadcastDetailsSectionProps {
|
|
|
12
12
|
requiredParameters?: string[];
|
|
13
13
|
selectedIntegrationId?: string;
|
|
14
14
|
onRefreshTemplates?: () => void;
|
|
15
|
+
/** Overrides the card title (defaults to the broadcast wording). */
|
|
16
|
+
title?: string;
|
|
17
|
+
/** Overrides the name field label and placeholder (defaults to the broadcast wording). */
|
|
18
|
+
nameLabel?: string;
|
|
15
19
|
}
|
|
16
|
-
declare const _default: React.MemoExoticComponent<({ renderField, renderDroplistField, templatesData, loadingTemplates, integrationsData, loadingIntegrations, parameterValues, onParameterChange, loadingTemplateDetails, requiredParameters, selectedIntegrationId, onRefreshTemplates, }: BroadcastDetailsSectionProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
20
|
+
declare const _default: React.MemoExoticComponent<({ renderField, renderDroplistField, templatesData, loadingTemplates, integrationsData, loadingIntegrations, parameterValues, onParameterChange, loadingTemplateDetails, requiredParameters, selectedIntegrationId, onRefreshTemplates, title, nameLabel, }: BroadcastDetailsSectionProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
17
21
|
export default _default;
|
|
@@ -5,7 +5,9 @@ interface BroadcastInfoTemplateMessagePreview {
|
|
|
5
5
|
templateDetailsData?: WabaMessageTemplateDetailsQuery['wabaMessageTemplateDetails'];
|
|
6
6
|
parameterValues?: Record<string, string>;
|
|
7
7
|
loadingTemplateDetails?: boolean;
|
|
8
|
+
/** Replaces the broadcast wording of the empty state, e.g. on the automation form. */
|
|
9
|
+
emptySubtitle?: string;
|
|
8
10
|
}
|
|
9
|
-
declare const BroadcastInfoTemplateMessagePreview: ({ templateName, templateDetailsData, parameterValues, loadingTemplateDetails, }: BroadcastInfoTemplateMessagePreview) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
10
|
-
declare const _default: React.MemoExoticComponent<({ templateName, templateDetailsData, parameterValues, loadingTemplateDetails, }: BroadcastInfoTemplateMessagePreview) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
11
|
+
declare const BroadcastInfoTemplateMessagePreview: ({ templateName, templateDetailsData, parameterValues, loadingTemplateDetails, emptySubtitle, }: BroadcastInfoTemplateMessagePreview) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare const _default: React.MemoExoticComponent<({ templateName, templateDetailsData, parameterValues, loadingTemplateDetails, emptySubtitle, }: BroadcastInfoTemplateMessagePreview) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
11
13
|
export default _default;
|
|
@@ -8,6 +8,8 @@ interface BroadcastRecipientsSectionProps {
|
|
|
8
8
|
selectedTags: string[];
|
|
9
9
|
setSelectedTags: (tags: string[]) => void;
|
|
10
10
|
refetchTags: () => void;
|
|
11
|
+
/** Overrides the card title (defaults to the broadcast wording). */
|
|
12
|
+
title?: string;
|
|
11
13
|
}
|
|
12
|
-
declare const _default: React.MemoExoticComponent<({ renderDroplistField, clientStages, clientTags, loadingTags, selectedTags, setSelectedTags, refetchTags, }: BroadcastRecipientsSectionProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
14
|
+
declare const _default: React.MemoExoticComponent<({ renderDroplistField, clientStages, clientTags, loadingTags, selectedTags, setSelectedTags, refetchTags, title, }: BroadcastRecipientsSectionProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
13
15
|
export default _default;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether sending a reply should assign the conversation to the sender.
|
|
3
|
+
* The portal persists the workspace role through withMe. The embedded inbox has no withMe,
|
|
4
|
+
* so an agent API key's role is read from `me` instead.
|
|
5
|
+
*/
|
|
6
|
+
declare const useAutoAssignOnSend: () => boolean;
|
|
7
|
+
export default useAutoAssignOnSend;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Agent } from '../../../graphql.autogenerated';
|
|
2
2
|
/** Workspace admin API key — not linked to an agent (`agentApiKey` is agent-linked). */
|
|
3
3
|
export declare const isWorkspaceAdminApiKey: (userType: string | undefined) => boolean;
|
|
4
|
+
/** Agent-linked API key — authenticates as the agent itself and carries its own role. */
|
|
5
|
+
export declare const isAgentApiKey: (userType: string | undefined) => boolean;
|
|
4
6
|
/**
|
|
5
7
|
* Resolves the workspace agent for the current session.
|
|
6
8
|
* Portal users match on agent.userId; agent-linked API keys authenticate with agent.id.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Permission } from '@bcrumbs.net/bc-shared';
|
|
1
2
|
export declare const ManagementSubmenu: ({
|
|
2
3
|
title: string;
|
|
3
4
|
hide: boolean;
|
|
@@ -20,6 +21,17 @@ export declare const ManagementSubmenu: ({
|
|
|
20
21
|
action: string;
|
|
21
22
|
description: string;
|
|
22
23
|
tags: string[];
|
|
24
|
+
requiredPermissions?: undefined;
|
|
25
|
+
hide?: undefined;
|
|
26
|
+
} | {
|
|
27
|
+
label: string;
|
|
28
|
+
title: string;
|
|
29
|
+
link: string;
|
|
30
|
+
icon: import("@emotion/react/jsx-runtime").JSX.Element;
|
|
31
|
+
action: string;
|
|
32
|
+
description: string;
|
|
33
|
+
tags: string[];
|
|
34
|
+
requiredPermissions: Permission[];
|
|
23
35
|
hide?: undefined;
|
|
24
36
|
} | {
|
|
25
37
|
label: string;
|
|
@@ -30,6 +42,7 @@ export declare const ManagementSubmenu: ({
|
|
|
30
42
|
action: string;
|
|
31
43
|
description: string;
|
|
32
44
|
tags: string[];
|
|
45
|
+
requiredPermissions?: undefined;
|
|
33
46
|
})[];
|
|
34
47
|
hide?: undefined;
|
|
35
48
|
})[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const AUTOMATIONS_FEATURE_FLAG = "automations";
|
|
2
|
+
/** Nav item `action` of the Automations entry in the management submenu. */
|
|
3
|
+
export declare const AUTOMATIONS_NAV_ACTION = "automations";
|
|
4
|
+
export type AutomationsFlagState = {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
/** True until PostHog has loaded flags, so deep links don't flash the 404 page. */
|
|
7
|
+
loading: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const useAutomationsEnabled: () => AutomationsFlagState;
|