Skip to content

Commit f47f18f

Browse files
committed
Add support for TS types file generation
1 parent 8fe05d0 commit f47f18f

13 files changed

+2672
-193
lines changed

.gitignore

+40-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,40 @@
1-
.idea
2-
.vscode
3-
.DS_Store
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
6+
# Runtime data
7+
pids
8+
*.pid
9+
*.seed
10+
11+
# Directory for instrumented libs generated by jscoverage/JSCover
12+
lib-cov
13+
14+
# Coverage directory used by tools like istanbul
15+
coverage
16+
17+
# nyc test coverage
18+
.nyc_output
19+
20+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
21+
.grunt
22+
23+
# node-waf configuration
24+
.lock-wscript
25+
26+
# Compiled binary addons (http://nodejs.org/api/addons.html)
27+
build/Release
28+
29+
# Dependency directories
30+
node_modules
31+
jspm_packages
32+
33+
# Optional npm cache directory
34+
.npm
35+
36+
# Optional REPL history
37+
.node_repl_history
38+
39+
.DS_Store
40+
/docs

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx lint-staged

README.md

+172-86
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,30 @@
22

33
[![NPM version][npm-version]][npm-url] [![NPM downloads][npm-downloads]][npm-url] [![NPM total downloads][npm-total-downloads]][npm-url] [![PayPal donate](https://img.shields.io/badge/paypal-donate-ff69b4?logo=paypal)][donate-url] [![Twitter][twitter-follow]][twitter-url]
44

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+
513
## Index
614

715
<!-- MarkdownTOC levels="2" autolink="true" -->
816

917
- [Supported Platforms](#supported-platforms)
1018
- [Installation](#installation)
11-
- [Methods](#methods)
12-
- [Dynamic link parameters](#dynamic-link-parameters)
19+
- [Type Aliases](#type-aliases)
20+
- [Functions](#functions)
1321

1422
<!-- /MarkdownTOC -->
1523

1624
## Supported Platforms
1725

1826
- iOS
1927
- Android
20-
28+
2129
## Installation
2230

2331
$ cordova plugin add cordova-plugin-firebase-dynamiclinks \
@@ -56,106 +64,184 @@ Cordova supports `resource-file` tag for easy copying resources files. Firebase
5664
</platform>
5765
```
5866

59-
## Methods
67+
<!-- TypedocGenerated -->
6068

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
7270

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.
8177

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
85132
cordova.plugins.firebase.dynamiclinks.createDynamicLink({
86133
link: "https://google.com"
87-
}).then(function(url) {
88-
console.log("Dynamic link was created:", url);
89134
});
90135
```
91136

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
95159
cordova.plugins.firebase.dynamiclinks.createShortDynamicLink({
96160
link: "https://google.com"
97-
}).then(function(url) {
98-
console.log("Dynamic link was created:", url);
99161
});
100162
```
101163

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({
106188
link: "https://google.com"
107-
}).then(function(url) {
108-
console.log("Dynamic link was created:", url);
109189
});
110190
```
111191

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");
145216
}
146-
},
147-
"socialMetaTagInfo": {
148-
"socialTitle": string,
149-
"socialDescription": string,
150-
"socialImageLink": string
151-
}
152-
}
217+
});
153218
```
154219

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

Comments
 (0)