capacitor-event-bird 0.0.23 → 0.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -37
- package/dist/docs.json +87 -0
- package/dist/esm/definitions.d.ts +23 -0
- package/dist/esm/definitions.js +2 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +25 -0
- package/dist/esm/web.js +28 -0
- package/dist/esm/web.js.map +1 -0
- package/ios/Sources/CapacitorEventBirdPlugin/CapacitorEventBirdPlugin.swift +19 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,50 +13,26 @@ npx cap sync
|
|
|
13
13
|
|
|
14
14
|
<docgen-index>
|
|
15
15
|
|
|
16
|
-
* [`echo(...)`](#echo)
|
|
17
|
-
* [`logout()`](#logout)
|
|
18
16
|
* [`signupWithGoogle()`](#signupwithgoogle)
|
|
19
17
|
* [`waitlistAfterInit()`](#waitlistafterinit)
|
|
20
18
|
* [`openHelpModal()`](#openhelpmodal)
|
|
21
19
|
* [`getDeviceId()`](#getdeviceid)
|
|
22
|
-
* [`getGoogleData()`](#getgoogledata)
|
|
23
20
|
* [`getFCMToken(...)`](#getfcmtoken)
|
|
21
|
+
* [`saveCredentials(...)`](#savecredentials)
|
|
24
22
|
|
|
25
23
|
</docgen-index>
|
|
26
24
|
|
|
27
25
|
<docgen-api>
|
|
28
26
|
<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->
|
|
29
27
|
|
|
30
|
-
### echo(...)
|
|
31
|
-
|
|
32
|
-
```typescript
|
|
33
|
-
echo(options: { value: string; }) => Promise<{ value: string; }>
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
| Param | Type |
|
|
37
|
-
| ------------- | ------------------------------- |
|
|
38
|
-
| **`options`** | <code>{ value: string; }</code> |
|
|
39
|
-
|
|
40
|
-
**Returns:** <code>Promise<{ value: string; }></code>
|
|
41
|
-
|
|
42
|
-
--------------------
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
### logout()
|
|
46
|
-
|
|
47
|
-
```typescript
|
|
48
|
-
logout() => Promise<void>
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
--------------------
|
|
52
|
-
|
|
53
|
-
|
|
54
28
|
### signupWithGoogle()
|
|
55
29
|
|
|
56
30
|
```typescript
|
|
57
|
-
signupWithGoogle() => Promise<
|
|
31
|
+
signupWithGoogle() => Promise<{ displayName: string; email: string; firebaseToken: string; }>
|
|
58
32
|
```
|
|
59
33
|
|
|
34
|
+
**Returns:** <code>Promise<{ displayName: string; email: string; firebaseToken: string; }></code>
|
|
35
|
+
|
|
60
36
|
--------------------
|
|
61
37
|
|
|
62
38
|
|
|
@@ -89,28 +65,32 @@ getDeviceId() => Promise<{ value: string; }>
|
|
|
89
65
|
--------------------
|
|
90
66
|
|
|
91
67
|
|
|
92
|
-
###
|
|
68
|
+
### getFCMToken(...)
|
|
93
69
|
|
|
94
70
|
```typescript
|
|
95
|
-
|
|
71
|
+
getFCMToken(options: { value: string; }) => Promise<{ value: string; }>
|
|
96
72
|
```
|
|
97
73
|
|
|
98
|
-
|
|
74
|
+
| Param | Type |
|
|
75
|
+
| ------------- | ------------------------------- |
|
|
76
|
+
| **`options`** | <code>{ value: string; }</code> |
|
|
77
|
+
|
|
78
|
+
**Returns:** <code>Promise<{ value: string; }></code>
|
|
99
79
|
|
|
100
80
|
--------------------
|
|
101
81
|
|
|
102
82
|
|
|
103
|
-
###
|
|
83
|
+
### saveCredentials(...)
|
|
104
84
|
|
|
105
85
|
```typescript
|
|
106
|
-
|
|
86
|
+
saveCredentials(options: { username: string; password: string; }) => Promise<{ isSuccess: boolean; }>
|
|
107
87
|
```
|
|
108
88
|
|
|
109
|
-
| Param | Type
|
|
110
|
-
| ------------- |
|
|
111
|
-
| **`options`** | <code>{
|
|
89
|
+
| Param | Type |
|
|
90
|
+
| ------------- | ---------------------------------------------------- |
|
|
91
|
+
| **`options`** | <code>{ username: string; password: string; }</code> |
|
|
112
92
|
|
|
113
|
-
**Returns:** <code>Promise<{
|
|
93
|
+
**Returns:** <code>Promise<{ isSuccess: boolean; }></code>
|
|
114
94
|
|
|
115
95
|
--------------------
|
|
116
96
|
|
package/dist/docs.json
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"api": {
|
|
3
|
+
"name": "CapacitorEventBirdPlugin",
|
|
4
|
+
"slug": "capacitoreventbirdplugin",
|
|
5
|
+
"docs": "",
|
|
6
|
+
"tags": [],
|
|
7
|
+
"methods": [
|
|
8
|
+
{
|
|
9
|
+
"name": "signupWithGoogle",
|
|
10
|
+
"signature": "() => Promise<{ displayName: string; email: string; firebaseToken: string; }>",
|
|
11
|
+
"parameters": [],
|
|
12
|
+
"returns": "Promise<{ displayName: string; email: string; firebaseToken: string; }>",
|
|
13
|
+
"tags": [],
|
|
14
|
+
"docs": "",
|
|
15
|
+
"complexTypes": [],
|
|
16
|
+
"slug": "signupwithgoogle"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "waitlistAfterInit",
|
|
20
|
+
"signature": "() => Promise<void>",
|
|
21
|
+
"parameters": [],
|
|
22
|
+
"returns": "Promise<void>",
|
|
23
|
+
"tags": [],
|
|
24
|
+
"docs": "",
|
|
25
|
+
"complexTypes": [],
|
|
26
|
+
"slug": "waitlistafterinit"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "openHelpModal",
|
|
30
|
+
"signature": "() => Promise<void>",
|
|
31
|
+
"parameters": [],
|
|
32
|
+
"returns": "Promise<void>",
|
|
33
|
+
"tags": [],
|
|
34
|
+
"docs": "",
|
|
35
|
+
"complexTypes": [],
|
|
36
|
+
"slug": "openhelpmodal"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "getDeviceId",
|
|
40
|
+
"signature": "() => Promise<{ value: string; }>",
|
|
41
|
+
"parameters": [],
|
|
42
|
+
"returns": "Promise<{ value: string; }>",
|
|
43
|
+
"tags": [],
|
|
44
|
+
"docs": "",
|
|
45
|
+
"complexTypes": [],
|
|
46
|
+
"slug": "getdeviceid"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "getFCMToken",
|
|
50
|
+
"signature": "(options: { value: string; }) => Promise<{ value: string; }>",
|
|
51
|
+
"parameters": [
|
|
52
|
+
{
|
|
53
|
+
"name": "options",
|
|
54
|
+
"docs": "",
|
|
55
|
+
"type": "{ value: string; }"
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"returns": "Promise<{ value: string; }>",
|
|
59
|
+
"tags": [],
|
|
60
|
+
"docs": "",
|
|
61
|
+
"complexTypes": [],
|
|
62
|
+
"slug": "getfcmtoken"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "saveCredentials",
|
|
66
|
+
"signature": "(options: { username: string; password: string; }) => Promise<{ isSuccess: boolean; }>",
|
|
67
|
+
"parameters": [
|
|
68
|
+
{
|
|
69
|
+
"name": "options",
|
|
70
|
+
"docs": "",
|
|
71
|
+
"type": "{ username: string; password: string; }"
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
"returns": "Promise<{ isSuccess: boolean; }>",
|
|
75
|
+
"tags": [],
|
|
76
|
+
"docs": "",
|
|
77
|
+
"complexTypes": [],
|
|
78
|
+
"slug": "savecredentials"
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"properties": []
|
|
82
|
+
},
|
|
83
|
+
"interfaces": [],
|
|
84
|
+
"enums": [],
|
|
85
|
+
"typeAliases": [],
|
|
86
|
+
"pluginConfigs": []
|
|
87
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface CapacitorEventBirdPlugin {
|
|
2
|
+
signupWithGoogle(): Promise<{
|
|
3
|
+
displayName: string;
|
|
4
|
+
email: string;
|
|
5
|
+
firebaseToken: string;
|
|
6
|
+
}>;
|
|
7
|
+
waitlistAfterInit(): Promise<void>;
|
|
8
|
+
openHelpModal(): Promise<void>;
|
|
9
|
+
getDeviceId(): Promise<{
|
|
10
|
+
value: string;
|
|
11
|
+
}>;
|
|
12
|
+
getFCMToken(options: {
|
|
13
|
+
value: string;
|
|
14
|
+
}): Promise<{
|
|
15
|
+
value: string;
|
|
16
|
+
}>;
|
|
17
|
+
saveCredentials(options: {
|
|
18
|
+
username: string;
|
|
19
|
+
password: string;
|
|
20
|
+
}): Promise<{
|
|
21
|
+
isSuccess: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface CapacitorEventBirdPlugin {\n signupWithGoogle(): Promise<{ displayName: string; email: string; firebaseToken: string }>;\n waitlistAfterInit(): Promise<void>;\n openHelpModal(): Promise<void>;\n getDeviceId(): Promise<{ value: string }>;\n getFCMToken(options: { value: string }): Promise<{ value: string }>;\n saveCredentials(options: { username: string; password: string }): Promise<{ isSuccess: boolean }>;\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { registerPlugin } from '@capacitor/core';
|
|
2
|
+
const CapacitorEventBird = registerPlugin('CapacitorEventBird', {
|
|
3
|
+
web: () => import('./web').then((m) => new m.CapacitorEventBirdWeb()),
|
|
4
|
+
});
|
|
5
|
+
export * from './definitions';
|
|
6
|
+
export { CapacitorEventBird };
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,kBAAkB,GAAG,cAAc,CAA2B,oBAAoB,EAAE;IACxF,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,qBAAqB,EAAE,CAAC;CACtE,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { CapacitorEventBirdPlugin } from './definitions';\n\nconst CapacitorEventBird = registerPlugin<CapacitorEventBirdPlugin>('CapacitorEventBird', {\n web: () => import('./web').then((m) => new m.CapacitorEventBirdWeb()),\n});\n\nexport * from './definitions';\nexport { CapacitorEventBird };\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
import type { CapacitorEventBirdPlugin } from './definitions';
|
|
3
|
+
export declare class CapacitorEventBirdWeb extends WebPlugin implements CapacitorEventBirdPlugin {
|
|
4
|
+
saveCredentials(_: {
|
|
5
|
+
username: string;
|
|
6
|
+
password: string;
|
|
7
|
+
}): Promise<{
|
|
8
|
+
isSuccess: boolean;
|
|
9
|
+
}>;
|
|
10
|
+
getFCMToken(options: {
|
|
11
|
+
value: string;
|
|
12
|
+
}): Promise<{
|
|
13
|
+
value: string;
|
|
14
|
+
}>;
|
|
15
|
+
signupWithGoogle(): Promise<{
|
|
16
|
+
displayName: string;
|
|
17
|
+
email: string;
|
|
18
|
+
firebaseToken: string;
|
|
19
|
+
}>;
|
|
20
|
+
openHelpModal(): Promise<void>;
|
|
21
|
+
waitlistAfterInit(): Promise<void>;
|
|
22
|
+
getDeviceId(): Promise<{
|
|
23
|
+
value: string;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
package/dist/esm/web.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { WebPlugin } from '@capacitor/core';
|
|
2
|
+
export class CapacitorEventBirdWeb extends WebPlugin {
|
|
3
|
+
saveCredentials(_) {
|
|
4
|
+
throw new Error('Method not implemented.');
|
|
5
|
+
}
|
|
6
|
+
async getFCMToken(options) {
|
|
7
|
+
console.log('getFCMToken', options);
|
|
8
|
+
return options;
|
|
9
|
+
}
|
|
10
|
+
async signupWithGoogle() {
|
|
11
|
+
console.log('signupWithGoogle in web isnt really needed it already works');
|
|
12
|
+
return {
|
|
13
|
+
displayName: '',
|
|
14
|
+
email: '',
|
|
15
|
+
firebaseToken: '',
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
async openHelpModal() {
|
|
19
|
+
console.log('openHelpModal in web isnt really needed it already works');
|
|
20
|
+
}
|
|
21
|
+
async waitlistAfterInit() {
|
|
22
|
+
console.log('waitlistAfterInit in web isnt really needed it already works');
|
|
23
|
+
}
|
|
24
|
+
async getDeviceId() {
|
|
25
|
+
return { value: 'ios device id is not needed for web' };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAI5C,MAAM,OAAO,qBAAsB,SAAQ,SAAS;IAClD,eAAe,CAAC,CAAyC;QACvD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAA0B;QAC1C,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QACpC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,CAAC,GAAG,CAAC,6DAA6D,CAAC,CAAC;QAC3E,OAAO;YACL,WAAW,EAAE,EAAE;YACf,KAAK,EAAE,EAAE;YACT,aAAa,EAAE,EAAE;SAClB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;IAC1E,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC,CAAC;IAC9E,CAAC;IAED,KAAK,CAAC,WAAW;QACf,OAAO,EAAE,KAAK,EAAE,qCAAqC,EAAE,CAAC;IAC1D,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { CapacitorEventBirdPlugin } from './definitions';\n\nexport class CapacitorEventBirdWeb extends WebPlugin implements CapacitorEventBirdPlugin {\n saveCredentials(_: { username: string; password: string }): Promise<{ isSuccess: boolean }> {\n throw new Error('Method not implemented.');\n }\n\n async getFCMToken(options: { value: string }): Promise<{ value: string }> {\n console.log('getFCMToken', options);\n return options;\n }\n\n async signupWithGoogle(): Promise<{ displayName: string; email: string; firebaseToken: string }> {\n console.log('signupWithGoogle in web isnt really needed it already works');\n return {\n displayName: '',\n email: '',\n firebaseToken: '',\n };\n }\n\n async openHelpModal(): Promise<void> {\n console.log('openHelpModal in web isnt really needed it already works');\n }\n\n async waitlistAfterInit(): Promise<void> {\n console.log('waitlistAfterInit in web isnt really needed it already works');\n }\n\n async getDeviceId(): Promise<{ value: string }> {\n return { value: 'ios device id is not needed for web' };\n }\n}\n"]}
|
|
@@ -12,13 +12,32 @@ public class CapacitorEventBirdPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
12
12
|
CAPPluginMethod(name: "openHelpModal", returnType: CAPPluginReturnPromise),
|
|
13
13
|
CAPPluginMethod(name: "getDeviceId", returnType: CAPPluginReturnPromise),
|
|
14
14
|
CAPPluginMethod(name: "signupWithGoogle", returnType: CAPPluginReturnPromise),
|
|
15
|
+
CAPPluginMethod(name: "saveCredentials", returnType: CAPPluginReturnPromise),
|
|
15
16
|
]
|
|
16
17
|
|
|
17
18
|
private var pendingFCMCalls: [CAPPluginCall] = []
|
|
18
19
|
private var pendingGoogleCalls: [CAPPluginCall] = []
|
|
20
|
+
private var pendingSaveCredentialsCall: [CAPPluginCall] = []
|
|
19
21
|
|
|
20
22
|
private var savedFCMToken: String?
|
|
21
23
|
|
|
24
|
+
@objc func saveCredentials(_ call: CAPPluginCall) {
|
|
25
|
+
let username = call.getString("username") ?? ""
|
|
26
|
+
let password = call.getString("password") ?? ""
|
|
27
|
+
|
|
28
|
+
NotificationCenter.default.post(name: Notification.Name("SaveCredentials"), object: ["username": username, "password": password])
|
|
29
|
+
pendingSaveCredentialsCall.append(call)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@objc public func saveCredentialsResult(_ isSuccess: Bool) {
|
|
33
|
+
print("[Native] saveCredentialsResult()")
|
|
34
|
+
|
|
35
|
+
for call in pendingSaveCredentialsCall {
|
|
36
|
+
call.resolve(["isSuccess": isSuccess])
|
|
37
|
+
}
|
|
38
|
+
pendingSaveCredentialsCall.removeAll()
|
|
39
|
+
}
|
|
40
|
+
|
|
22
41
|
@objc func getFCMToken(_ call: CAPPluginCall) {
|
|
23
42
|
if let token = savedFCMToken {
|
|
24
43
|
print("[Native] JS called getFCMToken, passing the token.")
|