@smart-axiata/js-bridge 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +154 -0
- package/dist/core/NativeBridge.js +1 -0
- package/dist/core/Transport.js +1 -0
- package/dist/core/nativeBridge/BridgeCalls.js +1 -0
- package/dist/core/nativeBridge/BridgeEvents.js +1 -0
- package/dist/core/nativeBridge/BridgeQueue.js +1 -0
- package/dist/core/nativeBridge/BridgeSerialization.js +1 -0
- package/dist/core/nativeBridge/BridgeTypes.js +1 -0
- package/dist/core/nativeBridge/NativeBridge.js +1 -0
- package/dist/index.js +1 -0
- package/dist/react/useBridge.js +1 -0
- package/dist/vue/plugin.js +1 -0
- package/dist/vue/useBridge.js +1 -0
- package/package.json +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 SmartAxiata
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# Smart Axiata Cambodia JS Bridge
|
|
2
|
+
|
|
3
|
+
Small WebView bridge library with a core JS bridge and Vue 3 adapter.
|
|
4
|
+
Use it to call native handlers from web content and receive native events.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @smart-axiata/js-bridge
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Web integration
|
|
13
|
+
|
|
14
|
+
Adapter docs: `docs/adapters.md`.
|
|
15
|
+
|
|
16
|
+
### Vue quick start
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { createApp } from 'vue';
|
|
20
|
+
import App from './App.vue';
|
|
21
|
+
import { createBridgePlugin, useBridge } from '@smart-axiata/js-bridge';
|
|
22
|
+
|
|
23
|
+
const app = createApp(App);
|
|
24
|
+
app.use(createBridgePlugin());
|
|
25
|
+
app.mount('#app');
|
|
26
|
+
|
|
27
|
+
const bridge = useBridge();
|
|
28
|
+
await bridge.call('getUserInfo');
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Vue component example
|
|
32
|
+
|
|
33
|
+
```vue
|
|
34
|
+
<script setup lang="ts">
|
|
35
|
+
import { useBridge } from '@smart-axiata/js-bridge';
|
|
36
|
+
|
|
37
|
+
const bridge = useBridge();
|
|
38
|
+
|
|
39
|
+
const loadUser = async () => {
|
|
40
|
+
const user = await bridge.call('getUserInfo');
|
|
41
|
+
console.log(user);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
bridge.on('tokenExpired', () => {
|
|
45
|
+
console.log('token expired');
|
|
46
|
+
});
|
|
47
|
+
</script>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### React usage
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import React from 'react';
|
|
54
|
+
import { ReactBridgeProvider, useReactBridge } from '@smart-axiata/js-bridge';
|
|
55
|
+
|
|
56
|
+
const UserPanel = () => {
|
|
57
|
+
const bridge = useReactBridge();
|
|
58
|
+
|
|
59
|
+
const loadUser = async () => {
|
|
60
|
+
const user = await bridge.call('getUserInfo');
|
|
61
|
+
console.log(user);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return <button onClick={loadUser}>Load user</button>;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const App = () => (
|
|
68
|
+
<ReactBridgeProvider>
|
|
69
|
+
<UserPanel />
|
|
70
|
+
</ReactBridgeProvider>
|
|
71
|
+
);
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Bridge contract (native <-> web)
|
|
75
|
+
|
|
76
|
+
The web layer expects the native app to inject a `WebViewJavascriptBridge`
|
|
77
|
+
object with two functions:
|
|
78
|
+
|
|
79
|
+
- `callHandler(name, data, callback)`
|
|
80
|
+
- `registerHandler(name, handler)`
|
|
81
|
+
|
|
82
|
+
The web app calls `bridge.call('methodName', payload)` which maps to
|
|
83
|
+
`callHandler` under the hood. The native side must register handlers that match
|
|
84
|
+
those method names and respond with JSON-compatible values. If an error occurs,
|
|
85
|
+
respond with `{ error: 'message' }`.
|
|
86
|
+
|
|
87
|
+
### Payload shape
|
|
88
|
+
|
|
89
|
+
- Requests: any JSON value (object, array, string, number, boolean, null)
|
|
90
|
+
- Responses: any JSON value or `{ error: string }`
|
|
91
|
+
|
|
92
|
+
## Native integration
|
|
93
|
+
|
|
94
|
+
### iOS (Swift, concept)
|
|
95
|
+
|
|
96
|
+
```swift
|
|
97
|
+
// Using a WebViewJavascriptBridge-style library
|
|
98
|
+
bridge.registerHandler("getUserInfo") { data, responseCallback in
|
|
99
|
+
// data: Any? from JS
|
|
100
|
+
let payload: [String: Any] = ["id": "123", "name": "Sok"]
|
|
101
|
+
responseCallback?(payload)
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Android (Kotlin, concept)
|
|
106
|
+
|
|
107
|
+
```kotlin
|
|
108
|
+
// Using a WebViewJavascriptBridge-style library
|
|
109
|
+
bridge.registerHandler("getUserInfo") { data, responseCallback ->
|
|
110
|
+
val payload = mapOf("id" to "123", "name" to "Sok")
|
|
111
|
+
responseCallback.onCallback(payload)
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
If your native bridge has different method names or injection behavior,
|
|
116
|
+
align those with the JS side in `src/core/Transport.ts`.
|
|
117
|
+
|
|
118
|
+
## Onboarding guide (route -> service -> transport)
|
|
119
|
+
|
|
120
|
+
If you usually onboard by tracing Laravel routes into services, use this
|
|
121
|
+
equivalent path to understand the bridge flow:
|
|
122
|
+
|
|
123
|
+
1) Public entry (routes)
|
|
124
|
+
- `src/index.ts` lists everything consumers can import.
|
|
125
|
+
|
|
126
|
+
2) Core service
|
|
127
|
+
- `src/core/nativeBridge/NativeBridge.ts` holds the main `call()` and `on()` behavior.
|
|
128
|
+
|
|
129
|
+
3) Transport layer
|
|
130
|
+
- `src/core/Transport.ts` talks to the native-injected bridge.
|
|
131
|
+
|
|
132
|
+
4) Framework adapters
|
|
133
|
+
- Vue: `src/vue/plugin.ts`, `src/vue/useBridge.ts`
|
|
134
|
+
- React: `src/react/useBridge.ts`
|
|
135
|
+
|
|
136
|
+
## Build
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
npm run build
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Obfuscation
|
|
143
|
+
|
|
144
|
+
This produces an obfuscated build and replaces `dist/`.
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
npm run build:obfuscate
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Publish
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
npm publish
|
|
154
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a0_0x2d633d=a0_0x20c4;(function(_0x299fae,_0x1d1eaa){const _0x1f88aa=a0_0x20c4,_0x1a2cf3=_0x299fae();while(!![]){try{const _0x1a0f22=-parseInt(_0x1f88aa(0xd5))/0x1*(-parseInt(_0x1f88aa(0x101))/0x2)+parseInt(_0x1f88aa(0xd7))/0x3*(-parseInt(_0x1f88aa(0xd2))/0x4)+parseInt(_0x1f88aa(0xc8))/0x5*(-parseInt(_0x1f88aa(0xc7))/0x6)+-parseInt(_0x1f88aa(0x10d))/0x7*(-parseInt(_0x1f88aa(0xef))/0x8)+-parseInt(_0x1f88aa(0xcc))/0x9*(-parseInt(_0x1f88aa(0xd4))/0xa)+-parseInt(_0x1f88aa(0xe9))/0xb+parseInt(_0x1f88aa(0xfc))/0xc*(-parseInt(_0x1f88aa(0xe1))/0xd);if(_0x1a0f22===_0x1d1eaa)break;else _0x1a2cf3['push'](_0x1a2cf3['shift']());}catch(_0xf83751){_0x1a2cf3['push'](_0x1a2cf3['shift']());}}}(a0_0x206d,0xc285d));const a0_0x37fd65=a0_0x3d97;(function(_0x3b35d5,_0x16b47a){const _0x89fa06=a0_0x20c4,_0x4318c9=a0_0x3d97,_0x42ac36=_0x3b35d5();while(!![]){try{const _0x34096d=parseInt(_0x4318c9(0x15d))/0x1+-parseInt(_0x4318c9(0x13a))/0x2+-parseInt(_0x4318c9(0x15b))/0x3+-parseInt(_0x4318c9(0x135))/0x4*(-parseInt(_0x4318c9(0x13e))/0x5)+-parseInt(_0x4318c9(0x158))/0x6*(parseInt(_0x4318c9(0x168))/0x7)+-parseInt(_0x4318c9(0x14b))/0x8*(parseInt(_0x4318c9(0x133))/0x9)+parseInt(_0x4318c9(0x134))/0xa*(parseInt(_0x4318c9(0x143))/0xb);if(_0x34096d===_0x16b47a)break;else _0x42ac36[_0x89fa06(0xfd)](_0x42ac36[_0x89fa06(0xdb)]());}catch(_0x1067cb){_0x42ac36[_0x89fa06(0xfd)](_0x42ac36[_0x89fa06(0xdb)]());}}}(a0_0x139b,0x66daa));function a0_0x3d97(_0x4b8ae7,_0x5dfe9d){_0x4b8ae7=_0x4b8ae7-0x12b;const _0x234767=a0_0x139b();let _0x345dd7=_0x234767[_0x4b8ae7];return _0x345dd7;}function a0_0x20c4(_0x12c90e,_0x5ad952){_0x12c90e=_0x12c90e-0xc6;const _0x206d54=a0_0x206d();let _0x20c423=_0x206d54[_0x12c90e];return _0x20c423;}import{WebViewJavascriptBridgeTransport}from'./Transport';function a0_0x206d(){const _0x2e2134=['2692557UpnhBn','filter','sendMessage','Bridge\x20not\x20ready.\x20Call\x20queued\x20and\x20will\x20reject\x20if\x20the\x20bridge\x20never\x20becomes\x20available.','callHandler','parse','then','168vnqCIP','push','warnUnavailableOnce','rejectAllPending','removePendingCall','238ClFlnz','object','registerHandler','reject','length','Bridge\x20call\x20failed.','1358976KKxdTm','createId','Bridge\x20not\x20ready.\x20Event\x20handler\x20will\x20register\x20once\x20the\x20bridge\x20becomes\x20available.','payload','flushPendingCalls','registerPendingHandlers','308ThQEET','forEach','pendingHandlers','message','Bridge\x20event\x20name\x20is\x20required.','string','1284SSdgeE','1510QvsLRp','warn','8tQEwyF','1254500eKOqAb','54rBGgFv','rejectCall','serialize','callTimeoutMs','4351434IueuRK','stringify','4XXWpaR','Native\x20bridge\x20is\x20not\x20available.','2276740TcSTDS','12517QIFTZv','whenReady','3487893LFbFUq','getBridge','12PJALdF','resolve','shift','Bridge\x20call\x20timed\x20out:\x20','set','649265MdbkRa','call','Bridge\x20method\x20is\x20required.','568451PHzxNj','820666mYWNhw','transport','logger','7MsfgBs','has','196629mhgpli','method','17113547mCpfsK','warnedUnavailable','isReady','callCounter','now','callbacks','242984raLRbh','isErrorPayload','handleResponse','delete','get','pendingCalls'];a0_0x206d=function(){return _0x2e2134;};return a0_0x206d();}export class NativeBridge{constructor(_0xe5c02f={}){const _0x5e00bd=a0_0x20c4,_0x2c14c1=a0_0x3d97;this[_0x2c14c1(0x136)]=new Map(),this[_0x5e00bd(0xf4)]=[],this[_0x2c14c1(0x142)]=[],this[_0x2c14c1(0x164)]=![],this[_0x2c14c1(0x169)]=![],this[_0x2c14c1(0x15f)]=0x0,this[_0x2c14c1(0x132)]=_0xe5c02f[_0x2c14c1(0x132)]??new WebViewJavascriptBridgeTransport(),this[_0x5e00bd(0xe4)]=_0xe5c02f[_0x2c14c1(0x166)]??console,this[_0x2c14c1(0x146)]=_0xe5c02f[_0x2c14c1(0x146)]??0x2710,this[_0x2c14c1(0x132)][_0x2c14c1(0x145)]()[_0x2c14c1(0x15a)](_0x31fe51=>{const _0x105c22=_0x5e00bd,_0x4808aa=_0x2c14c1;this[_0x4808aa(0x164)]=!![],_0x31fe51?(this[_0x4808aa(0x12e)](_0x31fe51),this[_0x105c22(0x10b)]()):this[_0x4808aa(0x159)](_0x4808aa(0x154));});}[a0_0x37fd65(0x12c)](_0x40b9e1,_0x122c0a=null){const _0x439424=a0_0x20c4,_0x1e75dc=a0_0x37fd65;if(!_0x40b9e1)return Promise[_0x439424(0x104)](new Error(_0x1e75dc(0x13f)));const _0x1d956a={'id':this[_0x1e75dc(0x131)](),'method':_0x40b9e1,'payload':_0x122c0a};return new Promise((_0x57cd45,_0x263ae1)=>{const _0x197cd0=_0x439424,_0x3bcc04=_0x1e75dc,_0x5a7fb9=setTimeout(()=>{const _0x5f2995=a0_0x20c4,_0x48d5e2=a0_0x3d97;this[_0x5f2995(0xee)][_0x5f2995(0xf2)](_0x1d956a['id']),this[_0x48d5e2(0x12f)](_0x1d956a['id']),_0x263ae1(new Error(_0x48d5e2(0x16a)+_0x40b9e1));},this[_0x3bcc04(0x146)]);this[_0x3bcc04(0x136)][_0x3bcc04(0x155)](_0x1d956a['id'],{'resolve':_0x57cd45,'reject':_0x263ae1,'timeoutId':_0x5a7fb9});if(!this[_0x3bcc04(0x164)]){this[_0x3bcc04(0x150)][_0x3bcc04(0x161)]({'message':_0x1d956a}),this[_0x3bcc04(0x148)](_0x197cd0(0xf8));return;}this[_0x197cd0(0xf7)](_0x1d956a);});}['on'](_0x17de25,_0x3f3335){const _0x4e0263=a0_0x20c4,_0x2041c4=a0_0x37fd65;if(!_0x17de25){this[_0x2041c4(0x166)][_0x2041c4(0x147)](_0x2041c4(0x13b));return;}if(!this[_0x4e0263(0xeb)]){this[_0x2041c4(0x142)][_0x2041c4(0x161)]({'event':_0x17de25,'handler':_0x3f3335}),this[_0x2041c4(0x148)](_0x2041c4(0x14c));return;}const _0x1cb983=this[_0x2041c4(0x132)][_0x2041c4(0x140)]();if(!_0x1cb983){this[_0x2041c4(0x166)][_0x2041c4(0x147)](_0x2041c4(0x144));return;}this[_0x2041c4(0x14a)](_0x1cb983,_0x17de25,_0x3f3335);}['registerPendingHandlers'](_0x200e6f){const _0x1a0a47=a0_0x20c4,_0x304c65=a0_0x37fd65;if(this[_0x1a0a47(0x10f)]['length']===0x0)return;const _0x37ce4c=[...this[_0x304c65(0x142)]];this[_0x304c65(0x142)]=[],_0x37ce4c[_0x304c65(0x15c)](({event:_0xa4c55c,handler:_0x3c1234})=>this[_0x304c65(0x14a)](_0x200e6f,_0xa4c55c,_0x3c1234));}[a0_0x37fd65(0x14a)](_0x1e1662,_0x51cd38,_0x4e1d1a){const _0x57ed32=a0_0x20c4;_0x1e1662[_0x57ed32(0x103)](_0x51cd38,_0x555659=>{const _0x25f8f3=a0_0x3d97;_0x4e1d1a(this[_0x25f8f3(0x14d)](_0x555659));});}[a0_0x37fd65(0x153)](){const _0x34c443=a0_0x37fd65;if(this[_0x34c443(0x150)][_0x34c443(0x15e)]===0x0)return;const _0x18aa4c=[...this['pendingCalls']];this[_0x34c443(0x150)]=[],_0x18aa4c[_0x34c443(0x15c)](({message:_0x298586})=>{const _0x1e10c6=_0x34c443;this[_0x1e10c6(0x136)][_0x1e10c6(0x138)](_0x298586['id'])&&this[_0x1e10c6(0x12b)](_0x298586);});}[a0_0x37fd65(0x12b)](_0x5d4e53){const _0x277eda=a0_0x20c4,_0xfced71=a0_0x37fd65,_0x527a9f=this[_0x277eda(0xe3)][_0xfced71(0x140)]();if(!_0x527a9f){this[_0xfced71(0x148)](_0xfced71(0x139)),this[_0xfced71(0x141)](_0x5d4e53['id'],_0xfced71(0x154));return;}try{const _0x1d8815=this[_0xfced71(0x151)](_0x5d4e53);_0x527a9f[_0x277eda(0xf9)](_0x5d4e53[_0xfced71(0x149)],_0x1d8815,_0x517f59=>{const _0x85a1b3=_0xfced71;this[_0x85a1b3(0x12d)](_0x5d4e53['id'],_0x517f59);});}catch(_0x288fdc){const _0x37f8f1=_0x288fdc instanceof Error?_0x288fdc[_0xfced71(0x163)]:_0xfced71(0x156);this[_0xfced71(0x141)](_0x5d4e53['id'],_0x37f8f1);}}[a0_0x37fd65(0x12d)](_0x48ffe2,_0x219313){const _0xe9b3ed=a0_0x20c4,_0xf2b577=a0_0x37fd65,_0x32c0bc=this[_0xf2b577(0x136)][_0xf2b577(0x167)](_0x48ffe2);if(!_0x32c0bc)return;this[_0xe9b3ed(0xee)][_0xf2b577(0x13c)](_0x48ffe2),_0x32c0bc[_0xf2b577(0x157)]&&clearTimeout(_0x32c0bc[_0xf2b577(0x157)]);const _0x11f60f=this[_0xf2b577(0x14d)](_0x219313);if(this[_0xf2b577(0x13d)](_0x11f60f)){_0x32c0bc[_0xf2b577(0x162)](new Error(_0x11f60f[_0xf2b577(0x152)]));return;}_0x32c0bc[_0xe9b3ed(0xda)](_0x11f60f);}[a0_0x37fd65(0x141)](_0x3c510a,_0x5ceb98){const _0x5c4614=a0_0x20c4,_0x2b0010=a0_0x37fd65,_0x5acb9d=this[_0x2b0010(0x136)][_0x2b0010(0x167)](_0x3c510a);if(!_0x5acb9d)return;this['callbacks'][_0x2b0010(0x13c)](_0x3c510a),_0x5acb9d[_0x2b0010(0x157)]&&clearTimeout(_0x5acb9d[_0x2b0010(0x157)]),_0x5acb9d[_0x5c4614(0x104)](new Error(_0x5ceb98));}[a0_0x37fd65(0x159)](_0x212e81){const _0x31d4e6=a0_0x37fd65;this[_0x31d4e6(0x150)][_0x31d4e6(0x15c)](({message:_0x9e512a})=>this[_0x31d4e6(0x141)](_0x9e512a['id'],_0x212e81)),this[_0x31d4e6(0x150)]=[];}[a0_0x2d633d(0x100)](_0x17bb84){const _0x5b301b=a0_0x2d633d,_0x4eb148=a0_0x37fd65;if(this[_0x5b301b(0xf4)][_0x4eb148(0x15e)]===0x0)return;this['pendingCalls']=this[_0x4eb148(0x150)][_0x4eb148(0x130)](({message:_0xaba183})=>_0xaba183['id']!==_0x17bb84);}[a0_0x37fd65(0x148)](_0x59a060){const _0x45a3c6=a0_0x37fd65;if(this[_0x45a3c6(0x169)])return;this[_0x45a3c6(0x169)]=!![],this[_0x45a3c6(0x166)][_0x45a3c6(0x147)](_0x59a060);}[a0_0x37fd65(0x151)](_0x4df335){const _0x511412=a0_0x2d633d,_0x30de30=a0_0x37fd65;return JSON[_0x511412(0xd1)]({'id':_0x4df335['id'],'method':_0x4df335[_0x511412(0xe8)],'payload':_0x4df335[_0x30de30(0x165)]});}[a0_0x37fd65(0x14d)](_0x2253ae){const _0x2a667e=a0_0x37fd65;if(typeof _0x2253ae===_0x2a667e(0x14e))try{return JSON[_0x2a667e(0x160)](_0x2253ae);}catch{return _0x2253ae;}return _0x2253ae??null;}[a0_0x37fd65(0x13d)](_0x3a818a){const _0x4e3347=a0_0x37fd65;return typeof _0x3a818a===_0x4e3347(0x137)&&_0x3a818a!==null&&_0x4e3347(0x152)in _0x3a818a&&typeof _0x3a818a[_0x4e3347(0x152)]===_0x4e3347(0x14e);}[a0_0x37fd65(0x131)](){const _0x36a1e7=a0_0x2d633d,_0x5cc2f5=a0_0x37fd65;return this[_0x5cc2f5(0x15f)]+=0x1,_0x5cc2f5(0x14f)+Date[_0x36a1e7(0xed)]()+'_'+this[_0x5cc2f5(0x15f)];}}let singleton=null;function a0_0x139b(){const _0x3ef5ec=a0_0x2d633d,_0x311e0d=[_0x3ef5ec(0xfe),'method','registerHandler',_0x3ef5ec(0xca),_0x3ef5ec(0x109),'deserialize',_0x3ef5ec(0xc6),'js_','pendingCalls',_0x3ef5ec(0xce),'error','flushPendingCalls',_0x3ef5ec(0xd3),_0x3ef5ec(0xdd),_0x3ef5ec(0x106),'timeoutId',_0x3ef5ec(0xd0),_0x3ef5ec(0xff),_0x3ef5ec(0xfb),_0x3ef5ec(0x107),_0x3ef5ec(0x10e),_0x3ef5ec(0xe7),_0x3ef5ec(0x105),_0x3ef5ec(0xec),_0x3ef5ec(0xfa),_0x3ef5ec(0xfd),'reject',_0x3ef5ec(0x110),_0x3ef5ec(0xeb),_0x3ef5ec(0x10a),_0x3ef5ec(0xe4),_0x3ef5ec(0xf3),_0x3ef5ec(0xe5),_0x3ef5ec(0xea),_0x3ef5ec(0xdc),_0x3ef5ec(0xf7),_0x3ef5ec(0xdf),_0x3ef5ec(0xf1),_0x3ef5ec(0x10c),_0x3ef5ec(0x100),_0x3ef5ec(0xf6),_0x3ef5ec(0x108),_0x3ef5ec(0xe3),_0x3ef5ec(0xf5),'260GnYNWm',_0x3ef5ec(0xd9),_0x3ef5ec(0xee),_0x3ef5ec(0x102),_0x3ef5ec(0xe6),'Bridge\x20not\x20available.\x20Call\x20rejected.',_0x3ef5ec(0xcb),_0x3ef5ec(0x111),'delete',_0x3ef5ec(0xf0),_0x3ef5ec(0xde),_0x3ef5ec(0xe0),_0x3ef5ec(0xd8),_0x3ef5ec(0xcd),_0x3ef5ec(0x10f),_0x3ef5ec(0xe2),'Bridge\x20not\x20available.\x20Event\x20handler\x20registration\x20skipped.',_0x3ef5ec(0xd6),_0x3ef5ec(0xcf),_0x3ef5ec(0xc9)];return a0_0x139b=function(){return _0x311e0d;},a0_0x139b();}export const getBridge=(_0x3a9221={})=>{return!singleton&&(singleton=new NativeBridge(_0x3a9221)),singleton;};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a1_0x172e73=a1_0x75fe;(function(_0x300ef7,_0x3505db){const _0x2be7f9=a1_0x75fe,_0x54c770=_0x300ef7();while(!![]){try{const _0x4c70a6=parseInt(_0x2be7f9(0xb3))/0x1+-parseInt(_0x2be7f9(0xb8))/0x2*(-parseInt(_0x2be7f9(0xbf))/0x3)+parseInt(_0x2be7f9(0xbd))/0x4*(-parseInt(_0x2be7f9(0xc3))/0x5)+parseInt(_0x2be7f9(0xb7))/0x6+parseInt(_0x2be7f9(0xb9))/0x7*(parseInt(_0x2be7f9(0xbe))/0x8)+-parseInt(_0x2be7f9(0xb5))/0x9+parseInt(_0x2be7f9(0xb6))/0xa;if(_0x4c70a6===_0x3505db)break;else _0x54c770['push'](_0x54c770['shift']());}catch(_0x4a3d78){_0x54c770['push'](_0x54c770['shift']());}}}(a1_0x16a5,0x3155c));export class WebViewJavascriptBridgeTransport{constructor(){const _0x4596a7=a1_0x75fe;this[_0x4596a7(0xb1)]=![],this[_0x4596a7(0xba)]=null;if(typeof window==='undefined'){this['ready']=!![],this[_0x4596a7(0xb2)]=Promise[_0x4596a7(0xc0)](null);return;}this[_0x4596a7(0xb2)]=new Promise(_0x1cc1b2=>{this['resolveReady']=_0x1cc1b2;});const _0x5b4922=this[_0x4596a7(0xc1)]();if(_0x5b4922){this[_0x4596a7(0xb1)]=!![],this[_0x4596a7(0xba)]?.(_0x5b4922);return;}window[_0x4596a7(0xbb)](_0x4596a7(0xb4),()=>{const _0x9e3a71=_0x4596a7;this[_0x9e3a71(0xb1)]=!![],this[_0x9e3a71(0xba)]?.(this['getBridge']());},{'once':!![]});}['getBridge'](){const _0x45d6e3=a1_0x75fe;if(typeof window===_0x45d6e3(0xc2))return null;return window[_0x45d6e3(0xbc)]??null;}[a1_0x172e73(0xc4)](){const _0x4d558f=a1_0x172e73;return this[_0x4d558f(0xb1)];}[a1_0x172e73(0xb0)](){return this['readyPromise'];}}function a1_0x75fe(_0x56a875,_0x432463){_0x56a875=_0x56a875-0xb0;const _0x16a55e=a1_0x16a5();let _0x75fe9=_0x16a55e[_0x56a875];return _0x75fe9;}function a1_0x16a5(){const _0xe582a1=['undefined','61865VIzTNG','isReady','whenReady','ready','readyPromise','22184widdRM','WebViewJavascriptBridgeReady','3548106HavwUh','4047820cVCHvN','998874lUvTKX','3818RCUskt','14eGGYjv','resolveReady','addEventListener','WebViewJavascriptBridge','116TdbXQn','1339824KzPnia','42RPtVQK','resolve','getBridge'];a1_0x16a5=function(){return _0xe582a1;};return a1_0x16a5();}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a2_0x53ff90=a2_0x45d6;(function(_0x416dcc,_0x2b9967){const _0x41f631=a2_0x45d6,_0x292931=_0x416dcc();while(!![]){try{const _0x40fdac=parseInt(_0x41f631(0xc7))/0x1*(-parseInt(_0x41f631(0xae))/0x2)+-parseInt(_0x41f631(0xac))/0x3+parseInt(_0x41f631(0xc2))/0x4*(parseInt(_0x41f631(0xc9))/0x5)+parseInt(_0x41f631(0xb4))/0x6*(-parseInt(_0x41f631(0xb9))/0x7)+-parseInt(_0x41f631(0xb8))/0x8*(parseInt(_0x41f631(0xba))/0x9)+-parseInt(_0x41f631(0xcc))/0xa*(parseInt(_0x41f631(0xbf))/0xb)+parseInt(_0x41f631(0xb3))/0xc;if(_0x40fdac===_0x2b9967)break;else _0x292931['push'](_0x292931['shift']());}catch(_0xc3aa79){_0x292931['push'](_0x292931['shift']());}}}(a2_0x11a6,0xeeeed));function a2_0x11a6(){const _0x2d45b8=['rejectAllPending','resolve','transport','22RhtALs','timeoutId','305ISExDX','UnavailableCallRejected','callTimeoutMs','4310420dtXgHv','queue','reject','3766323ygYYXu','sendMessage','9442qvnWSN','CallFailed','error','MethodRequired','method','47258556itgeOl','1298604BxpoWF','warnUnavailableOnce','message','rejectCall','815512nlFAgt','7NEiUmj','144sNVMLR','call','callHandler','queueCall','flushPendingCalls','11XjyRIF','NotReadyCallQueued','handleResponse','44476GxyBIw','getBridge'];a2_0x11a6=function(){return _0x2d45b8;};return a2_0x11a6();}import{BridgeErrorMessage,BridgeWarningMessage,buildCallTimeoutMessage}from'./BridgeTypes';import{deserializeBridgePayload,isErrorPayload,serializeBridgeMessage}from'./BridgeSerialization';function a2_0x45d6(_0x4d6f69,_0x1f7304){_0x4d6f69=_0x4d6f69-0xab;const _0x11a6ad=a2_0x11a6();let _0x45d614=_0x11a6ad[_0x4d6f69];return _0x45d614;}export class BridgeCalls{constructor(_0x23b8d0){const _0x145593=a2_0x45d6;this[_0x145593(0xc6)]=_0x23b8d0['transport'],this[_0x145593(0xcd)]=_0x23b8d0[_0x145593(0xcd)],this[_0x145593(0xcb)]=_0x23b8d0[_0x145593(0xcb)],this[_0x145593(0xb5)]=_0x23b8d0['warnUnavailableOnce'],this['createId']=_0x23b8d0['createId'];}[a2_0x53ff90(0xbb)](_0x42daaf,_0x2b8acd,_0x28c3a7){const _0x8b312d=a2_0x53ff90;if(!_0x42daaf)return Promise[_0x8b312d(0xab)](new Error(BridgeErrorMessage[_0x8b312d(0xb1)]));const _0x1bb2d7={'id':this['createId'](),'method':_0x42daaf,'payload':_0x2b8acd};return new Promise((_0x754456,_0x30628b)=>{const _0x253ac1=_0x8b312d,_0x3b2924=setTimeout(()=>{const _0x5003ec=a2_0x45d6;this[_0x5003ec(0xcd)]['deleteCallback'](_0x1bb2d7['id']),this[_0x5003ec(0xcd)]['removePendingCall'](_0x1bb2d7['id']),_0x30628b(new Error(buildCallTimeoutMessage(_0x42daaf)));},this[_0x253ac1(0xcb)]);this['queue']['addCallback'](_0x1bb2d7['id'],{'resolve':_0x754456,'reject':_0x30628b,'timeoutId':_0x3b2924});if(!_0x28c3a7){this['queue'][_0x253ac1(0xbd)](_0x1bb2d7),this[_0x253ac1(0xb5)](BridgeWarningMessage[_0x253ac1(0xc0)]);return;}this[_0x253ac1(0xad)](_0x1bb2d7);});}[a2_0x53ff90(0xbe)](){const _0x3b9287=a2_0x53ff90;this[_0x3b9287(0xcd)]['drainPendingCalls'](_0x50bcbd=>this[_0x3b9287(0xad)](_0x50bcbd));}[a2_0x53ff90(0xc4)](_0x501d75){const _0x375391=a2_0x53ff90;this['queue'][_0x375391(0xc4)](_0x501d75,(_0x1cbf63,_0x4fe93e)=>this[_0x375391(0xb7)](_0x1cbf63,_0x4fe93e));}[a2_0x53ff90(0xad)](_0x11d80a){const _0x5ee260=a2_0x53ff90,_0x4685bf=this[_0x5ee260(0xc6)][_0x5ee260(0xc3)]();if(!_0x4685bf){this['warnUnavailableOnce'](BridgeWarningMessage[_0x5ee260(0xca)]),this[_0x5ee260(0xb7)](_0x11d80a['id'],BridgeErrorMessage['BridgeUnavailable']);return;}try{const _0x5831c3=serializeBridgeMessage(_0x11d80a);_0x4685bf[_0x5ee260(0xbc)](_0x11d80a[_0x5ee260(0xb2)],_0x5831c3,_0x4a510b=>{this['handleResponse'](_0x11d80a['id'],_0x4a510b);});}catch(_0x4d52f7){const _0x532447=_0x4d52f7 instanceof Error?_0x4d52f7[_0x5ee260(0xb6)]:BridgeErrorMessage[_0x5ee260(0xaf)];this[_0x5ee260(0xb7)](_0x11d80a['id'],_0x532447);}}[a2_0x53ff90(0xc1)](_0x5a77aa,_0x25ab7d){const _0x2568b6=a2_0x53ff90,_0x3fbdd5=this[_0x2568b6(0xcd)]['getCallback'](_0x5a77aa);if(!_0x3fbdd5)return;this[_0x2568b6(0xcd)]['deleteCallback'](_0x5a77aa);_0x3fbdd5['timeoutId']&&clearTimeout(_0x3fbdd5[_0x2568b6(0xc8)]);const _0x39f2a4=deserializeBridgePayload(_0x25ab7d);if(isErrorPayload(_0x39f2a4)){_0x3fbdd5[_0x2568b6(0xab)](new Error(_0x39f2a4[_0x2568b6(0xb0)]));return;}_0x3fbdd5[_0x2568b6(0xc5)](_0x39f2a4);}['rejectCall'](_0x3fcf2c,_0x2bab8b){const _0x22f837=a2_0x53ff90,_0x190a6f=this['queue']['getCallback'](_0x3fcf2c);if(!_0x190a6f)return;this[_0x22f837(0xcd)]['deleteCallback'](_0x3fcf2c),_0x190a6f[_0x22f837(0xc8)]&&clearTimeout(_0x190a6f['timeoutId']),_0x190a6f[_0x22f837(0xab)](new Error(_0x2bab8b));}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a3_0x4988ee=a3_0x3ac5;function a3_0x3ac5(_0x29ae5a,_0x37b580){_0x29ae5a=_0x29ae5a-0x1bc;const _0x5694f4=a3_0x5694();let _0x3ac524=_0x5694f4[_0x29ae5a];return _0x3ac524;}(function(_0x306262,_0x5c2fba){const _0x5b42b7=a3_0x3ac5,_0x43d13d=_0x306262();while(!![]){try{const _0x59235b=-parseInt(_0x5b42b7(0x1ca))/0x1+-parseInt(_0x5b42b7(0x1d1))/0x2*(parseInt(_0x5b42b7(0x1cb))/0x3)+-parseInt(_0x5b42b7(0x1c2))/0x4*(parseInt(_0x5b42b7(0x1c1))/0x5)+parseInt(_0x5b42b7(0x1bf))/0x6*(-parseInt(_0x5b42b7(0x1cd))/0x7)+-parseInt(_0x5b42b7(0x1d2))/0x8*(parseInt(_0x5b42b7(0x1d3))/0x9)+parseInt(_0x5b42b7(0x1c3))/0xa*(parseInt(_0x5b42b7(0x1d0))/0xb)+-parseInt(_0x5b42b7(0x1cf))/0xc*(-parseInt(_0x5b42b7(0x1c5))/0xd);if(_0x59235b===_0x5c2fba)break;else _0x43d13d['push'](_0x43d13d['shift']());}catch(_0x4cba20){_0x43d13d['push'](_0x43d13d['shift']());}}}(a3_0x5694,0x4a971));import{BridgeWarningMessage}from'./BridgeTypes';import{deserializeBridgePayload}from'./BridgeSerialization';export class BridgeEvents{constructor(_0x568e69){const _0x21e9c0=a3_0x3ac5;this[_0x21e9c0(0x1c8)]=_0x568e69['transport'],this['queue']=_0x568e69['queue'],this[_0x21e9c0(0x1c4)]=_0x568e69[_0x21e9c0(0x1c4)],this[_0x21e9c0(0x1c0)]=_0x568e69[_0x21e9c0(0x1c0)];}['on'](_0x5654da,_0x2c08c8,_0x1135a0){const _0x255de8=a3_0x3ac5;if(!_0x5654da){this[_0x255de8(0x1c0)]['warn'](BridgeWarningMessage[_0x255de8(0x1c9)]);return;}if(!_0x1135a0){this[_0x255de8(0x1c6)][_0x255de8(0x1ce)](_0x5654da,_0x2c08c8),this['warnUnavailableOnce'](BridgeWarningMessage[_0x255de8(0x1cc)]);return;}const _0xc6eaf1=this[_0x255de8(0x1c8)][_0x255de8(0x1bd)]();if(!_0xc6eaf1){this[_0x255de8(0x1c0)][_0x255de8(0x1c7)](BridgeWarningMessage[_0x255de8(0x1bc)]);return;}this[_0x255de8(0x1be)](_0xc6eaf1,_0x5654da,_0x2c08c8);}['registerPendingHandlers'](_0x439d30){const _0x28b4ae=a3_0x3ac5;this[_0x28b4ae(0x1c6)]['drainHandlers']((_0x24ebfd,_0x415a1e)=>this[_0x28b4ae(0x1be)](_0x439d30,_0x24ebfd,_0x415a1e));}[a3_0x4988ee(0x1be)](_0x3cc043,_0x16fb5a,_0x1d712e){const _0x1e893c=a3_0x4988ee;_0x3cc043[_0x1e893c(0x1be)](_0x16fb5a,_0x3df8ab=>{_0x1d712e(deserializeBridgePayload(_0x3df8ab));});}}function a3_0x5694(){const _0x4c7ff9=['23520660LYjTKy','6046865WWASTh','82WevljR','2235304IxbDLx','18UwRZdO','UnavailableHandlerSkipped','getBridge','registerHandler','6qyorhF','logger','16685pQeLxz','228xjkIPU','10qjhaWD','warnUnavailableOnce','13xBmUPm','queue','warn','transport','EventNameRequired','414203uvSeOH','33702XrFaka','NotReadyHandlerQueued','4062919EtsFSK','queueHandler'];a3_0x5694=function(){return _0x4c7ff9;};return a3_0x5694();}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a4_0x37fec1=a4_0x387b;(function(_0x3f2acf,_0x1a3d8a){const _0x4c2ca7=a4_0x387b,_0x5296b9=_0x3f2acf();while(!![]){try{const _0x5d50a0=parseInt(_0x4c2ca7(0xdd))/0x1+-parseInt(_0x4c2ca7(0xc6))/0x2*(-parseInt(_0x4c2ca7(0xda))/0x3)+parseInt(_0x4c2ca7(0xc3))/0x4*(-parseInt(_0x4c2ca7(0xd5))/0x5)+-parseInt(_0x4c2ca7(0xca))/0x6*(parseInt(_0x4c2ca7(0xce))/0x7)+-parseInt(_0x4c2ca7(0xc9))/0x8+parseInt(_0x4c2ca7(0xdc))/0x9*(-parseInt(_0x4c2ca7(0xcb))/0xa)+-parseInt(_0x4c2ca7(0xde))/0xb*(-parseInt(_0x4c2ca7(0xc2))/0xc);if(_0x5d50a0===_0x1a3d8a)break;else _0x5296b9['push'](_0x5296b9['shift']());}catch(_0x2d727f){_0x5296b9['push'](_0x5296b9['shift']());}}}(a4_0x20fa,0x85d88));export class BridgeQueue{constructor(){const _0x1f6e02=a4_0x387b;this[_0x1f6e02(0xdf)]=new Map(),this[_0x1f6e02(0xd6)]=[],this[_0x1f6e02(0xd3)]=[];}[a4_0x37fec1(0xc4)](_0x2cf573,_0x1d4795){const _0x59b538=a4_0x37fec1;this[_0x59b538(0xdf)][_0x59b538(0xcd)](_0x2cf573,_0x1d4795);}[a4_0x37fec1(0xd7)](_0x5b476e){const _0x4d1b6e=a4_0x37fec1;return this[_0x4d1b6e(0xdf)]['get'](_0x5b476e);}['deleteCallback'](_0x4b2f5e){const _0x24ad7d=a4_0x37fec1;this[_0x24ad7d(0xdf)][_0x24ad7d(0xd1)](_0x4b2f5e);}[a4_0x37fec1(0xc5)](_0x35f6e5){const _0x2730a3=a4_0x37fec1;return this[_0x2730a3(0xdf)][_0x2730a3(0xdb)](_0x35f6e5);}['queueCall'](_0x535d8e){const _0x2dc7d2=a4_0x37fec1;this[_0x2dc7d2(0xd6)][_0x2dc7d2(0xd0)]({'message':_0x535d8e});}[a4_0x37fec1(0xcc)](_0xe50d04){const _0xec0b7a=a4_0x37fec1;if(this['pendingCalls'][_0xec0b7a(0xd4)]===0x0)return;this['pendingCalls']=this[_0xec0b7a(0xd6)][_0xec0b7a(0xc7)](({message:_0x29ebad})=>_0x29ebad['id']!==_0xe50d04);}[a4_0x37fec1(0xc8)](_0x11e9d1){const _0x5a1cfc=a4_0x37fec1;if(this['pendingCalls'][_0x5a1cfc(0xd4)]===0x0)return;const _0x226756=[...this[_0x5a1cfc(0xd6)]];this['pendingCalls']=[],_0x226756['forEach'](({message:_0x467533})=>{const _0x8606dc=_0x5a1cfc;this[_0x8606dc(0xc5)](_0x467533['id'])&&_0x11e9d1(_0x467533);});}[a4_0x37fec1(0xd2)](_0x51c5d8,_0x3a2e0c){const _0x500fe2=a4_0x37fec1;this[_0x500fe2(0xd3)]['push']({'event':_0x51c5d8,'handler':_0x3a2e0c});}[a4_0x37fec1(0xd9)](_0x24e2de){const _0xf0964f=a4_0x37fec1;if(this[_0xf0964f(0xd3)][_0xf0964f(0xd4)]===0x0)return;const _0x3136fa=[...this[_0xf0964f(0xd3)]];this[_0xf0964f(0xd3)]=[],_0x3136fa[_0xf0964f(0xd8)](({event:_0x993ef2,handler:_0x2df08c})=>_0x24e2de(_0x993ef2,_0x2df08c));}[a4_0x37fec1(0xcf)](_0x529a1b,_0x45ff5a){const _0x2b161e=a4_0x37fec1;this[_0x2b161e(0xd6)][_0x2b161e(0xd8)](({message:_0x3b98d5})=>_0x45ff5a(_0x3b98d5['id'],_0x529a1b)),this[_0x2b161e(0xd6)]=[];}}function a4_0x387b(_0x3bbe03,_0xb30ac0){_0x3bbe03=_0x3bbe03-0xc2;const _0x20fa66=a4_0x20fa();let _0x387b18=_0x20fa66[_0x3bbe03];return _0x387b18;}function a4_0x20fa(){const _0x1e62b7=['set','1211aHltgf','rejectAllPending','push','delete','queueHandler','pendingHandlers','length','345TTfpTY','pendingCalls','getCallback','forEach','drainHandlers','25638SEHFxm','has','31437nUEfAj','586715FUdeSR','11MXWOSb','callbacks','34380312TcrliJ','25852miszBk','addCallback','hasCallback','22tFXtwC','filter','drainPendingCalls','7360024hQKKHm','30540wPbKdq','2150bbIutm','removePendingCall'];a4_0x20fa=function(){return _0x1e62b7;};return a4_0x20fa();}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a5_0x4faece=a5_0x55cb;(function(_0x410cd8,_0x1a5469){const _0x5b323f=a5_0x55cb,_0x56af3e=_0x410cd8();while(!![]){try{const _0xb23e62=-parseInt(_0x5b323f(0xf2))/0x1+-parseInt(_0x5b323f(0xf5))/0x2+-parseInt(_0x5b323f(0xf3))/0x3*(-parseInt(_0x5b323f(0xfb))/0x4)+-parseInt(_0x5b323f(0xf1))/0x5+-parseInt(_0x5b323f(0xf6))/0x6+-parseInt(_0x5b323f(0xf8))/0x7+-parseInt(_0x5b323f(0xf7))/0x8*(-parseInt(_0x5b323f(0xf9))/0x9);if(_0xb23e62===_0x1a5469)break;else _0x56af3e['push'](_0x56af3e['shift']());}catch(_0x22abed){_0x56af3e['push'](_0x56af3e['shift']());}}}(a5_0x42ad,0x230c6));function a5_0x55cb(_0x1a9b49,_0x31a869){_0x1a9b49=_0x1a9b49-0xec;const _0x42adae=a5_0x42ad();let _0x55cbde=_0x42adae[_0x1a9b49];return _0x55cbde;}export const serializeBridgeMessage=_0x2d5c65=>JSON[a5_0x4faece(0xef)]({'id':_0x2d5c65['id'],'method':_0x2d5c65[a5_0x4faece(0xec)],'payload':_0x2d5c65[a5_0x4faece(0xf0)]});function a5_0x42ad(){const _0x1383ba=['object','stringify','payload','1095985eLuKjb','142842cUgXaQ','3DxJebf','parse','474890eSCLGO','158676ucVSGL','7591224prKrsI','1925672sxYXSL','9BrQNmj','error','382724UTrfCa','method','string'];a5_0x42ad=function(){return _0x1383ba;};return a5_0x42ad();}export const deserializeBridgePayload=_0x1f4c26=>{const _0xbc4217=a5_0x4faece;if(typeof _0x1f4c26===_0xbc4217(0xed))try{return JSON[_0xbc4217(0xf4)](_0x1f4c26);}catch{return _0x1f4c26;}return _0x1f4c26??null;};export const isErrorPayload=_0x2efa59=>typeof _0x2efa59===a5_0x4faece(0xee)&&_0x2efa59!==null&&'error'in _0x2efa59&&typeof _0x2efa59[a5_0x4faece(0xfa)]===a5_0x4faece(0xed);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x3ec156,_0x1c7715){var _0x41a913=a6_0x40fe,_0x31bc3d=_0x3ec156();while(!![]){try{var _0x173612=parseInt(_0x41a913(0x15d))/0x1+parseInt(_0x41a913(0x163))/0x2*(-parseInt(_0x41a913(0x15e))/0x3)+parseInt(_0x41a913(0x16d))/0x4+-parseInt(_0x41a913(0x171))/0x5*(parseInt(_0x41a913(0x16c))/0x6)+-parseInt(_0x41a913(0x167))/0x7*(parseInt(_0x41a913(0x161))/0x8)+parseInt(_0x41a913(0x16a))/0x9+parseInt(_0x41a913(0x160))/0xa;if(_0x173612===_0x1c7715)break;else _0x31bc3d['push'](_0x31bc3d['shift']());}catch(_0x2615e6){_0x31bc3d['push'](_0x31bc3d['shift']());}}}(a6_0x1dce,0xced00));export var BridgeWarningMessage;(function(_0x570663){var _0x2cd933=a6_0x40fe;_0x570663['EventNameRequired']='Bridge\x20event\x20name\x20is\x20required.',_0x570663[_0x2cd933(0x16f)]=_0x2cd933(0x16b),_0x570663['NotReadyHandlerQueued']=_0x2cd933(0x15f),_0x570663[_0x2cd933(0x164)]='Bridge\x20not\x20available.\x20Call\x20rejected.',_0x570663[_0x2cd933(0x162)]=_0x2cd933(0x169);}(BridgeWarningMessage||(BridgeWarningMessage={})));function a6_0x40fe(_0x1bd65d,_0x57ebc1){_0x1bd65d=_0x1bd65d-0x15d;var _0x1dce16=a6_0x1dce();var _0x40fe1f=_0x1dce16[_0x1bd65d];return _0x40fe1f;}export var BridgeErrorMessage;function a6_0x1dce(){var _0xec815a=['30384zpNPEI','UnavailableCallRejected','Native\x20bridge\x20is\x20not\x20available.','MethodRequired','210OYiqaD','Bridge\x20method\x20is\x20required.','Bridge\x20not\x20available.\x20Event\x20handler\x20registration\x20skipped.','12667509xEBzZj','Bridge\x20not\x20ready.\x20Call\x20queued\x20and\x20will\x20reject\x20if\x20the\x20bridge\x20never\x20becomes\x20available.','6bLahtq','313116qYfxot','BridgeUnavailable','NotReadyCallQueued','Bridge\x20call\x20failed.','6742470rJJbTd','18577NbPakc','129fcjfbd','Bridge\x20not\x20ready.\x20Event\x20handler\x20will\x20register\x20once\x20the\x20bridge\x20becomes\x20available.','28074470fUbBdM','390120WlfsrI','UnavailableHandlerSkipped'];a6_0x1dce=function(){return _0xec815a;};return a6_0x1dce();}(function(_0x435703){var _0x5a711f=a6_0x40fe;_0x435703[_0x5a711f(0x166)]=_0x5a711f(0x168),_0x435703[_0x5a711f(0x16e)]=_0x5a711f(0x165),_0x435703['CallFailed']=_0x5a711f(0x170);}(BridgeErrorMessage||(BridgeErrorMessage={})));export const buildCallTimeoutMessage=_0x4b840f=>'Bridge\x20call\x20timed\x20out:\x20'+_0x4b840f;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a7_0x4b7670=a7_0x2ca8;(function(_0x471548,_0x1a3de7){const _0x4aaa49=a7_0x2ca8,_0x7d88bf=_0x471548();while(!![]){try{const _0x58998e=parseInt(_0x4aaa49(0x1c4))/0x1*(parseInt(_0x4aaa49(0x1b9))/0x2)+parseInt(_0x4aaa49(0x1cc))/0x3*(-parseInt(_0x4aaa49(0x1ca))/0x4)+-parseInt(_0x4aaa49(0x1c3))/0x5+parseInt(_0x4aaa49(0x1b0))/0x6*(-parseInt(_0x4aaa49(0x1cb))/0x7)+parseInt(_0x4aaa49(0x1bf))/0x8*(parseInt(_0x4aaa49(0x1bb))/0x9)+-parseInt(_0x4aaa49(0x1b4))/0xa+-parseInt(_0x4aaa49(0x1b8))/0xb*(-parseInt(_0x4aaa49(0x1c6))/0xc);if(_0x58998e===_0x1a3de7)break;else _0x7d88bf['push'](_0x7d88bf['shift']());}catch(_0x31c747){_0x7d88bf['push'](_0x7d88bf['shift']());}}}(a7_0x5afd,0x3d91b));function a7_0x5afd(){const _0x53f9bb=['logger','calls','2514295UpaOfh','246811BsHIxd','callTimeoutMs','156dFHhmV','rejectAllPending','warnUnavailableOnce','call','960188uXrsEh','356923VcwxdA','3wuUMrm','54taYmzi','callCounter','warn','then','4328230DeAnHU','createId','transport','now','976151czJsJu','2meOQgq','events','387ioXdOv','isReady','queue','warnedUnavailable','90488IUJPMT','registerPendingHandlers'];a7_0x5afd=function(){return _0x53f9bb;};return a7_0x5afd();}import{WebViewJavascriptBridgeTransport}from'../Transport';import{BridgeErrorMessage}from'./BridgeTypes';import{BridgeCalls}from'./BridgeCalls';import{BridgeEvents}from'./BridgeEvents';import{BridgeQueue}from'./BridgeQueue';function a7_0x2ca8(_0x706426,_0x4ef10a){_0x706426=_0x706426-0x1b0;const _0x5afdbb=a7_0x5afd();let _0x2ca85c=_0x5afdbb[_0x706426];return _0x2ca85c;}export class NativeBridge{constructor(_0x9f6f1a={}){const _0x4c1449=a7_0x2ca8;this[_0x4c1449(0x1bd)]=new BridgeQueue(),this[_0x4c1449(0x1bc)]=![],this['warnedUnavailable']=![],this[_0x4c1449(0x1b1)]=0x0,this[_0x4c1449(0x1b6)]=_0x9f6f1a['transport']??new WebViewJavascriptBridgeTransport(),this[_0x4c1449(0x1c1)]=_0x9f6f1a[_0x4c1449(0x1c1)]??console,this[_0x4c1449(0x1c5)]=_0x9f6f1a[_0x4c1449(0x1c5)]??0x2710,this[_0x4c1449(0x1c2)]=new BridgeCalls({'transport':this['transport'],'queue':this['queue'],'callTimeoutMs':this[_0x4c1449(0x1c5)],'warnUnavailableOnce':_0x4072de=>this[_0x4c1449(0x1c8)](_0x4072de),'createId':()=>this['createId']()}),this[_0x4c1449(0x1ba)]=new BridgeEvents({'transport':this[_0x4c1449(0x1b6)],'queue':this['queue'],'warnUnavailableOnce':_0x7e383a=>this[_0x4c1449(0x1c8)](_0x7e383a),'logger':this['logger']}),this['transport']['whenReady']()[_0x4c1449(0x1b3)](_0x4379d9=>{const _0x33899d=_0x4c1449;this[_0x33899d(0x1bc)]=!![],_0x4379d9?(this[_0x33899d(0x1ba)][_0x33899d(0x1c0)](_0x4379d9),this[_0x33899d(0x1c2)]['flushPendingCalls']()):this[_0x33899d(0x1c2)][_0x33899d(0x1c7)](BridgeErrorMessage['BridgeUnavailable']);});}[a7_0x4b7670(0x1c9)](_0x631e10,_0xa35a27=null){const _0x17ca94=a7_0x4b7670;return this[_0x17ca94(0x1c2)]['call'](_0x631e10,_0xa35a27,this[_0x17ca94(0x1bc)]);}['on'](_0x20ae67,_0x1c9342){this['events']['on'](_0x20ae67,_0x1c9342,this['isReady']);}[a7_0x4b7670(0x1c8)](_0x142c80){const _0x481fb0=a7_0x4b7670;if(this[_0x481fb0(0x1be)])return;this[_0x481fb0(0x1be)]=!![],this[_0x481fb0(0x1c1)][_0x481fb0(0x1b2)](_0x142c80);}[a7_0x4b7670(0x1b5)](){const _0x4c823=a7_0x4b7670;return this['callCounter']+=0x1,'js_'+Date[_0x4c823(0x1b7)]()+'_'+this[_0x4c823(0x1b1)];}}let singleton=null;export const getBridge=(_0x3253fd={})=>{return!singleton&&(singleton=new NativeBridge(_0x3253fd)),singleton;};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function a8_0xcb4d(_0x381a75,_0x6e6a46){_0x381a75=_0x381a75-0x176;var _0x389eae=a8_0x389e();var _0xcb4d87=_0x389eae[_0x381a75];return _0xcb4d87;}function a8_0x389e(){var _0x27970a=['178885kfhjSo','544229FeEHjQ','2dtQiTn','1227087EynocD','1031190qSjfYG','417017UMuUrg','44FrWKMI','756180zHgBKL','1213992eZfnsu'];a8_0x389e=function(){return _0x27970a;};return a8_0x389e();}(function(_0x6c906c,_0x3dfb96){var _0x46a90f=a8_0xcb4d,_0x5367ec=_0x6c906c();while(!![]){try{var _0x463ee7=-parseInt(_0x46a90f(0x179))/0x1*(-parseInt(_0x46a90f(0x176))/0x2)+-parseInt(_0x46a90f(0x177))/0x3+parseInt(_0x46a90f(0x17a))/0x4*(parseInt(_0x46a90f(0x17d))/0x5)+parseInt(_0x46a90f(0x178))/0x6+-parseInt(_0x46a90f(0x17e))/0x7+-parseInt(_0x46a90f(0x17c))/0x8+-parseInt(_0x46a90f(0x17b))/0x9;if(_0x463ee7===_0x3dfb96)break;else _0x5367ec['push'](_0x5367ec['shift']());}catch(_0x2d3b92){_0x5367ec['push'](_0x5367ec['shift']());}}}(a8_0x389e,0x3f72c));export{NativeBridge,getBridge}from'./core/nativeBridge/NativeBridge';export{WebViewJavascriptBridgeTransport}from'./core/Transport';export{BridgeProvider as ReactBridgeProvider,useBridge as useReactBridge}from'./react/useBridge';export{createBridgePlugin}from'./vue/plugin';export{useBridge}from'./vue/useBridge';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function a9_0x1465(_0x3ff70b,_0x27b20f){_0x3ff70b=_0x3ff70b-0x1c1;const _0xa158ff=a9_0xa158();let _0x14655d=_0xa158ff[_0x3ff70b];return _0x14655d;}(function(_0x397569,_0x57a5a7){const _0x281c37=a9_0x1465,_0x1a7d57=_0x397569();while(!![]){try{const _0x32939b=-parseInt(_0x281c37(0x1c8))/0x1+parseInt(_0x281c37(0x1c1))/0x2*(parseInt(_0x281c37(0x1cc))/0x3)+-parseInt(_0x281c37(0x1c5))/0x4*(-parseInt(_0x281c37(0x1c3))/0x5)+parseInt(_0x281c37(0x1c4))/0x6*(parseInt(_0x281c37(0x1c6))/0x7)+-parseInt(_0x281c37(0x1ca))/0x8*(parseInt(_0x281c37(0x1cd))/0x9)+parseInt(_0x281c37(0x1ce))/0xa*(parseInt(_0x281c37(0x1c7))/0xb)+-parseInt(_0x281c37(0x1c9))/0xc*(-parseInt(_0x281c37(0x1cb))/0xd);if(_0x32939b===_0x57a5a7)break;else _0x1a7d57['push'](_0x1a7d57['shift']());}catch(_0x44af37){_0x1a7d57['push'](_0x1a7d57['shift']());}}}(a9_0xa158,0x4d216));import a9_0x54b641,{createContext,useContext,useMemo}from'react';import{getBridge}from'../core/nativeBridge/NativeBridge';const BridgeContext=createContext(null);function a9_0xa158(){const _0x5521e3=['360VfHAfy','256IFkUQP','31447bSFrGW','147102BsTCcG','134307NatOhH','5623780hvOmSW','2MUHaCP','Provider','355ngQWFN','114JuLgxD','27404GtaKaY','83601AXRTSB','11qpOzMY','603858rbjaGQ'];a9_0xa158=function(){return _0x5521e3;};return a9_0xa158();}export const BridgeProvider=({children:_0x46ac70,options:_0x35c00f})=>{const _0x5db624=a9_0x1465,_0x5ecdff=useMemo(()=>getBridge(_0x35c00f??{}),[_0x35c00f]);return a9_0x54b641['createElement'](BridgeContext[_0x5db624(0x1c2)],{'value':_0x5ecdff},_0x46ac70);};export const useBridge=()=>{const _0x54219a=useContext(BridgeContext);return _0x54219a??getBridge();};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(_0x3c3d8f,_0x3f45a0){const _0x5c543a=a10_0x3e46,_0x280b7b=_0x3c3d8f();while(!![]){try{const _0x2a8e3f=parseInt(_0x5c543a(0x1a1))/0x1*(parseInt(_0x5c543a(0x1a5))/0x2)+parseInt(_0x5c543a(0x19a))/0x3+parseInt(_0x5c543a(0x19c))/0x4+parseInt(_0x5c543a(0x1a4))/0x5*(-parseInt(_0x5c543a(0x19e))/0x6)+parseInt(_0x5c543a(0x1a2))/0x7*(-parseInt(_0x5c543a(0x1a3))/0x8)+-parseInt(_0x5c543a(0x1a6))/0x9*(parseInt(_0x5c543a(0x1a0))/0xa)+parseInt(_0x5c543a(0x1a7))/0xb;if(_0x2a8e3f===_0x3f45a0)break;else _0x280b7b['push'](_0x280b7b['shift']());}catch(_0x3672bc){_0x280b7b['push'](_0x280b7b['shift']());}}}(a10_0x3743,0x8b188));function a10_0x3e46(_0x5715e4,_0x26d123){_0x5715e4=_0x5715e4-0x19a;const _0x374309=a10_0x3743();let _0x3e4645=_0x374309[_0x5715e4];return _0x3e4645;}import{markRaw}from'vue';import{getBridge}from'../core/nativeBridge/NativeBridge';function a10_0x3743(){const _0x40a21a=['250uNsVkl','43JBtCWJ','6101879RTehHH','8EBWFde','73195gRqbHl','28706igOPdj','260883IqMceW','17183397uFcNRc','2546121lOTrNS','$bridge','124296TgtRvv','globalProperties','366HLQFEM','config'];a10_0x3743=function(){return _0x40a21a;};return a10_0x3743();}export const createBridgePlugin=(_0x11d1dc={})=>({'install'(_0x441a35){const _0x4e1f56=a10_0x3e46,_0x4c5000=markRaw(getBridge(_0x11d1dc));_0x441a35[_0x4e1f56(0x19f)][_0x4e1f56(0x19d)][_0x4e1f56(0x19b)]=_0x4c5000;}});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function a11_0xac2e(){const _0x29ad8f=['24741SwDmZG','469511OlIOEP','5802186ctzhpx','775445DulWtG','63363zNBbmG','12AlhJGR','1860tMyNXB','556194jCHskO','2jGHySF','64EwlEcg','60TOyxdE','100dNjEET','207366KteoLd'];a11_0xac2e=function(){return _0x29ad8f;};return a11_0xac2e();}(function(_0x5963f6,_0x4ded48){const _0x212a68=a11_0x1121,_0x25d81b=_0x5963f6();while(!![]){try{const _0x3ef870=parseInt(_0x212a68(0xe9))/0x1*(parseInt(_0x212a68(0xe8))/0x2)+parseInt(_0x212a68(0xf2))/0x3*(-parseInt(_0x212a68(0xec))/0x4)+parseInt(_0x212a68(0xeb))/0x5*(-parseInt(_0x212a68(0xed))/0x6)+parseInt(_0x212a68(0xef))/0x7*(parseInt(_0x212a68(0xea))/0x8)+parseInt(_0x212a68(0xee))/0x9*(parseInt(_0x212a68(0xf4))/0xa)+-parseInt(_0x212a68(0xf1))/0xb*(-parseInt(_0x212a68(0xf3))/0xc)+-parseInt(_0x212a68(0xf0))/0xd;if(_0x3ef870===_0x4ded48)break;else _0x25d81b['push'](_0x25d81b['shift']());}catch(_0x1112a9){_0x25d81b['push'](_0x25d81b['shift']());}}}(a11_0xac2e,0x45b44));import{getBridge}from'../core/nativeBridge/NativeBridge';function a11_0x1121(_0x11e827,_0x959c03){_0x11e827=_0x11e827-0xe8;const _0xac2e91=a11_0xac2e();let _0x1121bf=_0xac2e91[_0x11e827];return _0x1121bf;}export const useBridge=()=>getBridge();
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@smart-axiata/js-bridge",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Smart Axiata Cambodia WebView bridge with core JS, Vue, and React adapters.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc -p tsconfig.build.json",
|
|
20
|
+
"build:obfuscate": "npm run build && npm run obfuscate && rm -rf dist && mv dist-obfuscated dist",
|
|
21
|
+
"clean": "rm -rf dist",
|
|
22
|
+
"obfuscate": "javascript-obfuscator dist --output dist-obfuscated --config obfuscator.config.json",
|
|
23
|
+
"prepublishOnly": "npm run build:obfuscate"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"vue",
|
|
27
|
+
"webview",
|
|
28
|
+
"bridge",
|
|
29
|
+
"javascript"
|
|
30
|
+
],
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"react": "^18.2.0",
|
|
34
|
+
"vue": "^3.3.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/react": "^18.2.66",
|
|
38
|
+
"javascript-obfuscator": "^4.1.0",
|
|
39
|
+
"react": "^18.2.0",
|
|
40
|
+
"typescript": "^5.4.0",
|
|
41
|
+
"vue": "^3.4.0"
|
|
42
|
+
}
|
|
43
|
+
}
|