npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mighty-js-sdk

v1.0.5

Published

H5 SDk for mighty merchants

Downloads

15

Readme

[TOC]

安装

npm 安装

npm i mighty-js-sdk
import "mighty-js-sdk/dist/mightyJsSdk.js";
//use in vue3
app.config.globalProperties.$mightyJsSdk = window.mightyJsSdk;

script 引入

<script src="mightyJsSdk/dist/mightyJsSdk.js" />

使用(webview 内嵌页面、H5 浏览器调用场景)

通用说明

api 最后一个参数 options 可选参数:唤起 app 失败或者成功的回调方法,默认唤起失败的回调方法是跳转到 Mighty 下载页

{
  callAppSuccess:function(){},
  callAppFail:function(){}
}

授权

//@param String authToken  //商家授权token
//@param Function Callback
//@param Object? {callAppSuccess,callAppFail} //可选参数
//@response Object {code:stinrg,data:Object,message:string}
mightyJsSdk.auth(
  authToken,
  (result) => {
    console.log(result);
  },
  options
);

调用参数:

"authToken": "477599683939872768"

Callback 回调:

{
  "code": "0",
  "data": "55e7534dd2bd497793a25d430b4f61f0" //用户授权临时令牌(token)
}

其他:

{
  "code": "10",
  "message": "用户放弃授权"
}
{
  "code": "11",
  "message": "用户拒绝授权"
}

说明: 1.webview 网页情况:在回调函数中返回 token, 2.h5 唤起情况:在商家回调地址中获取 token 的查询参数。例如: {{回调地址}}?token=55e7534dd2bd497793a25d430b4f61f0

支付

//@param String orderId
//@param Function Callback
//@param Object? {callAppSuccess,callAppFail} //可选参数
//@response Object {code:stinrg,data:Object,message:string}
mightyJsSdk.pay(
  orderId,
  (result) => {
    console.log(result);
  },
  options
);

调用参数:

orderId:477599683939872768

Callback 回调:

{
  "code": "0",
  "data": { "status": "2", "returnUrl": "http://return;" }
}

其他:

{
  "code": "1",
  "message": "系统异常"
}
{
  "code": "-1",
  "message": "用户取消支付"
}
{
  "code": "2",
  "message": "支付成功"
}
{
  "code": "3",
  "message": "订单已取消"
}
{
  "code": "4",
  "message": "订单已超时关闭"
}
{
  "code": "5",
  "message": "订单异常"
}
{
  "code": "6",
  "message": "订单已支付"
}
{
  "code": "8",
  "message": "订单支付中"
}
{
  "code": "28506",
  "message": "账号被锁定"
}

注:H5 外部浏览器调用无回调,由商家自行轮询订单支付结果

分享

/*
  @param Object {shared_desc,shared_url,shared_cover_url,app_id,shared_type,shared_name}
  param detail:
  shared_desc        商品详情介绍
  shared_url         分享链接
  shared_cover_url   封面图
  app_id             商户appId
  shared_type        1:小程序 2:链接分享 3:小程序商品
  share_target       1是分享到好友, 2是分享到动态

  @param Function Callback
  @param Object? {callAppSuccess,callAppFail} //可选参数
  @response Object {code:stinrg,data:Object,message:string}
*/

mightyJsSdk.share(
    {
    shared_desc,
    shared_url,
    shared_cover_url,
    app_id,
    shared_type,
    shared_name,
    shared_target,
  },,
  (result) => {
    console.log(result);
  },
  options
);

调用参数:

{
  "shared_desc": "商品描述啊啊啊",
  "shared_url": "http://www.baidu.com",
  "shared_cover_url": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRoIJQVHQ8NtlS02Vtno0b81X9BQNkg34e1tg&usqp=CAU",
  "app_id": "475070042590339072",
  "shared_type": "2",
  "shared_name": "来看看",
  "shared_target": "1"
}

Callback 回调:无