Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@easyapp/wmp

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@easyapp/wmp - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

1

dist/easyapp-wmp.js

@@ -488,2 +488,3 @@ (function (global, factory) {

wmp: {
wx: wx,
auth: auth,

@@ -490,0 +491,0 @@ pay: pay

2

dist/easyapp-wmp.min.js

@@ -1,1 +0,1 @@

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).EasyappWmp=n()}(this,function(){"use strict";function e(){return(e=Object.assign||function(e){for(var n=1;arguments.length>n;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function n(e){return"string"==typeof e&&!!e.trim()}function t(t,i){var u=i.origin,c=void 0===u?"":u,a=i.parseData;return function(t){void 0===t&&(t={});var i=t.method,u=t.data,s=t.url||"",f={header:{Cookie:o()},dataType:"json"};return-1===s.indexOf("://")&&(s=c+s),f.method=i&&i.toUpperCase()||"GET",u&&(f.data=u),f.url=s,new Promise(function(n,t){wx.request(e({},f,{success:function(e){return n(e)},fail:function(e){return t(Error(e.errMsg))}}))}).then(function(t){var o=t.statusCode,i=t.data,u=t.header;if(200>o||o>=300)throw Error("网络请求失败");var c=u["Set-Cookie"];return c&&function(t){r=function(e){if(Array.isArray(e))return e;if("string"!=typeof e)return[];var n,t,r,o,i,u=[],c=0;function a(){for(;e.length>c&&/\s/.test(e.charAt(c));)c+=1;return e.length>c}for(;e.length>c;){for(n=c,i=!1;a();)if(","===(t=e.charAt(c))){for(r=c,c+=1,a(),o=c;e.length>c&&"="!==(t=e.charAt(c))&&";"!==t&&","!==t;)c+=1;e.length>c&&"="===e.charAt(c)?(i=!0,c=o,u.push(e.substring(n,r)),n=c):c=r+1}else c+=1;i&&e.length>c||u.push(e.substring(n,e.length))}return u}(t).reduce(function(e,t){var r=function(e,t){void 0===e&&(e=""),void 0===t&&(t={});var r=e.split(";").filter(n),o=r.shift().split("="),i=o.shift(),u=o.join("="),c={name:i,value:t.decodeValues?decodeURIComponent(u):u};return r.forEach(function(e){var n=e.split("="),t=n.shift().trimLeft().toLowerCase(),r=n.join("=");"expires"===t?c.expires=new Date(r):"max-age"===t?c.maxAge=parseInt(r,10):"secure"===t?c.secure=!0:"httponly"===t?c.httpOnly=!0:"samesite"===t?c.sameSite=r:c[t]=r}),c}(t);return e[r.name]=r,e},e({},r)),wx.setStorage({key:"COOKIES",data:r})}(c),a?a(i):i})}}var r=null;function o(){r||(r=wx.getStorageSync("COOKIES")||{});var e=[];for(var n in r){var t=r[n];if(t.expires){var o=t.expires;if("[object Date]"!==Object.prototype.toString.call(o)&&(o=new Date(o)),o.getTime()<(new Date).getTime())continue}e.push((t.name||t.key)+"="+t.value)}return e.join("; ")}function i(){throw Error("微信支付,需要实现 options.fetchPayCode 方法")}function u(){throw Error("微信认证,需要实现 options.authWithCode 方法")}var c=Object.freeze({getStorage:function(e){return new Promise(function(n){wx.getStorage({key:e,complete:function(e){return n(e.data)}})})},setStorage:function(e,n){return new Promise(function(t){void 0===n?wx.removeStorage({key:e,complete:function(){return t(n)}}):wx.setStorage({key:e,data:n,complete:function(){return t(n)}})})}});return function(n,r){return e({fetchAPI:t(0,r.fetchAPI)},function(e,n){void 0===e&&(e={});var t=e.stringifyLocation,r=e.parseLocation,o=n.convertToWmpNavType;function i(e){var n=e&&e.options||{},r="/"+(e&&e.route||""),o=Object.keys(n).map(function(e){return e+"="+n[e]}).join("&");return t({pathname:r,search:o})}function u(e,n){return o&&(e=o(n,e)),new Promise(function(t,r){wx[e]({url:n,success:function(){return t()},fail:function(e){return r(Error(e.errMsg))}})})}return{getTopPage:function(){var e=getCurrentPages();return i(e[e.length-1])},navigateBack:function(){return new Promise(function(e,n){return wx.navigateBack({delta:1,success:function(){return e()},fail:function(e){return n(Error(e.errMsg))}})})},navigateTo:function(e){return"string"!=typeof e&&(e=t(e)),u("navigateTo",e)},redirectTo:function(e){return"string"!=typeof e&&(e=t(e)),u("redirectTo",e)},parseLocation:function(e){return e&&"string"!=typeof e&&(e=i(e)),r(e)}}}(n,r),{},function(n,t){var r=t.showConfirm;return{showTips:function(e,n){return new Promise(function(t,r){wx.showToast({icon:"succ"===e?"success":"none",title:n||"未知错误",success:function(){return t()},fail:function(e){return r(Error(e.errMsg))}})})},showConfirm:function(n){var t,o,i=n.title,u=void 0===i?"":i,c=n.message,a=void 0===c?"":c,s=n.cancelTitle,f=void 0===s?"取消":s,l=n.doneTitle,p=void 0===l?"确定":l,d=n.primary,h=void 0===d?"done":d,g=n.cancelable,v=void 0===g||g;return v&&"cancel"===h?(t=p,o=f):(t=f,o=p),new Promise(function(n,i){wx.showModal(e({},r,{title:u,content:a,cancelText:t,confirmText:o,showCancel:v,success:function(e){return n(e)},fail:function(e){return i(Error(e.errMsg))}}))}).then(function(e){return"cancel"===h?{done:e.cancel,cancel:e.confirm}:{done:e.confirm,cancel:e.cancel}})}}}(0,r),{},function(n,t){var r=t.fetchPayCode,o=void 0===r?i:r,c=t.authWithCode,a=void 0===c?u:c;return{wmp:{auth:function(){return new Promise(function(e,n){wx.login({success:function(n){return e(n)},fail:function(e){return n(Error(e.errMsg))}})}).then(function(e){return a(e.code)})},pay:function(n){return Promise.resolve(o(n)).then(function(n){return new Promise(function(t,r){wx.requestPayment(e({},n,{complete:function(e){var n=e.errMsg,o=n.substring(n.indexOf(":")+1);"ok"!==o?r(Error("cancel"!==o?"微信支付失败":"微信支付已取消")):t()}}))})})}}}}(0,r),{},c)}});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e=e||self).EasyappWmp=n()}(this,function(){"use strict";function e(){return(e=Object.assign||function(e){for(var n=1;arguments.length>n;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function n(e){return"string"==typeof e&&!!e.trim()}function t(t,i){var u=i.origin,c=void 0===u?"":u,a=i.parseData;return function(t){void 0===t&&(t={});var i=t.method,u=t.data,s=t.url||"",f={header:{Cookie:o()},dataType:"json"};return-1===s.indexOf("://")&&(s=c+s),f.method=i&&i.toUpperCase()||"GET",u&&(f.data=u),f.url=s,new Promise(function(n,t){wx.request(e({},f,{success:function(e){return n(e)},fail:function(e){return t(Error(e.errMsg))}}))}).then(function(t){var o=t.statusCode,i=t.data,u=t.header;if(200>o||o>=300)throw Error("网络请求失败");var c=u["Set-Cookie"];return c&&function(t){r=function(e){if(Array.isArray(e))return e;if("string"!=typeof e)return[];var n,t,r,o,i,u=[],c=0;function a(){for(;e.length>c&&/\s/.test(e.charAt(c));)c+=1;return e.length>c}for(;e.length>c;){for(n=c,i=!1;a();)if(","===(t=e.charAt(c))){for(r=c,c+=1,a(),o=c;e.length>c&&"="!==(t=e.charAt(c))&&";"!==t&&","!==t;)c+=1;e.length>c&&"="===e.charAt(c)?(i=!0,c=o,u.push(e.substring(n,r)),n=c):c=r+1}else c+=1;i&&e.length>c||u.push(e.substring(n,e.length))}return u}(t).reduce(function(e,t){var r=function(e,t){void 0===e&&(e=""),void 0===t&&(t={});var r=e.split(";").filter(n),o=r.shift().split("="),i=o.shift(),u=o.join("="),c={name:i,value:t.decodeValues?decodeURIComponent(u):u};return r.forEach(function(e){var n=e.split("="),t=n.shift().trimLeft().toLowerCase(),r=n.join("=");"expires"===t?c.expires=new Date(r):"max-age"===t?c.maxAge=parseInt(r,10):"secure"===t?c.secure=!0:"httponly"===t?c.httpOnly=!0:"samesite"===t?c.sameSite=r:c[t]=r}),c}(t);return e[r.name]=r,e},e({},r)),wx.setStorage({key:"COOKIES",data:r})}(c),a?a(i):i})}}var r=null;function o(){r||(r=wx.getStorageSync("COOKIES")||{});var e=[];for(var n in r){var t=r[n];if(t.expires){var o=t.expires;if("[object Date]"!==Object.prototype.toString.call(o)&&(o=new Date(o)),o.getTime()<(new Date).getTime())continue}e.push((t.name||t.key)+"="+t.value)}return e.join("; ")}function i(){throw Error("微信支付,需要实现 options.fetchPayCode 方法")}function u(){throw Error("微信认证,需要实现 options.authWithCode 方法")}var c=Object.freeze({getStorage:function(e){return new Promise(function(n){wx.getStorage({key:e,complete:function(e){return n(e.data)}})})},setStorage:function(e,n){return new Promise(function(t){void 0===n?wx.removeStorage({key:e,complete:function(){return t(n)}}):wx.setStorage({key:e,data:n,complete:function(){return t(n)}})})}});return function(n,r){return e({fetchAPI:t(0,r.fetchAPI)},function(e,n){void 0===e&&(e={});var t=e.stringifyLocation,r=e.parseLocation,o=n.convertToWmpNavType;function i(e){var n=e&&e.options||{},r="/"+(e&&e.route||""),o=Object.keys(n).map(function(e){return e+"="+n[e]}).join("&");return t({pathname:r,search:o})}function u(e,n){return o&&(e=o(n,e)),new Promise(function(t,r){wx[e]({url:n,success:function(){return t()},fail:function(e){return r(Error(e.errMsg))}})})}return{getTopPage:function(){var e=getCurrentPages();return i(e[e.length-1])},navigateBack:function(){return new Promise(function(e,n){return wx.navigateBack({delta:1,success:function(){return e()},fail:function(e){return n(Error(e.errMsg))}})})},navigateTo:function(e){return"string"!=typeof e&&(e=t(e)),u("navigateTo",e)},redirectTo:function(e){return"string"!=typeof e&&(e=t(e)),u("redirectTo",e)},parseLocation:function(e){return e&&"string"!=typeof e&&(e=i(e)),r(e)}}}(n,r),{},function(n,t){var r=t.showConfirm;return{showTips:function(e,n){return new Promise(function(t,r){wx.showToast({icon:"succ"===e?"success":"none",title:n||"未知错误",success:function(){return t()},fail:function(e){return r(Error(e.errMsg))}})})},showConfirm:function(n){var t,o,i=n.title,u=void 0===i?"":i,c=n.message,a=void 0===c?"":c,s=n.cancelTitle,f=void 0===s?"取消":s,l=n.doneTitle,p=void 0===l?"确定":l,d=n.primary,h=void 0===d?"done":d,g=n.cancelable,v=void 0===g||g;return v&&"cancel"===h?(t=p,o=f):(t=f,o=p),new Promise(function(n,i){wx.showModal(e({},r,{title:u,content:a,cancelText:t,confirmText:o,showCancel:v,success:function(e){return n(e)},fail:function(e){return i(Error(e.errMsg))}}))}).then(function(e){return"cancel"===h?{done:e.cancel,cancel:e.confirm}:{done:e.confirm,cancel:e.cancel}})}}}(0,r),{},function(n,t){var r=t.fetchPayCode,o=void 0===r?i:r,c=t.authWithCode,a=void 0===c?u:c;return{wmp:{wx:wx,auth:function(){return new Promise(function(e,n){wx.login({success:function(n){return e(n)},fail:function(e){return n(Error(e.errMsg))}})}).then(function(e){return a(e.code)})},pay:function(n){return Promise.resolve(o(n)).then(function(n){return new Promise(function(t,r){wx.requestPayment(e({},n,{complete:function(e){var n=e.errMsg,o=n.substring(n.indexOf(":")+1);"ok"!==o?r(Error("cancel"!==o?"微信支付失败":"微信支付已取消")):t()}}))})})}}}}(0,r),{},c)}});

@@ -60,2 +60,3 @@ import _extends from "@babel/runtime/helpers/esm/extends";

wmp: {
wx: wx,
auth: auth,

@@ -62,0 +63,0 @@ pay: pay

@@ -67,2 +67,3 @@ "use strict";

wmp: {
wx: wx,
auth: auth,

@@ -69,0 +70,0 @@ pay: pay

{
"name": "@easyapp/wmp",
"version": "0.1.6",
"version": "0.1.7",
"description": "Easyapp Wechat MiniProgram",

@@ -5,0 +5,0 @@ "keywords": [],

@@ -48,3 +48,3 @@ function defaultFetchPayCode() {

return { wmp: { auth, pay } };
return { wmp: { wx, auth, pay } };
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc