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.8 to 0.1.9

8

dist/easyapp-wmp.js

@@ -445,3 +445,3 @@ (function (global, factory) {

function auth() {
function auth(params) {
return new Promise(function (resolve, reject) {

@@ -458,8 +458,8 @@ wx.login({

var code = _ref.code;
return authWithCode(code);
return authWithCode(code, params);
});
}
function pay(scene) {
return Promise.resolve(fetchPayCode(scene)).then(function (params) {
function pay(params) {
return Promise.resolve(fetchPayCode(params)).then(function (params) {
return new Promise(function (resolve, reject) {

@@ -466,0 +466,0 @@ wx.requestPayment(_extends({}, params, {

@@ -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:{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)}});
!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(e){return new Promise(function(e,n){wx.login({success:function(n){return e(n)},fail:function(e){return n(Error(e.errMsg))}})}).then(function(n){return a(n.code,e)})},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)}});

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

function auth() {
function auth(params) {
return new Promise(function (resolve, reject) {

@@ -30,8 +30,8 @@ wx.login({

var code = _ref.code;
return authWithCode(code);
return authWithCode(code, params);
});
}
function pay(scene) {
return Promise.resolve(fetchPayCode(scene)).then(function (params) {
function pay(params) {
return Promise.resolve(fetchPayCode(params)).then(function (params) {
return new Promise(function (resolve, reject) {

@@ -38,0 +38,0 @@ wx.requestPayment(_extends({}, params, {

@@ -24,3 +24,3 @@ "use strict";

function auth() {
function auth(params) {
return new Promise(function (resolve, reject) {

@@ -37,8 +37,8 @@ wx.login({

var code = _ref.code;
return authWithCode(code);
return authWithCode(code, params);
});
}
function pay(scene) {
return Promise.resolve(fetchPayCode(scene)).then(function (params) {
function pay(params) {
return Promise.resolve(fetchPayCode(params)).then(function (params) {
return new Promise(function (resolve, reject) {

@@ -45,0 +45,0 @@ wx.requestPayment((0, _extends2["default"])({}, params, {

{
"name": "@easyapp/wmp",
"version": "0.1.8",
"version": "0.1.9",
"description": "Easyapp Wechat MiniProgram",

@@ -49,21 +49,21 @@ "keywords": [

"@babel/preset-env": "^7.5.5",
"@typescript-eslint/eslint-plugin": "1.x",
"@typescript-eslint/parser": "1.x",
"babel-eslint": "10.x",
"eslint": "5.x",
"eslint-config-react-app": "4.0.1",
"eslint-plugin-flowtype": "2.x",
"eslint-plugin-import": "2.x",
"eslint-plugin-jsx-a11y": "6.x",
"eslint-plugin-react": "7.x",
"eslint-plugin-react-hooks": "1.x",
"rimraf": "^2.6.3",
"rollup": "^1.17.0",
"@typescript-eslint/eslint-plugin": "^1.13.0",
"@typescript-eslint/parser": "^1.13.0",
"babel-eslint": "^10.0.2",
"eslint": "^6.2.1",
"eslint-config-react-app": "^5.0.1",
"eslint-plugin-flowtype": "^3.13.0",
"eslint-plugin-import": "^2.18.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.14.3",
"eslint-plugin-react-hooks": "^1.7.0",
"rimraf": "^3.0.0",
"rollup": "^1.20.0",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-commonjs": "^10.0.1",
"rollup-plugin-commonjs": "^10.0.2",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-replace": "^2.2.0",
"rollup-plugin-terser": "^5.1.1",
"typescript": "3.x"
"typescript": "^3.5.3"
}
}

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

function auth() {
function auth(params) {
return new Promise((resolve, reject) => {

@@ -21,7 +21,7 @@ wx.login({

});
}).then(({ code }) => authWithCode(code));
}).then(({ code }) => authWithCode(code, params));
}
function pay(scene) {
return Promise.resolve(fetchPayCode(scene)).then(
function pay(params) {
return Promise.resolve(fetchPayCode(params)).then(
params =>

@@ -28,0 +28,0 @@ new Promise((resolve, reject) => {

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