@vqh2602/mini-app-sdk 1.0.2 → 1.0.5

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 (35) hide show
  1. package/dist/cli/index.js +1 -1
  2. package/dist/core/client.d.ts +3 -1
  3. package/dist/core/client.d.ts.map +1 -1
  4. package/dist/core/client.js +13 -4
  5. package/dist/core/client.js.map +1 -1
  6. package/dist/core/modules/navigation.d.ts +12 -0
  7. package/dist/core/modules/navigation.d.ts.map +1 -1
  8. package/dist/core/modules/navigation.js +18 -0
  9. package/dist/core/modules/navigation.js.map +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/index.js.map +1 -1
  14. package/dist/mock/mock-engine.d.ts.map +1 -1
  15. package/dist/mock/mock-engine.js +6 -0
  16. package/dist/mock/mock-engine.js.map +1 -1
  17. package/dist/transport/adaptive-transport.d.ts +33 -0
  18. package/dist/transport/adaptive-transport.d.ts.map +1 -0
  19. package/dist/transport/adaptive-transport.js +92 -0
  20. package/dist/transport/adaptive-transport.js.map +1 -0
  21. package/dist/transport/index.d.ts +1 -0
  22. package/dist/transport/index.d.ts.map +1 -1
  23. package/dist/transport/index.js +1 -0
  24. package/dist/transport/index.js.map +1 -1
  25. package/dist/transport/native-transport.d.ts.map +1 -1
  26. package/dist/transport/native-transport.js +62 -2
  27. package/dist/transport/native-transport.js.map +1 -1
  28. package/dist/transport/resolver.d.ts.map +1 -1
  29. package/dist/transport/resolver.js +3 -23
  30. package/dist/transport/resolver.js.map +1 -1
  31. package/dist/transport/types.d.ts +1 -1
  32. package/dist/transport/types.d.ts.map +1 -1
  33. package/package.json +8 -2
  34. package/simulator-dist/assets/{index-kRVYB6or.js → index-DpHZwm7N.js} +1 -1
  35. package/simulator-dist/index.html +1 -1
package/dist/cli/index.js CHANGED
@@ -9,7 +9,7 @@ const program = new Command();
9
9
  program
10
10
  .name('miniapp')
11
11
  .description('SuperApp Mini App Developer CLI: Create, Dev, Build, and Upload')
12
- .version('1.0.2');
12
+ .version('1.0.5');
13
13
  program
14
14
  .command('create <project-name>')
15
15
  .description('Khởi tạo một dự án Mini App mới từ mẫu chuẩn SuperApp')
@@ -9,7 +9,7 @@ import { MediaModule } from './modules/media.js';
9
9
  import { LifecycleModule } from './modules/lifecycle.js';
10
10
  import { AuthLoginOptions, AuthLoginResult, ConfigAppViewOptions, KeepScreenOptions, MinimizeAppResult, NotificationResult, RequestSendNotificationOptions, SDKInitOptions, SetNavigationBarColorOptions, ToastOptions, UserProfile } from './types/index.js';
