zmp-sdk 2.37.2 → 2.37.3

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_spread.mjs.js';import o from'./../../../../external/@swc/helpers/src/_object_spread_props.mjs.js';import r from"../../../token.js";import n from"../../../../utils/query-string.js";import{apiResponse as s}from"../../../../utils/response.js";import{PAYMENT_H5_URL as a,PAYMENT_APIS as i,APP_ID as p}from"../../../../constants.js";import c from"../openWebview.js";import{MPEEmitter as d}from"../../../eventEmitter.js";import m from"./checkTransaction.js";import{__generator as u}from'./../../../../external/tslib/tslib.es6.js';import{Events as f}from"../../../../types/enum.js";var l,h=(l=e((function(l,h,j,w,y,g,b){var I,C,_,R,O,v,S,P,A,E,N,T,U,k,z;return u(this,(function(J){switch(J.label){case 0:I=p,(C=new URLSearchParams).append("amount",l.toString()),C.append("item",encodeURIComponent(JSON.stringify(h))),C.append("appId",I),j&&C.append("desc",encodeURIComponent(j)),w&&(_=w,"object"==typeof w&&(_=JSON.stringify(w)),C.append("extradata",encodeURIComponent(_))),y&&(R=y,"object"==typeof y&&(R=JSON.stringify(y)),C.append("payload",encodeURIComponent(R))),g&&("string"==typeof g?(C.append("method",g),C.append("isCustom","false")):"object"==typeof g&&(C.append("method",g.id),C.append("isCustom",JSON.stringify(g.isCustom)))),b&&C.append("mac",b),O={headers:{"Content-Type":"application/x-www-form-urlencoded",authorization:"Bearer "}},J.label=1;case 1:return J.trys.push([1,6,,7]),[4,r.getAccessToken().catch((function(){throw s.error.loginRequired}))];case 2:return v=J.sent(),O.headers.authorization="Bearer ".concat(v),[4,fetch(i.CREATE_ORDER,o(t({method:"POST"},O),{body:C}))];case 3:return[4,J.sent().json()];case 4:if(!(S=J.sent()).data||0!==S.err)throw s.error.badRequest(S.msg);return P=S.data.id,A=S.data.jwt,E=window.APP_VERSION,N=window.APP_ENV,T={miniAppId:I,orderId:P},A&&(T.token=A),E&&(T.version=E),N&&(T.env=N),g&&("string"==typeof g?(T.method=g,T.isCustom=!1):"object"==typeof g&&(T.method=g.id,T.isCustom=g.isCustom)),U=n.encode(T),k=new URL("?".concat(U),a).toString(),[4,c(k).then((function(){var r=!1;d.getInstance().once(f.WebviewClosed,(function(){setTimeout(e((function(){var e;return u(this,(function(n){switch(n.label){case 0:return r?[3,2]:(console.log("orderId",P),[4,m({zmpOrderId:P})]);case 1:(e=n.sent()).err>=0&&!e.isCustom&&d.getInstance().emit(f.PaymentClose,e.err,o(t({},e),{zmpOrderId:P})),n.label=2;case 2:return[2]}}))})),500)})),d.getInstance().once(f.OpenApp,(function(){r=!0}))}))];case 5:return J.sent(),[2,{orderId:P}];case 6:throw z=J.sent(),console.log("Internal error"),z;case 7:return[2]}}))})),function(e,t,o,r,n,s,a){return l.apply(this,arguments)});export{h as default};
1
+ import e from'./../../../../external/@swc/helpers/src/_async_to_generator.mjs.js';import t from'./../../../../external/@swc/helpers/src/_object_spread.mjs.js';import o from'./../../../../external/@swc/helpers/src/_object_spread_props.mjs.js';import r from"../../../token.js";import n from"../../../../utils/query-string.js";import{apiResponse as s}from"../../../../utils/response.js";import{PAYMENT_H5_URL as a,PAYMENT_APIS as i,APP_ID as p}from"../../../../constants.js";import c from"../openWebview.js";import{MPEEmitter as d}from"../../../eventEmitter.js";import m from"./checkTransaction.js";import{__generator as u}from'./../../../../external/tslib/tslib.es6.js';import{Events as f}from"../../../../types/enum.js";var l,h=(l=e((function(l,h,j,w,g,y,I){var b,_,C,R,O,v,S,P,A,E,N,T,U,k,z,J,q;return u(this,(function(x){switch(x.label){case 0:b=p,(_=new URLSearchParams).append("amount",l.toString()),_.append("item",encodeURIComponent(JSON.stringify(h))),_.append("appId",b),j&&_.append("desc",encodeURIComponent(j)),w&&(C=w,"object"==typeof w&&(C=JSON.stringify(w)),_.append("extradata",encodeURIComponent(C))),g&&(R=g,"object"==typeof g&&(R=JSON.stringify(g)),_.append("payload",encodeURIComponent(R))),y&&("string"==typeof y?(_.append("method",y),_.append("isCustom","false")):"object"==typeof y&&(_.append("method",y.id),_.append("isCustom",JSON.stringify(y.isCustom)))),I&&_.append("mac",I),O={headers:{"Content-Type":"application/x-www-form-urlencoded",authorization:"Bearer "}},x.label=1;case 1:return x.trys.push([1,6,,7]),[4,r.getAccessToken().catch((function(){throw s.error.loginRequired}))];case 2:return v=x.sent(),O.headers.authorization="Bearer ".concat(v),[4,fetch(i.CREATE_ORDER,o(t({method:"POST"},O),{body:_}))];case 3:return[4,x.sent().json()];case 4:if(!(S=x.sent()).data||0!==S.err)throw s.error.badRequest(S.msg);return P=S.data.id,A=S.data.jwt,E=window.APP_VERSION,N=window.APP_ENV,T={miniAppId:b,orderId:P},U=S.data.method,k=S.data.isCustom,A&&(T.token=A),E&&(T.version=E),N&&(T.env=N),U&&(T.method=U),k&&(T.isCustom=k),z=n.encode(T),J=new URL("?".concat(z),a).toString(),[4,c(J).then((function(){var r=!1;d.getInstance().once(f.WebviewClosed,(function(){setTimeout(e((function(){var e;return u(this,(function(n){switch(n.label){case 0:return r?[3,2]:(console.log("orderId",P),[4,m({zmpOrderId:P})]);case 1:(e=n.sent()).err>=0&&!e.isCustom&&d.getInstance().emit(f.PaymentClose,e.err,o(t({},e),{zmpOrderId:P})),n.label=2;case 2:return[2]}}))})),500)})),d.getInstance().once(f.OpenApp,(function(){r=!0}))}))];case 5:return x.sent(),[2,{orderId:P}];case 6:throw q=x.sent(),console.log("Internal error"),q;case 7:return[2]}}))})),function(e,t,o,r,n,s,a){return l.apply(this,arguments)});export{h as default};
@@ -1 +1 @@
1
- var r="2.37.2";export{r as version};
1
+ var r="2.37.3";export{r as version};