@retion-miniapp/react-native 0.16.0 → 0.18.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.
- package/dist/index.d.mts +139 -2
- package/dist/index.d.ts +139 -2
- package/dist/index.js +11 -10
- package/dist/index.mjs +11 -10
- package/docs/MINIAPP_README.md +32 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ImageSourcePropType } from 'react-native';
|
|
2
3
|
|
|
3
4
|
type MiniAppChannel = 'production' | 'testing';
|
|
4
5
|
/** Quyền lấy token nhạy cảm — admin bật trên Console, Platform trả trong manifest. */
|
|
5
6
|
type MiniAppPermission = 'partner_token' | 'chatbox_token';
|
|
6
7
|
/** Manifest Platform trả (API list ứng dụng hoặc manifest lẻ). */
|
|
8
|
+
/** Changelog 1 version (Console / CHANGELOG.md): Mới · Sửa lỗi · Cải thiện. */
|
|
9
|
+
interface MiniAppChangelog {
|
|
10
|
+
new: string[];
|
|
11
|
+
fix: string[];
|
|
12
|
+
improve: string[];
|
|
13
|
+
}
|
|
14
|
+
interface MiniAppChangelogVersion {
|
|
15
|
+
version: string;
|
|
16
|
+
changelog: MiniAppChangelog;
|
|
17
|
+
created_at: string;
|
|
18
|
+
}
|
|
7
19
|
interface MiniAppManifest {
|
|
8
20
|
app_id: string;
|
|
9
21
|
name?: string;
|
|
@@ -15,6 +27,8 @@ interface MiniAppManifest {
|
|
|
15
27
|
/** true: đổi conversation → đẩy context; false: reload với context mới. */
|
|
16
28
|
context_update?: boolean;
|
|
17
29
|
permissions?: MiniAppPermission[];
|
|
30
|
+
/** Changelog version này (null: bản deploy trước khi có changelog). */
|
|
31
|
+
changelog?: MiniAppChangelog | null;
|
|
18
32
|
}
|
|
19
33
|
/** Bundle đã giải nén trong máy. */
|
|
20
34
|
interface MiniAppLocalBundle {
|
|
@@ -357,6 +371,11 @@ interface MiniAppConfig {
|
|
|
357
371
|
manual_update?: string[];
|
|
358
372
|
/** Giới hạn WebView sống. Mặc định: không huỷ. */
|
|
359
373
|
keep_alive?: MiniAppKeepAlive;
|
|
374
|
+
/**
|
|
375
|
+
* Tự hiện changelog "Có gì mới" khi mở mini app (openMiniApp) / cập nhật xong (updateMiniApp) có bản mới chưa xem.
|
|
376
|
+
* Cần mount <MiniAppUpdates /> để hiện. Mặc định true.
|
|
377
|
+
*/
|
|
378
|
+
changelog?: boolean;
|
|
360
379
|
/** Log tiến trình tải ra console. */
|
|
361
380
|
debug?: boolean;
|
|
362
381
|
}
|
|
@@ -447,7 +466,7 @@ interface MiniAppHostProps {
|
|
|
447
466
|
url: string;
|
|
448
467
|
}) => void;
|
|
449
468
|
}
|
|
450
|
-
declare const _default: React.MemoExoticComponent<({ container, splash, is_dark, bridge, close_on_back, opaque_background, allow_embedded_miniapps, onWebLoadEnd }: MiniAppHostProps) => React.JSX.Element | null>;
|
|
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>;
|
|
451
470
|
|
|
452
471
|
interface OpenMiniAppArgs {
|
|
453
472
|
app: MiniAppLaunch;
|
|
@@ -544,6 +563,12 @@ type MiniAppEvent =
|
|
|
544
563
|
app_id: string;
|
|
545
564
|
current_version: string;
|
|
546
565
|
next_version: string;
|
|
566
|
+
}
|
|
567
|
+
/** updateMiniApp xong — bản mới đã dùng (SDK tự hiện changelog nếu có). */
|
|
568
|
+
| {
|
|
569
|
+
type: 'update_applied';
|
|
570
|
+
app_id: string;
|
|
571
|
+
version: string;
|
|
547
572
|
};
|
|
548
573
|
interface MiniAppUpdate {
|
|
549
574
|
app_id: string;
|
|
@@ -640,6 +665,118 @@ declare const installBundledMiniApp: ({ manifest, zip_path }: {
|
|
|
640
665
|
zip_path: string;
|
|
641
666
|
}) => Promise<MiniAppLocalBundle>;
|
|
642
667
|
|
|
668
|
+
interface MiniAppPendingChangelog {
|
|
669
|
+
app_id: string;
|
|
670
|
+
/** Version đã xem changelog lần trước (loại trừ). */
|
|
671
|
+
from: string;
|
|
672
|
+
/** Version đang có trong máy (bao gồm). */
|
|
673
|
+
to: string;
|
|
674
|
+
}
|
|
675
|
+
declare const getMiniAppChangelogSeen: (app_id: string) => string | null;
|
|
676
|
+
/** Đã xem changelog tới version này (mặc định: bản đang có trong máy). */
|
|
677
|
+
declare const markMiniAppChangelogSeen: (app_id: string, version?: string | undefined) => void;
|
|
678
|
+
/** Gọi khi người dùng bấm mở mini app: có bản mới chưa xem changelog → { from, to }, không thì null. */
|
|
679
|
+
declare const getPendingChangelog: (app_id: string) => MiniAppPendingChangelog | null;
|
|
680
|
+
/**
|
|
681
|
+
* Changelog từ Platform, mới nhất trước. from: loại trừ, to: bao gồm; bỏ trống cả 2 → toàn bộ lịch sử.
|
|
682
|
+
* Reject khi lỗi mạng / API.
|
|
683
|
+
*/
|
|
684
|
+
declare const fetchMiniAppChangelog: (app_id: string, { from, to, channel }?: {
|
|
685
|
+
from?: string;
|
|
686
|
+
to?: string;
|
|
687
|
+
channel?: MiniAppChannel;
|
|
688
|
+
}) => Promise<MiniAppChangelogVersion[]>;
|
|
689
|
+
interface MiniAppChangelogState {
|
|
690
|
+
versions: MiniAppChangelogVersion[];
|
|
691
|
+
loading: boolean;
|
|
692
|
+
error?: string;
|
|
693
|
+
reload: () => void;
|
|
694
|
+
}
|
|
695
|
+
/** Hook lấy changelog (modal "Có gì mới": truyền from/to; màn "Xem tất cả": bỏ trống). enabled=false → không gọi. */
|
|
696
|
+
declare const useMiniAppChangelog: (app_id: string | undefined, { from, to, enabled }?: {
|
|
697
|
+
from?: string;
|
|
698
|
+
to?: string;
|
|
699
|
+
enabled?: boolean;
|
|
700
|
+
}) => MiniAppChangelogState;
|
|
701
|
+
interface MiniAppChangelogRequest extends MiniAppPendingChangelog {
|
|
702
|
+
name: string;
|
|
703
|
+
/** Changelog các bản đã nhảy qua (from loại trừ → to bao gồm), mới nhất trước. Luôn ≥ 1. */
|
|
704
|
+
versions: MiniAppChangelogVersion[];
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Có bản mới chưa xem changelog → tải → hiện (qua <MiniAppUpdates />). true nếu hiện.
|
|
708
|
+
* SDK tự gọi khi openMiniApp / updateMiniApp xong; gọi tay khi mở mini app theo đường khác (vd iframe trong web).
|
|
709
|
+
* Các bản nhảy qua đều chưa có changelog → ghi nhận đã xem, không hiện. Lỗi mạng → lần mở sau thử lại.
|
|
710
|
+
*/
|
|
711
|
+
declare const showMiniAppChangelog: (app_id: string, { name }?: {
|
|
712
|
+
name?: string;
|
|
713
|
+
}) => Promise<boolean>;
|
|
714
|
+
/** Đóng changelog đang hiện, ghi nhận đã xem tới bản đang có. */
|
|
715
|
+
declare const dismissMiniAppChangelog: () => void;
|
|
716
|
+
declare const useMiniAppChangelogRequest: () => MiniAppChangelogRequest | null;
|
|
717
|
+
|
|
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
|
+
*/
|
|
728
|
+
interface MiniAppUpdatePromptProps {
|
|
729
|
+
update: MiniAppUpdate;
|
|
730
|
+
is_updating: boolean;
|
|
731
|
+
/** 0–100. */
|
|
732
|
+
progress: number;
|
|
733
|
+
has_failed: boolean;
|
|
734
|
+
onUpdate: () => void;
|
|
735
|
+
}
|
|
736
|
+
interface MiniAppChangelogPromptProps {
|
|
737
|
+
request: MiniAppChangelogRequest;
|
|
738
|
+
/** Gộp changelog các bản đã nhảy qua. */
|
|
739
|
+
changelog: MiniAppChangelog;
|
|
740
|
+
/** Đóng + ghi nhận đã xem. */
|
|
741
|
+
onClose: () => void;
|
|
742
|
+
}
|
|
743
|
+
interface MiniAppUpdatesProps {
|
|
744
|
+
/** App hiện popup cập nhật. Mặc định: config.manual_update. */
|
|
745
|
+
app_ids?: string[];
|
|
746
|
+
/** Lọc thêm (vd dev đang chạy bản local mới hơn Console → không ép cập nhật lùi). */
|
|
747
|
+
shouldShowUpdate?: (update: MiniAppUpdate) => boolean;
|
|
748
|
+
/** Logo cho UI mặc định. */
|
|
749
|
+
logo?: ImageSourcePropType;
|
|
750
|
+
/** UI riêng cho popup cập nhật (logic vẫn do SDK). */
|
|
751
|
+
renderUpdate?: (props: MiniAppUpdatePromptProps) => ReactNode;
|
|
752
|
+
/** UI riêng cho "Có gì mới" (logic vẫn do SDK). */
|
|
753
|
+
renderChangelog?: (props: MiniAppChangelogPromptProps) => ReactNode;
|
|
754
|
+
}
|
|
755
|
+
declare const MINIAPP_CHANGELOG_KINDS: {
|
|
756
|
+
key: keyof MiniAppChangelog;
|
|
757
|
+
label: string;
|
|
758
|
+
color: string;
|
|
759
|
+
bg: string;
|
|
760
|
+
}[];
|
|
761
|
+
declare const mergeMiniAppChangelog: (versions: MiniAppChangelogVersion[]) => MiniAppChangelog;
|
|
762
|
+
/** 3 nhóm Mới / Sửa lỗi / Cải thiện (bỏ nhóm trống) — dùng lại được trong UI riêng. */
|
|
763
|
+
declare const MiniAppChangelogGroups: ({ changelog }: {
|
|
764
|
+
changelog: MiniAppChangelog;
|
|
765
|
+
}) => React.JSX.Element;
|
|
766
|
+
/** Toàn bộ lịch sử changelog của 1 mini app (màn "Xem tất cả"), mới nhất trước. */
|
|
767
|
+
declare const MiniAppChangelogHistory: ({ app_id, name, onClose }: {
|
|
768
|
+
app_id: string;
|
|
769
|
+
name: string;
|
|
770
|
+
onClose: () => void;
|
|
771
|
+
}) => React.JSX.Element;
|
|
772
|
+
/** UI mặc định "Có gì mới". */
|
|
773
|
+
declare const DefaultMiniAppChangelogPrompt: ({ request, changelog, onClose }: MiniAppChangelogPromptProps) => React.JSX.Element;
|
|
774
|
+
/** UI mặc định popup cập nhật bắt buộc (không đóng được). */
|
|
775
|
+
declare const DefaultMiniAppUpdatePrompt: ({ update, is_updating, progress, has_failed, onUpdate, logo }: MiniAppUpdatePromptProps & {
|
|
776
|
+
logo?: ImageSourcePropType;
|
|
777
|
+
}) => React.JSX.Element;
|
|
778
|
+
declare const _default: React.MemoExoticComponent<({ app_ids, shouldShowUpdate, logo, renderUpdate, renderChangelog }: MiniAppUpdatesProps) => React.JSX.Element | null>;
|
|
779
|
+
|
|
643
780
|
/**
|
|
644
781
|
* App → web: gửi event xuống web của mini app — web nhận y như `WebView.postMessage` (sự kiện `message`).
|
|
645
782
|
* `instance_id`: instance_id lúc openMiniApp; không dùng instance_id thì truyền app_id.
|
|
@@ -811,4 +948,4 @@ interface UploadCapabilities {
|
|
|
811
948
|
/** XHR (không phải fetch) để có tiến trình upload; RN đọc file từ uri (cả content://), không nạp vào JS. */
|
|
812
949
|
declare const uploadToUrl: MiniAppUploader;
|
|
813
950
|
|
|
814
|
-
export { CodeType, DefaultMiniAppSplash, type LocationOptions, type LocationResult, MINIAPP_PLATFORM_URL, type MiniAppBiometricAvailability, type MiniAppBiometricRequest, type MiniAppBiometricResult, type MiniAppBiometrics, type MiniAppBiometryType, type MiniAppBridgeOptions, type MiniAppCatalogEntry, type MiniAppCatalogItem, type MiniAppChannel, type MiniAppConfig, type MiniAppContainerProps, type MiniAppContext, type MiniAppDownloadState, type MiniAppDownloadStatus, type MiniAppDownloadTask, type MiniAppEvent, type MiniAppFileSystem, type MiniAppHandlerContext, type MiniAppHapticType, _default as MiniAppHost, type MiniAppHostData, BridgeError as MiniAppHostError, type MiniAppHostProps, type MiniAppKeepAlive, type MiniAppLaunch, type MiniAppLocalBundle, type MiniAppManifest, type MiniAppNativeHandlers, type MiniAppPaymentRequest, type MiniAppPaymentResult, type MiniAppPermission, type MiniAppPickedFile, type MiniAppSpeechProvider, type MiniAppSpeechStartContext, type MiniAppSplashProps, type MiniAppStorage, type MiniAppSyncResult, type MiniAppUpdate, type MiniAppUploadCaller, type MiniAppUploadOptions, type MiniAppUploadProcessOptions, type MiniAppUploadProcessor, type MiniAppUploadRequest, type MiniAppUploadSource, type MiniAppUploadSourceRequest, type MiniAppUploadTarget, type MiniAppUploader, type MiniAppUrlUploadTarget, type OpenMiniAppArgs, type ReactNativeBiometricsLike, ScannerEndReason, ScannerEvent, ScannerLayout, ScannerMethod, type ScannerOptions, type ScannerResult, type SpeechOptions, ToastType, type UploadCapabilities, type UploadFileType, type UploadFilesResult, type UploadedFile, closeMiniApp, configureMiniApp, createMmkvStorage, createReactNativeBiometrics, createRnfsFileSystem, ensureMiniApp, getLocalMiniApp, getMiniAppCatalog, getMiniAppCatalogEntry, getMiniAppStatuses, getMiniAppUpdate, installBundledMiniApp, onMiniAppEvent, openMiniApp, pauseMiniApp, pauseMiniAppDownloads, preloadMiniApp, releaseSpeechFor, restoreMiniApp, resumeMiniApp, resumeMiniAppDownloads, sendEventToWeb, syncMiniAppCatalog, uninstallMiniApp, updateMiniApp, uploadToUrl, useMiniAppDownload, useMiniAppDownloadsPaused };
|
|
951
|
+
export { CodeType, DefaultMiniAppChangelogPrompt, DefaultMiniAppSplash, DefaultMiniAppUpdatePrompt, type LocationOptions, type LocationResult, MINIAPP_CHANGELOG_KINDS, MINIAPP_PLATFORM_URL, type MiniAppBiometricAvailability, type MiniAppBiometricRequest, type MiniAppBiometricResult, type MiniAppBiometrics, type MiniAppBiometryType, type MiniAppBridgeOptions, type MiniAppCatalogEntry, type MiniAppCatalogItem, type MiniAppChangelog, MiniAppChangelogGroups, MiniAppChangelogHistory, type MiniAppChangelogPromptProps, type MiniAppChangelogRequest, type MiniAppChangelogState, type MiniAppChangelogVersion, type MiniAppChannel, type MiniAppConfig, type MiniAppContainerProps, type MiniAppContext, type MiniAppDownloadState, type MiniAppDownloadStatus, type MiniAppDownloadTask, type MiniAppEvent, type MiniAppFileSystem, type MiniAppHandlerContext, type MiniAppHapticType, _default$1 as MiniAppHost, type MiniAppHostData, BridgeError as MiniAppHostError, type MiniAppHostProps, type MiniAppKeepAlive, type MiniAppLaunch, type MiniAppLocalBundle, type MiniAppManifest, type MiniAppNativeHandlers, type MiniAppPaymentRequest, type MiniAppPaymentResult, type MiniAppPendingChangelog, type MiniAppPermission, type MiniAppPickedFile, type MiniAppSpeechProvider, type MiniAppSpeechStartContext, type MiniAppSplashProps, type MiniAppStorage, type MiniAppSyncResult, type MiniAppUpdate, type MiniAppUpdatePromptProps, _default as MiniAppUpdates, type MiniAppUpdatesProps, type MiniAppUploadCaller, type MiniAppUploadOptions, type MiniAppUploadProcessOptions, type MiniAppUploadProcessor, type MiniAppUploadRequest, type MiniAppUploadSource, type MiniAppUploadSourceRequest, type MiniAppUploadTarget, type MiniAppUploader, type MiniAppUrlUploadTarget, type OpenMiniAppArgs, type ReactNativeBiometricsLike, ScannerEndReason, ScannerEvent, ScannerLayout, ScannerMethod, type ScannerOptions, type ScannerResult, type SpeechOptions, ToastType, type UploadCapabilities, type UploadFileType, type UploadFilesResult, type UploadedFile, closeMiniApp, configureMiniApp, createMmkvStorage, createReactNativeBiometrics, createRnfsFileSystem, dismissMiniAppChangelog, ensureMiniApp, fetchMiniAppChangelog, getLocalMiniApp, getMiniAppCatalog, getMiniAppCatalogEntry, getMiniAppChangelogSeen, getMiniAppStatuses, getMiniAppUpdate, getPendingChangelog, installBundledMiniApp, markMiniAppChangelogSeen, mergeMiniAppChangelog, onMiniAppEvent, openMiniApp, pauseMiniApp, pauseMiniAppDownloads, preloadMiniApp, releaseSpeechFor, restoreMiniApp, resumeMiniApp, resumeMiniAppDownloads, sendEventToWeb, showMiniAppChangelog, syncMiniAppCatalog, uninstallMiniApp, updateMiniApp, uploadToUrl, useMiniAppChangelog, useMiniAppChangelogRequest, useMiniAppDownload, useMiniAppDownloadsPaused };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
+
import { ImageSourcePropType } from 'react-native';
|
|
2
3
|
|
|
3
4
|
type MiniAppChannel = 'production' | 'testing';
|
|
4
5
|
/** Quyền lấy token nhạy cảm — admin bật trên Console, Platform trả trong manifest. */
|
|
5
6
|
type MiniAppPermission = 'partner_token' | 'chatbox_token';
|
|
6
7
|
/** Manifest Platform trả (API list ứng dụng hoặc manifest lẻ). */
|
|
8
|
+
/** Changelog 1 version (Console / CHANGELOG.md): Mới · Sửa lỗi · Cải thiện. */
|
|
9
|
+
interface MiniAppChangelog {
|
|
10
|
+
new: string[];
|
|
11
|
+
fix: string[];
|
|
12
|
+
improve: string[];
|
|
13
|
+
}
|
|
14
|
+
interface MiniAppChangelogVersion {
|
|
15
|
+
version: string;
|
|
16
|
+
changelog: MiniAppChangelog;
|
|
17
|
+
created_at: string;
|
|
18
|
+
}
|
|
7
19
|
interface MiniAppManifest {
|
|
8
20
|
app_id: string;
|
|
9
21
|
name?: string;
|
|
@@ -15,6 +27,8 @@ interface MiniAppManifest {
|
|
|
15
27
|
/** true: đổi conversation → đẩy context; false: reload với context mới. */
|
|
16
28
|
context_update?: boolean;
|
|
17
29
|
permissions?: MiniAppPermission[];
|
|
30
|
+
/** Changelog version này (null: bản deploy trước khi có changelog). */
|
|
31
|
+
changelog?: MiniAppChangelog | null;
|
|
18
32
|
}
|
|
19
33
|
/** Bundle đã giải nén trong máy. */
|
|
20
34
|
interface MiniAppLocalBundle {
|
|
@@ -357,6 +371,11 @@ interface MiniAppConfig {
|
|
|
357
371
|
manual_update?: string[];
|
|
358
372
|
/** Giới hạn WebView sống. Mặc định: không huỷ. */
|
|
359
373
|
keep_alive?: MiniAppKeepAlive;
|
|
374
|
+
/**
|
|
375
|
+
* Tự hiện changelog "Có gì mới" khi mở mini app (openMiniApp) / cập nhật xong (updateMiniApp) có bản mới chưa xem.
|
|
376
|
+
* Cần mount <MiniAppUpdates /> để hiện. Mặc định true.
|
|
377
|
+
*/
|
|
378
|
+
changelog?: boolean;
|
|
360
379
|
/** Log tiến trình tải ra console. */
|
|
361
380
|
debug?: boolean;
|
|
362
381
|
}
|
|
@@ -447,7 +466,7 @@ interface MiniAppHostProps {
|
|
|
447
466
|
url: string;
|
|
448
467
|
}) => void;
|
|
449
468
|
}
|
|
450
|
-
declare const _default: React.MemoExoticComponent<({ container, splash, is_dark, bridge, close_on_back, opaque_background, allow_embedded_miniapps, onWebLoadEnd }: MiniAppHostProps) => React.JSX.Element | null>;
|
|
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>;
|
|
451
470
|
|
|
452
471
|
interface OpenMiniAppArgs {
|
|
453
472
|
app: MiniAppLaunch;
|
|
@@ -544,6 +563,12 @@ type MiniAppEvent =
|
|
|
544
563
|
app_id: string;
|
|
545
564
|
current_version: string;
|
|
546
565
|
next_version: string;
|
|
566
|
+
}
|
|
567
|
+
/** updateMiniApp xong — bản mới đã dùng (SDK tự hiện changelog nếu có). */
|
|
568
|
+
| {
|
|
569
|
+
type: 'update_applied';
|
|
570
|
+
app_id: string;
|
|
571
|
+
version: string;
|
|
547
572
|
};
|
|
548
573
|
interface MiniAppUpdate {
|
|
549
574
|
app_id: string;
|
|
@@ -640,6 +665,118 @@ declare const installBundledMiniApp: ({ manifest, zip_path }: {
|
|
|
640
665
|
zip_path: string;
|
|
641
666
|
}) => Promise<MiniAppLocalBundle>;
|
|
642
667
|
|
|
668
|
+
interface MiniAppPendingChangelog {
|
|
669
|
+
app_id: string;
|
|
670
|
+
/** Version đã xem changelog lần trước (loại trừ). */
|
|
671
|
+
from: string;
|
|
672
|
+
/** Version đang có trong máy (bao gồm). */
|
|
673
|
+
to: string;
|
|
674
|
+
}
|
|
675
|
+
declare const getMiniAppChangelogSeen: (app_id: string) => string | null;
|
|
676
|
+
/** Đã xem changelog tới version này (mặc định: bản đang có trong máy). */
|
|
677
|
+
declare const markMiniAppChangelogSeen: (app_id: string, version?: string | undefined) => void;
|
|
678
|
+
/** Gọi khi người dùng bấm mở mini app: có bản mới chưa xem changelog → { from, to }, không thì null. */
|
|
679
|
+
declare const getPendingChangelog: (app_id: string) => MiniAppPendingChangelog | null;
|
|
680
|
+
/**
|
|
681
|
+
* Changelog từ Platform, mới nhất trước. from: loại trừ, to: bao gồm; bỏ trống cả 2 → toàn bộ lịch sử.
|
|
682
|
+
* Reject khi lỗi mạng / API.
|
|
683
|
+
*/
|
|
684
|
+
declare const fetchMiniAppChangelog: (app_id: string, { from, to, channel }?: {
|
|
685
|
+
from?: string;
|
|
686
|
+
to?: string;
|
|
687
|
+
channel?: MiniAppChannel;
|
|
688
|
+
}) => Promise<MiniAppChangelogVersion[]>;
|
|
689
|
+
interface MiniAppChangelogState {
|
|
690
|
+
versions: MiniAppChangelogVersion[];
|
|
691
|
+
loading: boolean;
|
|
692
|
+
error?: string;
|
|
693
|
+
reload: () => void;
|
|
694
|
+
}
|
|
695
|
+
/** Hook lấy changelog (modal "Có gì mới": truyền from/to; màn "Xem tất cả": bỏ trống). enabled=false → không gọi. */
|
|
696
|
+
declare const useMiniAppChangelog: (app_id: string | undefined, { from, to, enabled }?: {
|
|
697
|
+
from?: string;
|
|
698
|
+
to?: string;
|
|
699
|
+
enabled?: boolean;
|
|
700
|
+
}) => MiniAppChangelogState;
|
|
701
|
+
interface MiniAppChangelogRequest extends MiniAppPendingChangelog {
|
|
702
|
+
name: string;
|
|
703
|
+
/** Changelog các bản đã nhảy qua (from loại trừ → to bao gồm), mới nhất trước. Luôn ≥ 1. */
|
|
704
|
+
versions: MiniAppChangelogVersion[];
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Có bản mới chưa xem changelog → tải → hiện (qua <MiniAppUpdates />). true nếu hiện.
|
|
708
|
+
* SDK tự gọi khi openMiniApp / updateMiniApp xong; gọi tay khi mở mini app theo đường khác (vd iframe trong web).
|
|
709
|
+
* Các bản nhảy qua đều chưa có changelog → ghi nhận đã xem, không hiện. Lỗi mạng → lần mở sau thử lại.
|
|
710
|
+
*/
|
|
711
|
+
declare const showMiniAppChangelog: (app_id: string, { name }?: {
|
|
712
|
+
name?: string;
|
|
713
|
+
}) => Promise<boolean>;
|
|
714
|
+
/** Đóng changelog đang hiện, ghi nhận đã xem tới bản đang có. */
|
|
715
|
+
declare const dismissMiniAppChangelog: () => void;
|
|
716
|
+
declare const useMiniAppChangelogRequest: () => MiniAppChangelogRequest | null;
|
|
717
|
+
|
|
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
|
+
*/
|
|
728
|
+
interface MiniAppUpdatePromptProps {
|
|
729
|
+
update: MiniAppUpdate;
|
|
730
|
+
is_updating: boolean;
|
|
731
|
+
/** 0–100. */
|
|
732
|
+
progress: number;
|
|
733
|
+
has_failed: boolean;
|
|
734
|
+
onUpdate: () => void;
|
|
735
|
+
}
|
|
736
|
+
interface MiniAppChangelogPromptProps {
|
|
737
|
+
request: MiniAppChangelogRequest;
|
|
738
|
+
/** Gộp changelog các bản đã nhảy qua. */
|
|
739
|
+
changelog: MiniAppChangelog;
|
|
740
|
+
/** Đóng + ghi nhận đã xem. */
|
|
741
|
+
onClose: () => void;
|
|
742
|
+
}
|
|
743
|
+
interface MiniAppUpdatesProps {
|
|
744
|
+
/** App hiện popup cập nhật. Mặc định: config.manual_update. */
|
|
745
|
+
app_ids?: string[];
|
|
746
|
+
/** Lọc thêm (vd dev đang chạy bản local mới hơn Console → không ép cập nhật lùi). */
|
|
747
|
+
shouldShowUpdate?: (update: MiniAppUpdate) => boolean;
|
|
748
|
+
/** Logo cho UI mặc định. */
|
|
749
|
+
logo?: ImageSourcePropType;
|
|
750
|
+
/** UI riêng cho popup cập nhật (logic vẫn do SDK). */
|
|
751
|
+
renderUpdate?: (props: MiniAppUpdatePromptProps) => ReactNode;
|
|
752
|
+
/** UI riêng cho "Có gì mới" (logic vẫn do SDK). */
|
|
753
|
+
renderChangelog?: (props: MiniAppChangelogPromptProps) => ReactNode;
|
|
754
|
+
}
|
|
755
|
+
declare const MINIAPP_CHANGELOG_KINDS: {
|
|
756
|
+
key: keyof MiniAppChangelog;
|
|
757
|
+
label: string;
|
|
758
|
+
color: string;
|
|
759
|
+
bg: string;
|
|
760
|
+
}[];
|
|
761
|
+
declare const mergeMiniAppChangelog: (versions: MiniAppChangelogVersion[]) => MiniAppChangelog;
|
|
762
|
+
/** 3 nhóm Mới / Sửa lỗi / Cải thiện (bỏ nhóm trống) — dùng lại được trong UI riêng. */
|
|
763
|
+
declare const MiniAppChangelogGroups: ({ changelog }: {
|
|
764
|
+
changelog: MiniAppChangelog;
|
|
765
|
+
}) => React.JSX.Element;
|
|
766
|
+
/** Toàn bộ lịch sử changelog của 1 mini app (màn "Xem tất cả"), mới nhất trước. */
|
|
767
|
+
declare const MiniAppChangelogHistory: ({ app_id, name, onClose }: {
|
|
768
|
+
app_id: string;
|
|
769
|
+
name: string;
|
|
770
|
+
onClose: () => void;
|
|
771
|
+
}) => React.JSX.Element;
|
|
772
|
+
/** UI mặc định "Có gì mới". */
|
|
773
|
+
declare const DefaultMiniAppChangelogPrompt: ({ request, changelog, onClose }: MiniAppChangelogPromptProps) => React.JSX.Element;
|
|
774
|
+
/** UI mặc định popup cập nhật bắt buộc (không đóng được). */
|
|
775
|
+
declare const DefaultMiniAppUpdatePrompt: ({ update, is_updating, progress, has_failed, onUpdate, logo }: MiniAppUpdatePromptProps & {
|
|
776
|
+
logo?: ImageSourcePropType;
|
|
777
|
+
}) => React.JSX.Element;
|
|
778
|
+
declare const _default: React.MemoExoticComponent<({ app_ids, shouldShowUpdate, logo, renderUpdate, renderChangelog }: MiniAppUpdatesProps) => React.JSX.Element | null>;
|
|
779
|
+
|
|
643
780
|
/**
|
|
644
781
|
* App → web: gửi event xuống web của mini app — web nhận y như `WebView.postMessage` (sự kiện `message`).
|
|
645
782
|
* `instance_id`: instance_id lúc openMiniApp; không dùng instance_id thì truyền app_id.
|
|
@@ -811,4 +948,4 @@ interface UploadCapabilities {
|
|
|
811
948
|
/** XHR (không phải fetch) để có tiến trình upload; RN đọc file từ uri (cả content://), không nạp vào JS. */
|
|
812
949
|
declare const uploadToUrl: MiniAppUploader;
|
|
813
950
|
|
|
814
|
-
export { CodeType, DefaultMiniAppSplash, type LocationOptions, type LocationResult, MINIAPP_PLATFORM_URL, type MiniAppBiometricAvailability, type MiniAppBiometricRequest, type MiniAppBiometricResult, type MiniAppBiometrics, type MiniAppBiometryType, type MiniAppBridgeOptions, type MiniAppCatalogEntry, type MiniAppCatalogItem, type MiniAppChannel, type MiniAppConfig, type MiniAppContainerProps, type MiniAppContext, type MiniAppDownloadState, type MiniAppDownloadStatus, type MiniAppDownloadTask, type MiniAppEvent, type MiniAppFileSystem, type MiniAppHandlerContext, type MiniAppHapticType, _default as MiniAppHost, type MiniAppHostData, BridgeError as MiniAppHostError, type MiniAppHostProps, type MiniAppKeepAlive, type MiniAppLaunch, type MiniAppLocalBundle, type MiniAppManifest, type MiniAppNativeHandlers, type MiniAppPaymentRequest, type MiniAppPaymentResult, type MiniAppPermission, type MiniAppPickedFile, type MiniAppSpeechProvider, type MiniAppSpeechStartContext, type MiniAppSplashProps, type MiniAppStorage, type MiniAppSyncResult, type MiniAppUpdate, type MiniAppUploadCaller, type MiniAppUploadOptions, type MiniAppUploadProcessOptions, type MiniAppUploadProcessor, type MiniAppUploadRequest, type MiniAppUploadSource, type MiniAppUploadSourceRequest, type MiniAppUploadTarget, type MiniAppUploader, type MiniAppUrlUploadTarget, type OpenMiniAppArgs, type ReactNativeBiometricsLike, ScannerEndReason, ScannerEvent, ScannerLayout, ScannerMethod, type ScannerOptions, type ScannerResult, type SpeechOptions, ToastType, type UploadCapabilities, type UploadFileType, type UploadFilesResult, type UploadedFile, closeMiniApp, configureMiniApp, createMmkvStorage, createReactNativeBiometrics, createRnfsFileSystem, ensureMiniApp, getLocalMiniApp, getMiniAppCatalog, getMiniAppCatalogEntry, getMiniAppStatuses, getMiniAppUpdate, installBundledMiniApp, onMiniAppEvent, openMiniApp, pauseMiniApp, pauseMiniAppDownloads, preloadMiniApp, releaseSpeechFor, restoreMiniApp, resumeMiniApp, resumeMiniAppDownloads, sendEventToWeb, syncMiniAppCatalog, uninstallMiniApp, updateMiniApp, uploadToUrl, useMiniAppDownload, useMiniAppDownloadsPaused };
|
|
951
|
+
export { CodeType, DefaultMiniAppChangelogPrompt, DefaultMiniAppSplash, DefaultMiniAppUpdatePrompt, type LocationOptions, type LocationResult, MINIAPP_CHANGELOG_KINDS, MINIAPP_PLATFORM_URL, type MiniAppBiometricAvailability, type MiniAppBiometricRequest, type MiniAppBiometricResult, type MiniAppBiometrics, type MiniAppBiometryType, type MiniAppBridgeOptions, type MiniAppCatalogEntry, type MiniAppCatalogItem, type MiniAppChangelog, MiniAppChangelogGroups, MiniAppChangelogHistory, type MiniAppChangelogPromptProps, type MiniAppChangelogRequest, type MiniAppChangelogState, type MiniAppChangelogVersion, type MiniAppChannel, type MiniAppConfig, type MiniAppContainerProps, type MiniAppContext, type MiniAppDownloadState, type MiniAppDownloadStatus, type MiniAppDownloadTask, type MiniAppEvent, type MiniAppFileSystem, type MiniAppHandlerContext, type MiniAppHapticType, _default$1 as MiniAppHost, type MiniAppHostData, BridgeError as MiniAppHostError, type MiniAppHostProps, type MiniAppKeepAlive, type MiniAppLaunch, type MiniAppLocalBundle, type MiniAppManifest, type MiniAppNativeHandlers, type MiniAppPaymentRequest, type MiniAppPaymentResult, type MiniAppPendingChangelog, type MiniAppPermission, type MiniAppPickedFile, type MiniAppSpeechProvider, type MiniAppSpeechStartContext, type MiniAppSplashProps, type MiniAppStorage, type MiniAppSyncResult, type MiniAppUpdate, type MiniAppUpdatePromptProps, _default as MiniAppUpdates, type MiniAppUpdatesProps, type MiniAppUploadCaller, type MiniAppUploadOptions, type MiniAppUploadProcessOptions, type MiniAppUploadProcessor, type MiniAppUploadRequest, type MiniAppUploadSource, type MiniAppUploadSourceRequest, type MiniAppUploadTarget, type MiniAppUploader, type MiniAppUrlUploadTarget, type OpenMiniAppArgs, type ReactNativeBiometricsLike, ScannerEndReason, ScannerEvent, ScannerLayout, ScannerMethod, type ScannerOptions, type ScannerResult, type SpeechOptions, ToastType, type UploadCapabilities, type UploadFileType, type UploadFilesResult, type UploadedFile, closeMiniApp, configureMiniApp, createMmkvStorage, createReactNativeBiometrics, createRnfsFileSystem, dismissMiniAppChangelog, ensureMiniApp, fetchMiniAppChangelog, getLocalMiniApp, getMiniAppCatalog, getMiniAppCatalogEntry, getMiniAppChangelogSeen, getMiniAppStatuses, getMiniAppUpdate, getPendingChangelog, installBundledMiniApp, markMiniAppChangelogSeen, mergeMiniAppChangelog, onMiniAppEvent, openMiniApp, pauseMiniApp, pauseMiniAppDownloads, preloadMiniApp, releaseSpeechFor, restoreMiniApp, resumeMiniApp, resumeMiniAppDownloads, sendEventToWeb, showMiniAppChangelog, syncMiniAppCatalog, uninstallMiniApp, updateMiniApp, uploadToUrl, useMiniAppChangelog, useMiniAppChangelogRequest, useMiniAppDownload, useMiniAppDownloadsPaused };
|