@vetc-miniapp/apis 0.0.26 → 0.0.27
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.cjs +1 -1
- package/dist/index.d.ts +21 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e="undefined"!=typeof window,t=async(t,r={})=>{const a=e&&window.flutter_inappwebview&&"function"==typeof window.flutter_inappwebview.callHandler?window.flutter_inappwebview:null;if(!a)return{ok:!1,error:"BRIDGE_CALL_FAILED"};try{const e=await a.callHandler("MiniAppBridge",{action:t,payload:r});return console.log("Bridge response:",e),e}catch(e){return console.error("Bridge error:",e),{ok:!1,error:"BRIDGE_CALL_FAILED"}}},r={confirmBeforeExit:(e,r)=>t("confirmBeforeExit",{title:e,message:r}),exitMiniApp:()=>t("exitMiniApp",{}),openAppSetting:()=>t("openAppSetting",{}),openNativeAppStore:(e,r)=>t("openNativeAppStore",{appleStoreId:e,googlePlayId:r}),shareApp:(e,r,a,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const e="undefined"!=typeof window,t=async(t,r={})=>{const a=e&&window.flutter_inappwebview&&"function"==typeof window.flutter_inappwebview.callHandler?window.flutter_inappwebview:null;if(!a)return{ok:!1,error:"BRIDGE_CALL_FAILED"};try{const e=await a.callHandler("MiniAppBridge",{action:t,payload:r});return console.log("Bridge response:",e),e}catch(e){return console.error("Bridge error:",e),{ok:!1,error:"BRIDGE_CALL_FAILED"}}},r={confirmBeforeExit:(e,r)=>t("confirmBeforeExit",{title:e,message:r}),exitMiniApp:()=>t("exitMiniApp",{}),openAppSetting:()=>t("openAppSetting",{}),openNativeAppStore:(e,r)=>t("openNativeAppStore",{appleStoreId:e,googlePlayId:r}),shareApp:(e,r,a,o)=>t("shareApp",{title:e,description:r,path:a,url:o}),getAuthCode:e=>t("getAuthCode",{scopes:e}),getUserInfo:()=>t("getUserInfo",{}),scanQr:(e=[])=>t("scanQr",{patterns:e}),closeScanQr:()=>t("closeScanQr",{}),pushEvent:(e,r={})=>t("pushEvent",{eventName:e,properties:r}),navigate:(e,r={})=>t("navigate",{type:"native",screen:e,params:r}),close:(e={})=>t("close",{result:e}),openTel:e=>t("openTel",{phone:e}),openGoogleMap:e=>t("openGoogleMap",{url:e}),chooseImage:({count:e,includeBase64:r,sourceType:a}={})=>t("chooseImage",{count:e,includeBase64:r,sourceType:a}),getBase64ByPath:({path:e})=>t("getBase64ByPath",{path:e}),addWatermarkImage:({originalPath:e,watermarkUrl:r,opacity:a,fileName:o,watermarkWidth:i,watermarkHeight:s,positionWatermarkX:n,positionWatermarkY:p,scale:l})=>t("addWatermarkImage",{originalPath:e,watermarkUrl:r,opacity:a,fileName:o,watermarkWidth:i,watermarkHeight:s,positionWatermarkX:n,positionWatermarkY:p,scale:l}),compressImage:({path:e,quality:r,minWidth:a,minHeight:o})=>t("compressImage",{path:e,quality:r,minWidth:a,minHeight:o}),getImageInfo:({path:e})=>t("getImageInfo",{path:e}),uploadFile:({path:e,url:r,headers:a,extraData:o,fieldName:i,method:s})=>t("uploadFile",{path:e,url:r,headers:a,extraData:o,fieldName:i,method:s}),uploadFileMinio:({path:e,url:r,headers:a,extraData:o,fieldName:i,method:s})=>t("uploadFileMinio",{path:e,url:r,headers:a,extraData:o,fieldName:i,method:s}),initPayment:({merchantOrderId:e,merchantService:r,amount:a,productName:o,midName:i,mid:s,tid:n,orderDesc:p,requestDate:l,serviceType:m,signature:c,extraData:d,onResult:u,ipnUrl:h,callbackUrl:g})=>t("initPayment",{merchantOrderId:e,merchantService:r,amount:a,productName:o,midName:i,mid:s,tid:n,orderDesc:p,requestDate:l,serviceType:m,signature:c,extraData:d,onResult:u,ipnUrl:h,callbackUrl:g}),getCurrentLocation:()=>t("getCurrentLocation",{}),requestPermission:(e,r)=>t("requestPermission",{permission:e,reason:r}),requestLocation:e=>r.requestPermission("location",e),requestCamera:e=>r.requestPermission("camera",e),requestMicrophone:e=>r.requestPermission("microphone",e),requestPhotos:e=>r.requestPermission("photos",e),requestContacts:e=>r.requestPermission("contacts",e),requestBluetooth:e=>r.requestPermission("bluetooth",e),requestNFC:e=>r.requestPermission("nfc",e),getClipboard:()=>t("getClipboard",{}),setClipboard:({text:e})=>t("setClipboard",{text:e}),setStorage:({key:e,data:r})=>t("setStorage",{key:e,data:r}),getStorage:({key:e})=>t("getStorage",{key:e}),removeStorage:({key:e})=>t("removeStorage",{key:e}),clearStorage:()=>t("clearStorage",{}),_listeners:{},on(e,t){r._listeners[e]||(r._listeners[e]=[]),r._listeners[e].push(t)},_emit(e,t){(r._listeners[e]||[]).forEach(e=>e(t))}};e&&window.addEventListener("miniapp_event",e=>{const{type:t,data:a}=e.detail||{};r._emit(t,a)}),exports.MiniApp=r,exports.callHost=t,exports.default=r;
|
package/dist/index.d.ts
CHANGED
|
@@ -64,6 +64,19 @@ export interface InitPaymentOptions {
|
|
|
64
64
|
extraData?: Record<string, any>;
|
|
65
65
|
onResult: (res: IVETCMiniAppResponse) => void;
|
|
66
66
|
}
|
|
67
|
+
export interface SetClipboardOptions {
|
|
68
|
+
text: string;
|
|
69
|
+
}
|
|
70
|
+
export interface SetStorageOptions {
|
|
71
|
+
key: string;
|
|
72
|
+
data: unknown;
|
|
73
|
+
}
|
|
74
|
+
export interface GetStorageOptions {
|
|
75
|
+
key: string;
|
|
76
|
+
}
|
|
77
|
+
export interface RemoveStorageOptions {
|
|
78
|
+
key: string;
|
|
79
|
+
}
|
|
67
80
|
export interface MiniAppSDK {
|
|
68
81
|
confirmBeforeExit(title?: string, message?: string): Promise<IVETCMiniAppResponse>;
|
|
69
82
|
exitMiniApp(): Promise<IVETCMiniAppResponse>;
|
|
@@ -120,6 +133,14 @@ export interface MiniAppSDK {
|
|
|
120
133
|
requestContacts(reason?: string): Promise<IVETCMiniAppResponse>;
|
|
121
134
|
requestBluetooth(reason?: string): Promise<IVETCMiniAppResponse>;
|
|
122
135
|
requestNFC(reason?: string): Promise<IVETCMiniAppResponse>;
|
|
136
|
+
getClipboard(): Promise<IVETCMiniAppResponse<string>>;
|
|
137
|
+
setClipboard(options: SetClipboardOptions): Promise<IVETCMiniAppResponse>;
|
|
138
|
+
setStorage(options: SetStorageOptions): Promise<IVETCMiniAppResponse>;
|
|
139
|
+
getStorage(options: GetStorageOptions): Promise<IVETCMiniAppResponse<{
|
|
140
|
+
data: unknown;
|
|
141
|
+
}>>;
|
|
142
|
+
removeStorage(options: RemoveStorageOptions): Promise<IVETCMiniAppResponse>;
|
|
143
|
+
clearStorage(): Promise<IVETCMiniAppResponse>;
|
|
123
144
|
on(event: string, callback: (data: any) => void): void;
|
|
124
145
|
_emit(event: string, data?: any): void;
|
|
125
146
|
_listeners: Record<string, ((data: any) => void)[]>;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e="undefined"!=typeof window,t=async(t,a={})=>{const r=e&&window.flutter_inappwebview&&"function"==typeof window.flutter_inappwebview.callHandler?window.flutter_inappwebview:null;if(!r)return{ok:!1,error:"BRIDGE_CALL_FAILED"};try{const e=await r.callHandler("MiniAppBridge",{action:t,payload:a});return console.log("Bridge response:",e),e}catch(e){return console.error("Bridge error:",e),{ok:!1,error:"BRIDGE_CALL_FAILED"}}},a={confirmBeforeExit:(e,a)=>t("confirmBeforeExit",{title:e,message:a}),exitMiniApp:()=>t("exitMiniApp",{}),openAppSetting:()=>t("openAppSetting",{}),openNativeAppStore:(e,a)=>t("openNativeAppStore",{appleStoreId:e,googlePlayId:a}),shareApp:(e,a,r,
|
|
1
|
+
const e="undefined"!=typeof window,t=async(t,a={})=>{const r=e&&window.flutter_inappwebview&&"function"==typeof window.flutter_inappwebview.callHandler?window.flutter_inappwebview:null;if(!r)return{ok:!1,error:"BRIDGE_CALL_FAILED"};try{const e=await r.callHandler("MiniAppBridge",{action:t,payload:a});return console.log("Bridge response:",e),e}catch(e){return console.error("Bridge error:",e),{ok:!1,error:"BRIDGE_CALL_FAILED"}}},a={confirmBeforeExit:(e,a)=>t("confirmBeforeExit",{title:e,message:a}),exitMiniApp:()=>t("exitMiniApp",{}),openAppSetting:()=>t("openAppSetting",{}),openNativeAppStore:(e,a)=>t("openNativeAppStore",{appleStoreId:e,googlePlayId:a}),shareApp:(e,a,r,o)=>t("shareApp",{title:e,description:a,path:r,url:o}),getAuthCode:e=>t("getAuthCode",{scopes:e}),getUserInfo:()=>t("getUserInfo",{}),scanQr:(e=[])=>t("scanQr",{patterns:e}),closeScanQr:()=>t("closeScanQr",{}),pushEvent:(e,a={})=>t("pushEvent",{eventName:e,properties:a}),navigate:(e,a={})=>t("navigate",{type:"native",screen:e,params:a}),close:(e={})=>t("close",{result:e}),openTel:e=>t("openTel",{phone:e}),openGoogleMap:e=>t("openGoogleMap",{url:e}),chooseImage:({count:e,includeBase64:a,sourceType:r}={})=>t("chooseImage",{count:e,includeBase64:a,sourceType:r}),getBase64ByPath:({path:e})=>t("getBase64ByPath",{path:e}),addWatermarkImage:({originalPath:e,watermarkUrl:a,opacity:r,fileName:o,watermarkWidth:i,watermarkHeight:n,positionWatermarkX:s,positionWatermarkY:p,scale:l})=>t("addWatermarkImage",{originalPath:e,watermarkUrl:a,opacity:r,fileName:o,watermarkWidth:i,watermarkHeight:n,positionWatermarkX:s,positionWatermarkY:p,scale:l}),compressImage:({path:e,quality:a,minWidth:r,minHeight:o})=>t("compressImage",{path:e,quality:a,minWidth:r,minHeight:o}),getImageInfo:({path:e})=>t("getImageInfo",{path:e}),uploadFile:({path:e,url:a,headers:r,extraData:o,fieldName:i,method:n})=>t("uploadFile",{path:e,url:a,headers:r,extraData:o,fieldName:i,method:n}),uploadFileMinio:({path:e,url:a,headers:r,extraData:o,fieldName:i,method:n})=>t("uploadFileMinio",{path:e,url:a,headers:r,extraData:o,fieldName:i,method:n}),initPayment:({merchantOrderId:e,merchantService:a,amount:r,productName:o,midName:i,mid:n,tid:s,orderDesc:p,requestDate:l,serviceType:m,signature:c,extraData:d,onResult:u,ipnUrl:h,callbackUrl:g})=>t("initPayment",{merchantOrderId:e,merchantService:a,amount:r,productName:o,midName:i,mid:n,tid:s,orderDesc:p,requestDate:l,serviceType:m,signature:c,extraData:d,onResult:u,ipnUrl:h,callbackUrl:g}),getCurrentLocation:()=>t("getCurrentLocation",{}),requestPermission:(e,a)=>t("requestPermission",{permission:e,reason:a}),requestLocation:e=>a.requestPermission("location",e),requestCamera:e=>a.requestPermission("camera",e),requestMicrophone:e=>a.requestPermission("microphone",e),requestPhotos:e=>a.requestPermission("photos",e),requestContacts:e=>a.requestPermission("contacts",e),requestBluetooth:e=>a.requestPermission("bluetooth",e),requestNFC:e=>a.requestPermission("nfc",e),getClipboard:()=>t("getClipboard",{}),setClipboard:({text:e})=>t("setClipboard",{text:e}),setStorage:({key:e,data:a})=>t("setStorage",{key:e,data:a}),getStorage:({key:e})=>t("getStorage",{key:e}),removeStorage:({key:e})=>t("removeStorage",{key:e}),clearStorage:()=>t("clearStorage",{}),_listeners:{},on(e,t){a._listeners[e]||(a._listeners[e]=[]),a._listeners[e].push(t)},_emit(e,t){(a._listeners[e]||[]).forEach(e=>e(t))}};e&&window.addEventListener("miniapp_event",e=>{const{type:t,data:r}=e.detail||{};a._emit(t,r)});export{a as MiniApp,t as callHost,a as default};
|