|
2 | 2 |
|
3 | 3 | [![NPM version][npm-version]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![NPM total downloads][npm-total-downloads]][npm-url] [][donate-url] [![Twitter][twitter-follow]][twitter-url]
|
4 | 4 |
|
| 5 | +[npm-url]: https://www.npmjs.com/package/cordova-plugin-firebase-dynamiclinks |
| 6 | +[npm-version]: https://img.shields.io/npm/v/cordova-plugin-firebase-dynamiclinks.svg |
| 7 | +[npm-downloads]: https://img.shields.io/npm/dm/cordova-plugin-firebase-dynamiclinks.svg |
| 8 | +[npm-total-downloads]: https://img.shields.io/npm/dt/cordova-plugin-firebase-dynamiclinks.svg?label=total+downloads |
| 9 | +[twitter-url]: https://twitter.com/chemerisuk |
| 10 | +[twitter-follow]: https://img.shields.io/twitter/follow/chemerisuk.svg?style=social&label=Follow%20me |
| 11 | +[donate-url]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=USD4VHG7CF6FN&source=url |
| 12 | + |
5 | 13 | ## Index
|
6 | 14 |
|
7 | 15 | <!-- MarkdownTOC levels="2" autolink="true" -->
|
8 | 16 |
|
9 | 17 | - [Supported Platforms](#supported-platforms)
|
10 | 18 | - [Installation](#installation)
|
11 |
| -- [Methods](#methods) |
12 |
| -- [Dynamic link parameters](#dynamic-link-parameters) |
| 19 | +- [Type Aliases](#type-aliases) |
| 20 | +- [Functions](#functions) |
13 | 21 |
|
14 | 22 | <!-- /MarkdownTOC -->
|
15 | 23 |
|
16 | 24 | ## Supported Platforms
|
17 | 25 |
|
18 | 26 | - iOS
|
19 | 27 | - Android
|
20 |
| - |
| 28 | + |
21 | 29 | ## Installation
|
22 | 30 |
|
23 | 31 | $ cordova plugin add cordova-plugin-firebase-dynamiclinks \
|
@@ -56,106 +64,184 @@ Cordova supports `resource-file` tag for easy copying resources files. Firebase
|
56 | 64 | </platform>
|
57 | 65 | ```
|
58 | 66 |
|
59 |
| -## Methods |
| 67 | +<!-- TypedocGenerated --> |
60 | 68 |
|
61 |
| -### getDynamicLink |
62 |
| -Determines if the app has a pending dynamic link and provide access to the dynamic link parameters. |
63 |
| -```js |
64 |
| -cordova.plugins.firebase.dynamiclinks.getDynamicLink().then(function(data) { |
65 |
| - if (data) { |
66 |
| - console.log("Read dynamic link data on app start:", data); |
67 |
| - } else { |
68 |
| - console.log("App wasn't started from a dynamic link"); |
69 |
| - } |
70 |
| -}); |
71 |
| -``` |
| 69 | +## Type Aliases |
72 | 70 |
|
73 |
| -### onDynamicLink(_callback_) |
74 |
| -Registers callback that is triggered on each dynamic link click. |
75 |
| -```js |
76 |
| -cordova.plugins.firebase.dynamiclinks.onDynamicLink(function(data) { |
77 |
| - console.log("Dynamic link click with data:", data); |
78 |
| -}); |
79 |
| -``` |
80 |
| -Every `create*` method accepts `dynamicLinkInfo` object as the first argument. Read section below to understand all supported [dynamic link parameters](#dynamic-link-parameters). |
| 71 | +### DynamicLinkOptions |
| 72 | + |
| 73 | + **DynamicLinkOptions**: `Object` |
| 74 | + |
| 75 | +Options when creating a dynamic link Parameter names has the same meaning as |
| 76 | +in the Firebase Dynamic Links Short Links API Reference. |
81 | 77 |
|
82 |
| -### createDynamicLink(_parameters_) |
83 |
| -Creates a Dynamic Link from the parameters. Returns a promise fulfilled with the new dynamic link url. |
84 |
| -```js |
| 78 | +#### Type declaration |
| 79 | + |
| 80 | +| Name | Type | Description | |
| 81 | +| :------ | :------ | :------ | |
| 82 | +| `androidInfo?` | { `androidFallbackLink`: `string` ; `androidMinPackageVersionCode`: `number` ; `androidPackageName`: `string` } | Android parameters. | |
| 83 | +| `androidInfo.androidFallbackLink` | `string` | - | |
| 84 | +| `androidInfo.androidMinPackageVersionCode` | `number` | - | |
| 85 | +| `androidInfo.androidPackageName` | `string` | - | |
| 86 | +| `domainUriPrefix?` | `string` | Domain uri prefix to use for this Dynamic Link. | |
| 87 | +| `googlePlayAnalytics?` | { `utmCampaign`: `string` ; `utmContent`: `string` ; `utmMedium`: `string` ; `utmSource`: `string` ; `utmTerm`: `string` } | Google Analytics parameters. | |
| 88 | +| `googlePlayAnalytics.utmCampaign` | `string` | - | |
| 89 | +| `googlePlayAnalytics.utmContent` | `string` | - | |
| 90 | +| `googlePlayAnalytics.utmMedium` | `string` | - | |
| 91 | +| `googlePlayAnalytics.utmSource` | `string` | - | |
| 92 | +| `googlePlayAnalytics.utmTerm` | `string` | - | |
| 93 | +| `iosInfo?` | { `iosAppStoreId`: `string` ; `iosBundleId`: `string` ; `iosFallbackLink`: `string` ; `iosIpadBundleId`: `string` ; `iosIpadFallbackLink`: `string` } | iOS parameters. | |
| 94 | +| `iosInfo.iosAppStoreId` | `string` | - | |
| 95 | +| `iosInfo.iosBundleId` | `string` | - | |
| 96 | +| `iosInfo.iosFallbackLink` | `string` | - | |
| 97 | +| `iosInfo.iosIpadBundleId` | `string` | - | |
| 98 | +| `iosInfo.iosIpadFallbackLink` | `string` | - | |
| 99 | +| `itunesConnectAnalytics?` | { `at`: `string` ; `ct`: `string` ; `pt`: `string` } | iTunes Connect App Analytics parameters. | |
| 100 | +| `itunesConnectAnalytics.at` | `string` | - | |
| 101 | +| `itunesConnectAnalytics.ct` | `string` | - | |
| 102 | +| `itunesConnectAnalytics.pt` | `string` | - | |
| 103 | +| `link` | `string` | The link your app will open. | |
| 104 | +| `navigationInfo?` | { `enableForcedRedirect`: `boolean` } | Navigation info parameters. | |
| 105 | +| `navigationInfo.enableForcedRedirect` | `boolean` | - | |
| 106 | +| `socialMetaTagInfo?` | { `socialDescription`: `string` ; `socialImageLink`: `string` ; `socialTitle`: `string` } | Social meta-tag parameters. | |
| 107 | +| `socialMetaTagInfo.socialDescription` | `string` | - | |
| 108 | +| `socialMetaTagInfo.socialImageLink` | `string` | - | |
| 109 | +| `socialMetaTagInfo.socialTitle` | `string` | - | |
| 110 | + |
| 111 | +### DynamicLinkPayload |
| 112 | + |
| 113 | + **DynamicLinkPayload**: `Object` |
| 114 | + |
| 115 | +#### Type declaration |
| 116 | + |
| 117 | +| Name | Type | Description | |
| 118 | +| :------ | :------ | :------ | |
| 119 | +| `clickTimestamp` | `number` | The time that the user clicked on the dynamic link. | |
| 120 | +| `deepLink` | `string` \| ``null`` | Link parameter of the dynamic link. | |
| 121 | +| `minimumAppVersion?` | `number` | The minimum app version requested to process the dynamic link that can be compared directly with versionCode (Android only) | |
| 122 | + |
| 123 | +## Functions |
| 124 | + |
| 125 | +### **createDynamicLink**(`params`): `Promise`<`string`\> |
| 126 | + |
| 127 | +Creates a Dynamic Link from the parameters. |
| 128 | + |
| 129 | +**`Example`** |
| 130 | + |
| 131 | +```ts |
85 | 132 | cordova.plugins.firebase.dynamiclinks.createDynamicLink({
|
86 | 133 | link: "https://google.com"
|
87 |
| -}).then(function(url) { |
88 |
| - console.log("Dynamic link was created:", url); |
89 | 134 | });
|
90 | 135 | ```
|
91 | 136 |
|
92 |
| -### createShortDynamicLink(_parameters_) |
93 |
| -Creates a shortened Dynamic Link from the parameters. Shorten the path to a string that is only as long as needed to be unique, with a minimum length of 4 characters. Use this method if sensitive information would not be exposed if a short Dynamic Link URL were guessed. |
94 |
| -```js |
| 137 | +#### Parameters |
| 138 | + |
| 139 | +| Name | Type | Description | |
| 140 | +| :------ | :------ | :------ | |
| 141 | +| `params` | [`DynamicLinkOptions`](FirebaseDynamicLinks.md#dynamiclinkoptions) | Parameters to use for building a link | |
| 142 | + |
| 143 | +#### Returns |
| 144 | + |
| 145 | +`Promise`<`string`\> |
| 146 | + |
| 147 | +Fulfils promise with created link value |
| 148 | + |
| 149 | +### **createShortDynamicLink**(`params`): `Promise`<`string`\> |
| 150 | + |
| 151 | +Creates a shortened Dynamic Link from the parameters. Shorten the path |
| 152 | +to a string that is only as long as needed to be unique, with a minimum |
| 153 | +length of 4 characters. Use this method if sensitive information would |
| 154 | +not be exposed if a short Dynamic Link URL were guessed. |
| 155 | + |
| 156 | +**`Example`** |
| 157 | + |
| 158 | +```ts |
95 | 159 | cordova.plugins.firebase.dynamiclinks.createShortDynamicLink({
|
96 | 160 | link: "https://google.com"
|
97 |
| -}).then(function(url) { |
98 |
| - console.log("Dynamic link was created:", url); |
99 | 161 | });
|
100 | 162 | ```
|
101 | 163 |
|
102 |
| -### createUnguessableDynamicLink(_parameters_) |
103 |
| -Creates a Dynamic Link from the parameters. Shorten the path to an unguessable string. Such strings are created by base62-encoding randomly generated 96-bit numbers, and consist of 17 alphanumeric characters. Use unguessable strings to prevent your Dynamic Links from being crawled, which can potentially expose sensitive information. |
104 |
| -```js |
105 |
| -cordova.plugins.firebase.dynamiclinks.createUnguessableDynamicLink({ |
| 164 | +#### Parameters |
| 165 | + |
| 166 | +| Name | Type | Description | |
| 167 | +| :------ | :------ | :------ | |
| 168 | +| `params` | [`DynamicLinkOptions`](FirebaseDynamicLinks.md#dynamiclinkoptions) | Parameters to use for building a link | |
| 169 | + |
| 170 | +#### Returns |
| 171 | + |
| 172 | +`Promise`<`string`\> |
| 173 | + |
| 174 | +Fulfils promise with created link value |
| 175 | + |
| 176 | +### **createUnguessableDynamicLink**(`params`): `Promise`<`string`\> |
| 177 | + |
| 178 | +Creates a Dynamic Link from the parameters. Shorten the path to |
| 179 | +an unguessable string. Such strings are created by base62-encoding |
| 180 | +randomly generated 96-bit numbers, and consist of 17 alphanumeric |
| 181 | +characters. Use unguessable strings to prevent your Dynamic Links |
| 182 | +from being crawled, which can potentially expose sensitive information. |
| 183 | + |
| 184 | +**`Example`** |
| 185 | + |
| 186 | +```ts |
| 187 | +cordova.plugins.firebase.dynamiclinks.createShortDynamicLink({ |
106 | 188 | link: "https://google.com"
|
107 |
| -}).then(function(url) { |
108 |
| - console.log("Dynamic link was created:", url); |
109 | 189 | });
|
110 | 190 | ```
|
111 | 191 |
|
112 |
| -## Dynamic link parameters |
113 |
| -Any create method supports all options below to customize a returned dynamic link. Parameter names has the same meaning as in the [Firebase Dynamic Links Short Links API Reference](https://firebase.google.com/docs/reference/dynamic-links/link-shortener#parameters): |
114 |
| -```json |
115 |
| -{ |
116 |
| - "domainUriPrefix": string, |
117 |
| - "link": string, |
118 |
| - "androidInfo": { |
119 |
| - "androidPackageName": string, |
120 |
| - "androidFallbackLink": string, |
121 |
| - "androidMinPackageVersionCode": number |
122 |
| - }, |
123 |
| - "iosInfo": { |
124 |
| - "iosBundleId": string, |
125 |
| - "iosFallbackLink": string, |
126 |
| - "iosIpadFallbackLink": string, |
127 |
| - "iosIpadBundleId": string, |
128 |
| - "iosAppStoreId": string |
129 |
| - }, |
130 |
| - "navigationInfo": { |
131 |
| - "enableForcedRedirect": boolean, |
132 |
| - }, |
133 |
| - "analyticsInfo": { |
134 |
| - "googlePlayAnalytics": { |
135 |
| - "utmSource": string, |
136 |
| - "utmMedium": string, |
137 |
| - "utmCampaign": string, |
138 |
| - "utmTerm": string, |
139 |
| - "utmContent": string |
140 |
| - }, |
141 |
| - "itunesConnectAnalytics": { |
142 |
| - "at": string, |
143 |
| - "ct": string, |
144 |
| - "pt": string |
| 192 | +#### Parameters |
| 193 | + |
| 194 | +| Name | Type | Description | |
| 195 | +| :------ | :------ | :------ | |
| 196 | +| `params` | [`DynamicLinkOptions`](FirebaseDynamicLinks.md#dynamiclinkoptions) | Parameters to use for building a link | |
| 197 | + |
| 198 | +#### Returns |
| 199 | + |
| 200 | +`Promise`<`string`\> |
| 201 | + |
| 202 | +Fulfils promise with created link value |
| 203 | + |
| 204 | +### **getDynamicLink**(): `Promise`<[`DynamicLinkPayload`](FirebaseDynamicLinks.md#dynamiclinkpayload) \| ``null``\> |
| 205 | + |
| 206 | +Determines if the app has a pending dynamic link and provide access to the dynamic link parameters. |
| 207 | + |
| 208 | +**`Example`** |
| 209 | + |
| 210 | +```ts |
| 211 | +cordova.plugins.firebase.dynamiclinks.getDynamicLink().then(function(payload) { |
| 212 | + if (payload) { |
| 213 | + console.log("Read dynamic link data on app start:", payload); |
| 214 | + } else { |
| 215 | + console.log("App wasn't started from a dynamic link"); |
145 | 216 | }
|
146 |
| - }, |
147 |
| - "socialMetaTagInfo": { |
148 |
| - "socialTitle": string, |
149 |
| - "socialDescription": string, |
150 |
| - "socialImageLink": string |
151 |
| - } |
152 |
| -} |
| 217 | +}); |
153 | 218 | ```
|
154 | 219 |
|
155 |
| -[npm-url]: https://www.npmjs.com/package/cordova-plugin-firebase-dynamiclinks |
156 |
| -[npm-version]: https://img.shields.io/npm/v/cordova-plugin-firebase-dynamiclinks.svg |
157 |
| -[npm-downloads]: https://img.shields.io/npm/dm/cordova-plugin-firebase-dynamiclinks.svg |
158 |
| -[npm-total-downloads]: https://img.shields.io/npm/dt/cordova-plugin-firebase-dynamiclinks.svg?label=total+downloads |
159 |
| -[twitter-url]: https://twitter.com/chemerisuk |
160 |
| -[twitter-follow]: https://img.shields.io/twitter/follow/chemerisuk.svg?style=social&label=Follow%20me |
161 |
| -[donate-url]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=USD4VHG7CF6FN&source=url |
| 220 | +#### Returns |
| 221 | + |
| 222 | +`Promise`<[`DynamicLinkPayload`](FirebaseDynamicLinks.md#dynamiclinkpayload) \| ``null``\> |
| 223 | + |
| 224 | +Dynamic link payload. |
| 225 | + |
| 226 | +### **onDynamicLink**(`callback`, `errorCallback`): `void` |
| 227 | + |
| 228 | +Registers callback that is triggered on each dynamic link click. |
| 229 | + |
| 230 | +**`Example`** |
| 231 | + |
| 232 | +```ts |
| 233 | +cordova.plugins.firebase.dynamiclinks.onDynamicLink(function(data) { |
| 234 | + console.log("Dynamic link click with data:", data); |
| 235 | +}); |
| 236 | +``` |
| 237 | + |
| 238 | +#### Parameters |
| 239 | + |
| 240 | +| Name | Type | Description | |
| 241 | +| :------ | :------ | :------ | |
| 242 | +| `callback` | (`payload`: [`DynamicLinkPayload`](FirebaseDynamicLinks.md#dynamiclinkpayload)) => `void` | Callback function | |
| 243 | +| `errorCallback` | (`error`: `string`) => `void` | Error callback function | |
| 244 | + |
| 245 | +#### Returns |
| 246 | + |
| 247 | +`void` |
0 commit comments