11
11
  export declare class SuperAppSDK {
12
- readonly version = "1.0.2";
12
+ readonly version = "1.0.5";
13
13
  readonly transport: ITransport;
14
14
  readonly mockEngine?: SDKMockEngine;
15
15
  readonly auth: AuthModule;
@@ -26,6 +26,8 @@ export declare class SuperAppSDK {
26
26
  getUserProfile(): Promise<UserProfile>;
27
27
  showToast(options: ToastOptions | string): Promise<void>;
28
28
  vibrate(style?: 'light' | 'medium' | 'heavy'): Promise<void>;
29
+ openNativePage(page: 'profile' | 'form' | string, params?: Record<string, any>): Promise<any>;
30
+ openMiniApp(appId: string, params?: Record<string, any>): Promise<any>;
29
31
  closeApp(): Promise<void>;
30
32
  minimizeApp(): Promise<MinimizeAppResult>;
31
33
  configAppView(options: ConfigAppViewOptions): Promise<any>;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/core/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA0C,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC1G,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,QAAQ,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G,OAAO,CAAC,GAAG,CAAC;IAItE,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAIzB,WAAW,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAIzC,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC;IAI1D,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIvE,qBAAqB,CAAC,OAAO,EAAE,4BAA4B,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpF,UAAU,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,YAAY,EAAE,OAAO,CAAA;KAAE,CAAC;IAIvG,uBAAuB,CAAC,OAAO,CAAC,EAAE,8BAA8B,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAI9F,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,GAAG,MAAM,IAAI;IAI/D,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;CAGlE"}
@@ -1,4 +1,4 @@
1
- import { MockBridgeTransport, TransportResolver } from '../transport/index.js';
1
+ import { AdaptiveBridgeTransport, MockBridgeTransport, TransportResolver } from '../transport/index.js';
2
2
  import { SDKMockEngine } from '../mock/index.js';
3
3
  import { AuthModule } from './modules/auth.js';
4
4
  import { DeviceModule } from './modules/device.js';
@@ -8,7 +8,7 @@ import { NavigationModule } from './modules/navigation.js';
8
8
  import { MediaModule } from './modules/media.js';
9
9
  import { LifecycleModule } from './modules/lifecycle.js';
10
10
  export class SuperAppSDK {
11
- version = '1.0.2';
11
+ version = '1.0.5';
12
12
  transport;
13
13
  mockEngine;
14
14
  // Domain modules
@@ -38,8 +38,11 @@ export class SuperAppSDK {
38
38
  forceTransport: options.forceTransport,
39
39
  mockDispatcher,
40
40
  });
41
- // If MockBridgeTransport was created and we have mockEngine, attach
42
- if (this.transport instanceof MockBridgeTransport && mockDispatcher) {
41
+ // If AdaptiveBridgeTransport or MockBridgeTransport was created and we have mockEngine, attach
42
+ if (this.transport instanceof AdaptiveBridgeTransport && mockDispatcher) {
43
+ this.transport.setMockDispatcher(mockDispatcher);
44
+ }
45
+ else if (this.transport instanceof MockBridgeTransport && mockDispatcher) {
43
46
  this.transport.setDispatcher(mockDispatcher);
44
47
  }
45
48
  this.auth = new AuthModule(this.transport);
@@ -63,6 +66,12 @@ export class SuperAppSDK {
63
66
  vibrate(style) {
64
67
  return this.device.vibrate(style);
65
68
  }
69
+ openNativePage(page, params) {
70
+ return this.navigation.openNativePage(page, params);
71
+ }
72
+ openMiniApp(appId, params) {
73
+ return this.navigation.openMiniApp(appId, params);
74
+ }
66
75
  closeApp() {
67
76
  return this.navigation.closeApp();
68
77
  }
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/core/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,mBAAmB,EAAE,iBAAiB,EAAiB,MAAM,uBAAuB,CAAC;AAC1G,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAezD,MAAM,OAAO,WAAW;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D,CAAC;IAEM,QAAQ;QACb,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC;IACpC,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;IACvC,CAAC;IAEM,aAAa,CAAC,OAA6B;QAChD,OAAO,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAEM,qBAAqB,CAAC,KAAiC;QAC5D,OAAO,IAAI,CAAC,EAAE,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC;IAEM,qBAAqB,CAAC,OAA8C;QACzE,OAAO,IAAI,CAAC,EAAE,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;IAEM,UAAU,CAAC,OAAqC;QACrD,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAEM,uBAAuB,CAAC,OAAwC;QACrE,OAAO,IAAI,CAAC,EAAE,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAClD,CAAC;IAEM,EAAE,CAAC,KAAa,EAAE,QAAgC;QACvD,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC5C,CAAC;IAEM,GAAG,CAAC,KAAa,EAAE,QAAgC;QACxD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC;CACF"}
@@ -3,10 +3,22 @@ import { MinimizeAppResult } from '../types/index.js';
3
3
  export declare class NavigationModule {
4
4
  private transport;
5
5
  constructor(transport: ITransport);
6
+ /**
7
+ * Tự động điều hướng mở màn hình Native của SuperApp (ví dụ: 'profile', 'form')
8
+ */
9
+ openNativePage(page: 'profile' | 'form' | string, params?: Record<string, any>): Promise<any>;
10
+ /**
11
+ * Điều hướng chuyển sang một Mini App khác trong SuperApp
12
+ */
13
+ openMiniApp(appId: string, params?: Record<string, any>): Promise<any>;
6
14
  /**
7
15
  * Đóng Mini App và quay lại màn hình SuperApp chính
8
16
  */
9
17
  closeApp(): Promise<void>;
18
+ /**
19
+ * Alias cho closeApp()
20
+ */
21
+ close(): Promise<void>;
10
22
  /**
11
23
  * Thu nhỏ Mini App vào dạng floating window / background dock
12
24
  */
@@ -1 +1 @@
1
- {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../src/core/modules/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,qBAAa,gBAAgB;IACf,OAAO,CAAC,SAAS;gBAAT,SAAS,EAAE,UAAU;IAEzC;;OAEG;IACU,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAItC;;OAEG;IACU,WAAW,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAItD;;OAEG;IACU,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGjD"}
1
+ {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../src/core/modules/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,qBAAa,gBAAgB;IACf,OAAO,CAAC,SAAS;gBAAT,SAAS,EAAE,UAAU;IAEzC;;OAEG;IACU,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IAI1G;;OAEG;IACU,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IAInF;;OAEG;IACU,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAItC;;OAEG;IACU,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAInC;;OAEG;IACU,WAAW,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAItD;;OAEG;IACU,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGjD"}
@@ -3,12 +3,30 @@ export class NavigationModule {
3
3
  constructor(transport) {
4
4
  this.transport = transport;
5
5
  }
6
+ /**
7
+ * Tự động điều hướng mở màn hình Native của SuperApp (ví dụ: 'profile', 'form')
8
+ */
9
+ async openNativePage(page, params) {
10
+ return this.transport.invoke('navigation.openNativePage', { page, params });
11
+ }
12
+ /**
13
+ * Điều hướng chuyển sang một Mini App khác trong SuperApp
14
+ */
15
+ async openMiniApp(appId, params) {
16
+ return this.transport.invoke('navigation.openMiniApp', { appId, params });
17
+ }
6
18
  /**
7
19
  * Đóng Mini App và quay lại màn hình SuperApp chính
8
20
  */
9
21
  async closeApp() {
10
22
  await this.transport.invoke('navigation.closeApp');
11
23
  }
24
+ /**
25
+ * Alias cho closeApp()
26
+ */
27
+ async close() {
28
+ await this.transport.invoke('navigation.close');
29
+ }
12
30
  /**
13
31
  * Thu nhỏ Mini App vào dạng floating window / background dock
14
32
  */
@@ -1 +1 @@
1
- {"version":3,"file":"navigation.js","sourceRoot":"","sources":["../../../src/core/modules/navigation.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,gBAAgB;IACP;IAApB,YAAoB,SAAqB;QAArB,cAAS,GAAT,SAAS,CAAY;IAAG,CAAC;IAE7C;;OAEG;IACI,KAAK,CAAC,QAAQ;QACnB,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;IACrD,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,WAAW;QACtB,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAA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"}
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { superApp, SuperAppSDK } from './core/index.js';
2
2
  export default superApp;
3
3
  export { superApp, SuperAppSDK };
4
4
  export * from './core/index.js';
5
- export { ITransport, NativeBridgeTransport, PostMessageTransport, MockBridgeTransport, TransportResolver, TransportType, BridgeRequest, BridgeResponse, BridgeEventListener, BridgeError, } from './transport/index.js';
5
+ export { ITransport, NativeBridgeTransport, PostMessageTransport, MockBridgeTransport, AdaptiveBridgeTransport, TransportResolver, TransportType, BridgeRequest, BridgeResponse, BridgeEventListener, BridgeError, } from './transport/index.js';
6
6
  export { SDKMockEngine, MockStateStore, MOCK_USER_PRESETS, MockUserProfile, MockPaymentOrder, MockDeviceState, MockNetworkCondition, MockLogEntry, } from './mock/index.js';
7
7
  export * as transport from './transport/index.js';
8
8
  export * as mock from './mock/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAExD,eAAe,QAAQ,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;AAGjC,cAAc,iBAAiB,CAAC;AAGhC,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,YAAY,GACb,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAExD,eAAe,QAAQ,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;AAGjC,cAAc,iBAAiB,CAAC;AAGhC,OAAO,EACL,UAAU,EACV,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,oBAAoB,EACpB,YAAY,GACb,MAAM,iBAAiB,CAAC;AAGzB,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC"}
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ export { superApp, SuperAppSDK };
4
4
  // Re-export all core modules and types
5
5
  export * from './core/index.js';
6
6
  // Re-export transport interfaces & classes
7
- export { NativeBridgeTransport, PostMessageTransport, MockBridgeTransport, TransportResolver, } from './transport/index.js';
7
+ export { NativeBridgeTransport, PostMessageTransport, MockBridgeTransport, AdaptiveBridgeTransport, TransportResolver, } from './transport/index.js';
8
8
  // Re-export mock engine classes & presets
9
9
  export { SDKMockEngine, MockStateStore, MOCK_USER_PRESETS, } from './mock/index.js';
10
10
  // Sub-namespaces
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAExD,eAAe,QAAQ,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;AAEjC,uCAAuC;AACvC,cAAc,iBAAiB,CAAC;AAEhC,2CAA2C;AAC3C,OAAO,EAEL,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,GAMlB,MAAM,sBAAsB,CAAC;AAE9B,0CAA0C;AAC1C,OAAO,EACL,aAAa,EACb,cAAc,EACd,iBAAiB,GAMlB,MAAM,iBAAiB,CAAC;AAEzB,iBAAiB;AACjB,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAExD,eAAe,QAAQ,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC;AAEjC,uCAAuC;AACvC,cAAc,iBAAiB,CAAC;AAEhC,2CAA2C;AAC3C,OAAO,EAEL,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,iBAAiB,GAMlB,MAAM,sBAAsB,CAAC;AAE9B,0CAA0C;AAC1C,OAAO,EACL,aAAa,EACb,cAAc,EACd,iBAAiB,GAMlB,MAAM,iBAAiB,CAAC;AAEzB,iBAAiB;AACjB,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"mock-engine.d.ts","sourceRoot":"","sources":["../../src/mock/mock-engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,C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,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,YAAY,CAA+B;IACnD,OAAO,CAAC,IAAI,CAAsB;gBAEtB,OAAO,GAAE,iBAAsB;IAYpC,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAI5B,KAAK,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,IAAI;IAKxC,OAAO,IAAI,YAAY,EAAE;IAIzB,SAAS,IAAI,IAAI;IAIX,QAAQ,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;IA6DtE,OAAO,CAAC,SAAS;YAcH,WAAW;CAwO1B"}
@@ -212,14 +212,20 @@ export class SDKMockEngine {
212
212
  case 'storage.getItem':
213
213
  case 'getStorage':
214
214
  case 'storage.getSecureItem':
215
+ case 'storage.getSecretData':
216
+ case 'getSecretData':
215
217
  return this.storage.getItem(appId, p);
216
218
  case 'storage.setItem':
217
219
  case 'setStorage':
218
220
  case 'storage.setSecureItem':
221
+ case 'storage.setSecretData':
222
+ case 'setSecretData':
219
223
  return this.storage.setItem(appId, p);
220
224
  case 'storage.removeItem':
221
225
  case 'removeStorage':
222
226
  case 'storage.removeSecureItem':
227
+ case 'storage.removeSecretData':
228
+ case 'removeSecretData':
223
229
  return this.storage.removeItem(appId, p);
224
230
  case 'storage.clear':
225
231
  case 'clearStorage':
@@ -1 +1 @@
1
- {"version":3,"file":"mock-engine.js","sourceRoot":"","sources":["../../src/mock/mock-engine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA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AA2B,MAAM,wDAAwD,CAAC,CAAC;gBACxG,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;QACjD,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,33 @@
1
+ import { ITransport } from './transport.interface.js';
2
+ import { MockDispatcher } from './mock-transport.js';
3
+ import { BridgeEventListener, TransportConfig, TransportType } from './types.js';
4
+ export interface AdaptiveTransportOptions extends TransportConfig {
5
+ mockDispatcher?: MockDispatcher;
6
+ }
7
+ /**
8
+ * AdaptiveBridgeTransport automatically selects and routes requests to:
9
+ * 1. Native container (SuperApp Flutter WebView via window.FlutterBridge or window.SuperAppBridge)
10
+ * 2. Parent Simulator iframe (Browser Simulator via window.parent.postMessage)
11
+ * 3. Mock Bridge Transport (Local dev, test suites, or standalone browser tabs)
12
+ *
13
+ * It re-evaluates the environment dynamically so that if the native bridge
14
+ * becomes available after script evaluation, calls are seamlessly routed to native.
15
+ */
16
+ export declare class AdaptiveBridgeTransport implements ITransport {
17
+ private nativeTransport;
18
+ private postmessageTransport;
19
+ private mockTransport;
20
+ private debug;
21
+ constructor(options?: AdaptiveTransportOptions);
22
+ setMockDispatcher(dispatcher: MockDispatcher): void;
23
+ isNativeAvailable(): boolean;
24
+ isSimulatorAvailable(): boolean;
25
+ getType(): TransportType;
26
+ isConnected(): boolean;
27
+ getActiveTransport(): ITransport;
28
+ invoke<T = any>(action: string, payload?: Record<string, any>, timeoutMs?: number): Promise<T>;
29
+ on(event: string, listener: BridgeEventListener): () => void;
30
+ off(event: string, listener: BridgeEventListener): void;
31
+ emit(event: string, payload: any): void;
32
+ }
33
+ //# sourceMappingURL=adaptive-transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adaptive-transport.d.ts","sourceRoot":"","sources":["../../src/transport/adaptive-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,OAAO,EAAuB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAsB,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAErG,MAAM,WAAW,wBAAyB,SAAQ,eAAe;IAC/D,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED;;;;;;;;GAQG;AACH,qBAAa,uBAAwB,YAAW,UAAU;IACxD,OAAO,CAAC,eAAe,CAAwB;IAC/C,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,aAAa,CAAsB;IAC3C,OAAO,CAAC,KAAK,CAAU;gBAEX,OAAO,GAAE,wBAA6B;IAO3C,iBAAiB,CAAC,UAAU,EAAE,cAAc,GAAG,IAAI;IAInD,iBAAiB,IAAI,OAAO;IAM5B,oBAAoB,IAAI,OAAO;IAK/B,OAAO,IAAI,aAAa;IAMxB,WAAW,IAAI,OAAO;IAItB,kBAAkB,IAAI,UAAU;IAU1B,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAiBxG,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,GAAG,MAAM,IAAI;IAW5D,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,GAAG,IAAI;IAMvD,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,IAAI;CAG/C"}
@@ -0,0 +1,92 @@
1
+ import { NativeBridgeTransport } from './native-transport.js';
2
+ import { PostMessageTransport } from './postmessage-transport.js';
3
+ import { MockBridgeTransport } from './mock-transport.js';
4
+ /**
5
+ * AdaptiveBridgeTransport automatically selects and routes requests to:
6
+ * 1. Native container (SuperApp Flutter WebView via window.FlutterBridge or window.SuperAppBridge)
7
+ * 2. Parent Simulator iframe (Browser Simulator via window.parent.postMessage)
8
+ * 3. Mock Bridge Transport (Local dev, test suites, or standalone browser tabs)
9
+ *
10
+ * It re-evaluates the environment dynamically so that if the native bridge
11
+ * becomes available after script evaluation, calls are seamlessly routed to native.
12
+ */
13
+ export class AdaptiveBridgeTransport {
14
+ nativeTransport;
15
+ postmessageTransport;
16
+ mockTransport;
17
+ debug;
18
+ constructor(options = {}) {
19
+ this.debug = options.debug ?? false;
20
+ this.nativeTransport = new NativeBridgeTransport(options);
21
+ this.postmessageTransport = new PostMessageTransport(options);
22
+ this.mockTransport = new MockBridgeTransport({ ...options, dispatcher: options.mockDispatcher });
23
+ }
24
+ setMockDispatcher(dispatcher) {
25
+ this.mockTransport.setDispatcher(dispatcher);
26
+ }
27
+ isNativeAvailable() {
28
+ if (typeof window === 'undefined')
29
+ return false;
30
+ const win = window;
31
+ return !!(win.FlutterBridge?.postMessage || win.SuperAppBridge?.postMessage);
32
+ }
33
+ isSimulatorAvailable() {
34
+ if (typeof window === 'undefined')
35
+ return false;
36
+ return !!(window.parent && window.parent !== window);
37
+ }
38
+ getType() {
39
+ if (this.isNativeAvailable())
40
+ return 'native';
41
+ if (this.isSimulatorAvailable())
42
+ return 'postmessage';
43
+ return 'mock';
44
+ }
45
+ isConnected() {
46
+ return this.isNativeAvailable() || this.isSimulatorAvailable() || this.mockTransport.isConnected();
47
+ }
48
+ getActiveTransport() {
49
+ if (this.isNativeAvailable()) {
50
+ return this.nativeTransport;
51
+ }
52
+ if (this.isSimulatorAvailable()) {
53
+ return this.postmessageTransport;
54
+ }
55
+ return this.mockTransport;
56
+ }
57
+ async invoke(action, payload = {}, timeoutMs) {
58
+ // If not immediately available, perform a brief micro-poll (up to 100ms)
59
+ // to give Flutter WebView's addJavaScriptChannel time to attach
60
+ if (!this.isNativeAvailable() && !this.isSimulatorAvailable() && typeof window !== 'undefined') {
61
+ for (let i = 0; i < 4; i++) {
62
+ if (this.isNativeAvailable())
63
+ break;
64
+ await new Promise((r) => setTimeout(r, 25));
65
+ }
66
+ }
67
+ const active = this.getActiveTransport();
68
+ if (this.debug) {
69
+ console.info(`[AdaptiveBridgeTransport] Routing action "${action}" to transport: [${active.getType()}]`);
70
+ }
71
+ return active.invoke(action, payload, timeoutMs);
72
+ }
73
+ on(event, listener) {
74
+ const unsubNative = this.nativeTransport.on(event, listener);
75
+ const unsubPost = this.postmessageTransport.on(event, listener);
76
+ const unsubMock = this.mockTransport.on(event, listener);
77
+ return () => {
78
+ unsubNative();
79
+ unsubPost();
80
+ unsubMock();
81
+ };
82
+ }
83
+ off(event, listener) {
84
+ this.nativeTransport.off(event, listener);
85
+ this.postmessageTransport.off(event, listener);
86
+ this.mockTransport.off(event, listener);
87
+ }
88
+ emit(event, payload) {
89
+ this.getActiveTransport().emit(event, payload);
90
+ }
91
+ }
92
+ //# sourceMappingURL=adaptive-transport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adaptive-transport.js","sourceRoot":"","sources":["../../src/transport/adaptive-transport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAkB,MAAM,qBAAqB,CAAC;AAO1E;;;;;;;;GAQG;AACH,MAAM,OAAO,uBAAuB;IAC1B,eAAe,CAAwB;IACvC,oBAAoB,CAAuB;IAC3C,aAAa,CAAsB;IACnC,KAAK,CAAU;IAEvB,YAAY,UAAoC,EAAE;QAChD,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC;QACpC,IAAI,CAAC,eAAe,GAAG,IAAI,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAC1D,IAAI,CAAC,oBAAoB,GAAG,IAAI,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAC9D,IAAI,CAAC,aAAa,GAAG,IAAI,mBAAmB,CAAC,EAAE,GAAG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Ae,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC1C,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC/C,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAEM,IAAI,CAAC,KAAa,EAAE,OAAY;QACrC,IAAI,CAAC,kBAAkB,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;CACF"}
@@ -3,5 +3,6 @@ export * from './transport.interface.js';
3
3
  export * from './native-transport.js';
4
4
  export * from './postmessage-transport.js';
5
5
  export * from './mock-transport.js';
6
+ export * from './adaptive-transport.js';
6
7
  export * from './resolver.js';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transport/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transport/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC"}
@@ -3,5 +3,6 @@ export * from './transport.interface.js';
3
3
  export * from './native-transport.js';
4
4
  export * from './postmessage-transport.js';
5
5
  export * from './mock-transport.js';
6
+ export * from './adaptive-transport.js';
6
7
  export * from './resolver.js';
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transport/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/transport/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"native-transport.d.ts","sourceRoot":"","sources":["../../src/transport/native-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAe,mBAAmB,EAAqD,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAIjJ,qBAAa,qBAAsB,YAAW,UAAU;IACtD,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,KAAK,CAAU;IACvB,OAAO,CAAC,SAAS,CAAmG;IACpH,OAAO,CAAC,SAAS,CAAoD;gBAEzD,MAAM,GAAE,eAAoB;IAOjC,OAAO,IAAI,aAAa;IAIxB,WAAW,IAAI,OAAO;IAM7B,OAAO,CAAC,sBAAsB;IA6B9B,OAAO,CAAC,oBAAoB;IAiBrB,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAuDlG,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,GAAG,MAAM,IAAI;IAQ5D,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,GAAG,IAAI;IAUvD,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,IAAI;CAe/C"}
1
+ {"version":3,"file":"native-transport.d.ts","sourceRoot":"","sources":["../../src/transport/native-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAe,mBAAmB,EAAqD,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAIjJ,qBAAa,qBAAsB,YAAW,UAAU;IACtD,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,KAAK,CAAU;IACvB,OAAO,CAAC,SAAS,CAAmG;IACpH,OAAO,CAAC,SAAS,CAAoD;gBAEzD,MAAM,GAAE,eAAoB;IAOjC,OAAO,IAAI,aAAa;IAIxB,WAAW,IAAI,OAAO;IAM7B,OAAO,CAAC,sBAAsB;IA6D9B,OAAO,CAAC,oBAAoB;IAyBrB,MAAM,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IA6ElG,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,GAAG,MAAM,IAAI;IAQ5D,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,GAAG,IAAI;IAUvD,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,IAAI;CAe/C"}
@@ -18,7 +18,7 @@ export class NativeBridgeTransport {
18
18
  if (typeof window === 'undefined')
19
19
  return false;
20
20
  const win = window;
21
- return !!win.FlutterBridge?.postMessage;
21
+ return !!(win.FlutterBridge?.postMessage || win.SuperAppBridge?.postMessage);
22
22
  }
23
23
  initNativeGlobalBridge() {
24
24
  if (typeof window === 'undefined')
@@ -47,8 +47,42 @@ export class NativeBridgeTransport {
47
47
  },
48
48
  };
49
49
  }
50
+ else {
51
+ // win.SuperAppBridge already exists (e.g. from Flutter's bridgePolyfillScript)
52
+ win.SuperAppBridge._callbacks = win.SuperAppBridge._callbacks || {};
53
+ win.SuperAppBridge._listeners = win.SuperAppBridge._listeners || {};
54
+ const prevDispatch = win.SuperAppBridge.dispatchResponse;
55
+ win.SuperAppBridge.dispatchResponse = (res) => {
56
+ this.handleNativeResponse(res);
57
+ if (typeof prevDispatch === 'function' && prevDispatch !== win.SuperAppBridge.dispatchResponse) {
58
+ try {
59
+ prevDispatch.call(win.SuperAppBridge, res);
60
+ }
61
+ catch (_) { }
62
+ }
63
+ };
64
+ const prevDispatchEvent = win.SuperAppBridge.dispatchEvent;
65
+ win.SuperAppBridge.dispatchEvent = (evt) => {
66
+ this.emit(evt.event, evt.payload);
67
+ if (typeof prevDispatchEvent === 'function' && prevDispatchEvent !== win.SuperAppBridge.dispatchEvent) {
68
+ try {
69
+ prevDispatchEvent.call(win.SuperAppBridge, evt);
70
+ }
71
+ catch (_) { }
72
+ }
73
+ };
74
+ if (!win.SuperAppBridge.postMessage) {
75
+ win.SuperAppBridge.postMessage = (msg) => {
76
+ if (win.FlutterBridge?.postMessage) {
77
+ win.FlutterBridge.postMessage(typeof msg === 'string' ? msg : JSON.stringify(msg));
78
+ }
79
+ };
80
+ }
81
+ }
50
82
  }
51
83
  handleNativeResponse(res) {
84
+ if (!res || !res.id)
85
+ return;
52
86
  if (this.debug) {
53
87
  console.log(`[NativeBridgeTransport] Response received:`, res);
54
88
  }
@@ -57,6 +91,12 @@ export class NativeBridgeTransport {
57
91
  return;
58
92
  clearTimeout(pending.timer);
59
93
  this.callbacks.delete(res.id);
94
+ if (typeof window !== 'undefined') {
95
+ const win = window;
96
+ if (win.SuperAppBridge?._callbacks) {
97
+ delete win.SuperAppBridge._callbacks[res.id];
98
+ }
99
+ }
60
100
  if (res.success) {
61
101
  pending.resolve(res.data);
62
102
  }
@@ -76,8 +116,15 @@ export class NativeBridgeTransport {
76
116
  timestamp: Date.now(),
77
117
  };
78
118
  return new Promise((resolve, reject) => {
119
+ this.initNativeGlobalBridge();
79
120
  const timer = setTimeout(() => {
80
121
  this.callbacks.delete(id);
122
+ if (typeof window !== 'undefined') {
123
+ const win = window;
124
+ if (win.SuperAppBridge?._callbacks) {
125
+ delete win.SuperAppBridge._callbacks[id];
126
+ }
127
+ }
81
128
  const timeoutError = {
82
129
  code: 'TIMEOUT',
83
130
  message: `Bridge call "${action}" timed out after ${timeout}ms`,
@@ -93,15 +140,28 @@ export class NativeBridgeTransport {
93
140
  }
94
141
  if (typeof window !== 'undefined') {
95
142
  const win = window;
143
+ // Register callback in window.SuperAppBridge._callbacks for seamless polyfill response delivery
144
+ if (win.SuperAppBridge) {
145
+ win.SuperAppBridge._callbacks = win.SuperAppBridge._callbacks || {};
146
+ win.SuperAppBridge._callbacks[id] = (res) => {
147
+ this.handleNativeResponse(res);
148
+ };
149
+ }
96
150
  if (win.FlutterBridge?.postMessage) {
97
151
  win.FlutterBridge.postMessage(JSON.stringify(request));
98
152
  }
153
+ else if (win.SuperAppBridge?.postMessage) {
154
+ win.SuperAppBridge.postMessage(request);
155
+ }
99
156
  else {
100
157
  clearTimeout(timer);
101
158
  this.callbacks.delete(id);
159
+ if (win.SuperAppBridge?._callbacks) {
160
+ delete win.SuperAppBridge._callbacks[id];
161
+ }
102
162
  reject({
103
163
  code: 'NATIVE_NOT_AVAILABLE',
104
- message: 'FlutterBridge is not installed on window object',
164
+ message: 'FlutterBridge or SuperAppBridge is not installed on window object',
105
165
  });
106
166
  }
107
167
  }
@@ -1 +1 @@
1
- {"version":3,"file":"native-transport.js","sourceRoot":"","sources":["../../src/transport/native-transport.ts"],"names":[],"mappings":"AAGA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YACR,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACrB,IAAI,GAAG,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;gBACnB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;IAEM,IAAI,CAAC,KAAa,EAAE,OAAY;QACrC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,2CAA2C,KAAK,IAAI,EAAE,OAAO,CAAC,CAAC;QAC7E,CAAC;QACD,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,GAAG,EAAE,CAAC;YACR,GAAG,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACvB,IAAI,CAAC;oBACH,QAAQ,CAAC,OAAO,CAAC,CAAC;gBACpB,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,OAAO,CAAC,KAAK,CAAC,wDAAwD,KAAK,IAAI,EAAE,GAAG,CAAC,CAAC;gBACxF,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"native-transport.js","sourceRoot":"","sources":["../../src/transport/native-transport.ts"],"names":[],"mappings":"AAGA,IAAI,eAAe,GAAG,CAAC,CAAC;AAExB,MAAM,OAAO,qBAAqB;IACxB,KAAK,CAAS;IACd,gBAAgB,CAAS;IACzB,KAAK,CAAU;IACf,SAAS,GAAyF,IAAI,GAAG,EAAE,CAAC;IAC5G,SAAS,GAA0C,IAAI,GAAG,EAAE,CAAC;IAErE,YAAY,SAA0B,EAAE;QACtC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,kBAAkB,CAAC;QAChD,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,SAAS,IAAI,KAAK,CAAC;QAClD,IAAI,CAAC,KAAK,GA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AI,GAAG,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;gBACnB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;IAEM,IAAI,CAAC,KAAa,EAAE,OAAY;QACrC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,2CAA2C,KAAK,IAAI,EAAE,OAAO,CAAC,CAAC;QAC7E,CAAC;QACD,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACtC,IAAI,GAAG,EAAE,CAAC;YACR,GAAG,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACvB,IAAI,CAAC;oBACH,QAAQ,CAAC,OAAO,CAAC,CAAC;gBACpB,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,OAAO,CAAC,KAAK,CAAC,wDAAwD,KAAK,IAAI,EAAE,GAAG,CAAC,CAAC;gBACxF,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/transport/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,OAAO,EAAuB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAsB,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhF,MAAM,WAAW,wBAAyB,SAAQ,eAAe;IAC/D,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,qBAAa,iBAAiB;WACd,OAAO,CAAC,OAAO,GAAE,wBAA6B,GAAG,UAAU;CAuC1E"}
1
+ {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/transport/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAGtD,OAAO,EAAuB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1E,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE5D,MAAM,WAAW,wBAAyB,SAAQ,eAAe;IAC/D,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,qBAAa,iBAAiB;WACd,OAAO,CAAC,OAAO,GAAE,wBAA6B,GAAG,UAAU;CAe1E"}
@@ -1,6 +1,7 @@
1
1
  import { NativeBridgeTransport } from './native-transport.js';
2
2
  import { PostMessageTransport } from './postmessage-transport.js';
3
3
  import { MockBridgeTransport } from './mock-transport.js';
4
+ import { AdaptiveBridgeTransport } from './adaptive-transport.js';
4
5
  export class TransportResolver {
5
6
  static resolve(options = {}) {
6
7
  // 1. Explicit override if requested
@@ -13,29 +14,8 @@ export class TransportResolver {
13
14
  if (options.forceTransport === 'mock') {
14
15
  return new MockBridgeTransport({ ...options, dispatcher: options.mockDispatcher });
15
16
  }
16
- // 2. Automatic runtime environment detection
17
- if (typeof window !== 'undefined') {
18
- const win = window;
19
- // Real SuperApp Flutter WebView environment
20
- if (win.FlutterBridge?.postMessage) {
21
- if (options.debug) {
22
- console.info('[TransportResolver] Detected Native Flutter Bridge container.');
23
- }
24
- return new NativeBridgeTransport(options);
25
- }
26
- // Inside Simulator Iframe (parent is different window)
27
- if (window.parent && window.parent !== window) {
28
- if (options.debug) {
29
- console.info('[TransportResolver] Detected Browser Simulator parent iframe container.');
30
- }
31
- return new PostMessageTransport(options);
32
- }
33
- }
34
- // 3. Fallback: Mock Bridge Transport (for standalone browser tabs, local dev, or testing)
35
- if (options.debug) {
36
- console.info('[TransportResolver] Falling back to Mock Bridge Transport.');
37
- }
38
- return new MockBridgeTransport({ ...options, dispatcher: options.mockDispatcher });
17
+ // 2. Default: Dynamic Adaptive Bridge Transport that automatically detects and routes calls
18
+ return new AdaptiveBridgeTransport(options);
39
19
  }
40
20
  }
41
21
  //# sourceMappingURL=resolver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../src/transport/resolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAkB,MAAM,qBAAqB,CAAC;AAQ1E,MAAM,OAAO,iBAAiB;IACrB,MAAM,CAAC,OAAO,CAAC,UAAoC,EAAE;QAC1D,oCAAoC;QACpC,IAAI,OAAO,CAAC,cAAc,KAAK,QAAQ,EAAE,CAAC;YACxC,OAAO,IAAI,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC;QACD,IAAI,OAAO,CAAC,cAAc,KAAK,aAAa,EAAE,CAAC;YAC7C,OAAO,IAAI,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAC3C,CAAC;QACD,IAAI,OAAO,CAAC,cAAc,KAAK,MAAM,EAAE,CAAC;YACtC,OAAO,IAAI,mBAAmB,CAAC,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;QACrF,CAAC;QAED,6CAA6C;QAC7C,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,MAAM,GAAG,GAAG,MAAuC,CAAC;YAEpD,4CAA4C;YAC5C,IAAI,GAAG,CAAC,aAAa,EAAE,WAAW,EAAE,CAAC;gBACnC,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;oBAClB,OAAO,CAAC,IAAI,CAAC,+DAA+D,CAAC,CAAC;gBAChF,CAAC;gBACD,OAAO,IAAI,qBAAqB,CAAC,OAAO,CAAC,CAAC;YAC5C,CAAC;YAED,uDAAuD;YACvD,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,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ACrF,CAAC;QAED,4FAA4F;QAC5F,OAAO,IAAI,uBAAuB,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;CACF"}
@@ -1,4 +1,4 @@
1
- export type TransportType = 'native' | 'postmessage' | 'mock';
1
+ export type TransportType = 'native' | 'postmessage' | 'mock' | 'adaptive';
2
2
  export interface BridgeRequest<T = Record<string, any>> {
3
3
  id: string;
4
4
  action: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/transport/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,aAAa,GAAG,MAAM,CAAC;AAE9D,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACpD,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,CAAC,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,GAAG,CAAC;CACf;AAED,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,GAAG;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,CAAC;AAEhE,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,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mB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;KAC5E,CAAC;CACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vqh2602/mini-app-sdk",
3
- "version": "1.0.2",
3
+ "version": "1.0.5",
4
4
  "description": "Official Unified TypeScript SDK & CLI for SuperApp Mini Apps: Core API, Bridge Transport, Mock Engine, and Browser Simulator",
5
5
  "type": "module",
6
6
  "bin": {
@@ -41,7 +41,13 @@
41
41
  "build:sim": "vite build simulator",
42
42
  "build:ts": "tsc",
43
43
  "build": "npm run build:sim && npm run build:ts && chmod +x ./bin/*.js",
44
- "prepublishOnly": "npm run build",
44
+ "bump": "node ../scripts/bump-version.cjs patch",
45
+ "bump:minor": "node ../scripts/bump-version.cjs minor",
46
+ "bump:major": "node ../scripts/bump-version.cjs major",
47
+ "release": "node ../scripts/bump-version.cjs patch && npm publish --access public",
48
+ "release:minor": "node ../scripts/bump-version.cjs minor && npm publish --access public",
49
+ "release:major": "node ../scripts/bump-version.cjs major && npm publish --access public",
50
+ "prepublishOnly": "node ../scripts/bump-version.cjs check-publish && npm run build",
45
51
  "simulator": "node ./bin/simulator.js",
46
52
  "clean": "rm -rf dist simulator-dist"
47
53
  },
@@ -196,4 +196,4 @@ Error generating stack: `+o.message+`
196
196
 
197
197
  ${t.message}`),{confirmed:!0}}async showConfirm(t){let n=!0;return typeof window<"u"&&typeof window.confirm=="function"&&(n=window.confirm(`${t.title}
198
198
 
199
- ${t.message}`)),{confirmed:n}}async setNavigationBarTitle(t){return typeof document<"u"&&(document.title=t.title),{success:!0,title:t.title}}async setStatusBarColor(t){return{success:!0,color:t.color}}async setNavigationBarColor(t){return{success:!0,color:t.color,textColor:t.textColor||"black",statusBarColor:t.statusBarColor}}async configAppView(t={}){return{success:!0,actionBarHidden:!!t.actionBarHidden,statusBar:t.statusBar||"transparent",hideAndroidBottomNavigationBar:!!t.hideAndroidBottomNavigationBar,hasPadding:t.hasPadding!==!1,...t}}async requestSendNotification(t={}){return{success:!0,granted:!0,subscriptionId:`mock_sub_${Date.now()}`,token:`mock_notif_token_${Date.now()}`,templateId:t.templateId,reason:t.reason}}}class kp{async scanQRCode(t={}){return{content:"https://superapp.vn/pay?order=mock_qr_12345",format:"QR_CODE"}}async chooseImage(t={}){const n=t.count||1,r=["https://images.unsplash.com/photo-1546069901-ba9599a7e63c?w=500","https://images.unsplash.com/photo-1565299624946-b28f40a0ae38?w=500"];return{tempFilePaths:r.slice(0,n),count:Math.min(n,r.length)}}}class wp{constructor(t){J(this,"approvalHook");this.store=t}setApprovalHook(t){this.approvalHook=t}async requestPayment(t){const n=Number(t.amount)||0,r=t.orderId||`ORD_${Date.now()}_${Math.floor(1e3+Math.random()*9e3)}`,l={orderId:r,amount:n,description:t.description||"Thanh toán dịch vụ Mini App",extraData:{currency:t.currency||"VND"}};if(this.approvalHook&&!await this.approvalHook(l))throw{code:"USER_CANCELLED",message:"Người dùng đã huỷ giao dịch thanh toán"};const o=this.store.getUser();if(o.walletBalance<n)throw{code:"INSUFFICIENT_FUNDS",message:`Số dư ví SuperApp Pay (${o.walletBalance.toLocaleString("vi-VN")} đ) không đủ để thanh toán ${n.toLocaleString("vi-VN")} đ`};this.store.deductBalance(n);const s={status:"SUCCESS",transactionId:`TXN_${Date.now()}_${Math.random().toString(36).substring(2,8).toUpperCase()}`,orderId:r,amount:n,timestamp:Date.now(),paymentMethod:"SUPERAPP_WALLET",message:"Thanh toán thành công qua Ví SuperApp"};return this.store.addTransaction(s),s}async createOrder(t){return{orderId:`ORD_${Date.now()}_${Math.floor(1e3+Math.random()*9e3)}`,amount:Number(t.amount)||0,currency:t.currency||"VND",status:"PENDING"}}}class Sp{constructor(t={}){J(this,"store");J(this,"auth");J(this,"device");J(this,"storage");J(this,"ui");J(this,"media");J(this,"payment");J(this,"latencyMs");J(this,"logListeners",new Set);J(this,"logs",[]);this.store=new gp(t.storageKeyPrefix),this.latencyMs=t.simulatedLatencyMs??40,this.auth=new mp(this.store),this.device=new yp(this.store),this.storage=new vp(this.store),this.ui=new xp,this.media=new kp,this.payment=new wp(this.store)}setLatency(t){this.latencyMs=t}onLog(t){return this.logListeners.add(t),()=>this.logListeners.delete(t)}getLogs(){return[...this.logs]}clearLogs(){this.logs=[]}async dispatch(t){const n=Date.now();this.latencyMs>0&&await new Promise(r=>setTimeout(r,this.latencyMs));try{const r=await this.routeAction(t),l=Date.now()-n,o={id:t.id,action:t.action,success:!0,data:r,timestamp:Date.now()};return this.recordLog({id:t.id,action:t.action,payload:t.payload,response:r,durationMs:l,timestamp:n,success:!0}),o}catch(r){const l=Date.now()-n,o={code:(r==null?void 0:r.code)||"ACTION_FAILED",message:(r==null?void 0:r.message)||"Operation failed in mock engine",details:r==null?void 0:r.details},i={id:t.id,action:t.action,success:!1,error:o,timestamp:Date.now()};return this.recordLog({id:t.id,action:t.action,payload:t.payload,error:o,durationMs:l,timestamp:n,success:!1}),i}}recordLog(t){this.logs.unshift(t),this.logs.length>200&&this.logs.pop(),this.logListeners.forEach(n=>{try{n(t)}catch(r){console.error("[SDKMockEngine] Error in log listener:",r)}})}async routeAction(t){var i;const{action:n,payload:r,appId:l}=t,o=r||{};switch(n){case"auth.login":case"login":return this.auth.login(o);case"auth.requestCode":return this.auth.requestCode(o);case"auth.exchangeCode":return this.auth.exchangeCode(o);case"auth.getAccessToken":case"getAccessToken":return this.auth.getAccessToken();case"auth.getUserProfile":case"getUserProfile":case"user.getProfile":return this.auth.getUserProfile();case"user.getBasicInfo":return this.auth.getBasicInfo();case"auth.refreshToken":return this.auth.refreshToken(o);case"auth.logout":return this.auth.logout();case"payment.requestPayment":case"payment.openCheckout":case"requestPayment":return this.payment.requestPayment(o);case"payment.createOrder":return this.payment.createOrder(o);case"device.getBatteryInfo":case"getBatteryInfo":return this.device.getBatteryInfo();case"device.getNetworkInfo":case"getNetworkInfo":return this.device.getNetworkInfo();case"device.getDeviceInfo":case"getDeviceInfo":return this.device.getDeviceInfo();case"device.getSystemInfo":case"getSystemInfo":return this.device.getSystemInfo();case"getAppInfo":return{appId:l||"mini_app",version:"1.0.0",platformVersion:"2.0.0",appName:"SuperApp Mini App"};case"device.getLocation":case"getLocation":return{latitude:21.028511,longitude:105.854167,accuracy:10,altitude:12,speed:0,address:"Hà Nội, Việt Nam"};case"getDeviceLanguage":return{language:this.store.getDeviceState().language||"vi-VN"};case"getSuperAppSettings":return{theme:"dark",notificationsEnabled:!0,language:"vi-VN",appVersion:"1.0.0"};case"device.vibrate":case"vibrate":return this.device.vibrate(o);case"device.keepScreen":case"keepScreen":return this.device.keepScreen(o);case"copyToClipboard":return{success:!0,text:o.text};case"setBrightness":return{success:!0,brightness:o.brightness};case"getContacts":return{contacts:[{id:"c_01",name:"Nguyễn Văn An",phone:"0988123456",email:"an.nguyen@example.com"},{id:"c_02",name:"Trần Thị Mai",phone:"0912345678",email:"mai.tran@example.com"}]};case"permission.request":case"permission.check":case"permission.getPermissions":return{granted:!0,capability:o.capability,permissions:{camera:"granted",location:"granted",notification:"granted",photos:"granted"}};case"storage.getItem":case"getStorage":case"storage.getSecureItem":return this.storage.getItem(l,o);case"storage.setItem":case"setStorage":case"storage.setSecureItem":return this.storage.setItem(l,o);case"storage.removeItem":case"removeStorage":case"storage.removeSecureItem":return this.storage.removeItem(l,o);case"storage.clear":case"clearStorage":return this.storage.clear(l);case"storage.getAll":return this.storage.getAll(l);case"storage.getCredentials":return{username:this.store.getUser().email,token:(i=this.store.getSession())==null?void 0:i.accessToken,role:this.store.getUser().role};case"storage.setCredentials":case"storage.deleteCredentials":return{success:!0};case"ui.showToast":case"showToast":return this.ui.showToast(o);case"ui.showAlert":case"showAlert":return this.ui.showAlert(o);case"ui.showConfirm":case"showConfirm":return this.ui.showConfirm(o);case"ui.setNavigationBarTitle":case"setTitle":case"setNavigationBarTitle":return this.ui.setNavigationBarTitle(o);case"ui.setStatusBarColor":case"setStatusBarColor":return this.ui.setStatusBarColor(o);case"ui.setNavigationBarColor":case"setNavigationBarColor":return this.ui.setNavigationBarColor(o);case"ui.configAppView":case"configAppView":return this.ui.configAppView(o);case"ui.requestSendNotification":case"requestSendNotification":return this.ui.requestSendNotification(o);case"showMiniappMenu":case"ui.showMiniappMenu":return{success:!0,message:"Menu triggered"};case"media.scanQRCode":case"scanQr":case"device.scanQRCode":return this.media.scanQRCode(o);case"media.chooseImage":case"getPhoto":case"device.pickImage":case"pickImages":return this.media.chooseImage(o);case"saveImageToGallery":case"saveVideoToGallery":case"pickVideo":case"saveFile":case"pickFile":case"filePreview":return{success:!0,uri:o.uri||"mock_file_uri_"+Date.now(),name:o.fileName||"demo_file.png"};case"navigation.closeApp":case"closeApp":case"navigation.close":return{success:!0,message:"App closed"};case"navigation.minimizeApp":case"minimizeApp":return{success:!0,status:"minimized",appId:l};case"navigation.openMiniApp":return{success:!0,targetAppId:o.appId};case"navigation.openNativePage":return{success:!0,page:o.page,params:o.params};case"openPhone":case"openSMS":case"openExternalBrowser":case"openDeepLink":return{success:!0};case"speechToText":return{success:!0,text:"Nội dung nhận diện giọng nói thử nghiệm",lang:o.lang||"vi-VN"};case"hideKeyboard":return{success:!0};case"debug.echo":return o;case"debug.simulateFailure":throw{code:o.type||"SIMULATED_FAILURE",message:"Mô phỏng lỗi debug từ Simulator"};default:return console.warn(`[SDKMockEngine] Action "${n}" not specifically handled. Returning generic success.`),{success:!0,action:n,payload:o}}}}const gc=M.createContext(null),Cp=({children:e})=>{const[t]=M.useState(()=>new Sp({autoApprovePayment:!0})),[n,r]=M.useState(()=>typeof window<"u"&&new URLSearchParams(window.location.search).get("url")||"http://localhost:3000"),[l,o]=M.useState("iphone"),[i,s]=M.useState(1),[u,d]=M.useState([]),[g,m]=M.useState("bridge"),[h,k]=M.useState(!1),[w,S]=M.useState(1),[A,f]=M.useState(null),[c,p]=M.useState(()=>t.store.getUser()),[v,C]=M.useState(()=>t.store.getNetworkCondition()),[j,_]=M.useState(()=>t.store.getDeviceState()),z=M.useRef(null);M.useEffect(()=>{const F=t.onLog(y=>{d(P=>[y,...P.slice(0,150)])});return()=>{F()}},[t]),M.useEffect(()=>{h?t.payment.setApprovalHook(F=>new Promise(y=>{z.current=y,f({order:F,resolve:y})})):t.payment.setApprovalHook(void 0)},[t,h]),M.useEffect(()=>{const F=async y=>{const P=y.data;if(!P)return;if(P.type==="MINIAPP_CLOSE"||P.type==="MINIAPP_MINIMIZE"){t.onLog(Me=>d(nt=>[Me,...nt.slice(0,150)]));return}let I=null;if(P.type==="SUPERAPP_BRIDGE_REQUEST"&&P.request?I=P.request:P.id&&P.action&&(I=P),!I||!I.id||!I.action)return;const O=await t.dispatch(I);p(t.store.getUser()),_(t.store.getDeviceState());const Y={type:"SUPERAPP_BRIDGE_RESPONSE",response:O};y.source&&"postMessage"in y.source&&y.source.postMessage(Y,"*"),document.querySelectorAll("iframe").forEach(Me=>{var nt;(nt=Me.contentWindow)==null||nt.postMessage(Y,"*")})};return window.addEventListener("message",F),()=>window.removeEventListener("message",F)},[t]);const W=F=>{z.current&&(z.current(F),z.current=null),f(null)},N=F=>{const y=t.store.setUser(F);p(y),Te("session.changed",{user:y,status:"LOGGED_IN"}),Te("auth.userChanged",{user:y}),Te("auth.sessionChanged",{state:"logged_in",user:y,userId:y.id})},ve=F=>{const y=t.store.setUserPreset(F);p(y),Te("session.changed",{user:y,status:"LOGGED_IN"}),Te("auth.userChanged",{user:y}),Te("auth.sessionChanged",{state:"logged_in",user:y,userId:y.id})},Ct=F=>{t.store.setNetworkCondition(F);const y=t.store.getNetworkCondition();C(y),Te("miniapp.networkChanged",{isConnected:y.online,networkType:y.type})},Et=F=>{t.store.updateDeviceState(F);const y=t.store.getDeviceState();_(y),Te("miniapp.batteryChanged",{batteryLevel:y.batteryLevel,isCharging:y.isCharging})},sr=()=>{S(F=>F+1)},Te=(F,y)=>{document.querySelectorAll("iframe").forEach(I=>{var O;(O=I.contentWindow)==null||O.postMessage({type:"SUPERAPP_BRIDGE_EVENT",event:F,payload:y},"*")})},mn=()=>{t.clearLogs(),d([])};return a.jsx(gc.Provider,{value:{mockEngine:t,miniAppUrl:n,setMiniAppUrl:r,deviceType:l,setDeviceType:o,scale:i,setScale:s,logs:u,clearLogs:mn,activeTab:g,setActiveTab:m,user:c,setUser:N,setUserPreset:ve,network:v,setNetwork:Ct,deviceState:j,setDeviceState:Et,manualPaymentMode:h,setManualPaymentMode:k,pendingPayment:A,resolvePayment:W,reloadIframe:sr,iframeKey:w,sendEventToMiniApp:Te},children:e})},Qe=()=>{const e=M.useContext(gc);if(!e)throw new Error("useSimulator must be used inside SimulatorProvider");return e},Ep=()=>{const{deviceType:e,network:t,deviceState:n}=Qe(),[r,l]=M.useState("09:41");return M.useEffect(()=>{const o=()=>{const s=new Date;l(`${String(s.getHours()).padStart(2,"0")}:${String(s.getMinutes()).padStart(2,"0")}`)};o();const i=setInterval(o,1e4);return()=>clearInterval(i)},[]),a.jsxs("div",{style:{height:44,padding:"0 20px",display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"#ffffff",color:"#000000",fontSize:13,fontWeight:600,userSelect:"none",position:"relative",borderTopLeftRadius:e==="iphone"?44:28,borderTopRightRadius:e==="iphone"?44:28},children:[a.jsx("span",{children:r}),e==="iphone"?a.jsx("div",{style:{position:"absolute",top:10,left:"50%",transform:"translateX(-50%)",width:110,height:28,backgroundColor:"#000000",borderRadius:18,zIndex:10}}):a.jsx("div",{style:{position:"absolute",top:12,left:"50%",transform:"translateX(-50%)",width:14,height:14,backgroundColor:"#000000",borderRadius:"50%",zIndex:10}}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[t.online?a.jsx("span",{style:{fontSize:11,fontWeight:700},children:t.type.toUpperCase()}):a.jsx("span",{style:{fontSize:11,color:"#ef4444"},children:"OFFLINE"}),t.online?a.jsx(pc,{size:14}):a.jsx(pp,{size:14,color:"#ef4444"}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[a.jsxs("span",{style:{fontSize:11},children:[n.batteryLevel,"%"]}),n.isCharging?a.jsx(ac,{size:16,color:"#10b981"}):a.jsx(qf,{size:16})]})]})]})},_p=({title:e="Mini App"})=>{const{reloadIframe:t,sendEventToMiniApp:n}=Qe();return a.jsxs("div",{style:{height:48,padding:"0 12px",backgroundColor:"#ffffff",borderBottom:"1px solid #e2e8f0",display:"flex",alignItems:"center",justifyContent:"space-between",color:"#0f172a"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("button",{onClick:()=>n("onNavigateBack",{}),title:"Back",style:{background:"none",border:"none",cursor:"pointer",padding:4,display:"flex",alignItems:"center"},children:a.jsx(Jf,{size:18,color:"#0f172a"})}),a.jsx("span",{style:{fontSize:15,fontWeight:600,maxWidth:160,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",backgroundColor:"#f1f5f9",border:"1px solid #cbd5e1",borderRadius:20,padding:"2px 6px",gap:6},children:[a.jsx("button",{onClick:t,title:"Tải lại Mini App",style:{background:"none",border:"none",cursor:"pointer",padding:2,display:"flex",alignItems:"center"},children:a.jsx(ap,{size:13,color:"#475569"})}),a.jsx("div",{style:{width:1,height:12,backgroundColor:"#cbd5e1"}}),a.jsx("button",{title:"Menu",style:{background:"none",border:"none",cursor:"pointer",padding:2,display:"flex",alignItems:"center"},children:a.jsx(rp,{size:14,color:"#475569"})}),a.jsx("div",{style:{width:1,height:12,backgroundColor:"#cbd5e1"}}),a.jsx("button",{onClick:()=>alert("Đóng Mini App - Trở về màn hình chính SuperApp"),title:"Đóng Mini App",style:{background:"none",border:"none",cursor:"pointer",padding:2,display:"flex",alignItems:"center"},children:a.jsx(hc,{size:14,color:"#475569"})})]})]})},jp=()=>{const{pendingPayment:e,resolvePayment:t,user:n}=Qe();if(!e)return null;const{order:r}=e,l=n.walletBalance>=r.amount;return a.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.6)",display:"flex",flexDirection:"column",justifyContent:"flex-end",zIndex:100,animation:"fadeIn 0.2s ease"},children:a.jsxs("div",{style:{backgroundColor:"#ffffff",borderTopLeftRadius:24,borderTopRightRadius:24,padding:20,color:"#0f172a",boxShadow:"0 -4px 20px rgba(0, 0, 0, 0.15)"},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(fc,{size:20,color:"#0068FF"}),a.jsx("span",{style:{fontWeight:700,fontSize:16},children:"SuperApp Pay"})]}),a.jsx("button",{onClick:()=>t(!1),style:{background:"none",border:"none",cursor:"pointer",padding:4},children:a.jsx(hc,{size:18,color:"#64748b"})})]}),a.jsxs("div",{style:{textAlign:"center",margin:"12px 0 20px"},children:[a.jsx("div",{style:{fontSize:13,color:"#64748b"},children:"Tổng tiền thanh toán"}),a.jsxs("div",{style:{fontSize:28,fontWeight:800,color:"#0068FF"},children:[r.amount.toLocaleString("vi-VN")," đ"]}),a.jsx("div",{style:{fontSize:13,fontWeight:500,color:"#334155",marginTop:4},children:r.description||"Thanh toán dịch vụ Mini App"})]}),a.jsx("div",{style:{backgroundColor:"#f8fafc",borderRadius:12,padding:12,marginBottom:20,border:"1px solid #e2e8f0"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("div",{style:{width:36,height:36,borderRadius:8,backgroundColor:"#dbeafe",display:"flex",alignItems:"center",justifyContent:"center"},children:a.jsx(fp,{size:20,color:"#0068FF"})}),a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:600,fontSize:14},children:"Ví điện tử SuperApp"}),a.jsxs("div",{style:{fontSize:12,color:l?"#10b981":"#ef4444"},children:["Số dư: ",n.walletBalance.toLocaleString("vi-VN")," đ",!l&&" (Không đủ số dư)"]})]})]}),a.jsx(cc,{size:18,color:"#0068FF"})]})}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[a.jsx("button",{onClick:()=>t(!0),disabled:!l,style:{padding:"14px",backgroundColor:l?"#0068FF":"#94a3b8",color:"white",border:"none",borderRadius:12,fontWeight:700,fontSize:15,cursor:l?"pointer":"not-allowed"},children:"Xác nhận thanh toán"}),a.jsx("button",{onClick:()=>t(!1),style:{padding:"12px",backgroundColor:"transparent",color:"#64748b",border:"none",borderRadius:12,fontWeight:600,fontSize:14,cursor:"pointer"},children:"Huỷ giao dịch"})]})]})})},zp=()=>{const{deviceType:e,scale:t,miniAppUrl:n,iframeKey:r,sendEventToMiniApp:l,user:o}=Qe(),i=e==="iphone"?390:412,s=e==="iphone"?844:880;return a.jsx("div",{style:{transform:`scale(${t})`,transformOrigin:"top center",transition:"transform 0.2s ease"},children:a.jsx("div",{style:{width:i,height:s,backgroundColor:"#000000",borderRadius:e==="iphone"?52:36,padding:10,boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.15)",position:"relative",display:"flex",flexDirection:"column"},children:a.jsxs("div",{style:{flex:1,backgroundColor:"#ffffff",borderRadius:e==="iphone"?44:28,overflow:"hidden",display:"flex",flexDirection:"column",position:"relative"},children:[a.jsx(Ep,{}),a.jsx(_p,{title:"SuperApp Mini App"}),a.jsxs("div",{style:{flex:1,position:"relative",overflow:"hidden"},children:[a.jsx("iframe",{src:n,title:"Mini App Simulator View",style:{width:"100%",height:"100%",border:"none",backgroundColor:"#f8fafc"},allow:"geolocation; camera; microphone",onLoad:()=>{setTimeout(()=>{l("miniapp.ready",{appId:"mini_app",timestamp:Date.now()}),l("session.changed",{user:o,status:"LOGGED_IN"})},150)}},r),a.jsx(jp,{})]}),e==="iphone"&&a.jsx("div",{style:{height:20,backgroundColor:"#ffffff",display:"flex",alignItems:"center",justifyContent:"center"},children:a.jsx("div",{style:{width:130,height:4,backgroundColor:"#0f172a",borderRadius:2}})})]})})})},Pp=()=>{const{logs:e,clearLogs:t}=Qe(),[n,r]=M.useState(null),[l,o]=M.useState(""),i=e.filter(s=>s.action.toLowerCase().includes(l.toLowerCase()));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",gap:12},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8},children:[a.jsx("input",{type:"text",placeholder:"Lọc bridge action (vd: auth, payment)...",value:l,onChange:s=>o(s.target.value),style:{flex:1,padding:"6px 12px",borderRadius:6,border:"1px solid #334155",backgroundColor:"#0f172a",color:"#f8fafc",fontSize:13}}),a.jsxs("button",{onClick:t,title:"Xoá nhật ký",style:{padding:"6px 10px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:6,color:"#94a3b8",cursor:"pointer",display:"flex",alignItems:"center",gap:4,fontSize:12},children:[a.jsx(Qo,{size:14})," Xoá"]})]}),a.jsx("div",{style:{flex:1,overflowY:"auto",display:"flex",flexDirection:"column",gap:6},children:i.length===0?a.jsx("div",{style:{textAlign:"center",color:"#64748b",padding:"40px 10px",fontSize:13},children:"Chưa có cuộc gọi Bridge nào từ Mini App. Hãy thực hiện thao tác trong Mini App để theo dõi."}):i.map(s=>{const u=(n==null?void 0:n.id)===s.id;return a.jsxs("div",{onClick:()=>r(u?null:s),style:{padding:10,borderRadius:8,backgroundColor:u?"#1e293b":"#0f172a",border:`1px solid ${u?"#38bdf8":"#1e293b"}`,cursor:"pointer",fontSize:12,display:"flex",flexDirection:"column",gap:6},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[s.success?a.jsx(cc,{size:14,color:"#10b981"}):a.jsx(tp,{size:14,color:"#ef4444"}),a.jsx("span",{style:{fontWeight:600,color:"#f1f5f9"},children:s.action})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#94a3b8"},children:[a.jsxs("span",{style:{display:"flex",alignItems:"center",gap:2,fontSize:11},children:[a.jsx(np,{size:11})," ",s.durationMs,"ms"]}),u?a.jsx(bf,{size:14}):a.jsx(ep,{size:14})]})]}),u&&a.jsxs("div",{style:{marginTop:6,paddingTop:8,borderTop:"1px solid #334155",display:"flex",flexDirection:"column",gap:8},children:[a.jsxs("div",{children:[a.jsx("div",{style:{color:"#94a3b8",fontSize:11,marginBottom:2},children:"Payload gửi đi:"}),a.jsx("pre",{style:{margin:0,padding:8,backgroundColor:"#020617",borderRadius:6,fontSize:11,color:"#e2e8f0",overflowX:"auto"},children:JSON.stringify(s.payload,null,2)})]}),a.jsxs("div",{children:[a.jsx("div",{style:{color:"#94a3b8",fontSize:11,marginBottom:2},children:"Kết quả phản hồi:"}),a.jsx("pre",{style:{margin:0,padding:8,backgroundColor:"#020617",borderRadius:6,fontSize:11,color:s.success?"#34d399":"#f87171",overflowX:"auto"},children:JSON.stringify(s.success?s.response:s.error,null,2)})]})]})]},s.id)})})]})},Ip=()=>{const{user:e,setUser:t,setUserPreset:n,mockEngine:r,sendEventToMiniApp:l}=Qe(),o=r.store.getSession();return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,fontSize:13,color:"#f1f5f9"},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:600,marginBottom:8,color:"#94a3b8"},children:"Chọn tài khoản mẫu (Persona):"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[a.jsx("button",{onClick:()=>n("standard"),style:{padding:8,backgroundColor:e.id==="user_std_001"?"#0284c7":"#1e293b",border:"1px solid #334155",borderRadius:6,color:"#ffffff",cursor:"pointer",fontWeight:500,fontSize:12},children:"👤 Khách hàng chuẩn"}),a.jsx("button",{onClick:()=>n("vip"),style:{padding:8,backgroundColor:e.id==="user_vip_888"?"#7c3aed":"#1e293b",border:"1px solid #334155",borderRadius:6,color:"#ffffff",cursor:"pointer",fontWeight:500,fontSize:12},children:"💎 VIP Diamond (50tr)"}),a.jsx("button",{onClick:()=>n("lowBalance"),style:{padding:8,backgroundColor:e.id==="user_low_002"?"#d97706":"#1e293b",border:"1px solid #334155",borderRadius:6,color:"#ffffff",cursor:"pointer",fontWeight:500,fontSize:12},children:"⚠️ Số dư thấp (15k)"}),a.jsx("button",{onClick:()=>n("unverified"),style:{padding:8,backgroundColor:e.id==="user_guest_999"?"#dc2626":"#1e293b",border:"1px solid #334155",borderRadius:6,color:"#ffffff",cursor:"pointer",fontWeight:500,fontSize:12},children:"❓ Khách vãng lai"})]})]}),a.jsxs("div",{style:{backgroundColor:"#0f172a",borderRadius:8,padding:12,border:"1px solid #1e293b",display:"flex",flexDirection:"column",gap:10},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("img",{src:e.avatarUrl,alt:"Avatar",style:{width:44,height:44,borderRadius:"50%",objectFit:"cover"}}),a.jsxs("div",{style:{flex:1},children:[a.jsx("div",{style:{fontWeight:700,fontSize:14},children:e.name}),a.jsx("div",{style:{color:"#94a3b8",fontSize:12},children:e.phone||"Chưa cung cấp SĐT"})]}),e.isVerified&&a.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4,backgroundColor:"#064e3b",color:"#34d399",padding:"2px 8px",borderRadius:12,fontSize:11,fontWeight:600},children:[a.jsx(fc,{size:12})," Đã xác thực"]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8,fontSize:12,marginTop:4},children:[a.jsxs("div",{children:[a.jsx("span",{style:{color:"#94a3b8"},children:"Vai trò:"})," ",a.jsx("span",{style:{fontWeight:600,color:"#38bdf8"},children:e.role})]}),a.jsxs("div",{children:[a.jsx("span",{style:{color:"#94a3b8"},children:"Số dư ví:"})," ",a.jsxs("span",{style:{fontWeight:600,color:"#10b981"},children:[e.walletBalance.toLocaleString("vi-VN")," đ"]})]})]})]}),a.jsxs("div",{style:{backgroundColor:"#0f172a",borderRadius:8,padding:12,border:"1px solid #1e293b",display:"flex",flexDirection:"column",gap:8},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontWeight:600,color:"#38bdf8"},children:[a.jsx(lp,{size:16})," Phiên Access Token"]}),o?a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:11,color:"#94a3b8",marginBottom:2},children:"Mã Token:"}),a.jsx("div",{style:{fontFamily:"monospace",fontSize:11,backgroundColor:"#020617",padding:6,borderRadius:4,color:"#facc15",wordBreak:"break-all"},children:o.accessToken}),a.jsxs("div",{style:{fontSize:11,color:"#94a3b8",marginTop:4},children:["Hết hạn sau: ",o.expiresIn,"s (",o.tokenType,")"]})]}):a.jsx("div",{style:{color:"#ef4444",fontSize:12},children:"Phiên đã hết hạn hoặc chưa đăng nhập"}),a.jsxs("div",{style:{display:"flex",gap:8,marginTop:4},children:[a.jsx("button",{onClick:()=>{r.store.createSession(),l("onAuthStatusChange",{loggedIn:!0})},style:{flex:1,padding:"6px 10px",backgroundColor:"#0369a1",color:"white",border:"none",borderRadius:6,cursor:"pointer",fontWeight:600,fontSize:12},children:"Làm mới Token"}),a.jsxs("button",{onClick:()=>{r.store.clearSession(),l("onAuthStatusChange",{loggedIn:!1})},style:{padding:"6px 10px",backgroundColor:"#334155",color:"#f87171",border:"none",borderRadius:6,cursor:"pointer",display:"flex",alignItems:"center",gap:4,fontSize:12},children:[a.jsx(op,{size:13})," Đăng xuất"]})]})]})]})},Np=()=>{const{deviceState:e,setDeviceState:t,network:n,setNetwork:r,mockEngine:l,sendEventToMiniApp:o}=Qe();return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,fontSize:13,color:"#f1f5f9"},children:[a.jsxs("div",{style:{backgroundColor:"#0f172a",borderRadius:8,padding:12,border:"1px solid #1e293b",display:"flex",flexDirection:"column",gap:10},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("div",{style:{fontWeight:600,display:"flex",alignItems:"center",gap:6},children:[a.jsx(ac,{size:16,color:"#38bdf8"})," Giả lập Pin thiết bị"]}),a.jsxs("span",{style:{fontWeight:700,color:"#38bdf8"},children:[e.batteryLevel,"%"]})]}),a.jsx("input",{type:"range",min:"0",max:"100",value:e.batteryLevel,onChange:i=>t({batteryLevel:parseInt(i.target.value,10)}),style:{width:"100%",accentColor:"#0284c7"}}),a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsx("span",{style:{color:"#94a3b8",fontSize:12},children:"Đang cắm sạc (Charging):"}),a.jsx("input",{type:"checkbox",checked:e.isCharging,onChange:i=>t({isCharging:i.target.checked}),style:{width:16,height:16,accentColor:"#0284c7"}})]})]}),a.jsxs("div",{style:{backgroundColor:"#0f172a",borderRadius:8,padding:12,border:"1px solid #1e293b",display:"flex",flexDirection:"column",gap:10},children:[a.jsxs("div",{style:{fontWeight:600,display:"flex",alignItems:"center",gap:6},children:[a.jsx(pc,{size:16,color:"#38bdf8"})," Mạng kết nối (Network Profile)"]}),a.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(5, 1fr)",gap:6},children:["wifi","5g","4g","2g","none"].map(i=>a.jsx("button",{onClick:()=>r({type:i,online:i!=="none"}),style:{padding:"6px 4px",backgroundColor:n.type===i?"#0284c7":"#1e293b",border:"1px solid #334155",borderRadius:6,color:"white",fontSize:11,fontWeight:600,cursor:"pointer",textTransform:"uppercase"},children:i},i))})]}),a.jsxs("div",{style:{backgroundColor:"#0f172a",borderRadius:8,padding:12,border:"1px solid #1e293b",display:"flex",flexDirection:"column",gap:10},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("div",{style:{fontWeight:600,display:"flex",alignItems:"center",gap:6},children:[a.jsx(sp,{size:16,color:"#38bdf8"})," Độ trễ Bridge (Latency Injection)"]}),a.jsxs("span",{style:{fontWeight:700,color:"#38bdf8"},children:[n.latencyMs," ms"]})]}),a.jsx("input",{type:"range",min:"0",max:"1500",step:"50",value:n.latencyMs,onChange:i=>{const s=parseInt(i.target.value,10);r({latencyMs:s}),l.setLatency(s)},style:{width:"100%",accentColor:"#0284c7"}})]}),a.jsxs("div",{style:{backgroundColor:"#0f172a",borderRadius:8,padding:12,border:"1px solid #1e293b",display:"flex",flexDirection:"column",gap:8},children:[a.jsx("div",{style:{fontWeight:600,color:"#94a3b8"},children:"Giả lập sự kiện vòng đời (Lifecycle Events):"}),a.jsxs("div",{style:{display:"flex",gap:8},children:[a.jsxs("button",{onClick:()=>o("appShow",{timestamp:Date.now()}),style:{flex:1,padding:"8px 10px",backgroundColor:"#065f46",color:"#34d399",border:"1px solid #047857",borderRadius:6,fontWeight:600,fontSize:12,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:4},children:[a.jsx(Gs,{size:14})," appShow"]}),a.jsxs("button",{onClick:()=>o("appHide",{timestamp:Date.now()}),style:{flex:1,padding:"8px 10px",backgroundColor:"#374151",color:"#d1d5db",border:"1px solid #4b5563",borderRadius:6,fontWeight:600,fontSize:12,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:4},children:[a.jsx(Gs,{size:14})," appHide"]})]})]})]})},Tp=()=>{const{mockEngine:e}=Qe(),[t,n]=M.useState(""),[r,l]=M.useState(""),[o,i]=M.useState(0),s=e.store.getStorage("mini_app_simulator"),u=Array.from(s.entries()),d=()=>{t.trim()&&(e.store.setStorageItem("mini_app_simulator",t.trim(),r),n(""),l(""),i(h=>h+1))},g=h=>{e.store.removeStorageItem("mini_app_simulator",h),i(k=>k+1)},m=()=>{e.store.clearStorage("mini_app_simulator"),i(h=>h+1)};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,fontSize:13,color:"#f1f5f9"},children:[a.jsxs("div",{style:{backgroundColor:"#0f172a",borderRadius:8,padding:12,border:"1px solid #1e293b",display:"flex",flexDirection:"column",gap:8},children:[a.jsxs("div",{style:{fontWeight:600,color:"#38bdf8",display:"flex",alignItems:"center",gap:6},children:[a.jsx(dc,{size:16})," Thêm Key vào bộ nhớ Mini App"]}),a.jsxs("div",{style:{display:"flex",gap:6},children:[a.jsx("input",{type:"text",placeholder:"Key (vd: cart_id)",value:t,onChange:h=>n(h.target.value),style:{flex:1,padding:"6px 10px",backgroundColor:"#020617",border:"1px solid #334155",borderRadius:6,color:"white",fontSize:12}}),a.jsx("input",{type:"text",placeholder:"Value",value:r,onChange:h=>l(h.target.value),style:{flex:2,padding:"6px 10px",backgroundColor:"#020617",border:"1px solid #334155",borderRadius:6,color:"white",fontSize:12}}),a.jsxs("button",{onClick:d,style:{padding:"6px 12px",backgroundColor:"#0284c7",color:"white",border:"none",borderRadius:6,cursor:"pointer",display:"flex",alignItems:"center",gap:4,fontSize:12,fontWeight:600},children:[a.jsx(ip,{size:14})," Thêm"]})]})]}),a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("div",{style:{fontWeight:600,color:"#94a3b8"},children:["Dữ liệu đã lưu (",u.length,"):"]}),u.length>0&&a.jsxs("button",{onClick:m,style:{background:"none",border:"none",color:"#ef4444",cursor:"pointer",fontSize:12,display:"flex",alignItems:"center",gap:4},children:[a.jsx(Qo,{size:13})," Xoá toàn bộ"]})]}),a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6,maxHeight:300,overflowY:"auto"},children:u.length===0?a.jsx("div",{style:{textAlign:"center",color:"#64748b",padding:"30px 0",fontSize:12},children:"Kho lưu trữ đang trống. Mini App có thể lưu qua `superApp.storage.setItem()`."}):u.map(([h,k])=>a.jsxs("div",{style:{backgroundColor:"#0f172a",border:"1px solid #1e293b",borderRadius:6,padding:"8px 10px",display:"flex",justifyContent:"space-between",alignItems:"center",gap:8},children:[a.jsxs("div",{style:{flex:1,overflow:"hidden"},children:[a.jsx("span",{style:{fontWeight:700,color:"#38bdf8",fontSize:12},children:h}),a.jsx("div",{style:{color:"#e2e8f0",fontSize:12,fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:k})]}),a.jsx("button",{onClick:()=>g(h),style:{background:"none",border:"none",cursor:"pointer",padding:4,color:"#94a3b8"},children:a.jsx(Qo,{size:14})})]},h))})]},o)},Mp=()=>{const{activeTab:e,setActiveTab:t,logs:n,user:r}=Qe(),l=[{id:"bridge",label:"Bridge Inspector",icon:Zf,count:n.length},{id:"auth",label:"Auth & Persona",icon:dp,note:r.name.split(" ")[0]},{id:"device",label:"Device & Hardware",icon:cp},{id:"storage",label:"Storage",icon:dc}];return a.jsxs("div",{style:{flex:1,backgroundColor:"#0b1120",borderRadius:16,border:"1px solid #1e293b",display:"flex",flexDirection:"column",overflow:"hidden",minWidth:420,maxWidth:600,height:"100%",boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.4)"},children:[a.jsx("div",{style:{display:"flex",backgroundColor:"#0f172a",borderBottom:"1px solid #1e293b",overflowX:"auto",padding:"4px 6px",gap:4},children:l.map(o=>{const i=e===o.id,s=o.icon;return a.jsxs("button",{onClick:()=>t(o.id),style:{display:"flex",alignItems:"center",gap:6,padding:"8px 12px",borderRadius:8,backgroundColor:i?"#1e293b":"transparent",color:i?"#38bdf8":"#94a3b8",border:"none",cursor:"pointer",fontWeight:i?600:500,fontSize:12,whiteSpace:"nowrap",transition:"all 0.15s ease"},children:[a.jsx(s,{size:15}),a.jsx("span",{children:o.label}),"count"in o&&o.count>0&&a.jsx("span",{style:{backgroundColor:i?"#0284c7":"#334155",color:"white",fontSize:10,fontWeight:700,padding:"1px 6px",borderRadius:10},children:o.count})]},o.id)})}),a.jsxs("div",{style:{flex:1,padding:16,overflowY:"auto"},children:[e==="bridge"&&a.jsx(Pp,{}),e==="auth"&&a.jsx(Ip,{}),e==="device"&&a.jsx(Np,{}),e==="storage"&&a.jsx(Tp,{})]})]})},Lp=()=>{const{miniAppUrl:e,setMiniAppUrl:t,reloadIframe:n,deviceType:r,setDeviceType:l,scale:o,setScale:i}=Qe(),[s,u]=M.useState(e),d=g=>{g.preventDefault(),s.trim()&&(t(s.trim()),n())};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100vh",width:"100vw",overflow:"hidden",backgroundColor:"#030712"},children:[a.jsxs("header",{style:{height:56,backgroundColor:"#0f172a",borderBottom:"1px solid #1e293b",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 20px",gap:16,zIndex:20},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("div",{style:{width:32,height:32,borderRadius:8,backgroundColor:"#0068FF",display:"flex",alignItems:"center",justifyContent:"center",color:"white",fontWeight:800,fontSize:16},children:"S"}),a.jsxs("div",{children:[a.jsxs("div",{style:{fontWeight:700,fontSize:14,color:"#f8fafc",display:"flex",alignItems:"center",gap:6},children:["SuperApp Browser Simulator",a.jsx("span",{style:{fontSize:10,backgroundColor:"#0284c7",color:"white",padding:"1px 6px",borderRadius:10},children:"v1.0"})]}),a.jsx("div",{style:{fontSize:11,color:"#64748b"},children:"Mini App Developer Workbench"})]})]}),a.jsxs("form",{onSubmit:d,style:{display:"flex",alignItems:"center",flex:1,maxWidth:520,gap:6},children:[a.jsx("input",{type:"text",value:s,onChange:g=>u(g.target.value),placeholder:"http://localhost:3000",style:{flex:1,padding:"7px 12px",backgroundColor:"#020617",border:"1px solid #334155",borderRadius:8,color:"#38bdf8",fontSize:13,fontFamily:"monospace"}}),a.jsxs("button",{type:"submit",style:{padding:"7px 14px",backgroundColor:"#0284c7",color:"white",border:"none",borderRadius:8,fontSize:12,fontWeight:600,cursor:"pointer",display:"flex",alignItems:"center",gap:4},children:[a.jsx(up,{size:13})," Nạp URL"]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsxs("div",{style:{display:"flex",backgroundColor:"#020617",padding:2,borderRadius:8,border:"1px solid #334155"},children:[a.jsx("button",{onClick:()=>l("iphone"),style:{padding:"4px 10px",borderRadius:6,backgroundColor:r==="iphone"?"#1e293b":"transparent",color:r==="iphone"?"#38bdf8":"#94a3b8",border:"none",cursor:"pointer",fontSize:12,fontWeight:600},children:"iPhone 15"}),a.jsx("button",{onClick:()=>l("android"),style:{padding:"4px 10px",borderRadius:6,backgroundColor:r==="android"?"#1e293b":"transparent",color:r==="android"?"#38bdf8":"#94a3b8",border:"none",cursor:"pointer",fontSize:12,fontWeight:600},children:"Android"})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,color:"#94a3b8",fontSize:12},children:[a.jsx(hp,{size:14}),a.jsxs("select",{value:o,onChange:g=>i(parseFloat(g.target.value)),style:{backgroundColor:"#020617",color:"#f8fafc",border:"1px solid #334155",borderRadius:6,padding:"4px 8px",fontSize:12,cursor:"pointer"},children:[a.jsx("option",{value:"0.75",children:"75%"}),a.jsx("option",{value:"0.85",children:"85%"}),a.jsx("option",{value:"0.9",children:"90%"}),a.jsx("option",{value:"1",children:"100%"})]})]})]})]}),a.jsxs("main",{style:{flex:1,display:"flex",gap:24,padding:20,overflow:"hidden",justifyContent:"center",alignItems:"flex-start"},children:[a.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"flex-start",overflowY:"auto",maxHeight:"calc(100vh - 96px)",padding:"10px 20px"},children:a.jsx(zp,{})}),a.jsx(Mp,{})]})]})};Jl.createRoot(document.getElementById("root")).render(a.jsx(Rc.StrictMode,{children:a.jsx(Cp,{children:a.jsx(Lp,{})})}));
199
+ ${t.message}`)),{confirmed:n}}async setNavigationBarTitle(t){return typeof document<"u"&&(document.title=t.title),{success:!0,title:t.title}}async setStatusBarColor(t){return{success:!0,color:t.color}}async setNavigationBarColor(t){return{success:!0,color:t.color,textColor:t.textColor||"black",statusBarColor:t.statusBarColor}}async configAppView(t={}){return{success:!0,actionBarHidden:!!t.actionBarHidden,statusBar:t.statusBar||"transparent",hideAndroidBottomNavigationBar:!!t.hideAndroidBottomNavigationBar,hasPadding:t.hasPadding!==!1,...t}}async requestSendNotification(t={}){return{success:!0,granted:!0,subscriptionId:`mock_sub_${Date.now()}`,token:`mock_notif_token_${Date.now()}`,templateId:t.templateId,reason:t.reason}}}class kp{async scanQRCode(t={}){return{content:"https://superapp.vn/pay?order=mock_qr_12345",format:"QR_CODE"}}async chooseImage(t={}){const n=t.count||1,r=["https://images.unsplash.com/photo-1546069901-ba9599a7e63c?w=500","https://images.unsplash.com/photo-1565299624946-b28f40a0ae38?w=500"];return{tempFilePaths:r.slice(0,n),count:Math.min(n,r.length)}}}class wp{constructor(t){J(this,"approvalHook");this.store=t}setApprovalHook(t){this.approvalHook=t}async requestPayment(t){const n=Number(t.amount)||0,r=t.orderId||`ORD_${Date.now()}_${Math.floor(1e3+Math.random()*9e3)}`,l={orderId:r,amount:n,description:t.description||"Thanh toán dịch vụ Mini App",extraData:{currency:t.currency||"VND"}};if(this.approvalHook&&!await this.approvalHook(l))throw{code:"USER_CANCELLED",message:"Người dùng đã huỷ giao dịch thanh toán"};const o=this.store.getUser();if(o.walletBalance<n)throw{code:"INSUFFICIENT_FUNDS",message:`Số dư ví SuperApp Pay (${o.walletBalance.toLocaleString("vi-VN")} đ) không đủ để thanh toán ${n.toLocaleString("vi-VN")} đ`};this.store.deductBalance(n);const s={status:"SUCCESS",transactionId:`TXN_${Date.now()}_${Math.random().toString(36).substring(2,8).toUpperCase()}`,orderId:r,amount:n,timestamp:Date.now(),paymentMethod:"SUPERAPP_WALLET",message:"Thanh toán thành công qua Ví SuperApp"};return this.store.addTransaction(s),s}async createOrder(t){return{orderId:`ORD_${Date.now()}_${Math.floor(1e3+Math.random()*9e3)}`,amount:Number(t.amount)||0,currency:t.currency||"VND",status:"PENDING"}}}class Sp{constructor(t={}){J(this,"store");J(this,"auth");J(this,"device");J(this,"storage");J(this,"ui");J(this,"media");J(this,"payment");J(this,"latencyMs");J(this,"logListeners",new Set);J(this,"logs",[]);this.store=new gp(t.storageKeyPrefix),this.latencyMs=t.simulatedLatencyMs??40,this.auth=new mp(this.store),this.device=new yp(this.store),this.storage=new vp(this.store),this.ui=new xp,this.media=new kp,this.payment=new wp(this.store)}setLatency(t){this.latencyMs=t}onLog(t){return this.logListeners.add(t),()=>this.logListeners.delete(t)}getLogs(){return[...this.logs]}clearLogs(){this.logs=[]}async dispatch(t){const n=Date.now();this.latencyMs>0&&await new Promise(r=>setTimeout(r,this.latencyMs));try{const r=await this.routeAction(t),l=Date.now()-n,o={id:t.id,action:t.action,success:!0,data:r,timestamp:Date.now()};return this.recordLog({id:t.id,action:t.action,payload:t.payload,response:r,durationMs:l,timestamp:n,success:!0}),o}catch(r){const l=Date.now()-n,o={code:(r==null?void 0:r.code)||"ACTION_FAILED",message:(r==null?void 0:r.message)||"Operation failed in mock engine",details:r==null?void 0:r.details},i={id:t.id,action:t.action,success:!1,error:o,timestamp:Date.now()};return this.recordLog({id:t.id,action:t.action,payload:t.payload,error:o,durationMs:l,timestamp:n,success:!1}),i}}recordLog(t){this.logs.unshift(t),this.logs.length>200&&this.logs.pop(),this.logListeners.forEach(n=>{try{n(t)}catch(r){console.error("[SDKMockEngine] Error in log listener:",r)}})}async routeAction(t){var i;const{action:n,payload:r,appId:l}=t,o=r||{};switch(n){case"auth.login":case"login":return this.auth.login(o);case"auth.requestCode":return this.auth.requestCode(o);case"auth.exchangeCode":return this.auth.exchangeCode(o);case"auth.getAccessToken":case"getAccessToken":return this.auth.getAccessToken();case"auth.getUserProfile":case"getUserProfile":case"user.getProfile":return this.auth.getUserProfile();case"user.getBasicInfo":return this.auth.getBasicInfo();case"auth.refreshToken":return this.auth.refreshToken(o);case"auth.logout":return this.auth.logout();case"payment.requestPayment":case"payment.openCheckout":case"requestPayment":return this.payment.requestPayment(o);case"payment.createOrder":return this.payment.createOrder(o);case"device.getBatteryInfo":case"getBatteryInfo":return this.device.getBatteryInfo();case"device.getNetworkInfo":case"getNetworkInfo":return this.device.getNetworkInfo();case"device.getDeviceInfo":case"getDeviceInfo":return this.device.getDeviceInfo();case"device.getSystemInfo":case"getSystemInfo":return this.device.getSystemInfo();case"getAppInfo":return{appId:l||"mini_app",version:"1.0.0",platformVersion:"2.0.0",appName:"SuperApp Mini App"};case"device.getLocation":case"getLocation":return{latitude:21.028511,longitude:105.854167,accuracy:10,altitude:12,speed:0,address:"Hà Nội, Việt Nam"};case"getDeviceLanguage":return{language:this.store.getDeviceState().language||"vi-VN"};case"getSuperAppSettings":return{theme:"dark",notificationsEnabled:!0,language:"vi-VN",appVersion:"1.0.0"};case"device.vibrate":case"vibrate":return this.device.vibrate(o);case"device.keepScreen":case"keepScreen":return this.device.keepScreen(o);case"copyToClipboard":return{success:!0,text:o.text};case"setBrightness":return{success:!0,brightness:o.brightness};case"getContacts":return{contacts:[{id:"c_01",name:"Nguyễn Văn An",phone:"0988123456",email:"an.nguyen@example.com"},{id:"c_02",name:"Trần Thị Mai",phone:"0912345678",email:"mai.tran@example.com"}]};case"permission.request":case"permission.check":case"permission.getPermissions":return{granted:!0,capability:o.capability,permissions:{camera:"granted",location:"granted",notification:"granted",photos:"granted"}};case"storage.getItem":case"getStorage":case"storage.getSecureItem":case"storage.getSecretData":case"getSecretData":return this.storage.getItem(l,o);case"storage.setItem":case"setStorage":case"storage.setSecureItem":case"storage.setSecretData":case"setSecretData":return this.storage.setItem(l,o);case"storage.removeItem":case"removeStorage":case"storage.removeSecureItem":case"storage.removeSecretData":case"removeSecretData":return this.storage.removeItem(l,o);case"storage.clear":case"clearStorage":return this.storage.clear(l);case"storage.getAll":return this.storage.getAll(l);case"storage.getCredentials":return{username:this.store.getUser().email,token:(i=this.store.getSession())==null?void 0:i.accessToken,role:this.store.getUser().role};case"storage.setCredentials":case"storage.deleteCredentials":return{success:!0};case"ui.showToast":case"showToast":return this.ui.showToast(o);case"ui.showAlert":case"showAlert":return this.ui.showAlert(o);case"ui.showConfirm":case"showConfirm":return this.ui.showConfirm(o);case"ui.setNavigationBarTitle":case"setTitle":case"setNavigationBarTitle":return this.ui.setNavigationBarTitle(o);case"ui.setStatusBarColor":case"setStatusBarColor":return this.ui.setStatusBarColor(o);case"ui.setNavigationBarColor":case"setNavigationBarColor":return this.ui.setNavigationBarColor(o);case"ui.configAppView":case"configAppView":return this.ui.configAppView(o);case"ui.requestSendNotification":case"requestSendNotification":return this.ui.requestSendNotification(o);case"showMiniappMenu":case"ui.showMiniappMenu":return{success:!0,message:"Menu triggered"};case"media.scanQRCode":case"scanQr":case"device.scanQRCode":return this.media.scanQRCode(o);case"media.chooseImage":case"getPhoto":case"device.pickImage":case"pickImages":return this.media.chooseImage(o);case"saveImageToGallery":case"saveVideoToGallery":case"pickVideo":case"saveFile":case"pickFile":case"filePreview":return{success:!0,uri:o.uri||"mock_file_uri_"+Date.now(),name:o.fileName||"demo_file.png"};case"navigation.closeApp":case"closeApp":case"navigation.close":return{success:!0,message:"App closed"};case"navigation.minimizeApp":case"minimizeApp":return{success:!0,status:"minimized",appId:l};case"navigation.openMiniApp":return{success:!0,targetAppId:o.appId};case"navigation.openNativePage":return{success:!0,page:o.page,params:o.params};case"openPhone":case"openSMS":case"openExternalBrowser":case"openDeepLink":return{success:!0};case"speechToText":return{success:!0,text:"Nội dung nhận diện giọng nói thử nghiệm",lang:o.lang||"vi-VN"};case"hideKeyboard":return{success:!0};case"debug.echo":return o;case"debug.simulateFailure":throw{code:o.type||"SIMULATED_FAILURE",message:"Mô phỏng lỗi debug từ Simulator"};default:return console.warn(`[SDKMockEngine] Action "${n}" not specifically handled. Returning generic success.`),{success:!0,action:n,payload:o}}}}const gc=M.createContext(null),Cp=({children:e})=>{const[t]=M.useState(()=>new Sp({autoApprovePayment:!0})),[n,r]=M.useState(()=>typeof window<"u"&&new URLSearchParams(window.location.search).get("url")||"http://localhost:3000"),[l,o]=M.useState("iphone"),[i,s]=M.useState(1),[u,d]=M.useState([]),[g,m]=M.useState("bridge"),[h,k]=M.useState(!1),[w,S]=M.useState(1),[A,f]=M.useState(null),[c,p]=M.useState(()=>t.store.getUser()),[v,C]=M.useState(()=>t.store.getNetworkCondition()),[j,_]=M.useState(()=>t.store.getDeviceState()),z=M.useRef(null);M.useEffect(()=>{const F=t.onLog(y=>{d(P=>[y,...P.slice(0,150)])});return()=>{F()}},[t]),M.useEffect(()=>{h?t.payment.setApprovalHook(F=>new Promise(y=>{z.current=y,f({order:F,resolve:y})})):t.payment.setApprovalHook(void 0)},[t,h]),M.useEffect(()=>{const F=async y=>{const P=y.data;if(!P)return;if(P.type==="MINIAPP_CLOSE"||P.type==="MINIAPP_MINIMIZE"){t.onLog(Me=>d(nt=>[Me,...nt.slice(0,150)]));return}let I=null;if(P.type==="SUPERAPP_BRIDGE_REQUEST"&&P.request?I=P.request:P.id&&P.action&&(I=P),!I||!I.id||!I.action)return;const O=await t.dispatch(I);p(t.store.getUser()),_(t.store.getDeviceState());const Y={type:"SUPERAPP_BRIDGE_RESPONSE",response:O};y.source&&"postMessage"in y.source&&y.source.postMessage(Y,"*"),document.querySelectorAll("iframe").forEach(Me=>{var nt;(nt=Me.contentWindow)==null||nt.postMessage(Y,"*")})};return window.addEventListener("message",F),()=>window.removeEventListener("message",F)},[t]);const W=F=>{z.current&&(z.current(F),z.current=null),f(null)},N=F=>{const y=t.store.setUser(F);p(y),Te("session.changed",{user:y,status:"LOGGED_IN"}),Te("auth.userChanged",{user:y}),Te("auth.sessionChanged",{state:"logged_in",user:y,userId:y.id})},ve=F=>{const y=t.store.setUserPreset(F);p(y),Te("session.changed",{user:y,status:"LOGGED_IN"}),Te("auth.userChanged",{user:y}),Te("auth.sessionChanged",{state:"logged_in",user:y,userId:y.id})},Ct=F=>{t.store.setNetworkCondition(F);const y=t.store.getNetworkCondition();C(y),Te("miniapp.networkChanged",{isConnected:y.online,networkType:y.type})},Et=F=>{t.store.updateDeviceState(F);const y=t.store.getDeviceState();_(y),Te("miniapp.batteryChanged",{batteryLevel:y.batteryLevel,isCharging:y.isCharging})},sr=()=>{S(F=>F+1)},Te=(F,y)=>{document.querySelectorAll("iframe").forEach(I=>{var O;(O=I.contentWindow)==null||O.postMessage({type:"SUPERAPP_BRIDGE_EVENT",event:F,payload:y},"*")})},mn=()=>{t.clearLogs(),d([])};return a.jsx(gc.Provider,{value:{mockEngine:t,miniAppUrl:n,setMiniAppUrl:r,deviceType:l,setDeviceType:o,scale:i,setScale:s,logs:u,clearLogs:mn,activeTab:g,setActiveTab:m,user:c,setUser:N,setUserPreset:ve,network:v,setNetwork:Ct,deviceState:j,setDeviceState:Et,manualPaymentMode:h,setManualPaymentMode:k,pendingPayment:A,resolvePayment:W,reloadIframe:sr,iframeKey:w,sendEventToMiniApp:Te},children:e})},Qe=()=>{const e=M.useContext(gc);if(!e)throw new Error("useSimulator must be used inside SimulatorProvider");return e},Ep=()=>{const{deviceType:e,network:t,deviceState:n}=Qe(),[r,l]=M.useState("09:41");return M.useEffect(()=>{const o=()=>{const s=new Date;l(`${String(s.getHours()).padStart(2,"0")}:${String(s.getMinutes()).padStart(2,"0")}`)};o();const i=setInterval(o,1e4);return()=>clearInterval(i)},[]),a.jsxs("div",{style:{height:44,padding:"0 20px",display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"#ffffff",color:"#000000",fontSize:13,fontWeight:600,userSelect:"none",position:"relative",borderTopLeftRadius:e==="iphone"?44:28,borderTopRightRadius:e==="iphone"?44:28},children:[a.jsx("span",{children:r}),e==="iphone"?a.jsx("div",{style:{position:"absolute",top:10,left:"50%",transform:"translateX(-50%)",width:110,height:28,backgroundColor:"#000000",borderRadius:18,zIndex:10}}):a.jsx("div",{style:{position:"absolute",top:12,left:"50%",transform:"translateX(-50%)",width:14,height:14,backgroundColor:"#000000",borderRadius:"50%",zIndex:10}}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[t.online?a.jsx("span",{style:{fontSize:11,fontWeight:700},children:t.type.toUpperCase()}):a.jsx("span",{style:{fontSize:11,color:"#ef4444"},children:"OFFLINE"}),t.online?a.jsx(pc,{size:14}):a.jsx(pp,{size:14,color:"#ef4444"}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:2},children:[a.jsxs("span",{style:{fontSize:11},children:[n.batteryLevel,"%"]}),n.isCharging?a.jsx(ac,{size:16,color:"#10b981"}):a.jsx(qf,{size:16})]})]})]})},_p=({title:e="Mini App"})=>{const{reloadIframe:t,sendEventToMiniApp:n}=Qe();return a.jsxs("div",{style:{height:48,padding:"0 12px",backgroundColor:"#ffffff",borderBottom:"1px solid #e2e8f0",display:"flex",alignItems:"center",justifyContent:"space-between",color:"#0f172a"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsx("button",{onClick:()=>n("onNavigateBack",{}),title:"Back",style:{background:"none",border:"none",cursor:"pointer",padding:4,display:"flex",alignItems:"center"},children:a.jsx(Jf,{size:18,color:"#0f172a"})}),a.jsx("span",{style:{fontSize:15,fontWeight:600,maxWidth:160,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:e})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",backgroundColor:"#f1f5f9",border:"1px solid #cbd5e1",borderRadius:20,padding:"2px 6px",gap:6},children:[a.jsx("button",{onClick:t,title:"Tải lại Mini App",style:{background:"none",border:"none",cursor:"pointer",padding:2,display:"flex",alignItems:"center"},children:a.jsx(ap,{size:13,color:"#475569"})}),a.jsx("div",{style:{width:1,height:12,backgroundColor:"#cbd5e1"}}),a.jsx("button",{title:"Menu",style:{background:"none",border:"none",cursor:"pointer",padding:2,display:"flex",alignItems:"center"},children:a.jsx(rp,{size:14,color:"#475569"})}),a.jsx("div",{style:{width:1,height:12,backgroundColor:"#cbd5e1"}}),a.jsx("button",{onClick:()=>alert("Đóng Mini App - Trở về màn hình chính SuperApp"),title:"Đóng Mini App",style:{background:"none",border:"none",cursor:"pointer",padding:2,display:"flex",alignItems:"center"},children:a.jsx(hc,{size:14,color:"#475569"})})]})]})},jp=()=>{const{pendingPayment:e,resolvePayment:t,user:n}=Qe();if(!e)return null;const{order:r}=e,l=n.walletBalance>=r.amount;return a.jsx("div",{style:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.6)",display:"flex",flexDirection:"column",justifyContent:"flex-end",zIndex:100,animation:"fadeIn 0.2s ease"},children:a.jsxs("div",{style:{backgroundColor:"#ffffff",borderTopLeftRadius:24,borderTopRightRadius:24,padding:20,color:"#0f172a",boxShadow:"0 -4px 20px rgba(0, 0, 0, 0.15)"},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:16},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[a.jsx(fc,{size:20,color:"#0068FF"}),a.jsx("span",{style:{fontWeight:700,fontSize:16},children:"SuperApp Pay"})]}),a.jsx("button",{onClick:()=>t(!1),style:{background:"none",border:"none",cursor:"pointer",padding:4},children:a.jsx(hc,{size:18,color:"#64748b"})})]}),a.jsxs("div",{style:{textAlign:"center",margin:"12px 0 20px"},children:[a.jsx("div",{style:{fontSize:13,color:"#64748b"},children:"Tổng tiền thanh toán"}),a.jsxs("div",{style:{fontSize:28,fontWeight:800,color:"#0068FF"},children:[r.amount.toLocaleString("vi-VN")," đ"]}),a.jsx("div",{style:{fontSize:13,fontWeight:500,color:"#334155",marginTop:4},children:r.description||"Thanh toán dịch vụ Mini App"})]}),a.jsx("div",{style:{backgroundColor:"#f8fafc",borderRadius:12,padding:12,marginBottom:20,border:"1px solid #e2e8f0"},children:a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("div",{style:{width:36,height:36,borderRadius:8,backgroundColor:"#dbeafe",display:"flex",alignItems:"center",justifyContent:"center"},children:a.jsx(fp,{size:20,color:"#0068FF"})}),a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:600,fontSize:14},children:"Ví điện tử SuperApp"}),a.jsxs("div",{style:{fontSize:12,color:l?"#10b981":"#ef4444"},children:["Số dư: ",n.walletBalance.toLocaleString("vi-VN")," đ",!l&&" (Không đủ số dư)"]})]})]}),a.jsx(cc,{size:18,color:"#0068FF"})]})}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[a.jsx("button",{onClick:()=>t(!0),disabled:!l,style:{padding:"14px",backgroundColor:l?"#0068FF":"#94a3b8",color:"white",border:"none",borderRadius:12,fontWeight:700,fontSize:15,cursor:l?"pointer":"not-allowed"},children:"Xác nhận thanh toán"}),a.jsx("button",{onClick:()=>t(!1),style:{padding:"12px",backgroundColor:"transparent",color:"#64748b",border:"none",borderRadius:12,fontWeight:600,fontSize:14,cursor:"pointer"},children:"Huỷ giao dịch"})]})]})})},zp=()=>{const{deviceType:e,scale:t,miniAppUrl:n,iframeKey:r,sendEventToMiniApp:l,user:o}=Qe(),i=e==="iphone"?390:412,s=e==="iphone"?844:880;return a.jsx("div",{style:{transform:`scale(${t})`,transformOrigin:"top center",transition:"transform 0.2s ease"},children:a.jsx("div",{style:{width:i,height:s,backgroundColor:"#000000",borderRadius:e==="iphone"?52:36,padding:10,boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.15)",position:"relative",display:"flex",flexDirection:"column"},children:a.jsxs("div",{style:{flex:1,backgroundColor:"#ffffff",borderRadius:e==="iphone"?44:28,overflow:"hidden",display:"flex",flexDirection:"column",position:"relative"},children:[a.jsx(Ep,{}),a.jsx(_p,{title:"SuperApp Mini App"}),a.jsxs("div",{style:{flex:1,position:"relative",overflow:"hidden"},children:[a.jsx("iframe",{src:n,title:"Mini App Simulator View",style:{width:"100%",height:"100%",border:"none",backgroundColor:"#f8fafc"},allow:"geolocation; camera; microphone",onLoad:()=>{setTimeout(()=>{l("miniapp.ready",{appId:"mini_app",timestamp:Date.now()}),l("session.changed",{user:o,status:"LOGGED_IN"})},150)}},r),a.jsx(jp,{})]}),e==="iphone"&&a.jsx("div",{style:{height:20,backgroundColor:"#ffffff",display:"flex",alignItems:"center",justifyContent:"center"},children:a.jsx("div",{style:{width:130,height:4,backgroundColor:"#0f172a",borderRadius:2}})})]})})})},Pp=()=>{const{logs:e,clearLogs:t}=Qe(),[n,r]=M.useState(null),[l,o]=M.useState(""),i=e.filter(s=>s.action.toLowerCase().includes(l.toLowerCase()));return a.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",gap:12},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8},children:[a.jsx("input",{type:"text",placeholder:"Lọc bridge action (vd: auth, payment)...",value:l,onChange:s=>o(s.target.value),style:{flex:1,padding:"6px 12px",borderRadius:6,border:"1px solid #334155",backgroundColor:"#0f172a",color:"#f8fafc",fontSize:13}}),a.jsxs("button",{onClick:t,title:"Xoá nhật ký",style:{padding:"6px 10px",backgroundColor:"#1e293b",border:"1px solid #334155",borderRadius:6,color:"#94a3b8",cursor:"pointer",display:"flex",alignItems:"center",gap:4,fontSize:12},children:[a.jsx(Qo,{size:14})," Xoá"]})]}),a.jsx("div",{style:{flex:1,overflowY:"auto",display:"flex",flexDirection:"column",gap:6},children:i.length===0?a.jsx("div",{style:{textAlign:"center",color:"#64748b",padding:"40px 10px",fontSize:13},children:"Chưa có cuộc gọi Bridge nào từ Mini App. Hãy thực hiện thao tác trong Mini App để theo dõi."}):i.map(s=>{const u=(n==null?void 0:n.id)===s.id;return a.jsxs("div",{onClick:()=>r(u?null:s),style:{padding:10,borderRadius:8,backgroundColor:u?"#1e293b":"#0f172a",border:`1px solid ${u?"#38bdf8":"#1e293b"}`,cursor:"pointer",fontSize:12,display:"flex",flexDirection:"column",gap:6},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[s.success?a.jsx(cc,{size:14,color:"#10b981"}):a.jsx(tp,{size:14,color:"#ef4444"}),a.jsx("span",{style:{fontWeight:600,color:"#f1f5f9"},children:s.action})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#94a3b8"},children:[a.jsxs("span",{style:{display:"flex",alignItems:"center",gap:2,fontSize:11},children:[a.jsx(np,{size:11})," ",s.durationMs,"ms"]}),u?a.jsx(bf,{size:14}):a.jsx(ep,{size:14})]})]}),u&&a.jsxs("div",{style:{marginTop:6,paddingTop:8,borderTop:"1px solid #334155",display:"flex",flexDirection:"column",gap:8},children:[a.jsxs("div",{children:[a.jsx("div",{style:{color:"#94a3b8",fontSize:11,marginBottom:2},children:"Payload gửi đi:"}),a.jsx("pre",{style:{margin:0,padding:8,backgroundColor:"#020617",borderRadius:6,fontSize:11,color:"#e2e8f0",overflowX:"auto"},children:JSON.stringify(s.payload,null,2)})]}),a.jsxs("div",{children:[a.jsx("div",{style:{color:"#94a3b8",fontSize:11,marginBottom:2},children:"Kết quả phản hồi:"}),a.jsx("pre",{style:{margin:0,padding:8,backgroundColor:"#020617",borderRadius:6,fontSize:11,color:s.success?"#34d399":"#f87171",overflowX:"auto"},children:JSON.stringify(s.success?s.response:s.error,null,2)})]})]})]},s.id)})})]})},Ip=()=>{const{user:e,setUser:t,setUserPreset:n,mockEngine:r,sendEventToMiniApp:l}=Qe(),o=r.store.getSession();return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,fontSize:13,color:"#f1f5f9"},children:[a.jsxs("div",{children:[a.jsx("div",{style:{fontWeight:600,marginBottom:8,color:"#94a3b8"},children:"Chọn tài khoản mẫu (Persona):"}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8},children:[a.jsx("button",{onClick:()=>n("standard"),style:{padding:8,backgroundColor:e.id==="user_std_001"?"#0284c7":"#1e293b",border:"1px solid #334155",borderRadius:6,color:"#ffffff",cursor:"pointer",fontWeight:500,fontSize:12},children:"👤 Khách hàng chuẩn"}),a.jsx("button",{onClick:()=>n("vip"),style:{padding:8,backgroundColor:e.id==="user_vip_888"?"#7c3aed":"#1e293b",border:"1px solid #334155",borderRadius:6,color:"#ffffff",cursor:"pointer",fontWeight:500,fontSize:12},children:"💎 VIP Diamond (50tr)"}),a.jsx("button",{onClick:()=>n("lowBalance"),style:{padding:8,backgroundColor:e.id==="user_low_002"?"#d97706":"#1e293b",border:"1px solid #334155",borderRadius:6,color:"#ffffff",cursor:"pointer",fontWeight:500,fontSize:12},children:"⚠️ Số dư thấp (15k)"}),a.jsx("button",{onClick:()=>n("unverified"),style:{padding:8,backgroundColor:e.id==="user_guest_999"?"#dc2626":"#1e293b",border:"1px solid #334155",borderRadius:6,color:"#ffffff",cursor:"pointer",fontWeight:500,fontSize:12},children:"❓ Khách vãng lai"})]})]}),a.jsxs("div",{style:{backgroundColor:"#0f172a",borderRadius:8,padding:12,border:"1px solid #1e293b",display:"flex",flexDirection:"column",gap:10},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("img",{src:e.avatarUrl,alt:"Avatar",style:{width:44,height:44,borderRadius:"50%",objectFit:"cover"}}),a.jsxs("div",{style:{flex:1},children:[a.jsx("div",{style:{fontWeight:700,fontSize:14},children:e.name}),a.jsx("div",{style:{color:"#94a3b8",fontSize:12},children:e.phone||"Chưa cung cấp SĐT"})]}),e.isVerified&&a.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4,backgroundColor:"#064e3b",color:"#34d399",padding:"2px 8px",borderRadius:12,fontSize:11,fontWeight:600},children:[a.jsx(fc,{size:12})," Đã xác thực"]})]}),a.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:8,fontSize:12,marginTop:4},children:[a.jsxs("div",{children:[a.jsx("span",{style:{color:"#94a3b8"},children:"Vai trò:"})," ",a.jsx("span",{style:{fontWeight:600,color:"#38bdf8"},children:e.role})]}),a.jsxs("div",{children:[a.jsx("span",{style:{color:"#94a3b8"},children:"Số dư ví:"})," ",a.jsxs("span",{style:{fontWeight:600,color:"#10b981"},children:[e.walletBalance.toLocaleString("vi-VN")," đ"]})]})]})]}),a.jsxs("div",{style:{backgroundColor:"#0f172a",borderRadius:8,padding:12,border:"1px solid #1e293b",display:"flex",flexDirection:"column",gap:8},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontWeight:600,color:"#38bdf8"},children:[a.jsx(lp,{size:16})," Phiên Access Token"]}),o?a.jsxs("div",{children:[a.jsx("div",{style:{fontSize:11,color:"#94a3b8",marginBottom:2},children:"Mã Token:"}),a.jsx("div",{style:{fontFamily:"monospace",fontSize:11,backgroundColor:"#020617",padding:6,borderRadius:4,color:"#facc15",wordBreak:"break-all"},children:o.accessToken}),a.jsxs("div",{style:{fontSize:11,color:"#94a3b8",marginTop:4},children:["Hết hạn sau: ",o.expiresIn,"s (",o.tokenType,")"]})]}):a.jsx("div",{style:{color:"#ef4444",fontSize:12},children:"Phiên đã hết hạn hoặc chưa đăng nhập"}),a.jsxs("div",{style:{display:"flex",gap:8,marginTop:4},children:[a.jsx("button",{onClick:()=>{r.store.createSession(),l("onAuthStatusChange",{loggedIn:!0})},style:{flex:1,padding:"6px 10px",backgroundColor:"#0369a1",color:"white",border:"none",borderRadius:6,cursor:"pointer",fontWeight:600,fontSize:12},children:"Làm mới Token"}),a.jsxs("button",{onClick:()=>{r.store.clearSession(),l("onAuthStatusChange",{loggedIn:!1})},style:{padding:"6px 10px",backgroundColor:"#334155",color:"#f87171",border:"none",borderRadius:6,cursor:"pointer",display:"flex",alignItems:"center",gap:4,fontSize:12},children:[a.jsx(op,{size:13})," Đăng xuất"]})]})]})]})},Np=()=>{const{deviceState:e,setDeviceState:t,network:n,setNetwork:r,mockEngine:l,sendEventToMiniApp:o}=Qe();return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,fontSize:13,color:"#f1f5f9"},children:[a.jsxs("div",{style:{backgroundColor:"#0f172a",borderRadius:8,padding:12,border:"1px solid #1e293b",display:"flex",flexDirection:"column",gap:10},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("div",{style:{fontWeight:600,display:"flex",alignItems:"center",gap:6},children:[a.jsx(ac,{size:16,color:"#38bdf8"})," Giả lập Pin thiết bị"]}),a.jsxs("span",{style:{fontWeight:700,color:"#38bdf8"},children:[e.batteryLevel,"%"]})]}),a.jsx("input",{type:"range",min:"0",max:"100",value:e.batteryLevel,onChange:i=>t({batteryLevel:parseInt(i.target.value,10)}),style:{width:"100%",accentColor:"#0284c7"}}),a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsx("span",{style:{color:"#94a3b8",fontSize:12},children:"Đang cắm sạc (Charging):"}),a.jsx("input",{type:"checkbox",checked:e.isCharging,onChange:i=>t({isCharging:i.target.checked}),style:{width:16,height:16,accentColor:"#0284c7"}})]})]}),a.jsxs("div",{style:{backgroundColor:"#0f172a",borderRadius:8,padding:12,border:"1px solid #1e293b",display:"flex",flexDirection:"column",gap:10},children:[a.jsxs("div",{style:{fontWeight:600,display:"flex",alignItems:"center",gap:6},children:[a.jsx(pc,{size:16,color:"#38bdf8"})," Mạng kết nối (Network Profile)"]}),a.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(5, 1fr)",gap:6},children:["wifi","5g","4g","2g","none"].map(i=>a.jsx("button",{onClick:()=>r({type:i,online:i!=="none"}),style:{padding:"6px 4px",backgroundColor:n.type===i?"#0284c7":"#1e293b",border:"1px solid #334155",borderRadius:6,color:"white",fontSize:11,fontWeight:600,cursor:"pointer",textTransform:"uppercase"},children:i},i))})]}),a.jsxs("div",{style:{backgroundColor:"#0f172a",borderRadius:8,padding:12,border:"1px solid #1e293b",display:"flex",flexDirection:"column",gap:10},children:[a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("div",{style:{fontWeight:600,display:"flex",alignItems:"center",gap:6},children:[a.jsx(sp,{size:16,color:"#38bdf8"})," Độ trễ Bridge (Latency Injection)"]}),a.jsxs("span",{style:{fontWeight:700,color:"#38bdf8"},children:[n.latencyMs," ms"]})]}),a.jsx("input",{type:"range",min:"0",max:"1500",step:"50",value:n.latencyMs,onChange:i=>{const s=parseInt(i.target.value,10);r({latencyMs:s}),l.setLatency(s)},style:{width:"100%",accentColor:"#0284c7"}})]}),a.jsxs("div",{style:{backgroundColor:"#0f172a",borderRadius:8,padding:12,border:"1px solid #1e293b",display:"flex",flexDirection:"column",gap:8},children:[a.jsx("div",{style:{fontWeight:600,color:"#94a3b8"},children:"Giả lập sự kiện vòng đời (Lifecycle Events):"}),a.jsxs("div",{style:{display:"flex",gap:8},children:[a.jsxs("button",{onClick:()=>o("appShow",{timestamp:Date.now()}),style:{flex:1,padding:"8px 10px",backgroundColor:"#065f46",color:"#34d399",border:"1px solid #047857",borderRadius:6,fontWeight:600,fontSize:12,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:4},children:[a.jsx(Gs,{size:14})," appShow"]}),a.jsxs("button",{onClick:()=>o("appHide",{timestamp:Date.now()}),style:{flex:1,padding:"8px 10px",backgroundColor:"#374151",color:"#d1d5db",border:"1px solid #4b5563",borderRadius:6,fontWeight:600,fontSize:12,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",gap:4},children:[a.jsx(Gs,{size:14})," appHide"]})]})]})]})},Tp=()=>{const{mockEngine:e}=Qe(),[t,n]=M.useState(""),[r,l]=M.useState(""),[o,i]=M.useState(0),s=e.store.getStorage("mini_app_simulator"),u=Array.from(s.entries()),d=()=>{t.trim()&&(e.store.setStorageItem("mini_app_simulator",t.trim(),r),n(""),l(""),i(h=>h+1))},g=h=>{e.store.removeStorageItem("mini_app_simulator",h),i(k=>k+1)},m=()=>{e.store.clearStorage("mini_app_simulator"),i(h=>h+1)};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16,fontSize:13,color:"#f1f5f9"},children:[a.jsxs("div",{style:{backgroundColor:"#0f172a",borderRadius:8,padding:12,border:"1px solid #1e293b",display:"flex",flexDirection:"column",gap:8},children:[a.jsxs("div",{style:{fontWeight:600,color:"#38bdf8",display:"flex",alignItems:"center",gap:6},children:[a.jsx(dc,{size:16})," Thêm Key vào bộ nhớ Mini App"]}),a.jsxs("div",{style:{display:"flex",gap:6},children:[a.jsx("input",{type:"text",placeholder:"Key (vd: cart_id)",value:t,onChange:h=>n(h.target.value),style:{flex:1,padding:"6px 10px",backgroundColor:"#020617",border:"1px solid #334155",borderRadius:6,color:"white",fontSize:12}}),a.jsx("input",{type:"text",placeholder:"Value",value:r,onChange:h=>l(h.target.value),style:{flex:2,padding:"6px 10px",backgroundColor:"#020617",border:"1px solid #334155",borderRadius:6,color:"white",fontSize:12}}),a.jsxs("button",{onClick:d,style:{padding:"6px 12px",backgroundColor:"#0284c7",color:"white",border:"none",borderRadius:6,cursor:"pointer",display:"flex",alignItems:"center",gap:4,fontSize:12,fontWeight:600},children:[a.jsx(ip,{size:14})," Thêm"]})]})]}),a.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs("div",{style:{fontWeight:600,color:"#94a3b8"},children:["Dữ liệu đã lưu (",u.length,"):"]}),u.length>0&&a.jsxs("button",{onClick:m,style:{background:"none",border:"none",color:"#ef4444",cursor:"pointer",fontSize:12,display:"flex",alignItems:"center",gap:4},children:[a.jsx(Qo,{size:13})," Xoá toàn bộ"]})]}),a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6,maxHeight:300,overflowY:"auto"},children:u.length===0?a.jsx("div",{style:{textAlign:"center",color:"#64748b",padding:"30px 0",fontSize:12},children:"Kho lưu trữ đang trống. Mini App có thể lưu qua `superApp.storage.setItem()`."}):u.map(([h,k])=>a.jsxs("div",{style:{backgroundColor:"#0f172a",border:"1px solid #1e293b",borderRadius:6,padding:"8px 10px",display:"flex",justifyContent:"space-between",alignItems:"center",gap:8},children:[a.jsxs("div",{style:{flex:1,overflow:"hidden"},children:[a.jsx("span",{style:{fontWeight:700,color:"#38bdf8",fontSize:12},children:h}),a.jsx("div",{style:{color:"#e2e8f0",fontSize:12,fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:k})]}),a.jsx("button",{onClick:()=>g(h),style:{background:"none",border:"none",cursor:"pointer",padding:4,color:"#94a3b8"},children:a.jsx(Qo,{size:14})})]},h))})]},o)},Mp=()=>{const{activeTab:e,setActiveTab:t,logs:n,user:r}=Qe(),l=[{id:"bridge",label:"Bridge Inspector",icon:Zf,count:n.length},{id:"auth",label:"Auth & Persona",icon:dp,note:r.name.split(" ")[0]},{id:"device",label:"Device & Hardware",icon:cp},{id:"storage",label:"Storage",icon:dc}];return a.jsxs("div",{style:{flex:1,backgroundColor:"#0b1120",borderRadius:16,border:"1px solid #1e293b",display:"flex",flexDirection:"column",overflow:"hidden",minWidth:420,maxWidth:600,height:"100%",boxShadow:"0 10px 25px -5px rgba(0, 0, 0, 0.4)"},children:[a.jsx("div",{style:{display:"flex",backgroundColor:"#0f172a",borderBottom:"1px solid #1e293b",overflowX:"auto",padding:"4px 6px",gap:4},children:l.map(o=>{const i=e===o.id,s=o.icon;return a.jsxs("button",{onClick:()=>t(o.id),style:{display:"flex",alignItems:"center",gap:6,padding:"8px 12px",borderRadius:8,backgroundColor:i?"#1e293b":"transparent",color:i?"#38bdf8":"#94a3b8",border:"none",cursor:"pointer",fontWeight:i?600:500,fontSize:12,whiteSpace:"nowrap",transition:"all 0.15s ease"},children:[a.jsx(s,{size:15}),a.jsx("span",{children:o.label}),"count"in o&&o.count>0&&a.jsx("span",{style:{backgroundColor:i?"#0284c7":"#334155",color:"white",fontSize:10,fontWeight:700,padding:"1px 6px",borderRadius:10},children:o.count})]},o.id)})}),a.jsxs("div",{style:{flex:1,padding:16,overflowY:"auto"},children:[e==="bridge"&&a.jsx(Pp,{}),e==="auth"&&a.jsx(Ip,{}),e==="device"&&a.jsx(Np,{}),e==="storage"&&a.jsx(Tp,{})]})]})},Lp=()=>{const{miniAppUrl:e,setMiniAppUrl:t,reloadIframe:n,deviceType:r,setDeviceType:l,scale:o,setScale:i}=Qe(),[s,u]=M.useState(e),d=g=>{g.preventDefault(),s.trim()&&(t(s.trim()),n())};return a.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100vh",width:"100vw",overflow:"hidden",backgroundColor:"#030712"},children:[a.jsxs("header",{style:{height:56,backgroundColor:"#0f172a",borderBottom:"1px solid #1e293b",display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 20px",gap:16,zIndex:20},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[a.jsx("div",{style:{width:32,height:32,borderRadius:8,backgroundColor:"#0068FF",display:"flex",alignItems:"center",justifyContent:"center",color:"white",fontWeight:800,fontSize:16},children:"S"}),a.jsxs("div",{children:[a.jsxs("div",{style:{fontWeight:700,fontSize:14,color:"#f8fafc",display:"flex",alignItems:"center",gap:6},children:["SuperApp Browser Simulator",a.jsx("span",{style:{fontSize:10,backgroundColor:"#0284c7",color:"white",padding:"1px 6px",borderRadius:10},children:"v1.0"})]}),a.jsx("div",{style:{fontSize:11,color:"#64748b"},children:"Mini App Developer Workbench"})]})]}),a.jsxs("form",{onSubmit:d,style:{display:"flex",alignItems:"center",flex:1,maxWidth:520,gap:6},children:[a.jsx("input",{type:"text",value:s,onChange:g=>u(g.target.value),placeholder:"http://localhost:3000",style:{flex:1,padding:"7px 12px",backgroundColor:"#020617",border:"1px solid #334155",borderRadius:8,color:"#38bdf8",fontSize:13,fontFamily:"monospace"}}),a.jsxs("button",{type:"submit",style:{padding:"7px 14px",backgroundColor:"#0284c7",color:"white",border:"none",borderRadius:8,fontSize:12,fontWeight:600,cursor:"pointer",display:"flex",alignItems:"center",gap:4},children:[a.jsx(up,{size:13})," Nạp URL"]})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[a.jsxs("div",{style:{display:"flex",backgroundColor:"#020617",padding:2,borderRadius:8,border:"1px solid #334155"},children:[a.jsx("button",{onClick:()=>l("iphone"),style:{padding:"4px 10px",borderRadius:6,backgroundColor:r==="iphone"?"#1e293b":"transparent",color:r==="iphone"?"#38bdf8":"#94a3b8",border:"none",cursor:"pointer",fontSize:12,fontWeight:600},children:"iPhone 15"}),a.jsx("button",{onClick:()=>l("android"),style:{padding:"4px 10px",borderRadius:6,backgroundColor:r==="android"?"#1e293b":"transparent",color:r==="android"?"#38bdf8":"#94a3b8",border:"none",cursor:"pointer",fontSize:12,fontWeight:600},children:"Android"})]}),a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,color:"#94a3b8",fontSize:12},children:[a.jsx(hp,{size:14}),a.jsxs("select",{value:o,onChange:g=>i(parseFloat(g.target.value)),style:{backgroundColor:"#020617",color:"#f8fafc",border:"1px solid #334155",borderRadius:6,padding:"4px 8px",fontSize:12,cursor:"pointer"},children:[a.jsx("option",{value:"0.75",children:"75%"}),a.jsx("option",{value:"0.85",children:"85%"}),a.jsx("option",{value:"0.9",children:"90%"}),a.jsx("option",{value:"1",children:"100%"})]})]})]})]}),a.jsxs("main",{style:{flex:1,display:"flex",gap:24,padding:20,overflow:"hidden",justifyContent:"center",alignItems:"flex-start"},children:[a.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"flex-start",overflowY:"auto",maxHeight:"calc(100vh - 96px)",padding:"10px 20px"},children:a.jsx(zp,{})}),a.jsx(Mp,{})]})]})};Jl.createRoot(document.getElementById("root")).render(a.jsx(Rc.StrictMode,{children:a.jsx(Cp,{children:a.jsx(Lp,{})})}));
@@ -7,7 +7,7 @@
7
7
  <link rel="preconnect" href="https://fonts.googleapis.com">
8
8
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
9
9
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
10
- <script type="module" crossorigin src="/assets/index-kRVYB6or.js"></script>
10
+ <script type="module" crossorigin src="/assets/index-DpHZwm7N.js"></script>
11
11
  </head>
12
12
  <body style="margin: 0; padding: 0; background-color: #0b0f19; font-family: 'Inter', sans-serif; color: #f1f5f9;">
13
13
  <div id="root"></div>