@universe-platform/ui 0.1.0-beta.20 → 0.1.0-beta.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/globals.css +3 -0
- package/dist/index.d.mts +246 -1
- package/dist/index.d.ts +246 -1
- package/dist/index.js +368 -31
- package/dist/index.mjs +366 -32
- package/package.json +1 -1
package/dist/globals.css
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -123,7 +123,9 @@ interface TableBlockProps extends Partial<BaseComponentProps<TableData, TableCon
|
|
|
123
123
|
role?: OrgRole | null;
|
|
124
124
|
permissions?: ComponentPermissions;
|
|
125
125
|
readOnly?: boolean;
|
|
126
|
+
selectedRowIds?: string[];
|
|
126
127
|
onSelectionChange?: (selectedIds: string[]) => void;
|
|
128
|
+
onRowToggle?: (rowId: string, checked: boolean) => void;
|
|
127
129
|
rowStatusMap?: Record<string, {
|
|
128
130
|
status: RowStatusType;
|
|
129
131
|
tooltip?: string;
|
|
@@ -140,6 +142,8 @@ interface DeleteRecordPayload {
|
|
|
140
142
|
ids: string[];
|
|
141
143
|
}
|
|
142
144
|
|
|
145
|
+
declare function TableBlockClient({ data: initialRecords, settings: schema, executeAction, exportAction, emitEvent, pageState, isLoading, isUpdating, error, isEmpty: isStateEmpty, componentId, orgId, className, 'data-testid': dataTestId, role, permissions, readOnly, selectedRowIds, onSelectionChange, onRowToggle, rowStatusMap, editModelUrl, }: TableBlockProps): react_jsx_runtime.JSX.Element;
|
|
146
|
+
|
|
143
147
|
declare function TableBlock(props: TableBlockProps): react_jsx_runtime.JSX.Element;
|
|
144
148
|
|
|
145
149
|
interface UseColumnResizeOptions {
|
|
@@ -382,13 +386,56 @@ interface MetaWhatsAppTemplate {
|
|
|
382
386
|
components?: MetaTemplateComponent[];
|
|
383
387
|
[key: string]: any;
|
|
384
388
|
}
|
|
389
|
+
interface TargetPhoneOption {
|
|
390
|
+
id: string;
|
|
391
|
+
label: string;
|
|
392
|
+
type: "DIRECT" | "SUBTABLE";
|
|
393
|
+
columnName: string;
|
|
394
|
+
parentColumnName?: string;
|
|
395
|
+
referencedTableId?: string;
|
|
396
|
+
}
|
|
397
|
+
interface PostSendTargetColumnOption {
|
|
398
|
+
id: string;
|
|
399
|
+
targetType: "MAIN" | "SUBTABLE";
|
|
400
|
+
columnName: string;
|
|
401
|
+
parentColumnName?: string;
|
|
402
|
+
referencedTableId?: string;
|
|
403
|
+
type: "BOOLEAN" | "RELATION";
|
|
404
|
+
label: string;
|
|
405
|
+
config?: any;
|
|
406
|
+
}
|
|
407
|
+
interface WhatsAppRecipient {
|
|
408
|
+
targetPhone: string;
|
|
409
|
+
mainRowId: string;
|
|
410
|
+
subtableRowId?: string;
|
|
411
|
+
recordData: Record<string, any>;
|
|
412
|
+
}
|
|
385
413
|
type WhatsAppData = any;
|
|
414
|
+
interface TemplateVariableMappingItem {
|
|
415
|
+
type: "column" | "static";
|
|
416
|
+
value: string;
|
|
417
|
+
}
|
|
418
|
+
type TemplateVariableMapping = Record<string, TemplateVariableMappingItem>;
|
|
419
|
+
interface TextableColumnOption {
|
|
420
|
+
id: string;
|
|
421
|
+
label: string;
|
|
422
|
+
columnName: string;
|
|
423
|
+
source: "MAIN" | "SUBTABLE";
|
|
424
|
+
parentColumnName?: string;
|
|
425
|
+
type?: string;
|
|
426
|
+
}
|
|
386
427
|
interface WhatsAppComponentProps extends Partial<BaseComponentProps<WhatsAppData, WhatsAppConfig>> {
|
|
387
428
|
permissions?: ComponentPermissions;
|
|
388
429
|
orgId?: string;
|
|
389
430
|
organizationId?: string;
|
|
390
431
|
}
|
|
391
432
|
|
|
433
|
+
interface SkippedRecipientDetail {
|
|
434
|
+
mainRowId: string;
|
|
435
|
+
subtableRowId?: string;
|
|
436
|
+
reason?: string;
|
|
437
|
+
}
|
|
438
|
+
|
|
392
439
|
/**
|
|
393
440
|
* WhatsAppComponent
|
|
394
441
|
* High-level orchestrator for the WhatsApp messaging interface.
|
|
@@ -413,6 +460,204 @@ interface CreateTemplateModalProps {
|
|
|
413
460
|
*/
|
|
414
461
|
declare function CreateTemplateModal({ isOpen, onClose, onSuccess, existingTemplateNames, existingTemplates, executeAction, orgId, }: CreateTemplateModalProps): react_jsx_runtime.JSX.Element | null;
|
|
415
462
|
|
|
463
|
+
interface BroadcastProgressState {
|
|
464
|
+
current: number;
|
|
465
|
+
total: number;
|
|
466
|
+
successful: number;
|
|
467
|
+
failed: number;
|
|
468
|
+
skipped: number;
|
|
469
|
+
percent: number;
|
|
470
|
+
}
|
|
471
|
+
interface BroadcastSummaryState {
|
|
472
|
+
successful: number;
|
|
473
|
+
failed: number;
|
|
474
|
+
skipped: number;
|
|
475
|
+
total: number;
|
|
476
|
+
successfulRowIds: string[];
|
|
477
|
+
failedRowIds: string[];
|
|
478
|
+
skippedRowIds: string[];
|
|
479
|
+
}
|
|
480
|
+
declare function useWhatsAppState(props: WhatsAppComponentProps): {
|
|
481
|
+
orgId: any;
|
|
482
|
+
tableColumns: ColumnDef[];
|
|
483
|
+
rawRecords: RecordData[];
|
|
484
|
+
relationOptions: Record<string, {
|
|
485
|
+
id: string;
|
|
486
|
+
label: string;
|
|
487
|
+
}[]>;
|
|
488
|
+
isLoadingTableData: boolean;
|
|
489
|
+
tableError: string | null;
|
|
490
|
+
loadTableData: () => Promise<void>;
|
|
491
|
+
embeddedTableExecuteAction: (actionType: string, payload: Record<string, any>) => Promise<any>;
|
|
492
|
+
filteredRecords: RecordData[];
|
|
493
|
+
filters: Record<string, string>;
|
|
494
|
+
filterableColumns: ColumnDef[];
|
|
495
|
+
handleFilterChange: (colName: string, val: string) => void;
|
|
496
|
+
handleClearFilters: () => void;
|
|
497
|
+
activeFiltersCount: number;
|
|
498
|
+
selectedRowIds: string[];
|
|
499
|
+
handleSelectionChange: (selectedIds: string[]) => void;
|
|
500
|
+
handleRowToggle: (rowId: string, checked?: boolean) => void;
|
|
501
|
+
toggleRowSelection: (rowId: string, checked?: boolean) => void;
|
|
502
|
+
autoSelectCount: number | null;
|
|
503
|
+
setAutoSelectCount: react.Dispatch<react.SetStateAction<number | null>>;
|
|
504
|
+
filteredData: RecordData[];
|
|
505
|
+
targetPhoneOptions: TargetPhoneOption[];
|
|
506
|
+
phoneColumns: {
|
|
507
|
+
name: string;
|
|
508
|
+
id: string;
|
|
509
|
+
type: "PHONE";
|
|
510
|
+
}[];
|
|
511
|
+
phoneColumnId: string;
|
|
512
|
+
setPhoneColumnId: react.Dispatch<react.SetStateAction<string>>;
|
|
513
|
+
selectedPhoneOption: TargetPhoneOption;
|
|
514
|
+
isScanningPhoneColumns: boolean;
|
|
515
|
+
hasPhoneColumn: boolean;
|
|
516
|
+
subtableFilterableColumns: ColumnDef[];
|
|
517
|
+
selectedSubtableFilterCol: ColumnDef | undefined;
|
|
518
|
+
subtableFilterColumn: string;
|
|
519
|
+
setSubtableFilterColumn: react.Dispatch<react.SetStateAction<string>>;
|
|
520
|
+
subtableFilterValue: string;
|
|
521
|
+
setSubtableFilterValue: react.Dispatch<react.SetStateAction<string>>;
|
|
522
|
+
subtableSendLimit: "ALL" | "PRIMARY" | "FIRST";
|
|
523
|
+
setSubtableSendLimit: react.Dispatch<react.SetStateAction<"ALL" | "PRIMARY" | "FIRST">>;
|
|
524
|
+
getRelationOptionsForCol: (colName: string, parentColName?: string) => {
|
|
525
|
+
id: string;
|
|
526
|
+
label: string;
|
|
527
|
+
}[];
|
|
528
|
+
isSubtableFilterIncomplete: boolean;
|
|
529
|
+
enablePostSendAction: boolean;
|
|
530
|
+
setEnablePostSendAction: react.Dispatch<react.SetStateAction<boolean>>;
|
|
531
|
+
postSendActionColumn: string;
|
|
532
|
+
setPostSendActionColumn: react.Dispatch<react.SetStateAction<string>>;
|
|
533
|
+
postSendActionValue: string;
|
|
534
|
+
setPostSendActionValue: react.Dispatch<react.SetStateAction<string>>;
|
|
535
|
+
postSendActionTargetType: "SUBTABLE" | "MAIN";
|
|
536
|
+
setPostSendActionTargetType: react.Dispatch<react.SetStateAction<"SUBTABLE" | "MAIN">>;
|
|
537
|
+
postSendActionTargetOptions: PostSendTargetColumnOption[];
|
|
538
|
+
selectedPostSendCol: PostSendTargetColumnOption | undefined;
|
|
539
|
+
isPostSendActionIncomplete: boolean;
|
|
540
|
+
preparedRecipients: WhatsAppRecipient[] & {
|
|
541
|
+
skippedRowIds: string[];
|
|
542
|
+
skippedDetails: SkippedRecipientDetail[];
|
|
543
|
+
};
|
|
544
|
+
finalRecipientCount: number;
|
|
545
|
+
validMainRowsCount: number;
|
|
546
|
+
isSendDisabled: boolean;
|
|
547
|
+
isTestDisabled: boolean;
|
|
548
|
+
sendButtonTitle: string;
|
|
549
|
+
testButtonTitle: string;
|
|
550
|
+
templates: MetaWhatsAppTemplate[];
|
|
551
|
+
selectedTemplateId: string | null;
|
|
552
|
+
setSelectedTemplateId: react.Dispatch<react.SetStateAction<string | null>>;
|
|
553
|
+
selectedTemplate: MetaWhatsAppTemplate | null;
|
|
554
|
+
templateBodyText: string;
|
|
555
|
+
templateHeaderComp: MetaTemplateComponent | null;
|
|
556
|
+
headerMediaUrl: string;
|
|
557
|
+
handleHeaderMediaUrlChange: (newUrl: string) => void;
|
|
558
|
+
handleResetHeaderMediaUrl: () => void;
|
|
559
|
+
templateVariables: string[];
|
|
560
|
+
variableMapping: TemplateVariableMapping;
|
|
561
|
+
textableColumnOptions: TextableColumnOption[];
|
|
562
|
+
handleVariableTypeChange: (varKey: string, newType: "column" | "static") => void;
|
|
563
|
+
handleVariableValueChange: (varKey: string, newValue: string) => void;
|
|
564
|
+
isLoadingTemplates: boolean;
|
|
565
|
+
fetchError: string | null;
|
|
566
|
+
isModalOpen: boolean;
|
|
567
|
+
setIsModalOpen: react.Dispatch<react.SetStateAction<boolean>>;
|
|
568
|
+
isDropdownOpen: boolean;
|
|
569
|
+
setIsDropdownOpen: react.Dispatch<react.SetStateAction<boolean>>;
|
|
570
|
+
isDeleting: boolean;
|
|
571
|
+
handleDeleteTemplate: () => Promise<void>;
|
|
572
|
+
existingTemplateNames: string[];
|
|
573
|
+
loadTemplates: () => Promise<void>;
|
|
574
|
+
isTestPromptOpen: boolean;
|
|
575
|
+
setIsTestPromptOpen: react.Dispatch<react.SetStateAction<boolean>>;
|
|
576
|
+
testPhoneNumber: string;
|
|
577
|
+
handleTestPhoneChange: (val: string) => void;
|
|
578
|
+
testFeedback: string | null;
|
|
579
|
+
setTestFeedback: react.Dispatch<react.SetStateAction<string | null>>;
|
|
580
|
+
isSendingTest: boolean;
|
|
581
|
+
isSendingBroadcast: boolean;
|
|
582
|
+
broadcastProgress: BroadcastProgressState;
|
|
583
|
+
broadcastSummary: BroadcastSummaryState | null;
|
|
584
|
+
rowStatusMap: Record<string, {
|
|
585
|
+
status: "success" | "failed" | "skipped" | "partial";
|
|
586
|
+
tooltip: string;
|
|
587
|
+
}>;
|
|
588
|
+
clearBroadcastSummary: () => void;
|
|
589
|
+
handleSendTest: () => Promise<void>;
|
|
590
|
+
handleSendMessages: () => Promise<void>;
|
|
591
|
+
feedback: {
|
|
592
|
+
type: "success" | "error";
|
|
593
|
+
message: string;
|
|
594
|
+
} | null;
|
|
595
|
+
setFeedback: react.Dispatch<react.SetStateAction<{
|
|
596
|
+
type: "success" | "error";
|
|
597
|
+
message: string;
|
|
598
|
+
} | null>>;
|
|
599
|
+
};
|
|
600
|
+
|
|
601
|
+
interface DynamicFiltersBlockProps {
|
|
602
|
+
filterableColumns: ColumnDef[];
|
|
603
|
+
filters: Record<string, string>;
|
|
604
|
+
handleFilterChange: (colName: string, val: string) => void;
|
|
605
|
+
handleClearFilters: () => void;
|
|
606
|
+
activeFiltersCount: number;
|
|
607
|
+
relationOptions: Record<string, any[]>;
|
|
608
|
+
getRelationOptionsForCol?: (colName: string, parentColName?: string) => any[];
|
|
609
|
+
selectedRowIds: string[];
|
|
610
|
+
filteredRecordsCount: number;
|
|
611
|
+
rawRecordsCount: number;
|
|
612
|
+
loadTableData: () => void;
|
|
613
|
+
isLoadingTableData: boolean;
|
|
614
|
+
}
|
|
615
|
+
declare function DynamicFiltersBlock({ filterableColumns, filters, handleFilterChange, handleClearFilters, activeFiltersCount, relationOptions, getRelationOptionsForCol, selectedRowIds, filteredRecordsCount, rawRecordsCount, loadTableData, isLoadingTableData, }: DynamicFiltersBlockProps): react_jsx_runtime.JSX.Element;
|
|
616
|
+
|
|
617
|
+
interface SettingsAndActionsBlockProps {
|
|
618
|
+
isScanningPhoneColumns: boolean;
|
|
619
|
+
targetPhoneOptions: TargetPhoneOption[];
|
|
620
|
+
phoneColumnId: string;
|
|
621
|
+
setPhoneColumnId: (id: string) => void;
|
|
622
|
+
selectedPhoneOption: TargetPhoneOption | null;
|
|
623
|
+
autoSelectCount?: number | null;
|
|
624
|
+
setAutoSelectCount?: (count: number | null) => void;
|
|
625
|
+
subtableFilterColumn: string;
|
|
626
|
+
setSubtableFilterColumn: (col: string) => void;
|
|
627
|
+
subtableFilterValue: string;
|
|
628
|
+
setSubtableFilterValue: (val: string) => void;
|
|
629
|
+
subtableSendLimit: "PRIMARY" | "FIRST" | "ALL";
|
|
630
|
+
setSubtableSendLimit: (limit: "PRIMARY" | "FIRST" | "ALL") => void;
|
|
631
|
+
subtableFilterableColumns: ColumnDef[];
|
|
632
|
+
selectedSubtableFilterCol: ColumnDef | undefined;
|
|
633
|
+
getRelationOptionsForCol: (colName: string, parentColName?: string) => any[];
|
|
634
|
+
relationOptions: Record<string, any[]>;
|
|
635
|
+
enablePostSendAction: boolean;
|
|
636
|
+
setEnablePostSendAction: (enable: boolean) => void;
|
|
637
|
+
postSendActionColumn: string;
|
|
638
|
+
setPostSendActionColumn: (col: string) => void;
|
|
639
|
+
postSendActionValue: string;
|
|
640
|
+
setPostSendActionValue: (val: string) => void;
|
|
641
|
+
postSendActionTargetType: "MAIN" | "SUBTABLE";
|
|
642
|
+
setPostSendActionTargetType: (type: "MAIN" | "SUBTABLE") => void;
|
|
643
|
+
postSendActionTargetOptions: PostSendTargetColumnOption[];
|
|
644
|
+
selectedPostSendOption: PostSendTargetColumnOption | undefined;
|
|
645
|
+
isTestDisabled: boolean;
|
|
646
|
+
testButtonTitle: string;
|
|
647
|
+
setIsTestPromptOpen: (open: boolean) => void;
|
|
648
|
+
isSendDisabled: boolean;
|
|
649
|
+
sendButtonTitle: string;
|
|
650
|
+
handleSendMessages: () => void;
|
|
651
|
+
selectedRowIdsCount: number;
|
|
652
|
+
finalRecipientCount: number;
|
|
653
|
+
validMainRowsCount: number;
|
|
654
|
+
isSendingBroadcast?: boolean;
|
|
655
|
+
broadcastProgress?: BroadcastProgressState;
|
|
656
|
+
broadcastSummary?: BroadcastSummaryState | null;
|
|
657
|
+
clearBroadcastSummary?: () => void;
|
|
658
|
+
}
|
|
659
|
+
declare function SettingsAndActionsBlock({ isScanningPhoneColumns, targetPhoneOptions, phoneColumnId, setPhoneColumnId, selectedPhoneOption, autoSelectCount, setAutoSelectCount, subtableFilterColumn, setSubtableFilterColumn, subtableFilterValue, setSubtableFilterValue, subtableSendLimit, setSubtableSendLimit, subtableFilterableColumns, selectedSubtableFilterCol, getRelationOptionsForCol, relationOptions, enablePostSendAction, setEnablePostSendAction, postSendActionColumn, setPostSendActionColumn, postSendActionValue, setPostSendActionValue, setPostSendActionTargetType, postSendActionTargetOptions, selectedPostSendOption, isTestDisabled, testButtonTitle, setIsTestPromptOpen, isSendDisabled, sendButtonTitle, handleSendMessages, selectedRowIdsCount, finalRecipientCount, validMainRowsCount, isSendingBroadcast, broadcastProgress, broadcastSummary, clearBroadcastSummary, }: SettingsAndActionsBlockProps): react_jsx_runtime.JSX.Element;
|
|
660
|
+
|
|
416
661
|
/**
|
|
417
662
|
* UNIVERSE_COMPONENTS
|
|
418
663
|
* Dynamic Component Registry dictionary mapping component type strings (e.g., "TABLE", "WHATSAPP")
|
|
@@ -445,4 +690,4 @@ declare function ToastProvider({ children }: {
|
|
|
445
690
|
|
|
446
691
|
declare function useToast(): ToastContextType;
|
|
447
692
|
|
|
448
|
-
export { type BaseComponentProps, ColumnHeaderTitle, type ColumnHeaderTitleProps, type ComponentCommunication, type ComponentConfig, type ComponentData, type ComponentPermissions, type ComponentRegistry, type ComponentState, type CreateRecordPayload, CreateTemplateModal, type CreateTemplateModalProps, DatePickerCell, type DeleteRecordPayload, LinkPickerCell, type MetaTemplateComponent, type MetaWhatsAppTemplate, type OrgRole, PASTEL_PALETTES, type PastelPalette, type RelationFilterOption, type RelationFilterPayload, RelationFilterPopover, type RelationFilterPopoverProps, RelationPickerCell, type RolePermissions, type RowStatusType, SmartTextCell, type SplitTitleResult, TableBlock, type TableBlockProps, type TableConfig, type TableData, TimePickerCell, ToastContext, type ToastContextType, type ToastItem, ToastProvider, TruncatedTooltip, UNIVERSE_COMPONENTS, type UniverseComponentType, type UpdateRecordPayload, type UseColumnReorderOptions, type UseColumnResizeOptions, WhatsAppComponent, type WhatsAppComponentProps, type WhatsAppData, calculateMinColumnWidth, checkElementTruncation, cn, formatConflictCellValue, formatPhoneDisplay, formatTimeInput, formatTimeIso, generateWhatsAppLink, getDeterministicPastelBadge, getRolePermissions, isValidPhoneNumber, measureTextWidth, normalizePhoneForWhatsApp, normalizeRelationValue, openWhatsAppChat, parseLinkValue, parseTimeParts, resolveProtocol, sanitizePhoneNumber, splitHeaderTitle, useColumnReorder, useColumnResize, useSmartTooltip, useToast };
|
|
693
|
+
export { type BaseComponentProps, ColumnHeaderTitle, type ColumnHeaderTitleProps, type ComponentCommunication, type ComponentConfig, type ComponentData, type ComponentPermissions, type ComponentRegistry, type ComponentState, type CreateRecordPayload, CreateTemplateModal, type CreateTemplateModalProps, DatePickerCell, type DeleteRecordPayload, DynamicFiltersBlock, type DynamicFiltersBlockProps, LinkPickerCell, type MetaTemplateComponent, type MetaWhatsAppTemplate, type OrgRole, PASTEL_PALETTES, type PastelPalette, type RelationFilterOption, type RelationFilterPayload, RelationFilterPopover, type RelationFilterPopoverProps, RelationPickerCell, type RolePermissions, type RowStatusType, SettingsAndActionsBlock, type SettingsAndActionsBlockProps, SmartTextCell, type SplitTitleResult, TableBlock, TableBlockClient, type TableBlockProps, type TableConfig, type TableData, TimePickerCell, ToastContext, type ToastContextType, type ToastItem, ToastProvider, TruncatedTooltip, UNIVERSE_COMPONENTS, type UniverseComponentType, type UpdateRecordPayload, type UseColumnReorderOptions, type UseColumnResizeOptions, WhatsAppComponent, type WhatsAppComponentProps, type WhatsAppData, calculateMinColumnWidth, checkElementTruncation, cn, formatConflictCellValue, formatPhoneDisplay, formatTimeInput, formatTimeIso, generateWhatsAppLink, getDeterministicPastelBadge, getRolePermissions, isValidPhoneNumber, measureTextWidth, normalizePhoneForWhatsApp, normalizeRelationValue, openWhatsAppChat, parseLinkValue, parseTimeParts, resolveProtocol, sanitizePhoneNumber, splitHeaderTitle, useColumnReorder, useColumnResize, useSmartTooltip, useToast, useWhatsAppState };
|
package/dist/index.d.ts
CHANGED
|
@@ -123,7 +123,9 @@ interface TableBlockProps extends Partial<BaseComponentProps<TableData, TableCon
|
|
|
123
123
|
role?: OrgRole | null;
|
|
124
124
|
permissions?: ComponentPermissions;
|
|
125
125
|
readOnly?: boolean;
|
|
126
|
+
selectedRowIds?: string[];
|
|
126
127
|
onSelectionChange?: (selectedIds: string[]) => void;
|
|
128
|
+
onRowToggle?: (rowId: string, checked: boolean) => void;
|
|
127
129
|
rowStatusMap?: Record<string, {
|
|
128
130
|
status: RowStatusType;
|
|
129
131
|
tooltip?: string;
|
|
@@ -140,6 +142,8 @@ interface DeleteRecordPayload {
|
|
|
140
142
|
ids: string[];
|
|
141
143
|
}
|
|
142
144
|
|
|
145
|
+
declare function TableBlockClient({ data: initialRecords, settings: schema, executeAction, exportAction, emitEvent, pageState, isLoading, isUpdating, error, isEmpty: isStateEmpty, componentId, orgId, className, 'data-testid': dataTestId, role, permissions, readOnly, selectedRowIds, onSelectionChange, onRowToggle, rowStatusMap, editModelUrl, }: TableBlockProps): react_jsx_runtime.JSX.Element;
|
|
146
|
+
|
|
143
147
|
declare function TableBlock(props: TableBlockProps): react_jsx_runtime.JSX.Element;
|
|
144
148
|
|
|
145
149
|
interface UseColumnResizeOptions {
|
|
@@ -382,13 +386,56 @@ interface MetaWhatsAppTemplate {
|
|
|
382
386
|
components?: MetaTemplateComponent[];
|
|
383
387
|
[key: string]: any;
|
|
384
388
|
}
|
|
389
|
+
interface TargetPhoneOption {
|
|
390
|
+
id: string;
|
|
391
|
+
label: string;
|
|
392
|
+
type: "DIRECT" | "SUBTABLE";
|
|
393
|
+
columnName: string;
|
|
394
|
+
parentColumnName?: string;
|
|
395
|
+
referencedTableId?: string;
|
|
396
|
+
}
|
|
397
|
+
interface PostSendTargetColumnOption {
|
|
398
|
+
id: string;
|
|
399
|
+
targetType: "MAIN" | "SUBTABLE";
|
|
400
|
+
columnName: string;
|
|
401
|
+
parentColumnName?: string;
|
|
402
|
+
referencedTableId?: string;
|
|
403
|
+
type: "BOOLEAN" | "RELATION";
|
|
404
|
+
label: string;
|
|
405
|
+
config?: any;
|
|
406
|
+
}
|
|
407
|
+
interface WhatsAppRecipient {
|
|
408
|
+
targetPhone: string;
|
|
409
|
+
mainRowId: string;
|
|
410
|
+
subtableRowId?: string;
|
|
411
|
+
recordData: Record<string, any>;
|
|
412
|
+
}
|
|
385
413
|
type WhatsAppData = any;
|
|
414
|
+
interface TemplateVariableMappingItem {
|
|
415
|
+
type: "column" | "static";
|
|
416
|
+
value: string;
|
|
417
|
+
}
|
|
418
|
+
type TemplateVariableMapping = Record<string, TemplateVariableMappingItem>;
|
|
419
|
+
interface TextableColumnOption {
|
|
420
|
+
id: string;
|
|
421
|
+
label: string;
|
|
422
|
+
columnName: string;
|
|
423
|
+
source: "MAIN" | "SUBTABLE";
|
|
424
|
+
parentColumnName?: string;
|
|
425
|
+
type?: string;
|
|
426
|
+
}
|
|
386
427
|
interface WhatsAppComponentProps extends Partial<BaseComponentProps<WhatsAppData, WhatsAppConfig>> {
|
|
387
428
|
permissions?: ComponentPermissions;
|
|
388
429
|
orgId?: string;
|
|
389
430
|
organizationId?: string;
|
|
390
431
|
}
|
|
391
432
|
|
|
433
|
+
interface SkippedRecipientDetail {
|
|
434
|
+
mainRowId: string;
|
|
435
|
+
subtableRowId?: string;
|
|
436
|
+
reason?: string;
|
|
437
|
+
}
|
|
438
|
+
|
|
392
439
|
/**
|
|
393
440
|
* WhatsAppComponent
|
|
394
441
|
* High-level orchestrator for the WhatsApp messaging interface.
|
|
@@ -413,6 +460,204 @@ interface CreateTemplateModalProps {
|
|
|
413
460
|
*/
|
|
414
461
|
declare function CreateTemplateModal({ isOpen, onClose, onSuccess, existingTemplateNames, existingTemplates, executeAction, orgId, }: CreateTemplateModalProps): react_jsx_runtime.JSX.Element | null;
|
|
415
462
|
|
|
463
|
+
interface BroadcastProgressState {
|
|
464
|
+
current: number;
|
|
465
|
+
total: number;
|
|
466
|
+
successful: number;
|
|
467
|
+
failed: number;
|
|
468
|
+
skipped: number;
|
|
469
|
+
percent: number;
|
|
470
|
+
}
|
|
471
|
+
interface BroadcastSummaryState {
|
|
472
|
+
successful: number;
|
|
473
|
+
failed: number;
|
|
474
|
+
skipped: number;
|
|
475
|
+
total: number;
|
|
476
|
+
successfulRowIds: string[];
|
|
477
|
+
failedRowIds: string[];
|
|
478
|
+
skippedRowIds: string[];
|
|
479
|
+
}
|
|
480
|
+
declare function useWhatsAppState(props: WhatsAppComponentProps): {
|
|
481
|
+
orgId: any;
|
|
482
|
+
tableColumns: ColumnDef[];
|
|
483
|
+
rawRecords: RecordData[];
|
|
484
|
+
relationOptions: Record<string, {
|
|
485
|
+
id: string;
|
|
486
|
+
label: string;
|
|
487
|
+
}[]>;
|
|
488
|
+
isLoadingTableData: boolean;
|
|
489
|
+
tableError: string | null;
|
|
490
|
+
loadTableData: () => Promise<void>;
|
|
491
|
+
embeddedTableExecuteAction: (actionType: string, payload: Record<string, any>) => Promise<any>;
|
|
492
|
+
filteredRecords: RecordData[];
|
|
493
|
+
filters: Record<string, string>;
|
|
494
|
+
filterableColumns: ColumnDef[];
|
|
495
|
+
handleFilterChange: (colName: string, val: string) => void;
|
|
496
|
+
handleClearFilters: () => void;
|
|
497
|
+
activeFiltersCount: number;
|
|
498
|
+
selectedRowIds: string[];
|
|
499
|
+
handleSelectionChange: (selectedIds: string[]) => void;
|
|
500
|
+
handleRowToggle: (rowId: string, checked?: boolean) => void;
|
|
501
|
+
toggleRowSelection: (rowId: string, checked?: boolean) => void;
|
|
502
|
+
autoSelectCount: number | null;
|
|
503
|
+
setAutoSelectCount: react.Dispatch<react.SetStateAction<number | null>>;
|
|
504
|
+
filteredData: RecordData[];
|
|
505
|
+
targetPhoneOptions: TargetPhoneOption[];
|
|
506
|
+
phoneColumns: {
|
|
507
|
+
name: string;
|
|
508
|
+
id: string;
|
|
509
|
+
type: "PHONE";
|
|
510
|
+
}[];
|
|
511
|
+
phoneColumnId: string;
|
|
512
|
+
setPhoneColumnId: react.Dispatch<react.SetStateAction<string>>;
|
|
513
|
+
selectedPhoneOption: TargetPhoneOption;
|
|
514
|
+
isScanningPhoneColumns: boolean;
|
|
515
|
+
hasPhoneColumn: boolean;
|
|
516
|
+
subtableFilterableColumns: ColumnDef[];
|
|
517
|
+
selectedSubtableFilterCol: ColumnDef | undefined;
|
|
518
|
+
subtableFilterColumn: string;
|
|
519
|
+
setSubtableFilterColumn: react.Dispatch<react.SetStateAction<string>>;
|
|
520
|
+
subtableFilterValue: string;
|
|
521
|
+
setSubtableFilterValue: react.Dispatch<react.SetStateAction<string>>;
|
|
522
|
+
subtableSendLimit: "ALL" | "PRIMARY" | "FIRST";
|
|
523
|
+
setSubtableSendLimit: react.Dispatch<react.SetStateAction<"ALL" | "PRIMARY" | "FIRST">>;
|
|
524
|
+
getRelationOptionsForCol: (colName: string, parentColName?: string) => {
|
|
525
|
+
id: string;
|
|
526
|
+
label: string;
|
|
527
|
+
}[];
|
|
528
|
+
isSubtableFilterIncomplete: boolean;
|
|
529
|
+
enablePostSendAction: boolean;
|
|
530
|
+
setEnablePostSendAction: react.Dispatch<react.SetStateAction<boolean>>;
|
|
531
|
+
postSendActionColumn: string;
|
|
532
|
+
setPostSendActionColumn: react.Dispatch<react.SetStateAction<string>>;
|
|
533
|
+
postSendActionValue: string;
|
|
534
|
+
setPostSendActionValue: react.Dispatch<react.SetStateAction<string>>;
|
|
535
|
+
postSendActionTargetType: "SUBTABLE" | "MAIN";
|
|
536
|
+
setPostSendActionTargetType: react.Dispatch<react.SetStateAction<"SUBTABLE" | "MAIN">>;
|
|
537
|
+
postSendActionTargetOptions: PostSendTargetColumnOption[];
|
|
538
|
+
selectedPostSendCol: PostSendTargetColumnOption | undefined;
|
|
539
|
+
isPostSendActionIncomplete: boolean;
|
|
540
|
+
preparedRecipients: WhatsAppRecipient[] & {
|
|
541
|
+
skippedRowIds: string[];
|
|
542
|
+
skippedDetails: SkippedRecipientDetail[];
|
|
543
|
+
};
|
|
544
|
+
finalRecipientCount: number;
|
|
545
|
+
validMainRowsCount: number;
|
|
546
|
+
isSendDisabled: boolean;
|
|
547
|
+
isTestDisabled: boolean;
|
|
548
|
+
sendButtonTitle: string;
|
|
549
|
+
testButtonTitle: string;
|
|
550
|
+
templates: MetaWhatsAppTemplate[];
|
|
551
|
+
selectedTemplateId: string | null;
|
|
552
|
+
setSelectedTemplateId: react.Dispatch<react.SetStateAction<string | null>>;
|
|
553
|
+
selectedTemplate: MetaWhatsAppTemplate | null;
|
|
554
|
+
templateBodyText: string;
|
|
555
|
+
templateHeaderComp: MetaTemplateComponent | null;
|
|
556
|
+
headerMediaUrl: string;
|
|
557
|
+
handleHeaderMediaUrlChange: (newUrl: string) => void;
|
|
558
|
+
handleResetHeaderMediaUrl: () => void;
|
|
559
|
+
templateVariables: string[];
|
|
560
|
+
variableMapping: TemplateVariableMapping;
|
|
561
|
+
textableColumnOptions: TextableColumnOption[];
|
|
562
|
+
handleVariableTypeChange: (varKey: string, newType: "column" | "static") => void;
|
|
563
|
+
handleVariableValueChange: (varKey: string, newValue: string) => void;
|
|
564
|
+
isLoadingTemplates: boolean;
|
|
565
|
+
fetchError: string | null;
|
|
566
|
+
isModalOpen: boolean;
|
|
567
|
+
setIsModalOpen: react.Dispatch<react.SetStateAction<boolean>>;
|
|
568
|
+
isDropdownOpen: boolean;
|
|
569
|
+
setIsDropdownOpen: react.Dispatch<react.SetStateAction<boolean>>;
|
|
570
|
+
isDeleting: boolean;
|
|
571
|
+
handleDeleteTemplate: () => Promise<void>;
|
|
572
|
+
existingTemplateNames: string[];
|
|
573
|
+
loadTemplates: () => Promise<void>;
|
|
574
|
+
isTestPromptOpen: boolean;
|
|
575
|
+
setIsTestPromptOpen: react.Dispatch<react.SetStateAction<boolean>>;
|
|
576
|
+
testPhoneNumber: string;
|
|
577
|
+
handleTestPhoneChange: (val: string) => void;
|
|
578
|
+
testFeedback: string | null;
|
|
579
|
+
setTestFeedback: react.Dispatch<react.SetStateAction<string | null>>;
|
|
580
|
+
isSendingTest: boolean;
|
|
581
|
+
isSendingBroadcast: boolean;
|
|
582
|
+
broadcastProgress: BroadcastProgressState;
|
|
583
|
+
broadcastSummary: BroadcastSummaryState | null;
|
|
584
|
+
rowStatusMap: Record<string, {
|
|
585
|
+
status: "success" | "failed" | "skipped" | "partial";
|
|
586
|
+
tooltip: string;
|
|
587
|
+
}>;
|
|
588
|
+
clearBroadcastSummary: () => void;
|
|
589
|
+
handleSendTest: () => Promise<void>;
|
|
590
|
+
handleSendMessages: () => Promise<void>;
|
|
591
|
+
feedback: {
|
|
592
|
+
type: "success" | "error";
|
|
593
|
+
message: string;
|
|
594
|
+
} | null;
|
|
595
|
+
setFeedback: react.Dispatch<react.SetStateAction<{
|
|
596
|
+
type: "success" | "error";
|
|
597
|
+
message: string;
|
|
598
|
+
} | null>>;
|
|
599
|
+
};
|
|
600
|
+
|
|
601
|
+
interface DynamicFiltersBlockProps {
|
|
602
|
+
filterableColumns: ColumnDef[];
|
|
603
|
+
filters: Record<string, string>;
|
|
604
|
+
handleFilterChange: (colName: string, val: string) => void;
|
|
605
|
+
handleClearFilters: () => void;
|
|
606
|
+
activeFiltersCount: number;
|
|
607
|
+
relationOptions: Record<string, any[]>;
|
|
608
|
+
getRelationOptionsForCol?: (colName: string, parentColName?: string) => any[];
|
|
609
|
+
selectedRowIds: string[];
|
|
610
|
+
filteredRecordsCount: number;
|
|
611
|
+
rawRecordsCount: number;
|
|
612
|
+
loadTableData: () => void;
|
|
613
|
+
isLoadingTableData: boolean;
|
|
614
|
+
}
|
|
615
|
+
declare function DynamicFiltersBlock({ filterableColumns, filters, handleFilterChange, handleClearFilters, activeFiltersCount, relationOptions, getRelationOptionsForCol, selectedRowIds, filteredRecordsCount, rawRecordsCount, loadTableData, isLoadingTableData, }: DynamicFiltersBlockProps): react_jsx_runtime.JSX.Element;
|
|
616
|
+
|
|
617
|
+
interface SettingsAndActionsBlockProps {
|
|
618
|
+
isScanningPhoneColumns: boolean;
|
|
619
|
+
targetPhoneOptions: TargetPhoneOption[];
|
|
620
|
+
phoneColumnId: string;
|
|
621
|
+
setPhoneColumnId: (id: string) => void;
|
|
622
|
+
selectedPhoneOption: TargetPhoneOption | null;
|
|
623
|
+
autoSelectCount?: number | null;
|
|
624
|
+
setAutoSelectCount?: (count: number | null) => void;
|
|
625
|
+
subtableFilterColumn: string;
|
|
626
|
+
setSubtableFilterColumn: (col: string) => void;
|
|
627
|
+
subtableFilterValue: string;
|
|
628
|
+
setSubtableFilterValue: (val: string) => void;
|
|
629
|
+
subtableSendLimit: "PRIMARY" | "FIRST" | "ALL";
|
|
630
|
+
setSubtableSendLimit: (limit: "PRIMARY" | "FIRST" | "ALL") => void;
|
|
631
|
+
subtableFilterableColumns: ColumnDef[];
|
|
632
|
+
selectedSubtableFilterCol: ColumnDef | undefined;
|
|
633
|
+
getRelationOptionsForCol: (colName: string, parentColName?: string) => any[];
|
|
634
|
+
relationOptions: Record<string, any[]>;
|
|
635
|
+
enablePostSendAction: boolean;
|
|
636
|
+
setEnablePostSendAction: (enable: boolean) => void;
|
|
637
|
+
postSendActionColumn: string;
|
|
638
|
+
setPostSendActionColumn: (col: string) => void;
|
|
639
|
+
postSendActionValue: string;
|
|
640
|
+
setPostSendActionValue: (val: string) => void;
|
|
641
|
+
postSendActionTargetType: "MAIN" | "SUBTABLE";
|
|
642
|
+
setPostSendActionTargetType: (type: "MAIN" | "SUBTABLE") => void;
|
|
643
|
+
postSendActionTargetOptions: PostSendTargetColumnOption[];
|
|
644
|
+
selectedPostSendOption: PostSendTargetColumnOption | undefined;
|
|
645
|
+
isTestDisabled: boolean;
|
|
646
|
+
testButtonTitle: string;
|
|
647
|
+
setIsTestPromptOpen: (open: boolean) => void;
|
|
648
|
+
isSendDisabled: boolean;
|
|
649
|
+
sendButtonTitle: string;
|
|
650
|
+
handleSendMessages: () => void;
|
|
651
|
+
selectedRowIdsCount: number;
|
|
652
|
+
finalRecipientCount: number;
|
|
653
|
+
validMainRowsCount: number;
|
|
654
|
+
isSendingBroadcast?: boolean;
|
|
655
|
+
broadcastProgress?: BroadcastProgressState;
|
|
656
|
+
broadcastSummary?: BroadcastSummaryState | null;
|
|
657
|
+
clearBroadcastSummary?: () => void;
|
|
658
|
+
}
|
|
659
|
+
declare function SettingsAndActionsBlock({ isScanningPhoneColumns, targetPhoneOptions, phoneColumnId, setPhoneColumnId, selectedPhoneOption, autoSelectCount, setAutoSelectCount, subtableFilterColumn, setSubtableFilterColumn, subtableFilterValue, setSubtableFilterValue, subtableSendLimit, setSubtableSendLimit, subtableFilterableColumns, selectedSubtableFilterCol, getRelationOptionsForCol, relationOptions, enablePostSendAction, setEnablePostSendAction, postSendActionColumn, setPostSendActionColumn, postSendActionValue, setPostSendActionValue, setPostSendActionTargetType, postSendActionTargetOptions, selectedPostSendOption, isTestDisabled, testButtonTitle, setIsTestPromptOpen, isSendDisabled, sendButtonTitle, handleSendMessages, selectedRowIdsCount, finalRecipientCount, validMainRowsCount, isSendingBroadcast, broadcastProgress, broadcastSummary, clearBroadcastSummary, }: SettingsAndActionsBlockProps): react_jsx_runtime.JSX.Element;
|
|
660
|
+
|
|
416
661
|
/**
|
|
417
662
|
* UNIVERSE_COMPONENTS
|
|
418
663
|
* Dynamic Component Registry dictionary mapping component type strings (e.g., "TABLE", "WHATSAPP")
|
|
@@ -445,4 +690,4 @@ declare function ToastProvider({ children }: {
|
|
|
445
690
|
|
|
446
691
|
declare function useToast(): ToastContextType;
|
|
447
692
|
|
|
448
|
-
export { type BaseComponentProps, ColumnHeaderTitle, type ColumnHeaderTitleProps, type ComponentCommunication, type ComponentConfig, type ComponentData, type ComponentPermissions, type ComponentRegistry, type ComponentState, type CreateRecordPayload, CreateTemplateModal, type CreateTemplateModalProps, DatePickerCell, type DeleteRecordPayload, LinkPickerCell, type MetaTemplateComponent, type MetaWhatsAppTemplate, type OrgRole, PASTEL_PALETTES, type PastelPalette, type RelationFilterOption, type RelationFilterPayload, RelationFilterPopover, type RelationFilterPopoverProps, RelationPickerCell, type RolePermissions, type RowStatusType, SmartTextCell, type SplitTitleResult, TableBlock, type TableBlockProps, type TableConfig, type TableData, TimePickerCell, ToastContext, type ToastContextType, type ToastItem, ToastProvider, TruncatedTooltip, UNIVERSE_COMPONENTS, type UniverseComponentType, type UpdateRecordPayload, type UseColumnReorderOptions, type UseColumnResizeOptions, WhatsAppComponent, type WhatsAppComponentProps, type WhatsAppData, calculateMinColumnWidth, checkElementTruncation, cn, formatConflictCellValue, formatPhoneDisplay, formatTimeInput, formatTimeIso, generateWhatsAppLink, getDeterministicPastelBadge, getRolePermissions, isValidPhoneNumber, measureTextWidth, normalizePhoneForWhatsApp, normalizeRelationValue, openWhatsAppChat, parseLinkValue, parseTimeParts, resolveProtocol, sanitizePhoneNumber, splitHeaderTitle, useColumnReorder, useColumnResize, useSmartTooltip, useToast };
|
|
693
|
+
export { type BaseComponentProps, ColumnHeaderTitle, type ColumnHeaderTitleProps, type ComponentCommunication, type ComponentConfig, type ComponentData, type ComponentPermissions, type ComponentRegistry, type ComponentState, type CreateRecordPayload, CreateTemplateModal, type CreateTemplateModalProps, DatePickerCell, type DeleteRecordPayload, DynamicFiltersBlock, type DynamicFiltersBlockProps, LinkPickerCell, type MetaTemplateComponent, type MetaWhatsAppTemplate, type OrgRole, PASTEL_PALETTES, type PastelPalette, type RelationFilterOption, type RelationFilterPayload, RelationFilterPopover, type RelationFilterPopoverProps, RelationPickerCell, type RolePermissions, type RowStatusType, SettingsAndActionsBlock, type SettingsAndActionsBlockProps, SmartTextCell, type SplitTitleResult, TableBlock, TableBlockClient, type TableBlockProps, type TableConfig, type TableData, TimePickerCell, ToastContext, type ToastContextType, type ToastItem, ToastProvider, TruncatedTooltip, UNIVERSE_COMPONENTS, type UniverseComponentType, type UpdateRecordPayload, type UseColumnReorderOptions, type UseColumnResizeOptions, WhatsAppComponent, type WhatsAppComponentProps, type WhatsAppData, calculateMinColumnWidth, checkElementTruncation, cn, formatConflictCellValue, formatPhoneDisplay, formatTimeInput, formatTimeIso, generateWhatsAppLink, getDeterministicPastelBadge, getRolePermissions, isValidPhoneNumber, measureTextWidth, normalizePhoneForWhatsApp, normalizeRelationValue, openWhatsAppChat, parseLinkValue, parseTimeParts, resolveProtocol, sanitizePhoneNumber, splitHeaderTitle, useColumnReorder, useColumnResize, useSmartTooltip, useToast, useWhatsAppState };
|