{"_id":"@aicxz/react-native-wechat","_rev":"2-2bf36f9664cfac009bcbad8b9266852a","name":"@aicxz/react-native-wechat","dist-tags":{"latest":"2.0.1"},"versions":{"2.0.0":{"name":"@aicxz/react-native-wechat","version":"2.0.0","description":"react-native library for wechat app","main":"index.js","scripts":{"test":"echo 1"},"repository":{"type":"git","url":"git+ssh://git@github.com/Aicxz/react-native-wechat.git"},"keywords":["wechat","react","react-native","react-component","ios"],"dependencies":{"events":"1.0.2"},"peerDependencies":{"react-native":">=0.40"},"author":{"name":"Yorkie Liu","email":"yorkiefixer@gmail.com"},"contributors":[{"name":"Yorkie Liu","email":"yorkiefixer@gmail.com"},{"name":"Deng Yun","email":"tdzl2003@gmail.com"}],"license":"MIT","bugs":{"url":"https://github.com/weflex/react-native-wechat/issues"},"homepage":"https://github.com/weflex/react-native-wechat#readme","gitHead":"a222bcf040f7f40c619b5e4c38e43cdec8b3b61f","_id":"@aicxz/react-native-wechat@2.0.0","_npmVersion":"6.4.1","_nodeVersion":"8.15.1","_npmUser":{"name":"aicxz","email":"877881606@qq.com"},"dist":{"integrity":"sha512-ndQgJgOnMPyMeCh6TRFg6axK7o/JpLbQ4nlB4qe7JvWl4aGMaeMSXEbnQoiskPEOcRrLl4UNgHbAsygzW8xVnQ==","shasum":"5b658892f96d7b8b281a894e1df158d0b4f0eac9","tarball":"https://registry.npmjs.org/@aicxz/react-native-wechat/-/react-native-wechat-2.0.0.tgz","fileCount":35,"unpackedSize":13447210,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdMrTHCRA9TVsSAnZWagAAMFsP/Rd4Ltk3QAij7XRCyeVz\nzVTl37DYM5ZOGVQvWVqZ/fYj9O/pRCc1F7dgLjH2j1UvjPZy+kQIHW9xioWX\nQZzvX7HPRqPKTxTAZ3wK9QwrpsDHEwTnjV5ln6aCsfH4XfOoXlqMz3S5r1uO\nuhwmlJFC+PGvUkHlTS6ZzJ/oS8RDEINE1OEF9B/tHlC3Cb93zEy0qgvUqKd9\nmmrumJzPb8t9bnMBgQjQbJ3afdGuOxY9j+gGbjZW9kWcleDSWn4flfLH1UvY\n2guSQuEi6EustioL6/FDxfW43CmkNBIxseAZMhypfc+CXRCTlynh4atczBpH\n8PSfOo+sNU6w2y1BQ3j9jUo2cOFUCqIiEgdrg5XKXT2S7aN3iUbei6anMAtX\nMTzj1r63Cyr46mAkLTiqSJiOVShRJYHkxZtL38NXF2WVUgmcJZfI6c0kOEJk\n2a66buLLbC5d5eJJtYBfiXvKd8mgxSOQ8/V/A3Xpkk3spufSLDhZ7MSGHzuN\n09IZoe0zcpISso0oCyyU+tFq4c2RZyTsNSAaQCvgW7PSKZsOh6TamXbhQ0Mq\nuYpbE1WiRNZdyQk6IeT26kSOjowcWvbFcT3BtZ0DzZlXxN/n4cs7vmCVclXO\nxpirLXp0SeiQrGqg+MxHkGVPWjFX74BMn3Nokr4Noeg6ivktz5rMdnv+qEFN\nA1Gq\r\n=nkYF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEhCp1KoZMnksUBP2XDaE7u+mwUeEPqNLBaPZDZYSCItAiB1U4MVb9/nOS8CyJYVdwwnKxdYGtq41cW7GE2uGQaoIQ=="}]},"maintainers":[{"name":"aicxz","email":"877881606@qq.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-wechat_2.0.0_1563604165980_0.41814634958747554"},"_hasShrinkwrap":false},"2.0.1":{"name":"@aicxz/react-native-wechat","version":"2.0.1","description":"react-native library for wechat app","main":"index.js","scripts":{"test":"echo 1"},"repository":{"type":"git","url":"git+ssh://git@github.com/Aicxz/react-native-wechat.git"},"keywords":["wechat","react","react-native","react-component","ios"],"dependencies":{"events":"1.0.2"},"peerDependencies":{"react-native":">=0.40"},"author":{"name":"Yorkie Liu","email":"yorkiefixer@gmail.com"},"contributors":[{"name":"Yorkie Liu","email":"yorkiefixer@gmail.com"},{"name":"Deng Yun","email":"tdzl2003@gmail.com"}],"license":"MIT","bugs":{"url":"https://github.com/weflex/react-native-wechat/issues"},"homepage":"https://github.com/weflex/react-native-wechat#readme","gitHead":"5934adb3a4c626f5a0cba2009a00036963cc3358","_id":"@aicxz/react-native-wechat@2.0.1","_npmVersion":"6.4.1","_nodeVersion":"8.15.1","_npmUser":{"name":"aicxz","email":"877881606@qq.com"},"dist":{"integrity":"sha512-bZqqZzjQlZQVQ5zAIb2SfCxrJpDN54byMXCrqpko25GLI3cl5J+wzHSIxIdSPTC6Clemn6YFlNHacaRcX+GTpA==","shasum":"f7dd9c5d140d93b504543951872e7d77980a980f","tarball":"https://registry.npmjs.org/@aicxz/react-native-wechat/-/react-native-wechat-2.0.1.tgz","fileCount":35,"unpackedSize":13447126,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdMrn/CRA9TVsSAnZWagAAnTYQAI84+WLH38IZiFgbMb1K\nT+oULZneVw1JCbH+QL0a9oB6Dg02ZNSpTDBuRzCORAMIsk4oyvyGercbrvD/\nnSMGjVp4PtRLVECNN16SN2EHOyKJNUja4/tnIHzX4AAbRRHDqz1QGXc3yeW0\nXYzTVVmSa7pqn1JAj+T8LWVKPsYr5CnCnT8obgiT6rphVWFcuFeZbO9Jxqt3\nOIqrhLQ2F9j4SsFUj+N98h+iEOVQCPO6iDXgYJuvOqSj1MT+r05g9H21x3x8\nOTFjZXPLux6WwPo/23IN3MK5vx+v4Gz0RAoOs3xQ01N9ap2pvNffwmzL4u/2\nMiygxpGw/hsdJDSP4hbM8I9A50OZkpsFL0JFqF/DxGQd8224E9frKJX83DO2\nLaHCL2L1HIqdbfon57i58I0x6AckVD8et8uisvfgaybkiMVGlHYGcgxWVis4\nlZUMFXLpNBB1o/mrvxpb6laa1u/3FtMKs3/3qUl/hDrtgNO80ZOgaGtnWmH2\nF4+JPN0tK23w3X5Qi4Xf8t5X/CF03HOfZVxBAiJXLplxeZbx7oNzWmQX/ubA\njqUm1KGsFQFWpvjIIHaViDQ8Skd1tzrpOHaPwqLDum29BRfkvdzXOExGDUI2\nf8nFdEdUsOd3+BsKMcqQMuYDlHRkSbDgkcb7mQ9SA6JvOq0O4kqZZ7k245ll\ncWlq\r\n=6BZO\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC+NMCKV8J6h2M6Dn9KWC8GNGAl8X4/BYDKdF6jWAzv6gIgDTRHSN/H4rV22ZwwEF5m6YILT6Wdh8RBDpIIMuJafPU="}]},"maintainers":[{"name":"aicxz","email":"877881606@qq.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/react-native-wechat_2.0.1_1563605502321_0.25978429074777165"},"_hasShrinkwrap":false}},"time":{"created":"2019-07-20T06:29:25.760Z","2.0.0":"2019-07-20T06:29:26.325Z","modified":"2022-04-04T12:16:17.587Z","2.0.1":"2019-07-20T06:51:42.764Z"},"maintainers":[{"name":"aicxz","email":"877881606@qq.com"}],"description":"react-native library for wechat app","homepage":"https://github.com/weflex/react-native-wechat#readme","keywords":["wechat","react","react-native","react-component","ios"],"repository":{"type":"git","url":"git+ssh://git@github.com/Aicxz/react-native-wechat.git"},"contributors":[{"name":"Yorkie Liu","email":"yorkiefixer@gmail.com"},{"name":"Deng Yun","email":"tdzl2003@gmail.com"}],"author":{"name":"Yorkie Liu","email":"yorkiefixer@gmail.com"},"bugs":{"url":"https://github.com/weflex/react-native-wechat/issues"},"license":"MIT","readme":"<img height=\"200\" src=\"./weixin.png?raw=true\">\r\n\r\n# React-Native-Wechat\r\n\r\n[React Native] bridging library that integrates WeChat SDKs:\r\n\r\n- [x] iOS SDK 1.7.2\r\n- [x] Android SDK 221\r\n\r\n[react-native-wechat] has the following tracking data in the open source world:\r\n\r\n| NPM | Dependency | Downloads | Build |\r\n|-----|------------|-----------|-------|\r\n| [![NPM version][npm-image]][npm-url] | [![Dependency Status][david-image]][david-url] | [![Downloads][downloads-image]][downloads-url] | [![Build Status][travis-image]][travis-url] |\r\n\r\n## Table of Contents\r\n\r\n- [Getting Started](#getting-started)\r\n- [API Documentation](#api-documentation)\r\n- [Installation](#installation)\r\n- [Community](#community)\r\n- [Authors](#authors)\r\n- [License](#license)\r\n\r\n## Getting Started\r\n\r\n- [Build setup on iOS](./docs/build-setup-ios.md)\r\n- [Build setup on Android](./docs/build-setup-android.md)\r\n\r\n## API Documentation\r\n\r\n[react-native-wechat] uses Promises, therefore you can use `Promise`\r\nor `async/await` to manage your dataflow.\r\n\r\n#### registerApp(appid)\r\n\r\n- `appid` {String} the appid you get from WeChat dashboard\r\n- returns {Boolean} explains if your application is registered done\r\n\r\nThis method should be called once globally.\r\n\r\n```js\r\nimport * as WeChat from 'react-native-wechat';\r\n\r\nWeChat.registerApp('appid');\r\n```\r\n\r\n#### registerAppWithDescription(appid, description)\r\n\r\n- `appid` {String} the appid you get from WeChat dashboard\r\n- `description` {String} the description of your app\r\n- returns {Boolean} explains if your application is registered done\r\n\r\nThis method is only available on iOS.\r\n\r\n#### isWXAppInstalled() \r\n\r\n- returns {Boolean} if WeChat is installed.\r\n\r\nCheck if the WeChat app is installed on the device.\r\n\r\n#### isWXAppSupportApi()\r\n\r\n- returns {Boolean} Contains the result.\r\n\r\nCheck if wechat support open url.\r\n\r\n#### getApiVersion()\r\n\r\n- returns {String} Contains the result.\r\n\r\nGet the WeChat SDK api version.\r\n\r\n#### openWXApp()\r\n\r\n- returns {Boolean} \r\n\r\nOpen the WeChat app from your application.\r\n\r\n#### sendAuthRequest([scope[, state]])\r\n\r\n- `scope` {Array|String} Scopes of auth request.\r\n- `state` {String} the state of OAuth2\r\n- returns {Object}\r\n\r\nSend authentication request, and it returns an object with the \r\nfollowing fields:\r\n\r\n| field   | type   | description                         |\r\n|---------|--------|-------------------------------------|\r\n| errCode | Number | Error Code                          |\r\n| errStr  | String | Error message if any error occurred |\r\n| openId  | String |                                     |\r\n| code    | String | Authorization code                  |\r\n| url     | String | The URL string                      |\r\n| lang    | String | The user language                   |\r\n| country | String | The user country                    |\r\n\r\n#### class `ShareMetadata`\r\n\r\n- `type` {Number} type of this message. Can be {news|text|imageUrl|imageFile|imageResource|video|audio|file}\r\n- `thumbImage` {String} Thumb image of the message, which can be a uri or a resource id.\r\n- `description` {String} The description about the sharing.\r\n- `webpageUrl` {String} Required if type equals `news`. The webpage link to share.\r\n- `imageUrl` {String} Provide a remote image if type equals `image`.\r\n- `videoUrl` {String} Provide a remote video if type equals `video`.\r\n- `musicUrl` {String} Provide a remote music if type equals `audio`.\r\n- `filePath` {String} Provide a local file if type equals `file`.\r\n- `fileExtension` {String} Provide the file type if type equals `file`.\r\n\r\n#### shareToTimeline(message)\r\n\r\n- `message` {ShareMetadata} This object saves the metadata for sharing\r\n- returns {Object}\r\n\r\nShare a `ShareMetadata` message to timeline(朋友圈) and returns:\r\n\r\n| name    | type   | description                         |\r\n|---------|--------|-------------------------------------|\r\n| errCode | Number | 0 if authorization successed        |\r\n| errStr  | String | Error message if any error occurred |\r\n\r\nThe following examples require the 'react-native-chat' and 'react-native-fs' packages.\r\n\r\n```js\r\nimport * as WeChat from 'react-native-wechat';\r\nimport fs from 'react-native-fs';\r\nlet resolveAssetSource = require('resolveAssetSource');\r\n\r\n// Code example to share text message:\r\ntry {\r\n  let result = await WeChat.shareToTimeline({\r\n    type: 'text', \r\n    description: 'hello, wechat'\r\n  });\r\n  console.log('share text message to time line successful:', result);\r\n} catch (e) {\r\n  if (e instanceof WeChat.WechatError) {\r\n    console.error(e.stack);\r\n  } else {\r\n    throw e;\r\n  }\r\n}\r\n\r\n// Code example to share image url:\r\n// Share raw http(s) image from web will always fail with unknown reason, please use image file or image resource instead\r\ntry {\r\n  let result = await WeChat.shareToTimeline({\r\n    type: 'imageUrl',\r\n    title: 'web image',\r\n    description: 'share web image to time line',\r\n    mediaTagName: 'email signature',\r\n    messageAction: undefined,\r\n    messageExt: undefined,\r\n    imageUrl: 'http://www.ncloud.hk/email-signature-262x100.png'\r\n  });\r\n  console.log('share image url to time line successful:', result);\r\n} catch (e) {\r\n  if (e instanceof WeChat.WechatError) {\r\n    console.error(e.stack);\r\n  } else {\r\n    throw e;\r\n  }\r\n}\r\n\r\n// Code example to share image file:\r\ntry {\r\n  let rootPath = fs.DocumentDirectoryPath;\r\n  let savePath = rootPath + '/email-signature-262x100.png';\r\n  console.log(savePath);\r\n  \r\n  /*\r\n   * savePath on iOS may be:\r\n   *  /var/mobile/Containers/Data/Application/B1308E13-35F1-41AB-A20D-3117BE8EE8FE/Documents/email-signature-262x100.png\r\n   *\r\n   * savePath on Android may be:\r\n   *  /data/data/com.wechatsample/files/email-signature-262x100.png\r\n   **/\r\n  await fs.downloadFile('http://www.ncloud.hk/email-signature-262x100.png', savePath);\r\n  let result = await WeChat.shareToTimeline({\r\n    type: 'imageFile',\r\n    title: 'image file download from network',\r\n    description: 'share image file to time line',\r\n    mediaTagName: 'email signature',\r\n    messageAction: undefined,\r\n    messageExt: undefined,\r\n    imageUrl: \"file://\" + savePath // require the prefix on both iOS and Android platform\r\n  });\r\n  console.log('share image file to time line successful:', result);\r\n} catch (e) {\r\n  if (e instanceof WeChat.WechatError) {\r\n    console.error(e.stack);\r\n  } else {\r\n    throw e;\r\n  }\r\n}\r\n\r\n// Code example to share image resource:\r\ntry {\r\n  let imageResource = require('./email-signature-262x100.png');\r\n  let result = await WeChat.shareToTimeline({\r\n    type: 'imageResource',\r\n    title: 'resource image',\r\n    description: 'share resource image to time line',\r\n    mediaTagName: 'email signature',\r\n    messageAction: undefined,\r\n    messageExt: undefined,\r\n    imageUrl: resolveAssetSource(imageResource).uri\r\n  });\r\n  console.log('share resource image to time line successful', result);\r\n}\r\ncatch (e) {\r\n  if (e instanceof WeChat.WechatError) {\r\n    console.error(e.stack);\r\n  } else {\r\n    throw e;\r\n  }\r\n}\r\n\r\n// Code example to download an word file from web, then share it to WeChat session\r\n// only support to share to session but time line\r\n// iOS code use DocumentDirectoryPath\r\ntry {\r\n  let rootPath = fs.DocumentDirectoryPath;\r\n  let fileName = 'signature_method.doc';\r\n  /*\r\n   * savePath on iOS may be:\r\n   *  /var/mobile/Containers/Data/Application/B1308E13-35F1-41AB-A20D-3117BE8EE8FE/Documents/signature_method.doc\r\n   **/ \r\n  let savePath = rootPath + '/' + fileName;\r\n\r\n  await fs.downloadFile('https://open.weixin.qq.com/zh_CN/htmledition/res/assets/signature_method.doc', savePath);\r\n  let result = await WeChat.shareToSession({\r\n    type: 'file',\r\n    title: fileName, // WeChat app treat title as file name\r\n    description: 'share word file to chat session',\r\n    mediaTagName: 'word file',\r\n    messageAction: undefined,\r\n    messageExt: undefined,\r\n    filePath: savePath,\r\n    fileExtension: '.doc'\r\n  });\r\n  console.log('share word file to chat session successful', result);\r\n} catch (e) {\r\n  if (e instanceof WeChat.WechatError) {\r\n    console.error(e.stack);\r\n  } else {\r\n    throw e;\r\n  }\r\n}\r\n\r\n//android code use ExternalDirectoryPath\r\ntry {\r\n  let rootPath = fs.ExternalDirectoryPath;\r\n  let fileName = 'signature_method.doc';\r\n  /*\r\n   * savePath on Android may be:\r\n   *  /storage/emulated/0/Android/data/com.wechatsample/files/signature_method.doc\r\n   **/\r\n  let savePath = rootPath + '/' + fileName;\r\n  await fs.downloadFile('https://open.weixin.qq.com/zh_CN/htmledition/res/assets/signature_method.doc', savePath);\r\n  let result = await WeChat.shareToSession({\r\n    type: 'file',\r\n    title: fileName, // WeChat app treat title as file name\r\n    description: 'share word file to chat session',\r\n    mediaTagName: 'word file',\r\n    messageAction: undefined,\r\n    messageExt: undefined,\r\n    filePath: savePath,\r\n    fileExtension: '.doc'\r\n  });\r\n  console.log('share word file to chat session successful', result);\r\n}\r\ncatch (e) {\r\n  if (e instanceof WeChat.WechatError) {\r\n    console.error(e.stack);\r\n  } else {\r\n    throw e;\r\n  }\r\n}\r\n```\r\n\r\n#### shareToSession(message)\r\n\r\n- `message` {ShareMetadata} This object saves the metadata for sharing\r\n- returns {Object}\r\n\r\nSimilar to `shareToTimeline` but sends the message to a friend or chat group.\r\n\r\n#### pay(payload)\r\n\r\n- `payload` {Object} the payment data\r\n  - `partnerId` {String} 商家向财付通申请的商家ID\r\n  - `prepayId` {String} 预支付订单ID\r\n  - `nonceStr` {String} 随机串\r\n  - `timeStamp` {String} 时间戳\r\n  - `package` {String} 商家根据财付通文档填写的数据和签名\r\n  - `sign` {String} 商家根据微信开放平台文档对数据做的签名\r\n- returns {Object}\r\n\r\nSends request for proceeding payment, then returns an object:\r\n\r\n| name    | type   | description                         |\r\n|---------|--------|-------------------------------------|\r\n| errCode | Number | 0 if authorization successed        |\r\n| errStr  | String | Error message if any error occurred |\r\n\r\n## Installation\r\n\r\n```sh\r\n$ npm install react-native-wechat --save\r\n```\r\n## Partners\r\n\r\n[React Native Starter Kit](https://reactnativestarter.com/) - is a mobile starter kit that allows your team to fully focus on development of the features that set your product apart from the competitors instead of building your app from scratch.\r\n\r\n## Community\r\n\r\n#### IRC\r\n\r\n<a href=\"http://qm.qq.com/cgi-bin/qm/qr?k=cg3irEFCGxjkm2YJCt5V9OeJA1pNo5Ui\"><img width=\"200\" src=\"./qrcode_qq.jpg\"></a>\r\n\r\n#### Tutorials\r\n\r\n- [react-native-wechat微信组件的使用](http://www.jianshu.com/p/3f424cccb888)\r\n- [超详细React Native实现微信好友/朋友圈分享功能-Android/iOS双平台通用](http://www.jianshu.com/p/ce5439dd1f52)\r\n- [柳轩涤俗 - 微信登录](http://www.cnblogs.com/zhangdw/p/6194345.html)\r\n\r\n#### Who's using it\r\n\r\n<a href=\"https://github.com/attentiveness/reading\"><img height=\"80\" width=\"80\" src=\"https://raw.githubusercontent.com/attentiveness/reading/master/Reading_Logo.png\"></a>\r\n<a href=\"https://github.com/lipeiwei-szu/ReactNativeOne\"><img height=\"80\" width=\"80\" src=\"http://android-artworks.25pp.com/fs08/2017/05/22/3/110_ed42e5c8f701ae26be6b0c423cb51858_con_130x130.png\"></a>\r\n\r\n## Authors\r\n\r\n| GitHub        | Role       | Email                 |\r\n|---------------|------------|-----------------------|\r\n| [@yorkie]     | Author     | yorkiefixer@gmail.com |\r\n| [@xing-zheng] | Emeriti    |                       |\r\n| [@tdzl2003]   | Emeriti    | tdzl2003@gmail.com    |\r\n\r\n[@yorkie]: https://github.com/yorkie\r\n[@xing-zheng]: https://github.com/xing-zheng\r\n[@tdzl2003]: https://github.com/tdzl2003\r\n\r\n## License\r\n\r\nMIT\r\n\r\n[react-native-wechat]: https://github.com/yorkie/react-native-wechat\r\n[npm-image]: https://img.shields.io/npm/v/react-native-wechat.svg?style=flat-square\r\n[npm-url]: https://npmjs.org/package/react-native-wechat\r\n[travis-image]: https://img.shields.io/travis/yorkie/react-native-wechat.svg?style=flat-square\r\n[travis-url]: https://travis-ci.org/yorkie/react-native-wechat\r\n[david-image]: http://img.shields.io/david/yorkie/react-native-wechat.svg?style=flat-square\r\n[david-url]: https://david-dm.org/yorkie/react-native-wechat\r\n[downloads-image]: http://img.shields.io/npm/dm/react-native-wechat.svg?style=flat-square\r\n[downloads-url]: https://npmjs.org/package/react-native-wechat\r\n[React Native]: https://github.com/facebook/react-native\r\n[react-native-cn]: https://github.com/reactnativecn\r\n[WeChat SDK]: https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=1417674108&token=&lang=zh_CN\r\n[Linking Libraries iOS Guidance]: https://developer.apple.com/library/ios/recipes/xcode_help-project_editor/Articles/AddingaLibrarytoaTarget.html\r\n","readmeFilename":"README.md"}