@usechat/react-native 1.0.13 → 1.0.14

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/index.d.mts CHANGED
@@ -496,6 +496,132 @@ interface MessageListRef {
496
496
  scrollToIndex: (index: number, animated?: boolean) => void;
497
497
  }
498
498
 
499
+ /**
500
+ * Translation keys for the chat SDK
501
+ * These keys define all user-facing text that can be translated
502
+ */
503
+ interface TranslationKeys {
504
+ 'input.placeholder': string;
505
+ 'search.placeholder': string;
506
+ 'status.online': string;
507
+ 'status.offline': string;
508
+ 'status.typing': string;
509
+ 'message.deleted': string;
510
+ 'message.sending': string;
511
+ 'message.sent': string;
512
+ 'message.delivered': string;
513
+ 'message.read': string;
514
+ 'message.failed': string;
515
+ 'action.reply': string;
516
+ 'action.copy': string;
517
+ 'action.delete': string;
518
+ 'action.cancel': string;
519
+ 'action.send': string;
520
+ 'action.clear': string;
521
+ 'action.clearAll': string;
522
+ 'attachment.add': string;
523
+ 'attachment.remove': string;
524
+ 'attachment.clear': string;
525
+ 'attachment.attachments': string;
526
+ 'accessibility.back': string;
527
+ 'accessibility.send': string;
528
+ 'accessibility.attach': string;
529
+ 'accessibility.emoji': string;
530
+ 'accessibility.videoCall': string;
531
+ 'accessibility.voiceCall': string;
532
+ 'accessibility.info': string;
533
+ 'accessibility.search': string;
534
+ 'accessibility.typing': string;
535
+ 'error.fileTooLarge': string;
536
+ 'error.invalidFileType': string;
537
+ 'error.maxAttachments': string;
538
+ 'error.networkError': string;
539
+ 'time.justNow': string;
540
+ 'time.minutesAgo': string;
541
+ 'time.hoursAgo': string;
542
+ 'time.daysAgo': string;
543
+ 'time.weeksAgo': string;
544
+ 'time.monthsAgo': string;
545
+ 'time.yearsAgo': string;
546
+ }
547
+ /**
548
+ * Supported locales
549
+ */
550
+ type SupportedLocale = 'en' | 'pl';
551
+ /**
552
+ * Translation function type
553
+ */
554
+ type TranslationFunction = (key: keyof TranslationKeys, params?: Record<string, string | number>) => string;
555
+ /**
556
+ * I18n context value
557
+ */
558
+ interface I18nContextValue {
559
+ t: TranslationFunction;
560
+ locale: SupportedLocale;
561
+ setLocale: (locale: SupportedLocale) => void;
562
+ }
563
+ /**
564
+ * Default i18n configuration
565
+ */
566
+ interface I18nConfig {
567
+ locale: SupportedLocale;
568
+ fallbackLocale: SupportedLocale;
569
+ }
570
+
571
+ /**
572
+ * Props for I18nProvider
573
+ */
574
+ interface I18nProviderProps {
575
+ children: ReactNode;
576
+ locale?: SupportedLocale;
577
+ fallbackLocale?: SupportedLocale;
578
+ }
579
+ /**
580
+ * I18nProvider component that provides translation context
581
+ *
582
+ * @example
583
+ * ```tsx
584
+ * <I18nProvider locale="pl">
585
+ * <Chat messages={messages} />
586
+ * </I18nProvider>
587
+ * ```
588
+ */
589
+ declare const I18nProvider: React__default.FC<I18nProviderProps>;
590
+ /**
591
+ * Hook to use translation context
592
+ *
593
+ * @example
594
+ * ```tsx
595
+ * const { t, locale, setLocale } = useTranslation();
596
+ * const placeholder = t('input.placeholder');
597
+ * ```
598
+ */
599
+ declare const useTranslation: () => I18nContextValue;
600
+ /**
601
+ * Hook to get just the translation function
602
+ * Returns a fallback function if not in I18nProvider context
603
+ *
604
+ * @example
605
+ * ```tsx
606
+ * const t = useTranslationFunction();
607
+ * const placeholder = t('input.placeholder');
608
+ * ```
609
+ */
610
+ declare const useTranslationFunction: () => TranslationFunction;
611
+
612
+ /**
613
+ * All default translations
614
+ */
615
+ declare const defaultTranslations: Record<SupportedLocale, TranslationKeys>;
616
+ /**
617
+ * Get translation for a specific locale
618
+ */
619
+ declare const getTranslation: (locale: SupportedLocale) => TranslationKeys;
620
+ /**
621
+ * Check if a locale is supported
622
+ */
623
+ declare const isSupportedLocale: (locale: string) => locale is SupportedLocale;
624
+
499
625
  interface ChatConfig {
500
626
  keyboardBehavior?: 'padding' | 'height' | 'position';
501
627
  keyboardVerticalOffset?: number;
@@ -510,6 +636,7 @@ interface ChatConfig {
510
636
  interface ChatProviderProps {
511
637
  children: ReactNode;
512
638
  config?: ChatConfig;
639
+ locale?: SupportedLocale;
513
640
  }
514
641
 
515
642
  interface ChatInitConfig {
@@ -661,4 +788,4 @@ declare const useMessageReactions: (config?: MessageListConfig | undefined) => {
661
788
  declare const useAttachments: (options?: UseAttachmentsOptions | undefined) => UseAttachmentsReturn;
662
789
  declare const useMessageInput: <T = string>(config?: MessageInputConfig<T> | undefined) => UseMessageInputReturn<T>;
663
790
 
664
- export { AttachmentMenu, type AttachmentResult, Chat, ChatAvatar, type ChatConfig, ChatHeader, type ChatHeaderProps, type ChatInitConfig, type ChatInitResponse, ChatItem, ChatList, ChatListSearchBar, type ChatListSearchBarProps, type ChatProps, ChatProvider, ChatScreenHeader, type Message$1 as Message, MessageInput, type MessageInputRef, MessageList, type MessageListRef, type Theme, type ThemeBorderRadius, type ThemeColors, ThemeProvider, type ThemeProviderProps, type ThemeSpacing, type ThemeTypography, TypingIndicator, type TypingIndicatorProps, defaultTheme, getAuthState, getProjectId, initChat, isInitialized, useAttachments, useChatConfig, useChatMessages, useChatSDK, useMessageActions, useMessageInput, useMessageList, useMessageReactions, useTheme };
791
+ export { AttachmentMenu, type AttachmentResult, Chat, ChatAvatar, type ChatConfig, ChatHeader, type ChatHeaderProps, type ChatInitConfig, type ChatInitResponse, ChatItem, ChatList, ChatListSearchBar, type ChatListSearchBarProps, type ChatProps, ChatProvider, ChatScreenHeader, type I18nConfig, type I18nContextValue, I18nProvider, type Message$1 as Message, MessageInput, type MessageInputRef, MessageList, type MessageListRef, type SupportedLocale, type Theme, type ThemeBorderRadius, type ThemeColors, ThemeProvider, type ThemeProviderProps, type ThemeSpacing, type ThemeTypography, type TranslationFunction, type TranslationKeys, TypingIndicator, type TypingIndicatorProps, defaultTheme, defaultTranslations, getAuthState, getProjectId, getTranslation, initChat, isInitialized, isSupportedLocale, useAttachments, useChatConfig, useChatMessages, useChatSDK, useMessageActions, useMessageInput, useMessageList, useMessageReactions, useTheme, useTranslation, useTranslationFunction };
package/dist/index.d.ts CHANGED
@@ -496,6 +496,132 @@ interface MessageListRef {
496
496
  scrollToIndex: (index: number, animated?: boolean) => void;
497
497
  }
498
498
 
499
+ /**
500
+ * Translation keys for the chat SDK
501
+ * These keys define all user-facing text that can be translated
502
+ */
503
+ interface TranslationKeys {
504
+ 'input.placeholder': string;
505
+ 'search.placeholder': string;
506
+ 'status.online': string;
507
+ 'status.offline': string;
508
+ 'status.typing': string;
509
+ 'message.deleted': string;
510
+ 'message.sending': string;
511
+ 'message.sent': string;
512
+ 'message.delivered': string;
513
+ 'message.read': string;
514
+ 'message.failed': string;
515
+ 'action.reply': string;
516
+ 'action.copy': string;
517
+ 'action.delete': string;
518
+ 'action.cancel': string;
519
+ 'action.send': string;
520
+ 'action.clear': string;
521
+ 'action.clearAll': string;
522
+ 'attachment.add': string;
523
+ 'attachment.remove': string;
524
+ 'attachment.clear': string;
525
+ 'attachment.attachments': string;
526
+ 'accessibility.back': string;
527
+ 'accessibility.send': string;
528
+ 'accessibility.attach': string;
529
+ 'accessibility.emoji': string;
530
+ 'accessibility.videoCall': string;
531
+ 'accessibility.voiceCall': string;
532
+ 'accessibility.info': string;
533
+ 'accessibility.search': string;
534
+ 'accessibility.typing': string;
535
+ 'error.fileTooLarge': string;
536
+ 'error.invalidFileType': string;
537
+ 'error.maxAttachments': string;
538
+ 'error.networkError': string;
539
+ 'time.justNow': string;
540
+ 'time.minutesAgo': string;
541
+ 'time.hoursAgo': string;
542
+ 'time.daysAgo': string;
543
+ 'time.weeksAgo': string;
544
+ 'time.monthsAgo': string;
545
+ 'time.yearsAgo': string;
546
+ }
547
+ /**
548
+ * Supported locales
549
+ */
550
+ type SupportedLocale = 'en' | 'pl';
551
+ /**
552
+ * Translation function type
553
+ */
554
+ type TranslationFunction = (key: keyof TranslationKeys, params?: Record<string, string | number>) => string;
555
+ /**
556
+ * I18n context value
557
+ */
558
+ interface I18nContextValue {
559
+ t: TranslationFunction;
560
+ locale: SupportedLocale;
561
+ setLocale: (locale: SupportedLocale) => void;
562
+ }
563
+ /**
564
+ * Default i18n configuration
565
+ */
566
+ interface I18nConfig {
567
+ locale: SupportedLocale;
568
+ fallbackLocale: SupportedLocale;
569
+ }
570
+
571
+ /**
572
+ * Props for I18nProvider
573
+ */
574
+ interface I18nProviderProps {
575
+ children: ReactNode;
576
+ locale?: SupportedLocale;
577
+ fallbackLocale?: SupportedLocale;
578
+ }
579
+ /**
580
+ * I18nProvider component that provides translation context
581
+ *
582
+ * @example
583
+ * ```tsx
584
+ * <I18nProvider locale="pl">
585
+ * <Chat messages={messages} />
586
+ * </I18nProvider>
587
+ * ```
588
+ */
589
+ declare const I18nProvider: React__default.FC<I18nProviderProps>;
590
+ /**
591
+ * Hook to use translation context
592
+ *
593
+ * @example
594
+ * ```tsx
595
+ * const { t, locale, setLocale } = useTranslation();
596
+ * const placeholder = t('input.placeholder');
597
+ * ```
598
+ */
599
+ declare const useTranslation: () => I18nContextValue;
600
+ /**
601
+ * Hook to get just the translation function
602
+ * Returns a fallback function if not in I18nProvider context
603
+ *
604
+ * @example
605
+ * ```tsx
606
+ * const t = useTranslationFunction();
607
+ * const placeholder = t('input.placeholder');
608
+ * ```
609
+ */
610
+ declare const useTranslationFunction: () => TranslationFunction;
611
+
612
+ /**
613
+ * All default translations
614
+ */
615
+ declare const defaultTranslations: Record<SupportedLocale, TranslationKeys>;
616
+ /**
617
+ * Get translation for a specific locale
618
+ */
619
+ declare const getTranslation: (locale: SupportedLocale) => TranslationKeys;
620
+ /**
621
+ * Check if a locale is supported
622
+ */
623
+ declare const isSupportedLocale: (locale: string) => locale is SupportedLocale;
624
+
499
625
  interface ChatConfig {
500
626
  keyboardBehavior?: 'padding' | 'height' | 'position';
501
627
  keyboardVerticalOffset?: number;
@@ -510,6 +636,7 @@ interface ChatConfig {
510
636
  interface ChatProviderProps {
511
637
  children: ReactNode;
512
638
  config?: ChatConfig;
639
+ locale?: SupportedLocale;
513
640
  }
514
641
 
515
642
  interface ChatInitConfig {
@@ -661,4 +788,4 @@ declare const useMessageReactions: (config?: MessageListConfig | undefined) => {
661
788
  declare const useAttachments: (options?: UseAttachmentsOptions | undefined) => UseAttachmentsReturn;
662
789
  declare const useMessageInput: <T = string>(config?: MessageInputConfig<T> | undefined) => UseMessageInputReturn<T>;
663
790
 
664
- export { AttachmentMenu, type AttachmentResult, Chat, ChatAvatar, type ChatConfig, ChatHeader, type ChatHeaderProps, type ChatInitConfig, type ChatInitResponse, ChatItem, ChatList, ChatListSearchBar, type ChatListSearchBarProps, type ChatProps, ChatProvider, ChatScreenHeader, type Message$1 as Message, MessageInput, type MessageInputRef, MessageList, type MessageListRef, type Theme, type ThemeBorderRadius, type ThemeColors, ThemeProvider, type ThemeProviderProps, type ThemeSpacing, type ThemeTypography, TypingIndicator, type TypingIndicatorProps, defaultTheme, getAuthState, getProjectId, initChat, isInitialized, useAttachments, useChatConfig, useChatMessages, useChatSDK, useMessageActions, useMessageInput, useMessageList, useMessageReactions, useTheme };
791
+ export { AttachmentMenu, type AttachmentResult, Chat, ChatAvatar, type ChatConfig, ChatHeader, type ChatHeaderProps, type ChatInitConfig, type ChatInitResponse, ChatItem, ChatList, ChatListSearchBar, type ChatListSearchBarProps, type ChatProps, ChatProvider, ChatScreenHeader, type I18nConfig, type I18nContextValue, I18nProvider, type Message$1 as Message, MessageInput, type MessageInputRef, MessageList, type MessageListRef, type SupportedLocale, type Theme, type ThemeBorderRadius, type ThemeColors, ThemeProvider, type ThemeProviderProps, type ThemeSpacing, type ThemeTypography, type TranslationFunction, type TranslationKeys, TypingIndicator, type TypingIndicatorProps, defaultTheme, defaultTranslations, getAuthState, getProjectId, getTranslation, initChat, isInitialized, isSupportedLocale, useAttachments, useChatConfig, useChatMessages, useChatSDK, useMessageActions, useMessageInput, useMessageList, useMessageReactions, useTheme, useTranslation, useTranslationFunction };