zmp-sdk 2.45.1 → 2.46.0-beta.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.
@@ -1 +1 @@
1
- import t from'./../external/@swc/helpers/src/_async_to_generator.mjs.js';import e from"../appEnv/index.js";import o from"../common/notFound.js";import{functionHandler as r}from"../utils/decorator.js";import n from"../common/apis/general/getLocation.js";import{__generator as i}from'./../external/tslib/tslib.es6.js';function s(t){return m.apply(this,arguments)}function m(){return(m=t((function(s){return i(this,(function(m){return[2,r("getLocation",[],[s],t((function(){return i(this,(function(t){switch(t.label){case 0:return e.isMp?[4,n()]:[3,2];case 1:return[2,t.sent()];case 2:return e.isMpWeb?[2,Promise.resolve({longitude:"105.788026",latitude:"21.0258773",timestamp:(new Date).getTime().toString(),provider:"fused"})]:[2,Promise.reject(o("getLocation",{}))]}}))})))]}))}))).apply(this,arguments)}export{s as getLocation};
1
+ import o from'./../external/@swc/helpers/src/_async_to_generator.mjs.js';import t from"../appEnv/index.js";import r from"../common/notFound.js";import{functionHandler as e}from"../utils/decorator.js";import n from"../common/apis/general/getLocation.js";import{__generator as s}from'./../external/tslib/tslib.es6.js';function i(o){return m.apply(this,arguments)}function m(){return(m=o((function(i){return s(this,(function(m){return[2,e("getLocation",[],[i],o((function(){return s(this,(function(o){switch(o.label){case 0:return t.isMp?[4,n()]:[3,2];case 1:return[2,o.sent()];case 2:return t.isMpWeb?[2,Promise.resolve({token:""})]:[2,Promise.reject(r("getLocation",{}))]}}))})))]}))}))).apply(this,arguments)}export{i as getLocation};
@@ -1 +1 @@
1
- import o from'./../external/@swc/helpers/src/_async_to_generator.mjs.js';import e,{object as r,number as t}from'./../external/zod/lib/index.mjs.js';import n from"../appEnv/index.js";import s from"../common/notFound.js";import{functionHandler as i}from"../utils/decorator.js";import m from"../common/apis/general/vibrate.js";import{__generator as u}from'./../external/tslib/tslib.es6.js';var l=[r({type:e.enum(["oneShot"]).default("oneShot"),milliseconds:t().optional()})];function p(o){return a.apply(this,arguments)}function a(){return a=o((function(e){return u(this,(function(r){return[2,i("vibrate",l,[e],(t=o((function(o){return u(this,(function(e){switch(e.label){case 0:return n.isMp?[4,m(null==o?void 0:o.type,null==o?void 0:o.milliseconds)]:[3,2];case 1:return[2,e.sent()];case 2:return n.isMpWeb?[2,Promise.resolve()]:[2,Promise.reject(s("vibrate",{}))]}}))})),function(o){return t.apply(this,arguments)}))];var t}))})),a.apply(this,arguments)}export{p as vibrate};
1
+ import o from'./../external/@swc/helpers/src/_async_to_generator.mjs.js';import e,{object as r,number as t}from'./../external/zod/lib/index.mjs.js';import n from"../appEnv/index.js";import i from"../common/notFound.js";import{functionHandler as s}from"../utils/decorator.js";import m from"../common/apis/general/vibrate.js";import{__generator as l}from'./../external/tslib/tslib.es6.js';var u=[r({type:e.enum(["oneShot"]).default("oneShot").optional(),milliseconds:t().optional()})];function p(o){return a.apply(this,arguments)}function a(){return a=o((function(e){return l(this,(function(r){return[2,s("vibrate",u,[e],(t=o((function(o){return l(this,(function(e){switch(e.label){case 0:return n.isMp?[4,m(null==o?void 0:o.type,null==o?void 0:o.milliseconds)]:[3,2];case 1:return[2,e.sent()];case 2:return n.isMpWeb?[2,Promise.resolve()]:[2,Promise.reject(i("vibrate",{}))]}}))})),function(o){return t.apply(this,arguments)}))];var t}))})),a.apply(this,arguments)}export{p as vibrate};
@@ -1 +1 @@
1
- import e from'./../external/@swc/helpers/src/_class_call_check.mjs.js';import t from'./../external/@swc/helpers/src/_get.mjs.js';import n from'./../external/@swc/helpers/src/_get_prototype_of.mjs.js';import a from'./../external/@swc/helpers/src/_inherits.mjs.js';import o from'./../external/@swc/helpers/src/_create_super.mjs.js';import r from'./../external/eventemitter3/index.js';import c from"../utils/debug.js";import{stringToData as s}from"../utils/common.js";import{APP_ID as i}from"../constants.js";import{transformPaymentDataFromOnDataCallback as m,transformPaymentDataFromPath as l,PaymentConfig as p}from"./apis/general/payment/utils.js";import{Events as u}from"../types/enum.js";var d="ACTION_CALLBACK";var f=function(r){a(i,r);var s=o(i);function i(){var t;return e(this,i),(t=s.apply(this,arguments)).debug=c("zmp:event-emitter"),t}var m=i.prototype;return m.h5ConfirmHandleEvent=function(e,t,n){ZaloJavaScriptInterface.jsH5EventCallback(e,t,n||"")},m.on=function(e,a,o){var r=this;if(e===d||e===u.PaymentCallback)return t(n(i.prototype),"on",this).call(this,e,a,o);this.debug("register ".concat(String(e),": ").concat(o));return t(n(i.prototype),"on",this).call(this,e,(function(t,n){r.h5ConfirmHandleEvent(t,e,o),a(n)}),o)},m.once=function(e,a,o){var r=this;if(e===d)return t(n(i.prototype),"once",this).call(this,e,a,o);this.debug("register once ".concat(String(e),": ").concat(o));return t(n(i.prototype),"once",this).call(this,e,(function(t,n){r.h5ConfirmHandleEvent(t,e,o),a(n)}),o)},i.getInstance=function(){return i.instance||(i.instance=new i),i.instance},i}(r);function v(e){f.getInstance().on(d,e)}function h(e){f.getInstance().emit(d,e)}window.onNativeMessage=function(e,t){return function(n){h({serialId:e,actionName:t,result:n})}},window.zaloJSV2={zalo_h5_event_handler:function(e,t,n){var a=c("zmp:zalo_h5_event_handler");a("eventId: ".concat(e,", eventName: ").concat(t,", eventData: ").concat(n));var o=s(n);a("stringToData",o);var r=function(e,t){try{if(e===u.OpenApp){var n=t.url,a=new URL(n),o=a.pathname.split("/zapps/".concat(i))[1];return{path:"".concat(o||"/").concat(a.search)}}return t}catch(e){return t}}(t,o),d=function(e,t,n,a){switch(!0){case e===u.OpenApp&&(null==a?void 0:a.enablePaymentDone):var o=l(n.path);return[{eventName:u.PaymentDone,eventId:t,data:o}];case e===u.OnDataCallback:if(["PAY_BY_BANK","PAY_BY_CUSTOM_METHOD"].includes(n.eventType))return[{eventName:u.OnDataCallback,eventId:t,data:n},{eventName:u.PaymentDone,eventId:t,data:m(n)}];default:return[{eventName:e,eventId:t,data:n}]}}(t,e,r,p);d.forEach((function(e){f.getInstance().emit(e.eventName,e.eventId,e.data)}))}},window.zaloNative2JS={nativeCall:function(e,t,n){f.getInstance().emit(u.PaymentCallback,e,t,n)}};export{f as MPEEmitter,h as fireActionMessage,v as onActionMessage};
1
+ import e from'./../external/@swc/helpers/src/_class_call_check.mjs.js';import t from'./../external/@swc/helpers/src/_get.mjs.js';import n from'./../external/@swc/helpers/src/_get_prototype_of.mjs.js';import a from'./../external/@swc/helpers/src/_inherits.mjs.js';import r from'./../external/@swc/helpers/src/_create_super.mjs.js';import o from'./../external/eventemitter3/index.js';import s from"../utils/debug.js";import{stringToData as c}from"../utils/common.js";import{APP_ID as i}from"../constants.js";import{transformPaymentDataFromOnDataCallback as l,transformPaymentDataFromPath as m,PaymentConfig as u}from"./apis/general/payment/utils.js";import{Events as p}from"../types/enum.js";var d="ACTION_CALLBACK";var f=function(o){a(i,o);var c=r(i);function i(){var t;return e(this,i),(t=c.apply(this,arguments)).debug=s("zmp:event-emitter"),t}var l=i.prototype;return l.h5ConfirmHandleEvent=function(e,t,n){ZaloJavaScriptInterface.jsH5EventCallback(e,t,n||"")},l.on=function(e,a,r){var o=this;if(e===d||e===p.PaymentCallback)return t(n(i.prototype),"on",this).call(this,e,a,r);this.debug("register ".concat(String(e),": ").concat(r));return t(n(i.prototype),"on",this).call(this,e,(function(t,n){o.h5ConfirmHandleEvent(t,e,r),a(n)}),r)},l.once=function(e,a,r){var o=this;if(e===d)return t(n(i.prototype),"once",this).call(this,e,a,r);this.debug("register once ".concat(String(e),": ").concat(r));return t(n(i.prototype),"once",this).call(this,e,(function(t,n){o.h5ConfirmHandleEvent(t,e,r),a(n)}),r)},i.getInstance=function(){return i.instance||(i.instance=new i),i.instance},i}(o);function v(e){f.getInstance().on(d,e)}function h(e){f.getInstance().emit(d,e)}window.onNativeMessage=function(e,t){return function(n){h({serialId:e,actionName:t,result:n})}},window.zaloJSV2={zalo_h5_event_handler:function(e,t,n){var a=s("zmp:zalo_h5_event_handler");a("eventId: ".concat(e,", eventName: ").concat(t,", eventData: ").concat(n));var r=c(n);a("stringToData",r);var o=function(e,t){if(!t||"string"==typeof t)return t;try{if(e===p.OpenApp){var n=t.url,a=new URL(n),r=a.pathname.split("/zapps/".concat(i))[1];return{path:"".concat(r||"/").concat(a.search)}}return t}catch(e){return t}}(t,r),d=function(e,t,n,a){switch(!0){case"string"==typeof n||null===n:return[{eventName:e,eventId:t,data:n}];case e===p.OpenApp&&(null==a?void 0:a.enablePaymentDone):var r=m(n.path);return[{eventName:p.PaymentDone,eventId:t,data:r}];case e===p.OnDataCallback:if(["PAY_BY_BANK","PAY_BY_CUSTOM_METHOD"].includes(null==n?void 0:n.eventType))return[{eventName:p.OnDataCallback,eventId:t,data:n},{eventName:p.PaymentDone,eventId:t,data:l(n)}];break;default:return[{eventName:e,eventId:t,data:n}]}}(t,e,o,u);d.forEach((function(e){f.getInstance().emit(e.eventName,e.eventId,e.data)}))}},window.zaloNative2JS={nativeCall:function(e,t,n){f.getInstance().emit(p.PaymentCallback,e,t,n)}};export{f as MPEEmitter,h as fireActionMessage,v as onActionMessage};