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

@freshservice/bridge

v1.3.5

Published

freshes js bridge

Downloads

38

Readme

@freshservice/bridge

freshes bridge

安装

# install dependencies
yarn add @freshservice/bridge

引入

import {
    SignIn,
    Address,
    AddToCart,
    Cart,
    Coupon,
    FindPayPwd,
    HomePage,
    OnlineService,
    Order,
    Point,
    Product,
    Profile,
    Recharge,
    Refresh,
    Register,
    SetShareOptions,
    ShareMenu,
    UnlockPayPwd,
    UpdateAuth,
    SetCustomData,
    AccountCard,
    LimitInWx,
    Category
  } from '@freshservice/bridge'

 ...

 data () {
     return {
         from: 'app/wechat' // 从建议从url获取或者从UpdateAuth方法存储的localStorage中获取from
     }
 }

统一说明

为了开发更方便测试,故在版本1.2.7加入了测试选项(仅对跳转类方法),如下:

例如登录,跳转到测试环境:
SignIn.init({test: true}).execute()

跳转到正式:
SignIn.init().execute()

跳转登录

SignIn.init().execute()

获取登录信息

// 手机号码只有从微信商城登录才有,app无此字段
UpdateAuth.init().execute()
console.log(window.localStorage.getItem('TOC_TOKEN'))// 用户token, 例如 {"AccessToken":"xxxxxabcxx","CustomerGuid":"xxx-xxx","SourceType":"9","Phone":"181111xxxxxxx","from":"wechat","expires":"2019-01-08T02:13:30.713Z"}
console.log(window.localStorage.getItem('TOC_CITY'))// 城市信息, 例如 {"CityId":"3","CityFlag":"sh"}

注意:app里登录完成后仅仅只是将用户信息塞入到url,并不会刷新。 解决方案:

'$route.query' () {
  if (this.$route.query.token) {
    window.location.reload()
  }
}

加入购物车

const productId = 111 // 商品id
AddToCart
  .init()
  .execute(productId)
  .success(response => {
    // do something
  })

设置分享信息

const data = {
    title: '标题',
    desc: '描述',
    link: 'https://www.baidu.com',
    imgUrl: 'https://picpro-sz.34580.com/sz/ImageUrl/8367/400.jpeg',
    shareCode: 3 // 0.禁止分享 1.只允许微信 2.允许所有 3.分享大图
}
SetShareOptions.init().execute(data).success(() => {
 // 分享成功
})

地址管理(只能查看)

Address.init().execute()

跳转购物车

Cart.init().execute()

查看优惠券

Coupon.init().execute()

找回支付密码

FindPayPwd.init().execute()

解锁支付密码

UnlockPayPwd.init().execute()

app/商城首页

HomePage.init().execute()

在线客服

OnlineService.init().execute()

查看我的订单

Order.init().execute()

查看我的积分

Point.init().execute()

查看商品

const productId = 111 // 商品id
Product.init().execute(productId)

用户信息页

Profile.init().execute()

跳转充值

Recharge.init().execute()

刷新页面

Refresh.init().execute()

注册

// 一般此方法不使用,由公共登录页引导登录即可
const registerMethod = 1200 // ios 安卓有区别
Register.init().execute(registerMethod)

打开分享

ShareMenu.init().execute()

设置zhugeTitle(埋点用)

SetCustomData.init().execute({ zhugeTitle: '测试标题吼吼吼吼' })

跳转到绑定卡

AccountCard.init().execute()

获取微信code

LimitInWx.init().execute()

当前环境为微信返回true,并且code作为query string跟在url后,否则返回false.

优惠券根据品类跳转

type: 1 全场通用  2 品类  4 or 5 单品
// Category.init().execute({type: 4, id: 10493})
// Category.init().execute({type: 2, id: 300})
Category.init().execute({type: 1})