@vetc-miniapp/apis 0.0.26 → 0.0.28
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 +120 -1
- 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,117 @@ 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
|
+
}
|
|
80
|
+
export interface EventProperties {
|
|
81
|
+
userId?: string;
|
|
82
|
+
sdkVersion?: string;
|
|
83
|
+
screenName?: string;
|
|
84
|
+
taxanomy?: string;
|
|
85
|
+
source?: string;
|
|
86
|
+
utmSource?: string;
|
|
87
|
+
utmMedium?: string;
|
|
88
|
+
utmCampaign?: string;
|
|
89
|
+
utmTerm?: string;
|
|
90
|
+
utmContent?: string;
|
|
91
|
+
gclid?: string;
|
|
92
|
+
eGuid?: string;
|
|
93
|
+
campaignId?: string;
|
|
94
|
+
campaignType?: string;
|
|
95
|
+
placement?: string;
|
|
96
|
+
paymentMethod?: string;
|
|
97
|
+
bankCode?: string;
|
|
98
|
+
cardBrand?: string;
|
|
99
|
+
status?: string;
|
|
100
|
+
errorCode?: string;
|
|
101
|
+
failStage?: string;
|
|
102
|
+
feeAmount?: number;
|
|
103
|
+
itemCount?: number;
|
|
104
|
+
tollTxnId?: string;
|
|
105
|
+
plazaId?: string;
|
|
106
|
+
routeId?: string;
|
|
107
|
+
tagId?: string;
|
|
108
|
+
vehiclePlate?: string;
|
|
109
|
+
topupChannel?: string;
|
|
110
|
+
vepPassId?: string;
|
|
111
|
+
parkingLotId?: string;
|
|
112
|
+
durationMonths?: number;
|
|
113
|
+
expiryDate?: string;
|
|
114
|
+
policyId?: string;
|
|
115
|
+
insurer?: string;
|
|
116
|
+
coverageStart?: string;
|
|
117
|
+
coverageEnd?: string;
|
|
118
|
+
provider?: string;
|
|
119
|
+
coverageArea?: string;
|
|
120
|
+
policyStatus?: string;
|
|
121
|
+
policyNoMasked?: string;
|
|
122
|
+
insurerCode?: string;
|
|
123
|
+
fileType?: string;
|
|
124
|
+
poolCode?: string;
|
|
125
|
+
points?: number;
|
|
126
|
+
loyaltyReason?: string;
|
|
127
|
+
referralCode?: string;
|
|
128
|
+
publisherId?: string;
|
|
129
|
+
conversionId?: string;
|
|
130
|
+
commissionAmount?: number;
|
|
131
|
+
threshold?: number;
|
|
132
|
+
runId?: string;
|
|
133
|
+
ekycMethod?: string;
|
|
134
|
+
accountId?: string;
|
|
135
|
+
linkStatus?: string;
|
|
136
|
+
vehicleType?: string;
|
|
137
|
+
isPrimary?: boolean;
|
|
138
|
+
direction?: string;
|
|
139
|
+
counterpartyHash?: string;
|
|
140
|
+
errorType?: string;
|
|
141
|
+
apiName?: string;
|
|
142
|
+
endpoint?: string;
|
|
143
|
+
statusCode?: number;
|
|
144
|
+
timeoutMs?: number;
|
|
145
|
+
errorMessage?: string;
|
|
146
|
+
latencyMs?: number;
|
|
147
|
+
retryCount?: number;
|
|
148
|
+
networkType?: string;
|
|
149
|
+
reason?: string;
|
|
150
|
+
result?: string;
|
|
151
|
+
invoiceStatus?: string;
|
|
152
|
+
entryPoint?: string;
|
|
153
|
+
entryCtaId?: string;
|
|
154
|
+
prevScreen?: string;
|
|
155
|
+
prevEvent?: string;
|
|
156
|
+
deeplinkId?: string;
|
|
157
|
+
msgId?: string;
|
|
158
|
+
actionType?: string;
|
|
159
|
+
actionId?: string;
|
|
160
|
+
currentScreen?: string;
|
|
161
|
+
targetScreen?: string;
|
|
162
|
+
positionIndex?: number;
|
|
163
|
+
value?: any;
|
|
164
|
+
formName?: string;
|
|
165
|
+
fieldCount?: number;
|
|
166
|
+
otpChannel?: string;
|
|
167
|
+
clientTs?: number;
|
|
168
|
+
slaTargetMin?: number;
|
|
169
|
+
etaMin?: number;
|
|
170
|
+
driverEtaSource?: string;
|
|
171
|
+
experimentKey?: string;
|
|
172
|
+
variant?: string;
|
|
173
|
+
subjectId?: string;
|
|
174
|
+
journeyId?: string;
|
|
175
|
+
termsVersion?: string;
|
|
176
|
+
[key: string]: any;
|
|
177
|
+
}
|
|
67
178
|
export interface MiniAppSDK {
|
|
68
179
|
confirmBeforeExit(title?: string, message?: string): Promise<IVETCMiniAppResponse>;
|
|
69
180
|
exitMiniApp(): Promise<IVETCMiniAppResponse>;
|
|
@@ -81,7 +192,7 @@ export interface MiniAppSDK {
|
|
|
81
192
|
}>>;
|
|
82
193
|
scanQr(patterns?: string[]): Promise<IVETCMiniAppResponse>;
|
|
83
194
|
closeScanQr(): Promise<IVETCMiniAppResponse>;
|
|
84
|
-
pushEvent(eventName: string, properties?:
|
|
195
|
+
pushEvent(eventName: string, properties?: EventProperties): Promise<IVETCMiniAppResponse>;
|
|
85
196
|
navigate(screen: string, params?: NavigateParams): Promise<IVETCMiniAppResponse>;
|
|
86
197
|
close(result?: any): Promise<IVETCMiniAppResponse>;
|
|
87
198
|
openTel(phone: string): Promise<IVETCMiniAppResponse>;
|
|
@@ -120,6 +231,14 @@ export interface MiniAppSDK {
|
|
|
120
231
|
requestContacts(reason?: string): Promise<IVETCMiniAppResponse>;
|
|
121
232
|
requestBluetooth(reason?: string): Promise<IVETCMiniAppResponse>;
|
|
122
233
|
requestNFC(reason?: string): Promise<IVETCMiniAppResponse>;
|
|
234
|
+
getClipboard(): Promise<IVETCMiniAppResponse<string>>;
|
|
235
|
+
setClipboard(options: SetClipboardOptions): Promise<IVETCMiniAppResponse>;
|
|
236
|
+
setStorage(options: SetStorageOptions): Promise<IVETCMiniAppResponse>;
|
|
237
|
+
getStorage(options: GetStorageOptions): Promise<IVETCMiniAppResponse<{
|
|
238
|
+
data: unknown;
|
|
239
|
+
}>>;
|
|
240
|
+
removeStorage(options: RemoveStorageOptions): Promise<IVETCMiniAppResponse>;
|
|
241
|
+
clearStorage(): Promise<IVETCMiniAppResponse>;
|
|
123
242
|
on(event: string, callback: (data: any) => void): void;
|
|
124
243
|
_emit(event: string, data?: any): void;
|
|
125
244
|
_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};
|