@retion-miniapp/react-native 0.20.1 → 0.20.2

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
@@ -1,4 +1,5 @@
1
- import React, { ReactNode } from 'react';
1
+ import * as React from 'react';
2
+ import React__default, { ReactNode } from 'react';
2
3
  import { ImageSourcePropType, TextProps } from 'react-native';
3
4
 
4
5
  type MiniAppChannel = 'production' | 'testing';
@@ -432,15 +433,15 @@ declare const createMmkvStorage: (mmkv: {
432
433
  }) => MiniAppStorage;
433
434
 
434
435
  /** Splash mặc định (chỉ dùng component RN) — ứng dụng truyền `splash` để thay bằng UI riêng. */
435
- declare const DefaultMiniAppSplash: ({ app, is_dark, status, progress, retry }: MiniAppSplashProps) => React.JSX.Element;
436
+ declare const DefaultMiniAppSplash: ({ app, is_dark, status, progress, retry }: MiniAppSplashProps) => React__default.JSX.Element;
436
437
  interface MiniAppHostProps {
437
438
  /**
438
439
  * Layout bao ngoài (bottom sheet, modal, full screen…). PHẢI là component cố định (khai báo ngoài
439
440
  * render) — truyền inline `(p) => …` thì mỗi lần render là component mới → mount lại mọi WebView.
440
441
  */
441
- container: React.ComponentType<MiniAppContainerProps>;
442
+ container: React__default.ComponentType<MiniAppContainerProps>;
442
443
  /** Màn che lúc khởi động / đang tải / lỗi. Mặc định DefaultMiniAppSplash. Cũng phải cố định như container. */
443
- splash?: React.ComponentType<MiniAppSplashProps>;
444
+ splash?: React__default.ComponentType<MiniAppSplashProps>;
444
445
  is_dark?: boolean;
445
446
  bridge?: MiniAppBridgeOptions;
446
447
  /**
@@ -466,7 +467,7 @@ interface MiniAppHostProps {
466
467
  url: string;
467
468
  }) => void;
468
469
  }
469
- declare const _default$1: React.MemoExoticComponent<({ container, splash, is_dark, bridge, close_on_back, opaque_background, allow_embedded_miniapps, onWebLoadEnd }: MiniAppHostProps) => React.JSX.Element | null>;
470
+ declare const _default$1: React__default.MemoExoticComponent<({ container, splash, is_dark, bridge, close_on_back, opaque_background, allow_embedded_miniapps, onWebLoadEnd }: MiniAppHostProps) => React__default.JSX.Element | null>;
470
471
 
471
472
  interface OpenMiniAppArgs {
472
473
  app: MiniAppLaunch;
@@ -715,16 +716,7 @@ declare const showMiniAppChangelog: (app_id: string, { name }?: {
715
716
  declare const dismissMiniAppChangelog: () => void;
716
717
  declare const useMiniAppChangelogRequest: () => MiniAppChangelogRequest | null;
717
718
 
718
- /**
719
- * Popup cập nhật + "Có gì mới" của mini app — SDK lo toàn bộ logic, ứng dụng chỉ mount 1 lần và (tuỳ chọn) bọc UI:
720
- *
721
- * <MiniAppUpdates logo={require('./assets/icon.png')} />
722
- * <MiniAppUpdates renderUpdate={props => <MyUpdatePopup {...props} />} />
723
- *
724
- * - Cập nhật (app trong config.manual_update có bản mới): popup bắt buộc → updateMiniApp → % tải → Thử lại khi lỗi.
725
- * - Changelog: openMiniApp / cập nhật xong / showMiniAppChangelog(app_id) mà có bản mới chưa xem → modal
726
- * gộp các bản đã nhảy qua + "Xem tất cả cập nhật". Lần đầu cài không hiện; bản chưa có changelog bỏ qua.
727
- */
719
+ /** Kiểu public của MiniAppUpdates — tách riêng để UI riêng của app import mà không kéo theo component. */
728
720
  interface MiniAppUpdatePromptProps {
729
721
  update: MiniAppUpdate;
730
722
  is_updating: boolean;
@@ -779,6 +771,8 @@ interface MiniAppUpdatesLabels {
779
771
  update_failed: string;
780
772
  update_now: string;
781
773
  updating_hint: string;
774
+ /** Locale định dạng ngày ở màn lịch sử (vd 'vi-VN', 'en-US'). */
775
+ date_locale: string;
782
776
  }
783
777
  interface MiniAppChangelogActionsProps {
784
778
  onClose: () => void;
@@ -791,7 +785,6 @@ interface MiniAppUpdateActionProps {
791
785
  /** "Cập nhật ngay" hoặc "Thử lại" theo labels. */
792
786
  label: string;
793
787
  }
794
- declare const DEFAULT_MINIAPP_UPDATES_LABELS: MiniAppUpdatesLabels;
795
788
  interface MiniAppHistoryHeaderProps {
796
789
  title: string;
797
790
  /** Tên mini app. */
@@ -803,6 +796,12 @@ interface MiniAppChangelogKindStyle {
803
796
  color?: string;
804
797
  bg?: string;
805
798
  }
799
+ interface MiniAppChangelogKind {
800
+ key: keyof MiniAppChangelog;
801
+ label: string;
802
+ color: string;
803
+ bg: string;
804
+ }
806
805
  /** Tuỳ biến UI — chỉ truyền phần cần đổi, còn lại theo mặc định (sáng hoặc tối nếu `dark`). */
807
806
  interface MiniAppUpdatesTheme {
808
807
  dark?: boolean;
@@ -832,32 +831,27 @@ interface MiniAppUpdatesTheme {
832
831
  /** Màu / nhãn từng nhóm. */
833
832
  kinds?: Partial<Record<keyof MiniAppChangelog, MiniAppChangelogKindStyle>>;
834
833
  }
835
- type ResolvedTheme = Required<Omit<MiniAppUpdatesTheme, 'kinds' | 'secondary'>> & {
834
+ /** Theme đã gộp mặc định + chữ — giá trị context mà mọi khối UI của SDK đọc. */
835
+ type MiniAppUpdatesUI = Required<Omit<MiniAppUpdatesTheme, 'kinds' | 'secondary'>> & {
836
836
  secondary?: string;
837
837
  labels: MiniAppUpdatesLabels;
838
- kinds: {
839
- key: keyof MiniAppChangelog;
840
- label: string;
841
- color: string;
842
- bg: string;
843
- }[];
838
+ kinds: MiniAppChangelogKind[];
844
839
  };
845
- /** Khai báo trước resolveMiniAppUpdatesTheme — DEFAULT_THEME tính ngay lúc nạp module. */
846
- declare const MINIAPP_CHANGELOG_KINDS: {
847
- key: keyof MiniAppChangelog;
848
- label: string;
849
- color: string;
850
- bg: string;
851
- }[];
852
- declare const resolveMiniAppUpdatesTheme: (theme?: MiniAppUpdatesTheme, labels?: Partial<MiniAppUpdatesLabels>) => ResolvedTheme;
853
- /** Bọc UI riêng để MiniAppChangelogGroups / MiniAppChangelogHistory ăn theme của app. */
840
+
841
+ declare const DEFAULT_MINIAPP_UPDATES_LABELS: MiniAppUpdatesLabels;
842
+ declare const MINIAPP_CHANGELOG_KINDS: MiniAppChangelogKind[];
843
+ /** Gộp theme + chữ của app với mặc định (sáng / tối theo `dark`). Nhóm "Mới" theo `primary` nếu app không đặt màu riêng. */
844
+ declare const resolveMiniAppUpdatesTheme: (theme?: MiniAppUpdatesTheme, labels?: Partial<MiniAppUpdatesLabels>) => MiniAppUpdatesUI;
845
+ /** Bọc UI riêng để MiniAppChangelogGroups / MiniAppChangelogHistory ăn theme + chữ của app. */
854
846
  declare const MiniAppUpdatesThemeProvider: ({ theme, labels, children }: {
855
847
  theme?: MiniAppUpdatesTheme;
856
848
  labels?: Partial<MiniAppUpdatesLabels>;
857
849
  children: ReactNode;
858
850
  }) => React.JSX.Element;
859
- declare const useMiniAppUpdatesTheme: () => ResolvedTheme;
851
+ declare const useMiniAppUpdatesTheme: () => MiniAppUpdatesUI;
852
+ /** Gộp changelog các bản đã nhảy qua thành 1. */
860
853
  declare const mergeMiniAppChangelog: (versions: MiniAppChangelogVersion[]) => MiniAppChangelog;
854
+
861
855
  /** 1 mục changelog: **đậm**, `code`, [chữ](https://link) — Text lồng nhau, link mở trình duyệt. */
862
856
  declare const MiniAppChangelogText: ({ text, style }: {
863
857
  text: string;
@@ -870,6 +864,7 @@ declare const MiniAppChangelogGroups: ({ changelog, max_items, onMore }: {
870
864
  max_items?: number;
871
865
  onMore?: () => void;
872
866
  }) => React.JSX.Element;
867
+
873
868
  /** Toàn bộ lịch sử changelog của 1 mini app (màn "Xem tất cả"), mới nhất trước. Header nổi kiểu Chat SDK. */
874
869
  declare const MiniAppChangelogHistory: ({ app_id, name, onBack, renderHeader }: {
875
870
  app_id: string;
@@ -877,7 +872,8 @@ declare const MiniAppChangelogHistory: ({ app_id, name, onBack, renderHeader }:
877
872
  onBack: () => void;
878
873
  /** Header riêng (nằm trong luồng, SDK đệm sẵn status bar). Không truyền → header nổi mặc định. */
879
874
  renderHeader?: (props: MiniAppHistoryHeaderProps) => ReactNode;
880
- }) => React.JSX.Element;
875
+ }) => React__default.JSX.Element;
876
+
881
877
  /** UI mặc định "Có gì mới". */
882
878
  declare const DefaultMiniAppChangelogPrompt: ({ request, changelog, onClose, renderHistoryHeader, renderActions }: MiniAppChangelogPromptProps & {
883
879
  renderHistoryHeader?: MiniAppUpdatesProps["renderHistoryHeader"];
@@ -888,7 +884,8 @@ declare const DefaultMiniAppUpdatePrompt: ({ update, is_updating, progress, has_
888
884
  logo?: ImageSourcePropType;
889
885
  renderAction?: MiniAppUpdatesProps["renderUpdateAction"];
890
886
  }) => React.JSX.Element;
891
- declare const _default: React.MemoExoticComponent<({ app_ids, shouldShowUpdate, logo, renderUpdate, renderChangelog, theme, renderHistoryHeader, labels, renderChangelogActions, renderUpdateAction }: MiniAppUpdatesProps) => React.JSX.Element | null>;
887
+
888
+ declare const _default: React__default.MemoExoticComponent<({ app_ids, shouldShowUpdate, logo, renderUpdate, renderChangelog, theme, renderHistoryHeader, labels, renderChangelogActions, renderUpdateAction }: MiniAppUpdatesProps) => React__default.JSX.Element | null>;
892
889
 
893
890
  /**
894
891
  * Markdown inline tối giản cho changelog (1 dòng / mục): **đậm**, `code`, [chữ](https://link).
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import React, { ReactNode } from 'react';
1
+ import * as React from 'react';
2
+ import React__default, { ReactNode } from 'react';
2
3
  import { ImageSourcePropType, TextProps } from 'react-native';
3
4
 
4
5
  type MiniAppChannel = 'production' | 'testing';
@@ -432,15 +433,15 @@ declare const createMmkvStorage: (mmkv: {
432
433
  }) => MiniAppStorage;
433
434
 
434
435
  /** Splash mặc định (chỉ dùng component RN) — ứng dụng truyền `splash` để thay bằng UI riêng. */
435
- declare const DefaultMiniAppSplash: ({ app, is_dark, status, progress, retry }: MiniAppSplashProps) => React.JSX.Element;
436
+ declare const DefaultMiniAppSplash: ({ app, is_dark, status, progress, retry }: MiniAppSplashProps) => React__default.JSX.Element;
436
437
  interface MiniAppHostProps {
437
438
  /**
438
439
  * Layout bao ngoài (bottom sheet, modal, full screen…). PHẢI là component cố định (khai báo ngoài
439
440
  * render) — truyền inline `(p) => …` thì mỗi lần render là component mới → mount lại mọi WebView.
440
441
  */
441
- container: React.ComponentType<MiniAppContainerProps>;
442
+ container: React__default.ComponentType<MiniAppContainerProps>;
442
443
  /** Màn che lúc khởi động / đang tải / lỗi. Mặc định DefaultMiniAppSplash. Cũng phải cố định như container. */
443
- splash?: React.ComponentType<MiniAppSplashProps>;
444
+ splash?: React__default.ComponentType<MiniAppSplashProps>;
444
445
  is_dark?: boolean;
445
446
  bridge?: MiniAppBridgeOptions;
446
447
  /**
@@ -466,7 +467,7 @@ interface MiniAppHostProps {
466
467
  url: string;
467
468
  }) => void;
468
469
  }
469
- declare const _default$1: React.MemoExoticComponent<({ container, splash, is_dark, bridge, close_on_back, opaque_background, allow_embedded_miniapps, onWebLoadEnd }: MiniAppHostProps) => React.JSX.Element | null>;
470
+ declare const _default$1: React__default.MemoExoticComponent<({ container, splash, is_dark, bridge, close_on_back, opaque_background, allow_embedded_miniapps, onWebLoadEnd }: MiniAppHostProps) => React__default.JSX.Element | null>;
470
471
 
471
472
  interface OpenMiniAppArgs {
472
473
  app: MiniAppLaunch;
@@ -715,16 +716,7 @@ declare const showMiniAppChangelog: (app_id: string, { name }?: {
715
716
  declare const dismissMiniAppChangelog: () => void;
716
717
  declare const useMiniAppChangelogRequest: () => MiniAppChangelogRequest | null;
717
718
 
718
- /**
719
- * Popup cập nhật + "Có gì mới" của mini app — SDK lo toàn bộ logic, ứng dụng chỉ mount 1 lần và (tuỳ chọn) bọc UI:
720
- *
721
- * <MiniAppUpdates logo={require('./assets/icon.png')} />
722
- * <MiniAppUpdates renderUpdate={props => <MyUpdatePopup {...props} />} />
723
- *
724
- * - Cập nhật (app trong config.manual_update có bản mới): popup bắt buộc → updateMiniApp → % tải → Thử lại khi lỗi.
725
- * - Changelog: openMiniApp / cập nhật xong / showMiniAppChangelog(app_id) mà có bản mới chưa xem → modal
726
- * gộp các bản đã nhảy qua + "Xem tất cả cập nhật". Lần đầu cài không hiện; bản chưa có changelog bỏ qua.
727
- */
719
+ /** Kiểu public của MiniAppUpdates — tách riêng để UI riêng của app import mà không kéo theo component. */
728
720
  interface MiniAppUpdatePromptProps {
729
721
  update: MiniAppUpdate;
730
722
  is_updating: boolean;
@@ -779,6 +771,8 @@ interface MiniAppUpdatesLabels {
779
771
  update_failed: string;
780
772
  update_now: string;
781
773
  updating_hint: string;
774
+ /** Locale định dạng ngày ở màn lịch sử (vd 'vi-VN', 'en-US'). */
775
+ date_locale: string;
782
776
  }
783
777
  interface MiniAppChangelogActionsProps {
784
778
  onClose: () => void;
@@ -791,7 +785,6 @@ interface MiniAppUpdateActionProps {
791
785
  /** "Cập nhật ngay" hoặc "Thử lại" theo labels. */
792
786
  label: string;
793
787
  }
794
- declare const DEFAULT_MINIAPP_UPDATES_LABELS: MiniAppUpdatesLabels;
795
788
  interface MiniAppHistoryHeaderProps {
796
789
  title: string;
797
790
  /** Tên mini app. */
@@ -803,6 +796,12 @@ interface MiniAppChangelogKindStyle {
803
796
  color?: string;
804
797
  bg?: string;
805
798
  }
799
+ interface MiniAppChangelogKind {
800
+ key: keyof MiniAppChangelog;
801
+ label: string;
802
+ color: string;
803
+ bg: string;
804
+ }
806
805
  /** Tuỳ biến UI — chỉ truyền phần cần đổi, còn lại theo mặc định (sáng hoặc tối nếu `dark`). */
807
806
  interface MiniAppUpdatesTheme {
808
807
  dark?: boolean;
@@ -832,32 +831,27 @@ interface MiniAppUpdatesTheme {
832
831
  /** Màu / nhãn từng nhóm. */
833
832
  kinds?: Partial<Record<keyof MiniAppChangelog, MiniAppChangelogKindStyle>>;
834
833
  }
835
- type ResolvedTheme = Required<Omit<MiniAppUpdatesTheme, 'kinds' | 'secondary'>> & {
834
+ /** Theme đã gộp mặc định + chữ — giá trị context mà mọi khối UI của SDK đọc. */
835
+ type MiniAppUpdatesUI = Required<Omit<MiniAppUpdatesTheme, 'kinds' | 'secondary'>> & {
836
836
  secondary?: string;
837
837
  labels: MiniAppUpdatesLabels;
838
- kinds: {
839
- key: keyof MiniAppChangelog;
840
- label: string;
841
- color: string;
842
- bg: string;
843
- }[];
838
+ kinds: MiniAppChangelogKind[];
844
839
  };
845
- /** Khai báo trước resolveMiniAppUpdatesTheme — DEFAULT_THEME tính ngay lúc nạp module. */
846
- declare const MINIAPP_CHANGELOG_KINDS: {
847
- key: keyof MiniAppChangelog;
848
- label: string;
849
- color: string;
850
- bg: string;
851
- }[];
852
- declare const resolveMiniAppUpdatesTheme: (theme?: MiniAppUpdatesTheme, labels?: Partial<MiniAppUpdatesLabels>) => ResolvedTheme;
853
- /** Bọc UI riêng để MiniAppChangelogGroups / MiniAppChangelogHistory ăn theme của app. */
840
+
841
+ declare const DEFAULT_MINIAPP_UPDATES_LABELS: MiniAppUpdatesLabels;
842
+ declare const MINIAPP_CHANGELOG_KINDS: MiniAppChangelogKind[];
843
+ /** Gộp theme + chữ của app với mặc định (sáng / tối theo `dark`). Nhóm "Mới" theo `primary` nếu app không đặt màu riêng. */
844
+ declare const resolveMiniAppUpdatesTheme: (theme?: MiniAppUpdatesTheme, labels?: Partial<MiniAppUpdatesLabels>) => MiniAppUpdatesUI;
845
+ /** Bọc UI riêng để MiniAppChangelogGroups / MiniAppChangelogHistory ăn theme + chữ của app. */
854
846
  declare const MiniAppUpdatesThemeProvider: ({ theme, labels, children }: {
855
847
  theme?: MiniAppUpdatesTheme;
856
848
  labels?: Partial<MiniAppUpdatesLabels>;
857
849
  children: ReactNode;
858
850
  }) => React.JSX.Element;
859
- declare const useMiniAppUpdatesTheme: () => ResolvedTheme;
851
+ declare const useMiniAppUpdatesTheme: () => MiniAppUpdatesUI;
852
+ /** Gộp changelog các bản đã nhảy qua thành 1. */
860
853
  declare const mergeMiniAppChangelog: (versions: MiniAppChangelogVersion[]) => MiniAppChangelog;
854
+
861
855
  /** 1 mục changelog: **đậm**, `code`, [chữ](https://link) — Text lồng nhau, link mở trình duyệt. */
862
856
  declare const MiniAppChangelogText: ({ text, style }: {
863
857
  text: string;
@@ -870,6 +864,7 @@ declare const MiniAppChangelogGroups: ({ changelog, max_items, onMore }: {
870
864
  max_items?: number;
871
865
  onMore?: () => void;
872
866
  }) => React.JSX.Element;
867
+
873
868
  /** Toàn bộ lịch sử changelog của 1 mini app (màn "Xem tất cả"), mới nhất trước. Header nổi kiểu Chat SDK. */
874
869
  declare const MiniAppChangelogHistory: ({ app_id, name, onBack, renderHeader }: {
875
870
  app_id: string;
@@ -877,7 +872,8 @@ declare const MiniAppChangelogHistory: ({ app_id, name, onBack, renderHeader }:
877
872
  onBack: () => void;
878
873
  /** Header riêng (nằm trong luồng, SDK đệm sẵn status bar). Không truyền → header nổi mặc định. */
879
874
  renderHeader?: (props: MiniAppHistoryHeaderProps) => ReactNode;
880
- }) => React.JSX.Element;
875
+ }) => React__default.JSX.Element;
876
+
881
877
  /** UI mặc định "Có gì mới". */
882
878
  declare const DefaultMiniAppChangelogPrompt: ({ request, changelog, onClose, renderHistoryHeader, renderActions }: MiniAppChangelogPromptProps & {
883
879
  renderHistoryHeader?: MiniAppUpdatesProps["renderHistoryHeader"];
@@ -888,7 +884,8 @@ declare const DefaultMiniAppUpdatePrompt: ({ update, is_updating, progress, has_
888
884
  logo?: ImageSourcePropType;
889
885
  renderAction?: MiniAppUpdatesProps["renderUpdateAction"];
890
886
  }) => React.JSX.Element;
891
- declare const _default: React.MemoExoticComponent<({ app_ids, shouldShowUpdate, logo, renderUpdate, renderChangelog, theme, renderHistoryHeader, labels, renderChangelogActions, renderUpdateAction }: MiniAppUpdatesProps) => React.JSX.Element | null>;
887
+
888
+ declare const _default: React__default.MemoExoticComponent<({ app_ids, shouldShowUpdate, logo, renderUpdate, renderChangelog, theme, renderHistoryHeader, labels, renderChangelogActions, renderUpdateAction }: MiniAppUpdatesProps) => React__default.JSX.Element | null>;
892
889
 
893
890
  /**
894
891
  * Markdown inline tối giản cho changelog (1 dòng / mục): **đậm**, `code`, [chữ](https://link).