{ "_args": [ [ { "raw": "react-native-branch@2.0.0-beta.3", "scope": null, "escapedName": "react-native-branch", "name": "react-native-branch", "rawSpec": "2.0.0-beta.3", "spec": "2.0.0-beta.3", "type": "version" }, "/home/jdaugherty/work/GT2/GT2-Android/node_modules/expo" ] ], "_from": "react-native-branch@2.0.0-beta.3", "_id": "react-native-branch@2.0.0-beta.3", "_inCache": true, "_location": "/react-native-branch", "_nodeVersion": "7.9.0", "_npmOperationalInternal": { "host": "packages-18-east.internal.npmjs.com", "tmp": "tmp/react-native-branch-2.0.0-beta.3.tgz_1493248713608_0.12053141696378589" }, "_npmUser": { "name": "jdee", "email": "jgvdthree@gmail.com" }, "_npmVersion": "4.5.0", "_phantomChildren": {}, "_requested": { "raw": "react-native-branch@2.0.0-beta.3", "scope": null, "escapedName": "react-native-branch", "name": "react-native-branch", "rawSpec": "2.0.0-beta.3", "spec": "2.0.0-beta.3", "type": "version" }, "_requiredBy": [ "/expo" ], "_resolved": "https://registry.npmjs.org/react-native-branch/-/react-native-branch-2.0.0-beta.3.tgz", "_shasum": "2167af86bbc9f964bd45bd5f37684e5b54965e32", "_shrinkwrap": null, "_spec": "react-native-branch@2.0.0-beta.3", "_where": "/home/jdaugherty/work/GT2/GT2-Android/node_modules/expo", "authors": [ "Zack Story (https://github.com/rt2zz)", "Kevin Stumpf (https://github.com/kevinstumpf)", "Jimmy Dee (https://github.com/jdee)" ], "ava": { "require": [ "babel-register", "babel-polyfill", "react-native-mock/mock.js", "./test/helpers/RNBranch.mock.js" ], "babel": "inherit" }, "babel": { "ignore": false, "presets": [ "react-native" ] }, "bugs": { "url": "https://github.com/BranchMetrics/react-native-branch/issues" }, "dependencies": {}, "description": "Branch Metrics React Native SDK", "devDependencies": { "ava": "~0.14.0", "babel-eslint": "^6.0.4", "babel-polyfill": "^6.7.4", "eslint": "^2.7.0", "eslint-config-rackt": "^1.1.1", "mockery": "*", "react": "~15.4.0", "react-addons-create-fragment": "~15.4.0", "react-addons-pure-render-mixin": "~15.4.0", "react-addons-test-utils": "~15.4.0", "react-addons-update": "~15.4.0", "react-dom": "~15.4.0", "react-native": "~0.41.2", "react-native-mock": "^0.3.0", "sinon": "*", "underscore": "*" }, "directories": {}, "dist": { "shasum": "2167af86bbc9f964bd45bd5f37684e5b54965e32", "tarball": "https://registry.npmjs.org/react-native-branch/-/react-native-branch-2.0.0-beta.3.tgz" }, "files": [ "src", "docs", "android", "ios", "react-native-branch.podspec" ], "gitHead": "e510ada9f8e34581d6407f8e6a1078f14c73188f", "homepage": "https://github.com/BranchMetrics/react-native-branch", "keywords": [ "react-native", "react-component", "ios", "android", "branch", "metrics", "deeplink", "deep", "link" ], "license": "MIT", "main": "src/index.js", "maintainers": [ { "name": "jdee", "email": "jgvdthree@gmail.com" }, { "name": "kevinstumpf", "email": "kevin@dispatchertrucking.com" }, { "name": "maephet", "email": "alexjaustin@gmail.com" }, { "name": "rt2zz", "email": "ztstory@gmail.com" } ], "name": "react-native-branch", "optionalDependencies": {}, "peerDependencies": { "react": ">=15.4.0", "react-native": ">=0.40.0" }, "readme": "# Branch Metrics React Native SDK Reference\n\n[![build status](https://img.shields.io/travis/BranchMetrics/react-native-branch-deep-linking.svg?style=flat-square)](https://travis-ci.org/BranchMetrics/react-native-branch-deep-linking)\n[![npm version](https://img.shields.io/npm/v/react-native-branch.svg?style=flat-square)](https://www.npmjs.com/package/react-native-branch)\n[![npm downloads](https://img.shields.io/npm/dm/react-native-branch.svg?style=flat-square)](https://www.npmjs.com/package/react-native-branch)\n[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://raw.githubusercontent.com/hyperium/hyper/master/LICENSE)\n\nThis is a repository of our open source React Native SDK. Huge shoutout to our friends at [Dispatcher, Inc.](https://dispatchertrucking.com) for their help in compiling the initial version of this SDK. This SDK will help you handle iOS Universal Links, Android App Links and deferred deep links, do install attribution and much more!\n\n## 2.0.0 beta\n\n[Release 2.0.0]: ./docs/Release-2.0.0.md\n\nVersion 2.0.0-beta.3 is now available in NPM with a simplified SDK integration process. See [Release 2.0.0] for details.\n\n**v1.1.0** The `createBranchUniversalObject` method is now async, so be sure to use `await` or handle the promise resolution, e.g.\n```js\nlet buo = await branch.createBranchUniversalObject(...)\n```\nor\n```js\nbranch.createBranchUniversalObject(...).then((buo) => {\n this.buo = buo\n})\n```\nThis method does not throw.\n\n**react-native v0.40 support** is available in version 1.x. This is a non-backwards compatible update. If you need to stay on react-native <0.40 please fix your package.json version to react-native-branch@0.9. See [Updating to 1.0.0](./docs/updating-1.0.0.md) for details. Note that some build steps differ between 0.9 and 1.x. These are highlighted\nwhere applicable.\n\n**v0.8.0** If you have overridden `onStop` in MainActivity.java be sure *not* to invoke `RNBranchModule.onStop()`.\n\n## Installation\n\nFor beta version 2.0.0 see [Release 2.0.0]. These instructions are for 0.9 and 1.x.\n\n1. `npm install --save react-native-branch`\n2. `react-native link react-native-branch` **or** link the project [manually](./docs/installation.md#manual-linking)\n3. Add `pod 'Branch'` to your ios/Podfile ([details](./docs/installation.md#cocoa-pods))\n4. `cd ios; pod install --repo-update`\n5. Follow the [setup instructions](./docs/setup.md)\n\nNote that CocoaPods 1.x no longer automatically updates pod repositories automatically on `pod install`. To make sure\nyou get the latest version of the Branch SDK, use `--repo-update` or run `pod repo update` before `pod install`.\n\nIf you are new to react-native or CocoaPods, read below for more details:\n- [Full Installation Instructions](./docs/installation.md)\n- [If you already have React in your Podfile](./docs/installation.md#pod-only-installation)\n- [If you do not know what a Podfile is](./docs/installation.md#creating-a-new-podfile)\n\n### Carthage\n[Carthage]: https://github.com/Carthage/Carthage\n\nIf you would prefer to use [Carthage], you can skip steps 3 & 4 above and instead add the following to your `Cartfile`:\n\n`github \"BranchMetrics/ios-branch-deep-linking\"`\n\nThen run:\n\n`carthage update`\n\nIf you're unfamiliar with how to add a framework to your project with [Carthage], you can [learn more here](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application). You will need to maually link the framework by adding it to the \"Linked Frameworks and Libraries\" section of your target settings, and copy it by adding it to the \"Input Files\" section of your `carthage copy-frameworks` build phase.\n\n## Next Steps\nIn order to get full Branch support you will need to setup your ios and android projects accordingly:\n- [iOS](./docs/setup.md#ios)\n- [Android](./docs/setup.md#android)\n\nPlease see the Branch [SDK Integration Guide](https://dev.branch.io/getting-started/sdk-integration-guide/) for complete setup instructions.\n\n## Additional Resources\n- [SDK Integration guide](https://dev.branch.io/recipes/add_the_sdk/react/)\n- [Testing](https://dev.branch.io/getting-started/integration-testing/guide/react/)\n- [Support portal, FAQ](http://support.branch.io/)\n\n## Usage\n```js\nimport branch, {\n AddToCartEvent,\n AddToWishlistEvent,\n PurchasedEvent,\n PurchaseInitiatedEvent,\n RegisterViewEvent,\n ShareCompletedEvent,\n ShareInitiatedEvent\n} from 'react-native-branch'\n\n// Subscribe to incoming links (both Branch & non-Branch)\n// bundle = object with: {params, error, uri}\nbranch.subscribe((bundle) => {\n if (bundle && bundle.params && !bundle.error) {\n \t// grab deep link data and route appropriately.\n }\n})\n\nlet lastParams = await branch.getLatestReferringParams() // params from last open\nlet installParams = await branch.getFirstReferringParams() // params from original install\nbranch.setIdentity('theUserId')\nbranch.userCompletedAction('Purchased Item', {item: 123})\nbranch.logout()\n\nlet branchUniversalObject = await branch.createBranchUniversalObject('canonicalIdentifier', {\n automaticallyListOnSpotlight: true,\n metadata: {prop1: 'test', prop2: 'abc'},\n title: 'Cool Content!',\n contentDescription: 'Cool Content Description'})\nbranchUniversalObject.userCompletedAction(RegisterViewEvent)\nbranchUniversalObject.userCompletedAction('Custom Action', { key: 'value' })\n\nlet shareOptions = { messageHeader: 'Check this out', messageBody: 'No really, check this out!' }\nlet linkProperties = { feature: 'share', channel: 'RNApp' }\nlet controlParams = { $desktop_url: 'http://example.com/home', $ios_url: 'http://example.com/ios' }\nlet {channel, completed, error} = await branchUniversalObject.showShareSheet(shareOptions, linkProperties, controlParams)\nlet {url} = await branchUniversalObject.generateShortUrl(linkProperties, controlParams)\nlet spotlightResult = await branchUniversalObject.listOnSpotlight()\n\n// optional: release native resources right away when finished with this BUO.\nbranchUniversalObject.release()\n\nlet rewards = await branch.loadRewards()\nlet redeemResult = await branch.redeemRewards(amount, bucket)\nlet creditHistory = await branch.getCreditHistory()\n```\n\n## Linking\n###### [subscribe(listener)](#subscribe)\n**listener** (function) \nAdds a change listener. Listener takes 1 argument with the shape `{ params, uri, error}`. The listener will be called for all incoming links. Branch links will have [params](#params), plain deep links will only have a uri. \n\n###### [getLatestReferringParams(): Promise](#getlatestreferringparams)\nReturns a promise that resolves to the most recent referring [params](#params). Because params come in asynchronously, in most cases it is better to use the `subscribe` method to receive the params as soon as they are available.\n\n###### [getFirstReferringParams(): Promise](#getfirstreferringparams)\nReturns a promise to resolves with the first install referring [params](#params).\n\n###### [params object](#params) \nThe params object is returned by various linking methods including subscribe, getLatestReferringParams, and getFirstReferringParams. Params will contain any data associated with the Branch link that was clicked before the app session began. \n\nBranch returns explicit parameters every time. Here is a list, and a description of what each represents. \n* `~` denotes analytics \n* `+` denotes information added by Branch\n\n| **Parameter** | **Meaning**\n| --- | ---\n| ~channel | The channel on which the link was shared, specified at link creation time\n| ~feature | The feature, such as `invite` or `share`, specified at link creation time\n| ~tags | Any tags, specified at link creation time\n| ~campaign | The campaign the link is associated with, specified at link creation time\n| ~stage | The stage, specified at link creation time\n| ~creation_source | Where the link was created ('API', 'Dashboard', 'SDK', 'iOS SDK', 'Android SDK', or 'Web SDK')\n| ~referring_link | The referring link that drove the install/open, if present\n| ~id | Automatically generated 18 digit ID number for the link that drove the install/open, if present\n| +match_guaranteed | True or false as to whether the match was made with 100% accuracy\n| +referrer | The referrer for the link click, if a link was clicked\n| +phone_number | The phone number of the user, if the user texted himself/herself the app\n| +is_first_session | Denotes whether this is the first session (install) or any other session (open)\n| +clicked_branch_link | Denotes whether or not the user clicked a Branch link that triggered this session\n| +click_timestamp | Epoch timestamp of when the click occurred\n| +url | The full URL of the link that drove the install/open, if present (e.g. bnc.lt/m/abcde12345)\n\nSee also [Deep Link Routing](https://dev.branch.io/getting-started/deep-link-routing/guide/react/#branch-provided-data-parameters-in-callback)\non the Branch documentation site for more information.\n\nAny additional data attached to the Branch link will be available unprefixed.\n\n## User Methods\n###### [setIdentity(userId)](#setidentity)\nSet an identifier for the current user.\n\n###### [logout(userId)](#logout)\nLogout the current user. \n\n###### [userCompletedAction(label, payload)](#usercompletedaction)\nRegister a user action with Branch. \n\n## Branch Universal Object\n###### [createBranchUniversalObject(canonicalIdentifier, universalObjectOptions): Promise](#createbranchuniversalobject)\nCreate a branch universal object. \n**canonicalIdentifier** the unique identifier for the content. \n**universalObjectOptions** options for universal object as defined [below](#universalobjectoptions). \nReturns a promise. On resolution, the promise returns an object with methods `generateShortUrl`, `registerView`, `listOnSpotlight`, `showShareSheet`, `userCompletedAction` (v1.1.0) and `release` (v1.1.0). This method does not throw.\n\n##### The following methods are available on the resulting branchUniversalObject:\n\n###### [- userCompletedAction(event, state = {}): null](#usercompletedaction)\n\n_Introduced in version 1.1.0_\n\nReport a user action for this Branch Universal Object instance. Create a Branch Universal Object on page load and call `userCompletedAction(RegisterViewEvent)`.\n\n**event** an event name string, either one of the standard events defined by the SDK (as defined [below](#useractions)) or a custom event name. \n**state** an optional object with string properties representing custom application state\n\nReturns null.\n\n###### [- showShareSheet(shareOptions, linkProperties, controlParams): object](#showsharesheet)\n**shareOptions** as defined [below](#shareoptions) \n**linkProperties** as defined [below](#linkproperties) \n**controlParams** as defined [below](#controlparams) \nReturns an object with `{ channel, completed, error }` \n\n###### [- generateShortUrl(linkProperties, controlParams): object](#generateshorturl)\n**linkProperties** as defined [below](#linkproperties) \n**controlParams** as defined [below](#controlparams) \nReturns an object with `{ url }` \n\n###### [- registerView()](#registerview)\nRegister a view for this universal object. **Deprecated**: Use `userCompletedAction(RegisterViewEvent)` instead.\n\n###### [- listOnSpotlight()](#listonspotlight)\nList the universal object on Spotlight (iOS only). **Note**: The recommended way to list an item on Spotlight is to use the `automaticallyListOnSpotlight` property with `createBranchUniversalObject` and then call `userCompletedAction(RegisterViewEvent)`, e.g.\n\n```js\nimport branch, { RegisterViewEvent } from 'react-native-branch'\n\nlet universalObject = await branch.createBranchUniversalObject('abc', {\n automaticallyListOnSpotlight: true,\n title: 'Item title',\n contentDescription: 'Item description',\n contentImageUrl: 'https://example.com/image.png'\n})\nuniversalObject.userCompletedAction(RegisterViewEvent)\n```\n\nThe `automaticallyListOnSpotlight` property is ignored on Android.\n\n##### [- release()](#release)\n_Introduced in version 1.1.0_\n\n(Optional) Immediately release native resources used by this Branch Universal Object instance. Those resources will eventually be removed if they are unused for some time, but you can also call `release()` when a BUO is no longer used, e.g. in `componentWillUnmount()`. (See the [example apps](./examples) in this repo.)\n\n##### [Register User Actions On An Object](#useractions)\n\nWe've added a series of custom events that you'll want to start tracking for rich analytics and targeting. Here's a list below with a sample snippet that calls the register view event.\n\n| Event | Description\n| ----- | ---\n| RegisterViewEvent | User viewed the object\n| AddToWishlistEvent | User added the object to their wishlist\n| AddToCartEvent | User added object to cart\n| PurchaseInitiatedEvent | User started to check out\n| PurchasedEvent | User purchased the item\n| ShareInitiatedEvent | User started to share the object\n| ShareCompletedEvent | User completed a share\n\n```js\nimport branch, { RegisterViewEvent } from 'react-native-branch'\nlet universalObject = await branch.createUniversalObject('abc', {})\nuniversalObject.userCompletedAction(RegisterViewEvent)\n```\n\nNote that `registerView()` is deprecated in favor of `userCompletedAction(RegisterViewEvent)`.\n\n###### [universalObjectOptions object](#universalobjectoptions)\nAn object of options for the branchUniversalObject. \n\n| Key | TYPE | DESCRIPTION |\n| ---------------------------- | ------ | ------------------------------------------------------ |\n| automaticallyListOnSpotlight | Bool | List this item on Spotlight (iOS). Ignored on Android. |\n| canonicalIdentifier | String | The object identifier |\n| contentDescription | String | Object Description |\n| contentImageUrl | String | The Image URL |\n| contentIndexingMode | String | Indexing Mode 'private' or 'public' |\n| currency | String | A 3-letter ISO currency code (used with price) |\n| expirationDate | String | A UTC expiration date, e.g. 2018-02-01T00:00:00 |\n| keywords | Array | An array of keyword strings |\n| metadata | Object | Custom key/value |\n| price | Float | A floating-point price (used with currency) |\n| title | String | The object title |\n| type | String | MIME type for this content |\n\n###### [linkProperties object](#linkproperties)\nAn object of link properties. \n\n| KEY | TYPE | MEANING\n| -------- | -------- |------------------------\n| alias | `string` | Specify a link alias in place of the standard encoded short URL (e.g., `[branchsubdomain]/youralias or yourdomain.co/youralias)`. Link aliases are unique, immutable objects that cannot be deleted. **Aliases on the legacy `bnc.lt` domain are incompatible with Universal Links and Spotlight**\n| campaign | `string` | Use this field to organize the links by actual campaign. For example, if you launched a new feature or product and want to run a campaign around that\n| channel | `string` | Use channel to tag the route that your link reaches users. For example, tag links with ‘Facebook’ or ‘LinkedIn’ to help track clicks and installs through those paths separately\n| feature | `string` | This is the feature of your app that the link might be associated with. eg: if you had built a referral program, you would label links with the feature `referral`\n| stage | `string` | Use this to categorize the progress or category of a user when the link was generated. For example, if you had an invite system accessible on level 1, level 3 and 5, you could differentiate links generated at each level with this parameter\n| tags | `array` | This is a free form entry with unlimited values. Use it to organize your link data with labels that don’t fit within the bounds of the above\n\n###### [controlParams object](#controlparams)\nControl parameters for the link. All Branch control parameters are supported. See [here](https://dev.branch.io/getting-started/configuring-links/guide/#link-control-parameters) for a complete list. In particular, these control parameters determine where the link redirects.\n\n| KEY | TYPE | MEANING\n| ------------------ | -------- | --------------------\n| $fallback_url | `string` | Change the redirect endpoint for all platforms - so you don’t have to enable it by platform\n| $desktop_url | `string` | Change the redirect endpoint on desktops \n| $android_url | `string` | Change the redirect endpoint for Android\n| $ios_url | `string` | Change the redirect endpoint for iOS\n| $ipad_url | `string` | Change the redirect endpoint for iPads\n| $fire_url | `string` | Change the redirect endpoint for Amazon Fire OS\n| $blackberry_url | `string` | Change the redirect endpoint for Blackberry OS\n| $windows_phone_url | `string` | Change the redirect endpoint for Windows OS\n\n###### [shareOptions object](#shareoptions) \n\n| KEY | TYPE | MEANING\n| ------------------ | -------- | --------------------\n| messageHeader | `string` | The header text\n| messageBody | `string` | The body text\n| emailSubject | `string` | The subject of the email channel if selected\n\n## Referral Methods\n###### [loadRewards()](#loadrewards)\nLoad rewards.\n\n###### [redeemRewards(amount, bucket)](#redeemrewards)\nRedeem rewards.\n**amount** the amount to redeem \n**bucket** (optional) the bucket to redeem from. \n\n###### [getCreditHistory(): array](#getcredithistory)\nGet the credit history as an array.\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/BranchMetrics/react-native-branch-deep-linking.git" }, "scripts": { "lint": "eslint src test", "test": "ava" }, "version": "2.0.0-beta.3" }