zmp-sdk 2.28.1 → 2.28.3-rc.0

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 o from'./../../external/@swc/helpers/src/_async_to_generator.mjs.js';import{RESPONSE_CODE as e,MESSAGES as t}from"../../constants.js";import a from"../../utils/lodash.js";import{MPEEmitter as r,onActionMessage as i,fireActionMessage as n}from"../eventEmitter.js";import{parseJSON as l,getDynamicAPIByAction as c,checkIOSSupportAction as s,serialize as u}from"../../utils/common.js";import d from"../token.js";import{sendLogData as m}from"../utils.js";import p from"../../appEnv/getEnv.js";import{__generator as v}from'./../../external/tslib/tslib.es6.js';import{Events as f}from"../../types/enum.js";var _,h,T,g,I,b,j=(T=p(),g={},I=r.getInstance(),b=[],!1||(i((function(o){var e=o.serialId,t=l(o.result);if(e&&g[e]){var r=g[e],i=r.callback,n=r.timeout,s=r.isMultiCallback,u=r.options;!function(o,e){var t=e||{},r=t.success,i=t.fail,n=c(o.action),l=o.error_code;try{l=0!==o.error_code?o.error_code:n?JSON.parse(o.data).error_code:o.error_code}catch(o){}var s=o;try{s=n&&0===o.error_code?JSON.parse(o.data):o}catch(o){}0===l?a.isFunction(r)&&r(s):a.isFunction(i)&&i(s)}(t,i),!s&&delete g[e],n&&clearTimeout(n);var d={action:null==t?void 0:t.action,error:null==t?void 0:t.error_code,message:null==t?void 0:t.error_message,data:{}};try{if("action.open.inapp"===t.action||"action.open.outapp"===t.action){var m=new URL(null==u?void 0:u.url),p="".concat(m.protocol,"//").concat(m.host).concat(m.pathname);d.data={url:p}}if("action.follow.oa"===t.action||"action.unfollow.oa"===t.action){var v=null==u?void 0:u.uid;d.data={uid:v}}if("action.open.chat"===t.action){var f=null==u?void 0:u.uId,_=null==u?void 0:u.type;d.data={uid:f,openChatType:_}}}catch(o){}b.push(d)}})),I.on(f.AppPaused,(function(){if(b.length>0){var o=b;b=[],m(o)}})),_?clearInterval(_):_=setInterval((function(){if(b.length>0){var o=b;b=[],m(o)}}),5e3),!0),h=o((function(o,r,i,l){var m,p,f,_,h,I,b,j,M,k,N,w,O,S,C,y,E,J;return v(this,(function(v){switch(v.label){case 0:return p=Math.floor(1e6*Math.random()),f="".concat(o,"_").concat(p),_="action.".concat(o.replace(/\_/g,".").toLowerCase()),(null==l?void 0:l.actionName)&&l.actionName.length>0&&(_=null==l?void 0:l.actionName),h=(null==l?void 0:l.isMultiCallback)||!1,I=!1!==(null==l?void 0:l.timeout)&&((null==l?void 0:l.timeout)||!0),b=(null==l?void 0:l.haveActionCallback)||!1,j=(null==l?void 0:l.skipJump)||!1,M=(null==l?void 0:l.requireAccessToken)||!1,r&&i&&(g[f]={options:r,callback:i,isMultiCallback:h},I&&b&&(g[f].timeout=setTimeout((function(){var a={serialId:f,result:{error_code:e.TIME_OUT,error_message:t.TIME_OUT,data:{timeout:I},action:o}};n(a)}),!0===I?8e3:1e3*I))),k=c(_),!(null==T||null===(m=T.platform)||void 0===m?void 0:m.isMobile)||!o||a.isUndefined(ZaloJavaScriptInterface)||T.platform.isIOS&&!s(o)||k&&!1===k.isSupported?(w={serialId:f,result:{error_code:e.CLIENT_NOT_SUPPORT,error_message:t.CLIENT_NOT_SUPPORT,data:{isMobile:null==T||null===(N=T.platform)||void 0===N?void 0:N.isMobile},action:o}},n(w),[2]):(O=u(r),j?[3,2]:[4,d.getJSAccessToken()]);case 1:return C=v.sent(),[3,3];case 2:C="",v.label=3;case 3:return S=C,j||!M?[3,5]:[4,d.getAccessToken()];case 4:return E=v.sent(),[3,6];case 5:E="",v.label=6;case 6:return y=E,J=T.platform.isIOS?window.onNativeMessage(f):"window.onNativeMessage('".concat(f,"')"),[2,ZaloJavaScriptInterface.jsCall(S,_,y,O,J)]}}))})),function(o,e,t,a){return h.apply(this,arguments)});export{j as default};
1
+ import o from'./../../external/@swc/helpers/src/_async_to_generator.mjs.js';import{RESPONSE_CODE as e,MESSAGES as t}from"../../constants.js";import a from"../../utils/lodash.js";import{MPEEmitter as r,onActionMessage as i,fireActionMessage as n}from"../eventEmitter.js";import{parseJSON as l,getDynamicAPIByAction as c,checkIOSSupportAction as s,serialize as u}from"../../utils/common.js";import d from"../token.js";import{sendLogData as m}from"../utils.js";import p from"../../appEnv/getEnv.js";import{__generator as v}from'./../../external/tslib/tslib.es6.js';import{Events as f}from"../../types/enum.js";var _,h,g,T,I,b,j=(g=p(),T={},I=r.getInstance(),b=[],!1||(i((function(o){var e=o.serialId,t=l(o.result),r={error_code:a.isEmpty(null==t?void 0:t.error_code)?0:null==t?void 0:t.error_code,error_message:null==t?void 0:t.error_message,data:(null==t?void 0:t.data)||t,action:(null==t?void 0:t.action)||o.actionName};if(e&&T[e]){var i=T[e],n=i.callback,s=i.timeout,u=i.isMultiCallback,d=i.options;!function(o,e){var t=e||{},r=t.success,i=t.fail,n=c(o.action),l=o.error_code;try{l=0!==o.error_code?o.error_code:n?JSON.parse(o.data).error_code:o.error_code}catch(o){}var s=o;try{s=n&&0===o.error_code?JSON.parse(o.data):o}catch(o){}0===l?a.isFunction(r)&&r(s):a.isFunction(i)&&i(s)}(r,n),!u&&delete T[e],s&&clearTimeout(s);var m={action:null==r?void 0:r.action,error:null==r?void 0:r.error_code,message:null==r?void 0:r.error_message,data:{}};try{if("action.open.inapp"===r.action||"action.open.outapp"===r.action){var p=new URL(null==d?void 0:d.url),v="".concat(p.protocol,"//").concat(p.host).concat(p.pathname);m.data={url:v}}if("action.follow.oa"===r.action||"action.unfollow.oa"===r.action){var f=null==d?void 0:d.uid;m.data={uid:f}}if("action.open.chat"===r.action){var _=null==d?void 0:d.uId,h=null==d?void 0:d.type;m.data={uid:_,openChatType:h}}}catch(o){}b.push(m)}})),I.on(f.AppPaused,(function(){if(b.length>0){var o=b;b=[],m(o)}})),_?clearInterval(_):_=setInterval((function(){if(b.length>0){var o=b;b=[],m(o)}}),5e3),!0),h=o((function(o,r,i,l){var m,p,f,_,h,I,b,j,M,N,k,w,O,S,y,C,E,J;return v(this,(function(v){switch(v.label){case 0:return p=Math.floor(1e6*Math.random()),f="".concat(o,"_").concat(p),_="action.".concat(o.replace(/\_/g,".").toLowerCase()),(null==l?void 0:l.actionName)&&l.actionName.length>0&&(_=null==l?void 0:l.actionName),h=(null==l?void 0:l.isMultiCallback)||!1,I=!1!==(null==l?void 0:l.timeout)&&((null==l?void 0:l.timeout)||!0),b=(null==l?void 0:l.haveActionCallback)||!1,j=(null==l?void 0:l.skipJump)||!1,M=(null==l?void 0:l.requireAccessToken)||!1,r&&i&&(T[f]={options:r,callback:i,isMultiCallback:h},I&&b&&(T[f].timeout=setTimeout((function(){var a={serialId:f,result:{error_code:e.TIME_OUT,error_message:t.TIME_OUT,data:{timeout:I},action:o}};n(a)}),!0===I?8e3:1e3*I))),N=c(_),!(null==g||null===(m=g.platform)||void 0===m?void 0:m.isMobile)||!o||a.isUndefined(ZaloJavaScriptInterface)||g.platform.isIOS&&!s(o)||N&&!1===N.isSupported?(w={serialId:f,result:{error_code:e.CLIENT_NOT_SUPPORT,error_message:t.CLIENT_NOT_SUPPORT,data:{isMobile:null==g||null===(k=g.platform)||void 0===k?void 0:k.isMobile},action:o}},n(w),[2]):(O=u(r),j?[3,2]:[4,d.getJSAccessToken()]);case 1:return y=v.sent(),[3,3];case 2:y="",v.label=3;case 3:return S=y,j||!M?[3,5]:[4,d.getAccessToken()];case 4:return E=v.sent(),[3,6];case 5:E="",v.label=6;case 6:return C=E,J=g.platform.isIOS?window.onNativeMessage(f,_):'window.onNativeMessage("'.concat(f,'", "').concat(_,'")'),[2,ZaloJavaScriptInterface.jsCall(S,_,C,O,J)]}}))})),function(o,e,t,a){return h.apply(this,arguments)});export{j as default};
@@ -1 +1 @@
1
- import t from'./../external/@swc/helpers/src/_class_call_check.mjs.js';import e from'./../external/@swc/helpers/src/_get.mjs.js';import n from'./../external/@swc/helpers/src/_get_prototype_of.mjs.js';import o from'./../external/@swc/helpers/src/_inherits.mjs.js';import r from'./../external/@swc/helpers/src/_create_super.mjs.js';import s from'./../external/eventemitter3/index.js';import c from"../utils/debug.js";import{stringToData as a}from"../utils/common.js";import{APP_ID as i}from"../constants.js";import{Events as l}from"../types/enum.js";var m="ACTION_CALLBACK";var u=function(s){o(i,s);var a=r(i);function i(){var e;return t(this,i),(e=a.call(this)).debug=c("zmp:event-emitter"),e}var u=i.prototype;return u.h5ConfirmHandleEvent=function(t,e,n){ZaloJavaScriptInterface.jsH5EventCallback(t,e,n||"")},u.on=function(t,o,r){var s=this;if(t===m||t===l.PaymentCallback)return e(n(i.prototype),"on",this).call(this,t,o,r);this.debug("register ".concat(String(t),": ").concat(r));return e(n(i.prototype),"on",this).call(this,t,(function(e,n){s.h5ConfirmHandleEvent(e,t,r),o(n)}),r)},u.once=function(t,o,r){var s=this;if(t===m)return e(n(i.prototype),"once",this).call(this,t,o,r);this.debug("register once ".concat(String(t),": ").concat(r));return e(n(i.prototype),"once",this).call(this,t,(function(e,n){s.h5ConfirmHandleEvent(e,t,r),o(n)}),r)},i.getInstance=function(){return i.instance||(i.instance=new i),i.instance},i}(s);function p(t){u.getInstance().on(m,t)}function f(t){u.getInstance().emit(m,t)}window.onNativeMessage=function(t){return function(e){f({serialId:t,result:e})}},window.zaloJSV2={zalo_h5_event_handler:function(t,e,n){var o=c("zmp:zalo_h5_event_handler");o("eventId: ".concat(t,", eventName: ").concat(e,", eventData: ").concat(n));var r=a(n);o("stringToData",r);var s=function(t,e){try{if(t===l.OpenApp){var n=e.url,o=new URL(n),r=o.pathname.split("/zapps/".concat(i))[1];return{path:"".concat(r||"/").concat(o.search)}}return e}catch(t){return e}}(e,r);u.getInstance().emit(e,t,s)}},window.zaloNative2JS={nativeCall:function(t,e,n){u.getInstance().emit(l.PaymentCallback,t,e,n)}};export{u as MPEEmitter,f as fireActionMessage,p as onActionMessage};
1
+ import t from'./../external/@swc/helpers/src/_class_call_check.mjs.js';import e from'./../external/@swc/helpers/src/_get.mjs.js';import n from'./../external/@swc/helpers/src/_get_prototype_of.mjs.js';import o from'./../external/@swc/helpers/src/_inherits.mjs.js';import r from'./../external/@swc/helpers/src/_create_super.mjs.js';import a 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{Events as m}from"../types/enum.js";var l="ACTION_CALLBACK";var u=function(a){o(i,a);var s=r(i);function i(){var e;return t(this,i),(e=s.call(this)).debug=c("zmp:event-emitter"),e}var u=i.prototype;return u.h5ConfirmHandleEvent=function(t,e,n){ZaloJavaScriptInterface.jsH5EventCallback(t,e,n||"")},u.on=function(t,o,r){var a=this;if(t===l||t===m.PaymentCallback)return e(n(i.prototype),"on",this).call(this,t,o,r);this.debug("register ".concat(String(t),": ").concat(r));return e(n(i.prototype),"on",this).call(this,t,(function(e,n){a.h5ConfirmHandleEvent(e,t,r),o(n)}),r)},u.once=function(t,o,r){var a=this;if(t===l)return e(n(i.prototype),"once",this).call(this,t,o,r);this.debug("register once ".concat(String(t),": ").concat(r));return e(n(i.prototype),"once",this).call(this,t,(function(e,n){a.h5ConfirmHandleEvent(e,t,r),o(n)}),r)},i.getInstance=function(){return i.instance||(i.instance=new i),i.instance},i}(a);function p(t){u.getInstance().on(l,t)}function f(t){u.getInstance().emit(l,t)}window.onNativeMessage=function(t,e){return function(n){f({serialId:t,actionName:e,result:n})}},window.zaloJSV2={zalo_h5_event_handler:function(t,e,n){var o=c("zmp:zalo_h5_event_handler");o("eventId: ".concat(t,", eventName: ").concat(e,", eventData: ").concat(n));var r=s(n);o("stringToData",r);var a=function(t,e){try{if(t===m.OpenApp){var n=e.url,o=new URL(n),r=o.pathname.split("/zapps/".concat(i))[1];return{path:"".concat(r||"/").concat(o.search)}}return e}catch(t){return e}}(e,r);u.getInstance().emit(e,t,a)}},window.zaloNative2JS={nativeCall:function(t,e,n){u.getInstance().emit(m.PaymentCallback,t,e,n)}};export{u as MPEEmitter,f as fireActionMessage,p as onActionMessage};
@@ -1 +1 @@
1
- var r="2.28.1";export{r as version};
1
+ var r="2.28.3-rc.0";export{r as version};