@btsd/aitu-bridge 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +1 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +1 -1
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/index.ts +17 -0
- package/src/version.ts +1 -1
package/src/index.ts
CHANGED
|
@@ -146,6 +146,7 @@ export interface AituBridge {
|
|
|
146
146
|
setCustomBackArrowMode: (enabled: boolean) => Promise<ResponseType>;
|
|
147
147
|
getCustomBackArrowMode: () => Promise<boolean>;
|
|
148
148
|
setCustomBackArrowVisible: (visible: boolean) => Promise<ResponseType>;
|
|
149
|
+
openPayment: (transactionId: string) => Promise<ResponseType>;
|
|
149
150
|
setCustomBackArrowOnClickHandler: (handler: BackArrowClickHandlerType) => void;
|
|
150
151
|
}
|
|
151
152
|
|
|
@@ -172,6 +173,7 @@ const setHeaderMenuItemClickHandlerMethod = 'setHeaderMenuItemClickHandler';
|
|
|
172
173
|
const setCustomBackArrowModeMethod = 'setCustomBackArrowMode';
|
|
173
174
|
const getCustomBackArrowModeMethod = 'getCustomBackArrowMode';
|
|
174
175
|
const setCustomBackArrowVisibleMethod = 'setCustomBackArrowVisible';
|
|
176
|
+
const openPaymentMethod = 'openPayment'
|
|
175
177
|
const setCustomBackArrowOnClickHandlerMethod = 'setCustomBackArrowOnClickHandler';
|
|
176
178
|
|
|
177
179
|
const android = typeof window !== 'undefined' && (window as any).AndroidBridge;
|
|
@@ -604,6 +606,19 @@ const buildBridge = (): AituBridge => {
|
|
|
604
606
|
}
|
|
605
607
|
}
|
|
606
608
|
|
|
609
|
+
const openPayment = (reqId, transactionId: string) => {
|
|
610
|
+
const isAndroid = android && android[openPaymentMethod];
|
|
611
|
+
const isIos = ios && ios[openPaymentMethod];
|
|
612
|
+
|
|
613
|
+
if (isAndroid) {
|
|
614
|
+
android[openPaymentMethod](reqId, transactionId);
|
|
615
|
+
} else if (isIos) {
|
|
616
|
+
ios[openPaymentMethod].postMessage({ reqId, transactionId });
|
|
617
|
+
} else {
|
|
618
|
+
console.log('--openPayment-isUnknown');
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
|
|
607
622
|
|
|
608
623
|
const invokePromise = promisifyInvoke(invoke, sub);
|
|
609
624
|
const storagePromise = promisifyStorage(storage, sub);
|
|
@@ -625,6 +640,7 @@ const buildBridge = (): AituBridge => {
|
|
|
625
640
|
const setCustomBackArrowModePromise = promisifyMethod(setCustomBackArrowMode, setCustomBackArrowModeMethod, sub);
|
|
626
641
|
const getCustomBackArrowModePromise = promisifyMethod(getCustomBackArrowMode, getCustomBackArrowModeMethod, sub);
|
|
627
642
|
const setCustomBackArrowVisiblePromise = promisifyMethod(setCustomBackArrowVisible, setCustomBackArrowVisibleMethod, sub);
|
|
643
|
+
const openPaymentPromise = promisifyMethod(openPayment, openPaymentMethod, sub);
|
|
628
644
|
|
|
629
645
|
return {
|
|
630
646
|
version: String(LIB_VERSION),
|
|
@@ -662,6 +678,7 @@ const buildBridge = (): AituBridge => {
|
|
|
662
678
|
setCustomBackArrowMode: setCustomBackArrowModePromise,
|
|
663
679
|
getCustomBackArrowMode: getCustomBackArrowModePromise,
|
|
664
680
|
setCustomBackArrowVisible: setCustomBackArrowVisiblePromise,
|
|
681
|
+
openPayment: openPaymentPromise,
|
|
665
682
|
setCustomBackArrowOnClickHandler,
|
|
666
683
|
}
|
|
667
684
|
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const LIB_VERSION = "0.3.
|
|
1
|
+
export const LIB_VERSION = "0.3.4";
|