@vetc-miniapp/apis 0.0.18 → 0.0.20

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vetc-miniapp/apis",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "description": "MiniApp Platform JS SDK",
5
5
  "main": "src/apis/index.js",
6
6
  "type": "module",
@@ -95,6 +95,8 @@ export interface MiniAppSDK {
95
95
 
96
96
  chooseImage({ count?: number, includeBase64: boolean, sourceType?: ("camera" | "album")[], success?: Function, fail?: Function, complete?: Function }):Promise<IVETCMiniAppResponse<ChooseImageFile[]>
97
97
 
98
+ initPayment({ merchantOrderId: string, merchantService: string, amount: double, productName: string, midName: string, mid: string, tid: string, orderDesc: string, requestDate: string, serviceType: string, signature: string, extraData: {[key: string]: any;}, onResult: Function }): Promise<IVETCMiniAppResponse>;
99
+
98
100
  requestPermission(
99
101
  permission: MiniAppPermission,
100
102
  reason?: string
package/src/apis/index.js CHANGED
@@ -80,6 +80,12 @@ export const MiniApp = {
80
80
  uploadFile({ path, url, headers, extraData, fieldName, method } = {}) {
81
81
  return callHost("uploadFile", { path, url, headers, extraData, fieldName, method });
82
82
  },
83
+ uploadFileMinio({ path, url, headers, extraData, fieldName, method } = {}) {
84
+ return callHost("uploadFileMinio", { path, url, headers, extraData, fieldName, method });
85
+ },
86
+ initPayment({ merchantOrderId, merchantService, amount, productName, midName, mid, tid, orderDesc, requestDate, serviceType, signature, extraData, onResult } = {}) {
87
+ return callHost("initPayment", { merchantOrderId, merchantService, amount, productName, midName, mid, tid, orderDesc, requestDate, serviceType, signature, extraData, onResult });
88
+ },
83
89
  requestPermission(permission, reason) {
84
90
  return callHost("requestPermission", { permission, reason });
85
91
  },
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.MiniApp=t():e.MiniApp=t()}(this,()=>(()=>{"use strict";var e={d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{MiniApp:()=>i,callHost:()=>r,default:()=>a});const o="undefined"!=typeof window,r=async(e,t={})=>{const r=o&&window.flutter_inappwebview&&window.flutter_inappwebview.callHandler&&"function"==typeof window.flutter_inappwebview.callHandler?window.flutter_inappwebview:null;if(!r)return{ok:!1,error:"BRIDGE_CALL_FAILED"};try{const o=await r.callHandler("MiniAppBridge",{action:e,payload:t});return console.log("Bridge response:",o),o}catch(e){return console.error("Bridge error:",e),{ok:!1,error:"BRIDGE_CALL_FAILED"}}},i={confirmBeforeExit:(e,t,o,i,a)=>r("confirmBeforeExit",{title:e,message:t,success:o,fail:i,complete:a}),exitMiniApp:(e,t,o)=>r("exitMiniApp",{success:e,fail:t,complete:o}),openAppSetting:(e,t,o)=>r("openAppSetting",{success:e,fail:t,complete:o}),openNativeAppStore:(e,t,o,i,a)=>r("openNativeAppStore",{appleStoreId:e,googlePlayId:t,success:o,fail:i,complete:a}),shareApp:(e,t,o,i,a,s,n)=>r("shareApp",{title:e,description:t,path:o,url:i,success:a,fail:s,complete:n}),getAuthCode:(e,t,o,i)=>r("getAuthCode",{scopes:e,success:t,fail:o,complete:i}),getUserInfo:(e,t,o)=>r("getUserInfo",{success:e,fail:t,complete:o}),scanQr:(e=[])=>r("scanQr",{patterns:e}),closeScanQr:()=>r("closeScanQr",{}),navigate:(e,t={})=>r("navigate",{type:"native",screen:e,params:t}),close:(e={})=>r("close",{result:e}),openTel:e=>r("openTel",{phone:e}),chooseImage:({count:e,includeBase64:t,sourceType:o,success:i,fail:a,complete:s}={})=>r("chooseImage",{count:e,includeBase64:t,sourceType:o,success:i,fail:a,complete:s}),getBase64ByPath:({path:e}={})=>r("getBase64ByPath",{path:e}),addWatermarkImage:({originalPath:e,watermarkUrl:t,opacity:o,fileName:i,watermarkWidth:a,watermarkHeight:s,positionWatermarkX:n,positionWatermarkY:p}={})=>r("addWatermarkImage",{originalPath:e,watermarkUrl:t,opacity:o,fileName:i,watermarkWidth:a,watermarkHeight:s,positionWatermarkX:n,positionWatermarkY:p}),uploadFile:({path:e,url:t,headers:o,extraData:i,fieldName:a,method:s}={})=>r("uploadFile",{path:e,url:t,headers:o,extraData:i,fieldName:a,method:s}),requestPermission:(e,t)=>r("requestPermission",{permission:e,reason:t}),requestLocation:e=>i.requestPermission("location",e),requestCamera:e=>i.requestPermission("camera",e),requestMicrophone:e=>i.requestPermission("microphone",e),requestPhotos:e=>i.requestPermission("photos",e),requestContacts:e=>i.requestPermission("contacts",e),requestBluetooth:e=>i.requestPermission("bluetooth",e),requestNFC:e=>i.requestPermission("nfc",e),_listeners:{},on(e,t){i._listeners[e]||(i._listeners[e]=[]),i._listeners[e].push(t)},_emit(e,t){(i._listeners[e]||[]).forEach(e=>e(t))}};o&&window.addEventListener("miniapp_event",e=>{const{type:t,data:o}=e.detail||{};i._emit(t,o)});const a=i;return t})());
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.MiniApp=t():e.MiniApp=t()}(this,()=>(()=>{"use strict";var e={d:(t,r)=>{for(var a in r)e.o(r,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:r[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{MiniApp:()=>o,callHost:()=>a,default:()=>i});const r="undefined"!=typeof window,a=async(e,t={})=>{const a=r&&window.flutter_inappwebview&&window.flutter_inappwebview.callHandler&&"function"==typeof window.flutter_inappwebview.callHandler?window.flutter_inappwebview:null;if(!a)return{ok:!1,error:"BRIDGE_CALL_FAILED"};try{const r=await a.callHandler("MiniAppBridge",{action:e,payload:t});return console.log("Bridge response:",r),r}catch(e){return console.error("Bridge error:",e),{ok:!1,error:"BRIDGE_CALL_FAILED"}}},o={confirmBeforeExit:(e,t,r,o,i)=>a("confirmBeforeExit",{title:e,message:t,success:r,fail:o,complete:i}),exitMiniApp:(e,t,r)=>a("exitMiniApp",{success:e,fail:t,complete:r}),openAppSetting:(e,t,r)=>a("openAppSetting",{success:e,fail:t,complete:r}),openNativeAppStore:(e,t,r,o,i)=>a("openNativeAppStore",{appleStoreId:e,googlePlayId:t,success:r,fail:o,complete:i}),shareApp:(e,t,r,o,i,s,n)=>a("shareApp",{title:e,description:t,path:r,url:o,success:i,fail:s,complete:n}),getAuthCode:(e,t,r,o)=>a("getAuthCode",{scopes:e,success:t,fail:r,complete:o}),getUserInfo:(e,t,r)=>a("getUserInfo",{success:e,fail:t,complete:r}),scanQr:(e=[])=>a("scanQr",{patterns:e}),closeScanQr:()=>a("closeScanQr",{}),navigate:(e,t={})=>a("navigate",{type:"native",screen:e,params:t}),close:(e={})=>a("close",{result:e}),openTel:e=>a("openTel",{phone:e}),chooseImage:({count:e,includeBase64:t,sourceType:r,success:o,fail:i,complete:s}={})=>a("chooseImage",{count:e,includeBase64:t,sourceType:r,success:o,fail:i,complete:s}),getBase64ByPath:({path:e}={})=>a("getBase64ByPath",{path:e}),addWatermarkImage:({originalPath:e,watermarkUrl:t,opacity:r,fileName:o,watermarkWidth:i,watermarkHeight:s,positionWatermarkX:n,positionWatermarkY:p}={})=>a("addWatermarkImage",{originalPath:e,watermarkUrl:t,opacity:r,fileName:o,watermarkWidth:i,watermarkHeight:s,positionWatermarkX:n,positionWatermarkY:p}),uploadFile:({path:e,url:t,headers:r,extraData:o,fieldName:i,method:s}={})=>a("uploadFile",{path:e,url:t,headers:r,extraData:o,fieldName:i,method:s}),uploadFileMinio:({path:e,url:t,headers:r,extraData:o,fieldName:i,method:s}={})=>a("uploadFileMinio",{path:e,url:t,headers:r,extraData:o,fieldName:i,method:s}),initPayment:({merchantOrderId:e,merchantService:t,amount:r,productName:o,midName:i,mid:s,tid:n,orderDesc:p,requestDate:l,serviceType:c,signature:u,extraData:d,onResult:m}={})=>a("initPayment",{merchantOrderId:e,merchantService:t,amount:r,productName:o,midName:i,mid:s,tid:n,orderDesc:p,requestDate:l,serviceType:c,signature:u,extraData:d,onResult:m}),requestPermission:(e,t)=>a("requestPermission",{permission:e,reason:t}),requestLocation:e=>o.requestPermission("location",e),requestCamera:e=>o.requestPermission("camera",e),requestMicrophone:e=>o.requestPermission("microphone",e),requestPhotos:e=>o.requestPermission("photos",e),requestContacts:e=>o.requestPermission("contacts",e),requestBluetooth:e=>o.requestPermission("bluetooth",e),requestNFC:e=>o.requestPermission("nfc",e),_listeners:{},on(e,t){o._listeners[e]||(o._listeners[e]=[]),o._listeners[e].push(t)},_emit(e,t){(o._listeners[e]||[]).forEach(e=>e(t))}};r&&window.addEventListener("miniapp_event",e=>{const{type:t,data:r}=e.detail||{};o._emit(t,r)});const i=o;return t})());