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

mp-privacy

v1.0.10

Published

微信小程序隐私接口授权组件

Downloads

18

Readme

mp-privacy (小程序隐私保护授权弹窗组件)

微信发布关于小程序隐私保护指引设置的公告,为规范开发者的用户个人信息处理行为,保障用户的合法权益,自2023年9月15日起,对于涉及处理用户个人信息的小程序开发者,微信要求,仅当开发者主动向平台同步用户已阅读并同意了小程序的隐私保护指引等信息处理规则后,方可调用微信提供的隐私接口。

小程序用户隐私保护指引内容介绍里边所涉及到的隐私接口,都要做适配。

使用mp-privacy小程序隐私保护授权弹窗组件可降低开发成本,简单配置就可使用。需要授权时展示弹窗,用户点击“拒绝”授权隐私接口时,不能调用隐私接口,但不影响小程序其他功能的使用,点击“同意”后继续调用隐私接口。

mp-privacy

1 - 仓库地址

2 - 测试环境

  • 微信小程序基础库版本:2.32.3 及以上

3 - 安装方法:npm安装

npm i mp-privacy --save

3.1 依赖包安装后,需要在小程序开发者工具中:构建npm

3.2 如果不想使用npm安装,可以直接下载源码,然后复制mp-privacy组件进行使用

4 - 配置与使用(两种使用方式都需要以下配置)

4.1 小程序配置文件 app.json (2023年9月15日前调试需要此步配置)

{
  "__usePrivacyCheck__": true,
}

4.2 小程序 app.js

App({
  onLaunch: function (options) {

    // 监听隐私接口需要用户授权事件
    if (wx.onNeedPrivacyAuthorization) {
      wx.onNeedPrivacyAuthorization(resolve => {
        // 需要用户同意隐私授权时,弹出开发者自定义的隐私授权弹窗
        this.globalData.showPrivacy = true;
        this.globalData.resolvePrivacyAuthorization = resolve
      })
    }

  },
  globalData: {
    showPrivacy: false,
    resolvePrivacyAuthorization: null,
  },
})

4.3 使用到隐私接口的页面的配置文件 index.json

{
  "usingComponents": {
    "mp-privacy": "mp-privacy"
  }
}

4.4 使用到隐私接口的页面文件 index.wxml

<mp-privacy />

<!-- <mp-privacy action="exit" read="{{true}}" /> -->

4.5 所有使用到的隐私接口必须要在「小程序管理后台」设置《小程序用户隐私保护指引》,否则无法触发wx.onNeedPrivacyAuthorization 监听

组件可配置属性

| 属性 | 必填 | 类型 | 默认 | 说明 | 最低版本 | | ----- | ---- | ------ | ----- | ------- | ------ | | action | 否 | string | none | 用户点击拒绝后的程序动作。可选 exit 或 none,exit退出小程序 | 1.0.5 | | read | 否 | boolean | false | 是否必须有阅读动作才能点击同意按钮 | 1.0.5 |