@mantine-vue/whatsapp-inbox 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/README.md +88 -0
  2. package/cjs/index.cjs +11842 -0
  3. package/cjs/index.cjs.map +1 -0
  4. package/esm/index.mjs +11704 -0
  5. package/esm/index.mjs.map +1 -0
  6. package/lib/WhatsAppInbox.context.d.ts +70 -0
  7. package/lib/component-props.d.ts +138 -0
  8. package/lib/components/WhatsAppAttachmentPreview/WhatsAppAttachmentPreview.d.ts +8 -0
  9. package/lib/components/WhatsAppAttachmentPreview/WhatsAppAttachmentPreview.types.d.ts +33 -0
  10. package/lib/components/WhatsAppAttachmentPreview/WhatsAppAttachmentPreview.vue.d.ts +19 -0
  11. package/lib/components/WhatsAppAttachmentPreview/index.d.ts +1 -0
  12. package/lib/components/WhatsAppComposer/WhatsAppComposer.d.ts +10 -0
  13. package/lib/components/WhatsAppComposer/WhatsAppComposer.types.d.ts +173 -0
  14. package/lib/components/WhatsAppComposer/WhatsAppComposer.vue.d.ts +52 -0
  15. package/lib/components/WhatsAppComposer/index.d.ts +1 -0
  16. package/lib/components/WhatsAppContactPanel/WhatsAppContactPanel.d.ts +9 -0
  17. package/lib/components/WhatsAppContactPanel/WhatsAppContactPanel.types.d.ts +40 -0
  18. package/lib/components/WhatsAppContactPanel/WhatsAppContactPanel.vue.d.ts +19 -0
  19. package/lib/components/WhatsAppContactPanel/index.d.ts +1 -0
  20. package/lib/components/WhatsAppConversation/WhatsAppConversation.d.ts +10 -0
  21. package/lib/components/WhatsAppConversation/WhatsAppConversation.types.d.ts +163 -0
  22. package/lib/components/WhatsAppConversation/WhatsAppConversation.vue.d.ts +69 -0
  23. package/lib/components/WhatsAppConversation/index.d.ts +1 -0
  24. package/lib/components/WhatsAppConversationHeader/WhatsAppConversationHeader.d.ts +9 -0
  25. package/lib/components/WhatsAppConversationHeader/WhatsAppConversationHeader.types.d.ts +57 -0
  26. package/lib/components/WhatsAppConversationHeader/WhatsAppConversationHeader.vue.d.ts +23 -0
  27. package/lib/components/WhatsAppConversationHeader/index.d.ts +1 -0
  28. package/lib/components/WhatsAppConversationList/WhatsAppConversationList.d.ts +9 -0
  29. package/lib/components/WhatsAppConversationList/WhatsAppConversationList.types.d.ts +113 -0
  30. package/lib/components/WhatsAppConversationList/WhatsAppConversationList.vue.d.ts +35 -0
  31. package/lib/components/WhatsAppConversationList/index.d.ts +1 -0
  32. package/lib/components/WhatsAppConversationListItem/WhatsAppConversationListItem.d.ts +9 -0
  33. package/lib/components/WhatsAppConversationListItem/WhatsAppConversationListItem.types.d.ts +56 -0
  34. package/lib/components/WhatsAppConversationListItem/WhatsAppConversationListItem.vue.d.ts +21 -0
  35. package/lib/components/WhatsAppConversationListItem/index.d.ts +1 -0
  36. package/lib/components/WhatsAppEmojiPicker/WhatsAppEmojiPicker.d.ts +9 -0
  37. package/lib/components/WhatsAppEmojiPicker/WhatsAppEmojiPicker.types.d.ts +91 -0
  38. package/lib/components/WhatsAppEmojiPicker/WhatsAppEmojiPicker.vue.d.ts +31 -0
  39. package/lib/components/WhatsAppEmojiPicker/index.d.ts +1 -0
  40. package/lib/components/WhatsAppInbox/WhatsAppInbox.d.ts +10 -0
  41. package/lib/components/WhatsAppInbox/WhatsAppInbox.types.d.ts +135 -0
  42. package/lib/components/WhatsAppInbox/WhatsAppInbox.vue.d.ts +84 -0
  43. package/lib/components/WhatsAppInbox/index.d.ts +1 -0
  44. package/lib/components/WhatsAppInboxDrawer/WhatsAppInboxDrawer.d.ts +9 -0
  45. package/lib/components/WhatsAppInboxDrawer/WhatsAppInboxDrawer.types.d.ts +52 -0
  46. package/lib/components/WhatsAppInboxDrawer/WhatsAppInboxDrawer.vue.d.ts +24 -0
  47. package/lib/components/WhatsAppInboxDrawer/index.d.ts +1 -0
  48. package/lib/components/WhatsAppInboxModal/WhatsAppInboxModal.d.ts +9 -0
  49. package/lib/components/WhatsAppInboxModal/WhatsAppInboxModal.types.d.ts +52 -0
  50. package/lib/components/WhatsAppInboxModal/WhatsAppInboxModal.vue.d.ts +28 -0
  51. package/lib/components/WhatsAppInboxModal/index.d.ts +1 -0
  52. package/lib/components/WhatsAppInboxProvider/WhatsAppInboxProvider.d.ts +16 -0
  53. package/lib/components/WhatsAppInboxProvider/WhatsAppInboxProvider.types.d.ts +16 -0
  54. package/lib/components/WhatsAppInboxProvider/WhatsAppInboxProvider.vue.d.ts +11 -0
  55. package/lib/components/WhatsAppInboxProvider/index.d.ts +1 -0
  56. package/lib/components/WhatsAppInteractiveMessageEditor/WhatsAppInteractiveMessageEditor.d.ts +8 -0
  57. package/lib/components/WhatsAppInteractiveMessageEditor/WhatsAppInteractiveMessageEditor.types.d.ts +49 -0
  58. package/lib/components/WhatsAppInteractiveMessageEditor/WhatsAppInteractiveMessageEditor.vue.d.ts +27 -0
  59. package/lib/components/WhatsAppInteractiveMessageEditor/index.d.ts +1 -0
  60. package/lib/components/WhatsAppMediaAttachment/WhatsAppMediaAttachment.d.ts +8 -0
  61. package/lib/components/WhatsAppMediaAttachment/WhatsAppMediaAttachment.types.d.ts +41 -0
  62. package/lib/components/WhatsAppMediaAttachment/WhatsAppMediaAttachment.vue.d.ts +19 -0
  63. package/lib/components/WhatsAppMediaAttachment/index.d.ts +1 -0
  64. package/lib/components/WhatsAppMessage/WhatsAppMessage.d.ts +9 -0
  65. package/lib/components/WhatsAppMessage/WhatsAppMessage.types.d.ts +46 -0
  66. package/lib/components/WhatsAppMessage/WhatsAppMessage.vue.d.ts +25 -0
  67. package/lib/components/WhatsAppMessage/index.d.ts +1 -0
  68. package/lib/components/WhatsAppMessageBubble/WhatsAppMessageBubble.d.ts +9 -0
  69. package/lib/components/WhatsAppMessageBubble/WhatsAppMessageBubble.types.d.ts +77 -0
  70. package/lib/components/WhatsAppMessageBubble/WhatsAppMessageBubble.vue.d.ts +22 -0
  71. package/lib/components/WhatsAppMessageBubble/index.d.ts +1 -0
  72. package/lib/components/WhatsAppMessageList/WhatsAppMessageList.d.ts +10 -0
  73. package/lib/components/WhatsAppMessageList/WhatsAppMessageList.types.d.ts +94 -0
  74. package/lib/components/WhatsAppMessageList/WhatsAppMessageList.vue.d.ts +39 -0
  75. package/lib/components/WhatsAppMessageList/index.d.ts +1 -0
  76. package/lib/components/WhatsAppMessageStatus/WhatsAppMessageStatus.d.ts +7 -0
  77. package/lib/components/WhatsAppMessageStatus/WhatsAppMessageStatus.types.d.ts +30 -0
  78. package/lib/components/WhatsAppMessageStatus/WhatsAppMessageStatus.vue.d.ts +24 -0
  79. package/lib/components/WhatsAppMessageStatus/index.d.ts +1 -0
  80. package/lib/components/WhatsAppMessagingWindowNotice/WhatsAppMessagingWindowNotice.d.ts +9 -0
  81. package/lib/components/WhatsAppMessagingWindowNotice/WhatsAppMessagingWindowNotice.types.d.ts +55 -0
  82. package/lib/components/WhatsAppMessagingWindowNotice/WhatsAppMessagingWindowNotice.vue.d.ts +18 -0
  83. package/lib/components/WhatsAppMessagingWindowNotice/index.d.ts +1 -0
  84. package/lib/components/WhatsAppTemplatePreview/WhatsAppTemplatePreview.d.ts +7 -0
  85. package/lib/components/WhatsAppTemplatePreview/WhatsAppTemplatePreview.types.d.ts +36 -0
  86. package/lib/components/WhatsAppTemplatePreview/WhatsAppTemplatePreview.vue.d.ts +12 -0
  87. package/lib/components/WhatsAppTemplatePreview/index.d.ts +1 -0
  88. package/lib/components/WhatsAppTemplateSelector/WhatsAppTemplateSelector.d.ts +9 -0
  89. package/lib/components/WhatsAppTemplateSelector/WhatsAppTemplateSelector.types.d.ts +106 -0
  90. package/lib/components/WhatsAppTemplateSelector/WhatsAppTemplateSelector.vue.d.ts +33 -0
  91. package/lib/components/WhatsAppTemplateSelector/index.d.ts +1 -0
  92. package/lib/emoji/emoji-data.d.ts +27 -0
  93. package/lib/emoji/emoji-filter.d.ts +49 -0
  94. package/lib/emoji/index.d.ts +4 -0
  95. package/lib/icons/WhatsAppIcon.vue.d.ts +14 -0
  96. package/lib/icons/icon-paths.d.ts +43 -0
  97. package/lib/icons/index.d.ts +3 -0
  98. package/lib/index.d.mts +29 -0
  99. package/lib/index.d.ts +29 -0
  100. package/lib/labels.d.ts +184 -0
  101. package/lib/types.d.ts +777 -0
  102. package/lib/utils/capabilities.d.ts +14 -0
  103. package/lib/utils/format.d.ts +27 -0
  104. package/lib/utils/index.d.ts +9 -0
  105. package/lib/utils/media.d.ts +45 -0
  106. package/lib/utils/messages.d.ts +48 -0
  107. package/lib/utils/phone.d.ts +18 -0
  108. package/lib/utils/templates.d.ts +65 -0
  109. package/package.json +46 -0
  110. package/styles.css +1504 -0
  111. package/styles.layer.css +1506 -0
