zmp-sdk 2.49.0-beta.1 → 2.49.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 e from'./../../external/@swc/helpers/src/_async_to_generator.mjs.js';import t from'./../../external/@swc/helpers/src/_object_without_properties.mjs.js';import o from'./../../external/@swc/helpers/src/_sliced_to_array.mjs.js';import n from'./../../external/@swc/helpers/src/_to_consumable_array.mjs.js';import r,{object as s,string as a}from'./../../external/zod/lib/index.mjs.js';import i from"../../appEnv/index.js";import c from"../../common/notFound.js";import{functionHandler as m}from"../../utils/decorator.js";import u from"../../common/token.js";import l from"../../common/call/index.js";import{setSearchParams as d,postMessageToWidget as p}from"../../utils/common.js";import{CHECKOUT_KIT_WIDGET_ID as f,WIDGET_URLS as h,ALLOW_WIDGET_ORIGIN as g}from"../../constants.js";import{getZaloVersionCode as j}from"../../common/utils.js";import{__generator as y}from'./../../external/tslib/tslib.es6.js';import w from"../../appEnv/getEnv.js";var v,_=[s({id:a(),onMethodChange:r.function().optional()}).catchall(r.any())];function b(e){return E.apply(this,arguments)}function E(){return E=e((function(r){return y(this,(function(s){return[2,m("showWidget",_,[r],(a=e((function(r){var s,a,m,_,b,E,C,I,P,M,L;return y(this,(function(T){if(i.isMp){try{s=document.getElementById(r.id),a=r.onMethodChange,m=r.fail,_=t(r,["onMethodChange","fail"]),s&&((b=document.getElementById(f))&&(document.body.removeChild(b),b=null),b=document.createElement("iframe"),E=f,C=new URL(h.CHECKOUT_KIT),I={id:E,appId:window.APP_ID},Object.entries(_).forEach((function(e){var t=o(e,2),n=t[0],r=t[1];r&&(I["data-".concat(n)]=r)})),P=JSON.stringify(I),M=btoa(P),L=encodeURIComponent(M),d(C.searchParams,"data",L),b.id=E,b.src=C.href,b.style.width="100%",b.style.height="100%",b.style.border="none",s.innerHTML=b.outerHTML,window.removeEventListener("message",v,!1),v=function(){var t=e((function(e){var t,o,r,s,i,c,d,f,h,v;return y(this,(function(y){switch(y.label){case 0:if(t=e.data,!e.origin.startsWith(g))return[3,9];if(o=t.type,r=document.getElementById(E),(s=new URL(t.href)).origin!==C.origin||s.pathname!==C.pathname||t.id!==E)return[3,9];switch(o){case"getInfo":return[3,1];case"getToken":return[3,2];case"heightChange":return[3,4];case"callAction":return[3,5];case"onMethodChange":return[3,6];case"onError":return[3,7]}return[3,8];case 1:return p(r,o,{appId:window.APP_ID,zaloVersion:j(),appPlatform:null===(i=w())||void 0===i?void 0:i.platformName}),[3,9];case 2:return[4,u.jumpAndGetToken()];case 3:return y.sent(),d=null===(c=u.miniProgramConfig)||void 0===c?void 0:c.jwt,p(r,o,{jwt:d}),[3,9];case 4:return r.style.height="".concat(t.payload,"px"),[3,9];case 5:return f=t.payload,h=f.actionName,v=f.actionData,String(h).length>0&&l(h,v,{success:function(e){p(r,o,{status:0,actionName:h,data:e})},fail:function(e){p(r,o,{status:-1,actionName:h,data:e})}},{}),[3,9];case 6:return null==a||a.apply(void 0,n(Object.values(t.payload))),[3,9];case 7:null==m||m(t.payload),y.label=8;case 8:return[3,9];case 9:return[2]}}))}));return function(e){return t.apply(this,arguments)}}(),window.addEventListener("message",v,!1))}catch(e){console.log(e)}return[2,Promise.resolve()]}return i.isMpWeb?[2,Promise.resolve()]:[2,Promise.reject(c("showWidget",{}))]}))})),function(e){return a.apply(this,arguments)}))];var a}))})),E.apply(this,arguments)}export{b as showWidget};
1
+ import e from'./../../external/@swc/helpers/src/_async_to_generator.mjs.js';import t from'./../../external/@swc/helpers/src/_object_without_properties.mjs.js';import o from'./../../external/@swc/helpers/src/_sliced_to_array.mjs.js';import n from'./../../external/@swc/helpers/src/_to_consumable_array.mjs.js';import r,{object as s,string as a}from'./../../external/zod/lib/index.mjs.js';import i from"../../appEnv/index.js";import c from"../../common/notFound.js";import{functionHandler as m}from"../../utils/decorator.js";import u from"../../common/token.js";import l from"../../common/call/index.js";import{setSearchParams as d,postMessageToWidget as p}from"../../utils/common.js";import{CHECKOUT_KIT_WIDGET_ID as f,WIDGET_URLS as h,ALLOW_WIDGET_ORIGIN as g}from"../../constants.js";import{getZaloVersionCode as j}from"../../common/utils.js";import{__generator as y}from'./../../external/tslib/tslib.es6.js';import w from"../../appEnv/getEnv.js";var v,_=[s({id:a(),onMethodChange:r.function().optional()}).catchall(r.any())];function b(e){return E.apply(this,arguments)}function E(){return E=e((function(r){return y(this,(function(s){return[2,m("showWidget",_,[r],(a=e((function(r){var s,a,m,_,b,E,C,I,P,M,L;return y(this,(function(N){if(i.isMp){try{s=document.getElementById(r.id),a=r.onMethodChange,m=r.fail,_=t(r,["onMethodChange","fail"]),s&&((b=document.getElementById(f))&&(b.parentNode.removeChild(b),b=null),b=document.createElement("iframe"),E=f,C=new URL(h.CHECKOUT_KIT),I={id:E,appId:window.APP_ID},Object.entries(_).forEach((function(e){var t=o(e,2),n=t[0],r=t[1];r&&(I["data-".concat(n)]=r)})),P=JSON.stringify(I),M=btoa(P),L=encodeURIComponent(M),d(C.searchParams,"data",L),b.id=E,b.src=C.href,b.style.width="100%",b.style.height="100%",b.style.border="none",s.innerHTML=b.outerHTML,window.removeEventListener("message",v,!1),v=function(){var t=e((function(e){var t,o,r,s,i,c,d,f,h,v;return y(this,(function(y){switch(y.label){case 0:if(t=e.data,!e.origin.startsWith(g))return[3,9];if(o=t.type,r=document.getElementById(E),(s=new URL(t.href)).origin!==C.origin||s.pathname!==C.pathname||t.id!==E)return[3,9];switch(o){case"getInfo":return[3,1];case"getToken":return[3,2];case"heightChange":return[3,4];case"callAction":return[3,5];case"onMethodChange":return[3,6];case"onError":return[3,7]}return[3,8];case 1:return p(r,o,{appId:window.APP_ID,zaloVersion:j(),appPlatform:null===(i=w())||void 0===i?void 0:i.platformName}),[3,9];case 2:return[4,u.jumpAndGetToken()];case 3:return y.sent(),d=null===(c=u.miniProgramConfig)||void 0===c?void 0:c.jwt,p(r,o,{jwt:d}),[3,9];case 4:return r.style.height="".concat(t.payload,"px"),[3,9];case 5:return f=t.payload,h=f.actionName,v=f.actionData,String(h).length>0&&l(h,v,{success:function(e){p(r,o,{status:0,actionName:h,data:e})},fail:function(e){p(r,o,{status:-1,actionName:h,data:e})}},{}),[3,9];case 6:return null==a||a.apply(void 0,n(Object.values(t.payload))),[3,9];case 7:null==m||m(t.payload),y.label=8;case 8:return[3,9];case 9:return[2]}}))}));return function(e){return t.apply(this,arguments)}}(),window.addEventListener("message",v,!1))}catch(e){console.log(e)}return[2,Promise.resolve()]}return i.isMpWeb?[2,Promise.resolve()]:[2,Promise.reject(c("showWidget",{}))]}))})),function(e){return a.apply(this,arguments)}))];var a}))})),E.apply(this,arguments)}export{b as showWidget};
@@ -1 +1 @@
1
- import r 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 t}from"../utils/decorator.js";import{apiResponse as s}from"../utils/response.js";import n from"../common/apis/general/getDeviceInfo.js";import{isAPISupport as i}from"../common/utils.js";import{__generator as m}from'./../external/tslib/tslib.es6.js';function c(r){return p.apply(this,arguments)}function p(){return(p=r((function(c){return m(this,(function(p){return[2,t("getDeviceInfo",[],[c],r((function(){return m(this,(function(r){switch(r.label){case 0:return e.isMp?i(25102853,674)?[4,n()]:[3,2]:[3,3];case 1:return[2,r.sent()];case 2:return[2,Promise.reject(s.error.clientNotSupport())];case 3:return e.isMpWeb?[2,Promise.resolve({})]:[2,Promise.reject(o("getDeviceInfo",{}))]}}))})))]}))}))).apply(this,arguments)}export{c as getDeviceInfo};
1
+ import r 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 t}from"../utils/decorator.js";import{apiResponse as s}from"../utils/response.js";import n from"../common/apis/general/getDeviceInfo.js";import{isAPISupport as i}from"../common/utils.js";import{__generator as m}from'./../external/tslib/tslib.es6.js';function c(r){return p.apply(this,arguments)}function p(){return(p=r((function(c){return m(this,(function(p){return[2,t("getDeviceInfo",[],[c],r((function(){return m(this,(function(r){switch(r.label){case 0:return e.isMp?i(25102854,674)?[4,n()]:[3,2]:[3,3];case 1:return[2,r.sent()];case 2:return[2,Promise.reject(s.error.clientNotSupport())];case 3:return e.isMpWeb?[2,Promise.resolve({})]:[2,Promise.reject(o("getDeviceInfo",{}))]}}))})))]}))}))).apply(this,arguments)}export{c as getDeviceInfo};
@@ -1 +1 @@
1
- var a="2.49.0-beta.1";export{a as version};
1
+ var r="2.49.1";export{r as version};