capacitor-event-bird 0.0.21 → 0.0.23

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.
@@ -7,39 +7,18 @@ public class CapacitorEventBirdPlugin: CAPPlugin, CAPBridgedPlugin {
7
7
  public let jsName = "CapacitorEventBird"
8
8
 
9
9
  public let pluginMethods: [CAPPluginMethod] = [
10
- CAPPluginMethod(name: "echo", returnType: CAPPluginReturnPromise),
11
10
  CAPPluginMethod(name: "getFCMToken", returnType: CAPPluginReturnPromise),
12
- CAPPluginMethod(name: "logout", returnType: CAPPluginReturnPromise),
13
- CAPPluginMethod(name: "signupWithGoogle", returnType: CAPPluginReturnPromise),
14
11
  CAPPluginMethod(name: "waitlistAfterInit", returnType: CAPPluginReturnPromise),
15
12
  CAPPluginMethod(name: "openHelpModal", returnType: CAPPluginReturnPromise),
16
13
  CAPPluginMethod(name: "getDeviceId", returnType: CAPPluginReturnPromise),
17
- CAPPluginMethod(name: "getGoogleData", returnType: CAPPluginReturnPromise),
14
+ CAPPluginMethod(name: "signupWithGoogle", returnType: CAPPluginReturnPromise),
18
15
  ]
19
16
 
20
- private var pendingEchoCalls: [CAPPluginCall] = []
21
17
  private var pendingFCMCalls: [CAPPluginCall] = []
22
18
  private var pendingGoogleCalls: [CAPPluginCall] = []
23
19
 
24
- private var savedToken: String?
25
20
  private var savedFCMToken: String?
26
21
 
27
- private var savedGoogleDisplayName: String?
28
- private var savedGoogleEmail: String?
29
- private var savedFirebaseToken: String?
30
-
31
- private let implementation = CapacitorEventBird()
32
-
33
- @objc func echo(_ call: CAPPluginCall) {
34
- if let token = savedToken {
35
- print("[Native] JS called echo, passing the token.")
36
- call.resolve(["value": token])
37
- } else {
38
- print("[Native] JS called echo, but token not ready. Queuing callback.")
39
- pendingEchoCalls.append(call)
40
- }
41
- }
42
-
43
22
  @objc func getFCMToken(_ call: CAPPluginCall) {
44
23
  if let token = savedFCMToken {
45
24
  print("[Native] JS called getFCMToken, passing the token.")
@@ -55,24 +34,16 @@ public class CapacitorEventBirdPlugin: CAPPlugin, CAPBridgedPlugin {
55
34
  return
56
35
  }
57
36
 
58
- @objc func getGoogleData(_ call: CAPPluginCall) {
59
- if self.savedGoogleDisplayName != nil && self.savedGoogleEmail != nil {
60
- print("[Native] JS called getGoogleData, passing the data.")
61
- call.resolve(["displayName": self.savedGoogleDisplayName, "email": self.savedGoogleEmail, "firebaseToken": self.savedFirebaseToken])
62
- } else {
63
- print("[Native] JS called getGoogleData, but data not ready. Queuing callback.")
64
- pendingGoogleCalls.append(call)
65
- }
37
+ @objc func signupWithGoogle(_ call: CAPPluginCall) {
38
+ NotificationCenter.default.post(name: Notification.Name("CapacitorSignupWithGoogle"), object: nil)
39
+ print("[Native] JS called getGoogleData, sending CapacitorSignupWithGoogle event")
40
+ pendingGoogleCalls.append(call)
66
41
  }
67
42
 
68
43
  @objc public func setGoogleUserData(_ displayName: String, _ email: String, _ token: String) {
69
44
  print("[Native] setGoogleUserData in plugin")
70
- self.savedGoogleDisplayName = displayName
71
- self.savedGoogleEmail = email
72
- self.savedFirebaseToken = token
73
-
74
45
  for call in pendingGoogleCalls {
75
- call.resolve(["displayName": self.savedGoogleDisplayName, "email": self.savedGoogleEmail, "firebaseToken": self.savedFirebaseToken])
46
+ call.resolve(["displayName": displayName, "email": email, "firebaseToken": token])
76
47
  }
77
48
  pendingGoogleCalls.removeAll()
78
49
  }
@@ -87,28 +58,6 @@ public class CapacitorEventBirdPlugin: CAPPlugin, CAPBridgedPlugin {
87
58
  pendingFCMCalls.removeAll()
88
59
  }
89
60
 
90
- @objc public func setAuthToken(_ token: String) {
91
- print("[Native] Setting auth token in plugin")
92
- self.savedToken = token
93
-
94
- for call in pendingEchoCalls {
95
- call.resolve(["value": token])
96
- }
97
- pendingEchoCalls.removeAll()
98
- }
99
-
100
- @objc func logout(_ call: CAPPluginCall) {
101
- NotificationCenter.default.post(name: Notification.Name("NativeLogoutEvent"), object: nil)
102
- savedToken = nil
103
- pendingEchoCalls.removeAll()
104
- call.resolve()
105
- }
106
-
107
- @objc func signupWithGoogle(_ call: CAPPluginCall) {
108
- NotificationCenter.default.post(name: Notification.Name("CapacitorSignupWithGoogle"), object: nil)
109
- call.resolve()
110
- }
111
-
112
61
  @objc func openHelpModal(_ call: CAPPluginCall) {
113
62
  NotificationCenter.default.post(name: Notification.Name("HelpBeaconOpenEvent"), object: nil)
114
63
  call.resolve()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-event-bird",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
4
4
  "description": "returns events back to native env",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
package/dist/docs.json DELETED
@@ -1,107 +0,0 @@
1
- {
2
- "api": {
3
- "name": "CapacitorEventBirdPlugin",
4
- "slug": "capacitoreventbirdplugin",
5
- "docs": "",
6
- "tags": [],
7
- "methods": [
8
- {
9
- "name": "echo",
10
- "signature": "(options: { value: string; }) => Promise<{ value: string; }>",
11
- "parameters": [
12
- {
13
- "name": "options",
14
- "docs": "",
15
- "type": "{ value: string; }"
16
- }
17
- ],
18
- "returns": "Promise<{ value: string; }>",
19
- "tags": [],
20
- "docs": "",
21
- "complexTypes": [],
22
- "slug": "echo"
23
- },
24
- {
25
- "name": "logout",
26
- "signature": "() => Promise<void>",
27
- "parameters": [],
28
- "returns": "Promise<void>",
29
- "tags": [],
30
- "docs": "",
31
- "complexTypes": [],
32
- "slug": "logout"
33
- },
34
- {
35
- "name": "signupWithGoogle",
36
- "signature": "() => Promise<void>",
37
- "parameters": [],
38
- "returns": "Promise<void>",
39
- "tags": [],
40
- "docs": "",
41
- "complexTypes": [],
42
- "slug": "signupwithgoogle"
43
- },
44
- {
45
- "name": "waitlistAfterInit",
46
- "signature": "() => Promise<void>",
47
- "parameters": [],
48
- "returns": "Promise<void>",
49
- "tags": [],
50
- "docs": "",
51
- "complexTypes": [],
52
- "slug": "waitlistafterinit"
53
- },
54
- {
55
- "name": "openHelpModal",
56
- "signature": "() => Promise<void>",
57
- "parameters": [],
58
- "returns": "Promise<void>",
59
- "tags": [],
60
- "docs": "",
61
- "complexTypes": [],
62
- "slug": "openhelpmodal"
63
- },
64
- {
65
- "name": "getDeviceId",
66
- "signature": "() => Promise<{ value: string; }>",
67
- "parameters": [],
68
- "returns": "Promise<{ value: string; }>",
69
- "tags": [],
70
- "docs": "",
71
- "complexTypes": [],
72
- "slug": "getdeviceid"
73
- },
74
- {
75
- "name": "getGoogleData",
76
- "signature": "() => Promise<{ displayName: string; email: string; firebaseToken: string; }>",
77
- "parameters": [],
78
- "returns": "Promise<{ displayName: string; email: string; firebaseToken: string; }>",
79
- "tags": [],
80
- "docs": "",
81
- "complexTypes": [],
82
- "slug": "getgoogledata"
83
- },
84
- {
85
- "name": "getFCMToken",
86
- "signature": "(options: { value: string; }) => Promise<{ value: string; }>",
87
- "parameters": [
88
- {
89
- "name": "options",
90
- "docs": "",
91
- "type": "{ value: string; }"
92
- }
93
- ],
94
- "returns": "Promise<{ value: string; }>",
95
- "tags": [],
96
- "docs": "",
97
- "complexTypes": [],
98
- "slug": "getfcmtoken"
99
- }
100
- ],
101
- "properties": []
102
- },
103
- "interfaces": [],
104
- "enums": [],
105
- "typeAliases": [],
106
- "pluginConfigs": []
107
- }
@@ -1,24 +0,0 @@
1
- export interface CapacitorEventBirdPlugin {
2
- echo(options: {
3
- value: string;
4
- }): Promise<{
5
- value: string;
6
- }>;
7
- logout(): Promise<void>;
8
- signupWithGoogle(): Promise<void>;
9
- waitlistAfterInit(): Promise<void>;
10
- openHelpModal(): Promise<void>;
11
- getDeviceId(): Promise<{
12
- value: string;
13
- }>;
14
- getGoogleData(): Promise<{
15
- displayName: string;
16
- email: string;
17
- firebaseToken: string;
18
- }>;
19
- getFCMToken(options: {
20
- value: string;
21
- }): Promise<{
22
- value: string;
23
- }>;
24
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=definitions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export interface CapacitorEventBirdPlugin {\n echo(options: { value: string }): Promise<{ value: string }>;\n logout(): Promise<void>;\n signupWithGoogle(): Promise<void>;\n waitlistAfterInit(): Promise<void>;\n openHelpModal(): Promise<void>;\n getDeviceId(): Promise<{ value: string }>;\n getGoogleData(): Promise<{ displayName: string; email: string, firebaseToken: string }>;\n getFCMToken(options: { value: string }): Promise<{ value: string }>;\n}\n"]}
@@ -1,4 +0,0 @@
1
- import type { CapacitorEventBirdPlugin } from './definitions';
2
- declare const CapacitorEventBird: CapacitorEventBirdPlugin;
3
- export * from './definitions';
4
- export { CapacitorEventBird };
package/dist/esm/index.js DELETED
@@ -1,7 +0,0 @@
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
@@ -1 +0,0 @@
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"]}
package/dist/esm/web.d.ts DELETED
@@ -1,26 +0,0 @@
1
- import { WebPlugin } from '@capacitor/core';
2
- import type { CapacitorEventBirdPlugin } from './definitions';
3
- export declare class CapacitorEventBirdWeb extends WebPlugin implements CapacitorEventBirdPlugin {
4
- echo(options: {
5
- value: string;
6
- }): Promise<{
7
- value: string;
8
- }>;
9
- getFCMToken(options: {
10
- value: string;
11
- }): Promise<{
12
- value: string;
13
- }>;
14
- logout(): Promise<void>;
15
- signupWithGoogle(): Promise<void>;
16
- openHelpModal(): Promise<void>;
17
- waitlistAfterInit(): Promise<void>;
18
- getDeviceId(): Promise<{
19
- value: string;
20
- }>;
21
- getGoogleData(): Promise<{
22
- displayName: string;
23
- email: string;
24
- firebaseToken: string;
25
- }>;
26
- }
package/dist/esm/web.js DELETED
@@ -1,34 +0,0 @@
1
- import { WebPlugin } from '@capacitor/core';
2
- export class CapacitorEventBirdWeb extends WebPlugin {
3
- async echo(options) {
4
- console.log('ECHO', options);
5
- return options;
6
- }
7
- async getFCMToken(options) {
8
- console.log('getFCMToken', options);
9
- return options;
10
- }
11
- async logout() {
12
- console.log('logout in web isnt really needed it already works');
13
- }
14
- async signupWithGoogle() {
15
- console.log('signupWithGoogle in web isnt really needed it already works');
16
- }
17
- async openHelpModal() {
18
- console.log('openHelpModal in web isnt really needed it already works');
19
- }
20
- async waitlistAfterInit() {
21
- console.log('waitlistAfterInit in web isnt really needed it already works');
22
- }
23
- async getDeviceId() {
24
- return { value: 'ios device id is not needed for web' };
25
- }
26
- async getGoogleData() {
27
- return {
28
- displayName: '',
29
- email: '',
30
- firebaseToken: '',
31
- };
32
- }
33
- }
34
- //# sourceMappingURL=web.js.map
@@ -1 +0,0 @@
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,KAAK,CAAC,IAAI,CAAC,OAA0B;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IACjB,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,MAAM;QACV,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;IACnE,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,CAAC,GAAG,CAAC,6DAA6D,CAAC,CAAC;IAC7E,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;IAED,KAAK,CAAC,aAAa;QACjB,OAAO;YACL,WAAW,EAAE,EAAE;YACf,KAAK,EAAE,EAAE;YACT,aAAa,EAAE,EAAE;SAClB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type { CapacitorEventBirdPlugin } from './definitions';\n\nexport class CapacitorEventBirdWeb extends WebPlugin implements CapacitorEventBirdPlugin {\n async echo(options: { value: string }): Promise<{ value: string }> {\n console.log('ECHO', options);\n return options;\n }\n\n async getFCMToken(options: { value: string }): Promise<{ value: string }> {\n console.log('getFCMToken', options);\n return options;\n }\n\n async logout(): Promise<void> {\n console.log('logout in web isnt really needed it already works');\n }\n\n async signupWithGoogle(): Promise<void> {\n console.log('signupWithGoogle in web isnt really needed it already works');\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 async getGoogleData(): Promise<{ displayName: string; email: string; firebaseToken: string }> {\n return {\n displayName: '',\n email: '',\n firebaseToken: '',\n };\n }\n}\n"]}
@@ -1,8 +0,0 @@
1
- import Foundation
2
-
3
- @objc public class CapacitorEventBird: NSObject {
4
- @objc public func echo(_ value: String) -> String {
5
- print(value)
6
- return value
7
- }
8
- }