@@ -0,0 +1,14 @@
1
+ import type { WhatsAppConversationCapabilities, WhatsAppMediaType, WhatsAppMessagingWindow, WhatsAppResolvedCapabilities } from '../types';
2
+ /** Media types offered when `canSendMedia` is set but `allowedMediaTypes` is not. */
3
+ export declare const DEFAULT_ALLOWED_MEDIA_TYPES: WhatsAppMediaType[];
4
+ /** Window state assumed when the backend did not report one. */
5
+ export declare const UNKNOWN_MESSAGING_WINDOW: WhatsAppMessagingWindow;
6
+ /**
7
+ * Fills in every capability default once, so no component repeats them.
8
+ *
9
+ * The only rule the frontend applies is the one it can apply safely: a *closed* window, as
10
+ * reported by the backend, turns free-form messaging off. Whether the window is closed is never
11
+ * derived from timestamps here — `state: 'unknown'` deliberately leaves the composer usable
12
+ * rather than guessing at WhatsApp's 24-hour rule.
13
+ */
14
+ export declare function resolveCapabilities(capabilities: WhatsAppConversationCapabilities | undefined): WhatsAppResolvedCapabilities;
@@ -0,0 +1,27 @@
1
+ import type { WhatsAppInboxLabels } from '../labels';
2
+ import type { WhatsAppTimestamp } from '../types';
3
+ /**
4
+ * Converts any accepted timestamp to a `Date`, or `null` when it cannot be parsed.
5
+ *
6
+ * Invalid values return `null` so callers do not render `Invalid Date` or `NaN`.
7
+ */
8
+ export declare function toDate(value: WhatsAppTimestamp | undefined | null): Date | null;
9
+ /** Whether two dates fall on the same calendar day in the local timezone. */
10
+ export declare function isSameDay(a: Date, b: Date): boolean;
11
+ /** Start of the calendar day, used as the grouping key of the message list. */
12
+ export declare function startOfDay(date: Date): Date;
13
+ /** Time of day, as shown under a message bubble. */
14
+ export declare function formatMessageTime(value: WhatsAppTimestamp, locale?: string): string;
15
+ /** Full date and time, used as the `title` and screen-reader text of a message timestamp. */
16
+ export declare function formatFullTimestamp(value: WhatsAppTimestamp, locale?: string): string;
17
+ /** Day divider label: `Today`, `Yesterday`, a weekday within the last week, or a full date. */
18
+ export declare function formatDayLabel(value: WhatsAppTimestamp, locale?: string, labels?: Pick<WhatsAppInboxLabels, 'today' | 'yesterday'>, now?: Date): string;
19
+ /**
20
+ * Timestamp of a conversation list item: the time for today, `Yesterday`, a weekday within the
21
+ * last week, and a short date beyond that. This is what keeps the column narrow.
22
+ */
23
+ export declare function formatConversationTime(value: WhatsAppTimestamp | undefined, locale?: string, labels?: Pick<WhatsAppInboxLabels, 'today' | 'yesterday'>, now?: Date): string;
24
+ /** Human readable file size. Used by the attachment previews and by the size validation copy. */
25
+ export declare function formatFileSize(bytes: number | undefined): string;
26
+ /** `m:ss` duration, as shown on audio and video attachments. */
27
+ export declare function formatDuration(seconds: number | undefined): string;
@@ -0,0 +1,9 @@
1
+ export { formatConversationTime, formatDayLabel, formatDuration, formatFileSize, formatFullTimestamp, formatMessageTime, isSameDay, startOfDay, toDate, } from './format';
2
+ export { DEFAULT_ALLOWED_MEDIA_TYPES, UNKNOWN_MESSAGING_WINDOW, resolveCapabilities, } from './capabilities';
3
+ export { createClientId, getContactDisplayName, getConversationActivityTime, getConversationPreviewText, getMessagePreviewText, getMessageTypeLabel, groupMessagesByDay, sortConversationsByActivity, } from './messages';
4
+ export type { WhatsAppMessageGroup } from './messages';
5
+ export { createEmptyTemplateValues, extractPlaceholders, filterTemplates, getTemplateBody, getTemplateButtons, getTemplateFooter, getTemplateHeader, getTemplateParameters, isTemplateSendable, renderTemplateText, validateTemplateValues, } from './templates';
6
+ export type { WhatsAppTemplateButtonParameters, WhatsAppTemplateErrors, WhatsAppTemplateParameters, WhatsAppTemplateValidation, } from './templates';
7
+ export { MAX_PHONE_NUMBER_DIGITS, MIN_PHONE_NUMBER_DIGITS, isValidPhoneNumber, normalizePhoneNumber, } from './phone';
8
+ export { DEFAULT_MEDIA_ACCEPT, getAcceptAttribute, getMediaTypeFromMime, matchesAccept, validateFiles, } from './media';
9
+ export type { ValidateFilesInput, ValidateFilesResult } from './media';
@@ -0,0 +1,45 @@
1
+ import type { WhatsAppInboxLabels } from '../labels';
2
+ import type { WhatsAppMediaConstraints, WhatsAppMediaType, WhatsAppRejectedFile } from '../types';
3
+ /**
4
+ * `accept` values offered per media type when the consumer does not configure its own.
5
+ *
6
+ * Deliberately broad: the authoritative list of what a provider accepts lives on the backend, and
7
+ * a consumer narrows this through `capabilities.mediaConstraints`.
8
+ */
9
+ export declare const DEFAULT_MEDIA_ACCEPT: Record<WhatsAppMediaType, string[]>;
10
+ /**
11
+ * Maps a MIME type onto the media type that decides which renderer is used.
12
+ *
13
+ * Never returns `sticker`: stickers are classified by the backend, a picked `.webp` file is an
14
+ * image. Anything unrecognized is a document, which is the renderer that degrades best.
15
+ */
16
+ export declare function getMediaTypeFromMime(mimeType: string | undefined): WhatsAppMediaType;
17
+ /** Value for the `accept` attribute of the composer file input. */
18
+ export declare function getAcceptAttribute(allowedMediaTypes: WhatsAppMediaType[], constraints?: Partial<Record<WhatsAppMediaType, WhatsAppMediaConstraints>>): string;
19
+ /** Whether a file matches any entry of an `accept` list. An empty list accepts everything. */
20
+ export declare function matchesAccept(file: File, accept: string[] | undefined): boolean;
21
+ /** Input of {@link validateFiles}. */
22
+ export interface ValidateFilesInput {
23
+ /** Files the user picked. */
24
+ files: File[];
25
+ /** Media types the conversation accepts. */
26
+ allowedMediaTypes: WhatsAppMediaType[];
27
+ /** Per media type constraints from the conversation capabilities. */
28
+ constraints?: Partial<Record<WhatsAppMediaType, WhatsAppMediaConstraints>>;
29
+ /** Attachments already staged in the composer, counted against `maxFiles`. */
30
+ existingCount?: number;
31
+ /** Labels used to build the rejection messages. */
32
+ labels?: WhatsAppInboxLabels;
33
+ }
34
+ /** Files split into the ones the composer forwards and the ones it refused. */
35
+ export interface ValidateFilesResult {
36
+ accepted: File[];
37
+ rejected: WhatsAppRejectedFile[];
38
+ }
39
+ /**
40
+ * Applies the configured file constraints before any file reaches the consumer.
41
+ *
42
+ * This is the only validation the extension performs on media, and every limit comes from
43
+ * `capabilities` rather than from a hard-coded provider table.
44
+ */
45
+ export declare function validateFiles({ files, allowedMediaTypes, constraints, existingCount, labels, }: ValidateFilesInput): ValidateFilesResult;
@@ -0,0 +1,48 @@
1
+ import type { WhatsAppInboxLabels } from '../labels';
2
+ import type { WhatsAppConversationPreview, WhatsAppConversationSummary, WhatsAppMessageData, WhatsAppMessageType } from '../types';
3
+ /** One calendar day of messages, as rendered between two day dividers. */
4
+ export interface WhatsAppMessageGroup {
5
+ /** Stable key for the group, derived from the day. */
6
+ key: string;
7
+ /** Start of the day the group covers. `null` for messages without a usable timestamp. */
8
+ date: Date | null;
9
+ messages: WhatsAppMessageData[];
10
+ }
11
+ /**
12
+ * Splits a message list into calendar days, preserving the order it was given in.
13
+ *
14
+ * The list is not sorted: the consumer owns ordering, and re-sorting here would fight a backend
15
+ * that returns messages in its own sequence (for example threaded or cursor-paged results).
16
+ */
17
+ export declare function groupMessagesByDay(messages: WhatsAppMessageData[]): WhatsAppMessageGroup[];
18
+ /** Label used when a message type has no text of its own, for example a photo without caption. */
19
+ export declare function getMessageTypeLabel(type: WhatsAppMessageType | undefined, labels?: WhatsAppInboxLabels): string;
20
+ /**
21
+ * Single-line text for a message, used by conversation previews and by accessible names.
22
+ *
23
+ * Exhaustive over the message union, so adding a message type is a compile error here rather
24
+ * than an empty preview at runtime.
25
+ */
26
+ export declare function getMessagePreviewText(message: WhatsAppMessageData, labels?: WhatsAppInboxLabels): string;
27
+ /** Preview text of a conversation list item, falling back to a label derived from the type. */
28
+ export declare function getConversationPreviewText(preview: WhatsAppConversationPreview | undefined, labels?: WhatsAppInboxLabels): string;
29
+ /** Display name of a contact, falling back to the phone number and then to the id. */
30
+ export declare function getContactDisplayName(conversation: WhatsAppConversationSummary): string;
31
+ /** Time a conversation is ordered by: its last activity, then its last message. */
32
+ export declare function getConversationActivityTime(conversation: WhatsAppConversationSummary): number;
33
+ /**
34
+ * Copy of the list ordered by latest activity, pinned conversations first.
35
+ *
36
+ * Opt-in: `WhatsAppConversationList` renders the array it is given untouched unless `order` is
37
+ * set, because a server-side ordering (relevance, priority, custom queues) must not be silently
38
+ * overwritten by the UI.
39
+ */
40
+ export declare function sortConversationsByActivity<T extends WhatsAppConversationSummary>(conversations: T[]): T[];
41
+ /**
42
+ * Identifier attached to every outgoing payload so the consumer can reconcile its optimistic
43
+ * message with the one the backend echoes back.
44
+ *
45
+ * `crypto.randomUUID` when available, and a counter-plus-timestamp fallback for the environments
46
+ * that do not expose it (older Safari, non-secure contexts, some test runners).
47
+ */
48
+ export declare function createClientId(): string;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Phone number handling for starting a conversation with a number that is not in the list yet.
3
+ *
4
+ * Deliberately permissive: the authoritative check is whichever provider the consumer uses, and
5
+ * a frontend that guessed at national formats would reject numbers the backend accepts. All this
6
+ * does is catch obvious typos before the payload is emitted.
7
+ */
8
+ /** Digits only, keeping a leading `+`. Handy as a lookup key for an existing conversation. */
9
+ export declare function normalizePhoneNumber(value: string): string;
10
+ /**
11
+ * Shortest and longest number the default validation accepts.
12
+ *
13
+ * E.164 allows up to 15 digits; the lower bound is loose enough for short codes.
14
+ */
15
+ export declare const MIN_PHONE_NUMBER_DIGITS = 6;
16
+ export declare const MAX_PHONE_NUMBER_DIGITS = 15;
17
+ /** Whether a number is plausible enough to send to the backend. */
18
+ export declare function isValidPhoneNumber(value: string): boolean;
@@ -0,0 +1,65 @@
1
+ import type { WhatsAppInboxLabels } from '../labels';
2
+ import type { WhatsAppTemplate, WhatsAppTemplateBodyComponent, WhatsAppTemplateButton, WhatsAppTemplateButtonsComponent, WhatsAppTemplateFooterComponent, WhatsAppTemplateHeaderComponent, WhatsAppTemplateParameter, WhatsAppTemplateValues } from '../types';
3
+ /** Placeholder keys used in a piece of template text, in order and without duplicates. */
4
+ export declare function extractPlaceholders(text: string | undefined): string[];
5
+ export declare function getTemplateHeader(template: WhatsAppTemplate | undefined): WhatsAppTemplateHeaderComponent | undefined;
6
+ export declare function getTemplateBody(template: WhatsAppTemplate | undefined): WhatsAppTemplateBodyComponent | undefined;
7
+ export declare function getTemplateFooter(template: WhatsAppTemplate | undefined): WhatsAppTemplateFooterComponent | undefined;
8
+ export declare function getTemplateButtons(template: WhatsAppTemplate | undefined): WhatsAppTemplateButtonsComponent | undefined;
9
+ /** Placeholders of one template button, together with the button and its index. */
10
+ export interface WhatsAppTemplateButtonParameters {
11
+ index: number;
12
+ button: WhatsAppTemplateButton;
13
+ parameters: WhatsAppTemplateParameter[];
14
+ }
15
+ /** Everything the parameter form needs to know about a template. */
16
+ export interface WhatsAppTemplateParameters {
17
+ header: WhatsAppTemplateParameter[];
18
+ body: WhatsAppTemplateParameter[];
19
+ buttons: WhatsAppTemplateButtonParameters[];
20
+ /** Header format, or `undefined` when the template has no header. */
21
+ headerFormat: WhatsAppTemplateHeaderComponent['format'] | undefined;
22
+ /** Whether the header expects a media file rather than text. */
23
+ requiresHeaderMedia: boolean;
24
+ /** Whether the template needs any input at all. */
25
+ hasParameters: boolean;
26
+ }
27
+ /** Collects every placeholder a template declares, grouped by the section it belongs to. */
28
+ export declare function getTemplateParameters(template: WhatsAppTemplate | undefined): WhatsAppTemplateParameters;
29
+ /** Empty value object matching a template's shape, used to seed the parameter form. */
30
+ export declare function createEmptyTemplateValues(template: WhatsAppTemplate | undefined): WhatsAppTemplateValues;
31
+ /** Field-level validation errors of a template parameter form. */
32
+ export interface WhatsAppTemplateErrors {
33
+ header: Record<string, string>;
34
+ body: Record<string, string>;
35
+ buttons: Record<string, Record<string, string>>;
36
+ headerMedia?: string;
37
+ }
38
+ /** Result of validating a template parameter form. */
39
+ export interface WhatsAppTemplateValidation {
40
+ valid: boolean;
41
+ errors: WhatsAppTemplateErrors;
42
+ }
43
+ /**
44
+ * Validates entered template values against the template's own declaration.
45
+ *
46
+ * Only the shape of the template drives this: nothing here knows which templates a particular
47
+ * provider accepts, which stays a backend decision surfaced through `WhatsAppTemplate.status`.
48
+ */
49
+ export declare function validateTemplateValues(template: WhatsAppTemplate | undefined, values: WhatsAppTemplateValues, labels?: WhatsAppInboxLabels): WhatsAppTemplateValidation;
50
+ /**
51
+ * Substitutes entered values into template text.
52
+ *
53
+ * Placeholders without a value keep their original form, so the preview shows the user exactly
54
+ * which variables are still empty.
55
+ */
56
+ export declare function renderTemplateText(text: string | undefined, values: Record<string, string> | undefined): string;
57
+ /** Whether a template may be sent, that is, whether the provider approved it. */
58
+ export declare function isTemplateSendable(template: WhatsAppTemplate): boolean;
59
+ /**
60
+ * Filters templates by a free-text query across name, description, category and body text.
61
+ *
62
+ * Client-side filtering of an already-supplied list, not a data-fetching concern: a consumer
63
+ * that searches server-side simply passes the filtered list and leaves the query empty.
64
+ */
65
+ export declare function filterTemplates(templates: WhatsAppTemplate[], query: string): WhatsAppTemplate[];
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@mantine-vue/whatsapp-inbox",
3
+ "version": "3.2.0",
4
+ "description": "Backend-agnostic WhatsApp inbox components for Mantine Vue",
5
+ "license": "MIT",
6
+ "files": [
7
+ "cjs",
8
+ "esm",
9
+ "lib",
10
+ "styles.css",
11
+ "styles.layer.css",
12
+ "styles"
13
+ ],
14
+ "sideEffects": [
15
+ "*.css"
16
+ ],
17
+ "main": "./cjs/index.cjs",
18
+ "module": "./esm/index.mjs",
19
+ "types": "./lib/index.d.ts",
20
+ "exports": {
21
+ ".": {
22
+ "import": {
23
+ "types": "./lib/index.d.mts",
24
+ "default": "./esm/index.mjs"
25
+ },
26
+ "require": {
27
+ "types": "./lib/index.d.ts",
28
+ "default": "./cjs/index.cjs"
29
+ }
30
+ },
31
+ "./styles.css": "./styles.css",
32
+ "./styles.layer.css": "./styles.layer.css"
33
+ },
34
+ "devDependencies": {
35
+ "@mantine-vue/core": "workspace:*",
36
+ "@mantine-vue/hooks": "workspace:*",
37
+ "@vue/compiler-dom": "^3.5.0",
38
+ "@vue/test-utils": "^2.4.6",
39
+ "vue": "^3.5.0"
40
+ },
41
+ "peerDependencies": {
42
+ "@mantine-vue/core": "3.2.0",
43
+ "@mantine-vue/hooks": "3.2.0",
44
+ "vue": "^3.5.0"
45
+ }
46
+ }