capacitor-event-bird 0.0.13 → 0.0.15

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 CHANGED
@@ -18,6 +18,7 @@ npx cap sync
18
18
  * [`waitlistAfterInit()`](#waitlistafterinit)
19
19
  * [`openHelpModal()`](#openhelpmodal)
20
20
  * [`getDeviceId()`](#getdeviceid)
21
+ * [`getFCMToken(...)`](#getfcmtoken)
21
22
 
22
23
  </docgen-index>
23
24
 
@@ -76,4 +77,19 @@ getDeviceId() => Promise<{ value: string; }>
76
77
 
77
78
  --------------------
78
79
 
80
+
81
+ ### getFCMToken(...)
82
+
83
+ ```typescript
84
+ getFCMToken(options: { value: string; }) => Promise<{ value: string; }>
85
+ ```
86
+
87
+ | Param | Type |
88
+ | ------------- | ------------------------------- |
89
+ | **`options`** | <code>{ value: string; }</code> |
90
+
91
+ **Returns:** <code>Promise&lt;{ value: string; }&gt;</code>
92
+
93
+ --------------------
94
+
79
95
  </docgen-api>
package/dist/docs.json CHANGED
@@ -60,6 +60,22 @@
60
60
  "docs": "",
61
61
  "complexTypes": [],
62
62
  "slug": "getdeviceid"
63
+ },
64
+ {
65
+ "name": "getFCMToken",
66
+ "signature": "(options: { value: string; }) => Promise<{ value: string; }>",
67
+ "parameters": [
68
+ {
69
+ "name": "options",
70
+ "docs": "",
71
+ "type": "{ value: string; }"
72
+ }
73
+ ],
74
+ "returns": "Promise<{ value: string; }>",
75
+ "tags": [],
76
+ "docs": "",
77
+ "complexTypes": [],
78
+ "slug": "getfcmtoken"
63
79
  }
64
80
  ],
65
81
  "properties": []
@@ -10,4 +10,9 @@ export interface CapacitorEventBirdPlugin {
10
10
  getDeviceId(): Promise<{
11
11
  value: string;
12
12
  }>;
13
+ getFCMToken(options: {
14
+ value: string;
15
+ }): Promise<{
16
+ value: string;
17
+ }>;
13
18
  }
@@ -1 +1 @@
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 waitlistAfterInit(): Promise<void>\n openHelpModal(): Promise<void>\n getDeviceId(): Promise<{ value: string }>;\n}\n"]}
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 waitlistAfterInit(): Promise<void>\n openHelpModal(): Promise<void>\n getDeviceId(): Promise<{ value: string }>;\n getFCMToken(options: { value: string }): Promise<{ value: string }>;\n}\n"]}
package/dist/esm/web.d.ts CHANGED
@@ -6,6 +6,11 @@ export declare class CapacitorEventBirdWeb extends WebPlugin implements Capacito
6
6
  }): Promise<{
7
7
  value: string;
8
8
  }>;
9
+ getFCMToken(options: {
10
+ value: string;
11
+ }): Promise<{
12
+ value: string;
13
+ }>;
9
14
  logout(): Promise<void>;
10
15
  openHelpModal(): Promise<void>;
11
16
  waitlistAfterInit(): Promise<void>;
package/dist/esm/web.js CHANGED
@@ -4,6 +4,10 @@ export class CapacitorEventBirdWeb extends WebPlugin {
4
4
  console.log('ECHO', options);
5
5
  return options;
6
6
  }
7
+ async getFCMToken(options) {
8
+ console.log('getFCMToken', options);
9
+ return options;
10
+ }
7
11
  async logout() {
8
12
  console.log('logout in web isnt really needed it already works');
9
13
  }
@@ -1 +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,KAAK,CAAC,IAAI,CAAC,OAA0B;QACnC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7B,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;IACnE,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 async echo(options: { value: string }): Promise<{ value: string }> {\n console.log('ECHO', 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 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"]}
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,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 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 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"]}
@@ -11,6 +11,10 @@ class CapacitorEventBirdWeb extends core.WebPlugin {
11
11
  console.log('ECHO', options);
12
12
  return options;
13
13
  }
14
+ async getFCMToken(options) {
15
+ console.log('getFCMToken', options);
16
+ return options;
17
+ }
14
18
  async logout() {
15
19
  console.log('logout in web isnt really needed it already works');
16
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorEventBird = registerPlugin('CapacitorEventBird', {\n web: () => import('./web').then((m) => new m.CapacitorEventBirdWeb()),\n});\nexport * from './definitions';\nexport { CapacitorEventBird };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorEventBirdWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async logout() {\n console.log('logout in web isnt really needed it already works');\n }\n async openHelpModal() {\n console.log('openHelpModal in web isnt really needed it already works');\n }\n async waitlistAfterInit() {\n console.log('waitlistAfterInit in web isnt really needed it already works');\n }\n async getDeviceId() {\n return { value: 'ios device id is not needed for web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,kBAAkB,GAAGA,mBAAc,CAAC,oBAAoB,EAAE;AAChE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,qBAAqB,EAAE,CAAC;AACzE,CAAC;;ACFM,MAAM,qBAAqB,SAASC,cAAS,CAAC;AACrD,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;AACpC,QAAQ,OAAO,OAAO;AACtB;AACA,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC;AACxE;AACA,IAAI,MAAM,aAAa,GAAG;AAC1B,QAAQ,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC;AAC/E;AACA,IAAI,MAAM,iBAAiB,GAAG;AAC9B,QAAQ,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC;AACnF;AACA,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,OAAO,EAAE,KAAK,EAAE,qCAAqC,EAAE;AAC/D;AACA;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorEventBird = registerPlugin('CapacitorEventBird', {\n web: () => import('./web').then((m) => new m.CapacitorEventBirdWeb()),\n});\nexport * from './definitions';\nexport { CapacitorEventBird };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorEventBirdWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async getFCMToken(options) {\n console.log('getFCMToken', options);\n return options;\n }\n async logout() {\n console.log('logout in web isnt really needed it already works');\n }\n async openHelpModal() {\n console.log('openHelpModal in web isnt really needed it already works');\n }\n async waitlistAfterInit() {\n console.log('waitlistAfterInit in web isnt really needed it already works');\n }\n async getDeviceId() {\n return { value: 'ios device id is not needed for web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,kBAAkB,GAAGA,mBAAc,CAAC,oBAAoB,EAAE;AAChE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,qBAAqB,EAAE,CAAC;AACzE,CAAC;;ACFM,MAAM,qBAAqB,SAASC,cAAS,CAAC;AACrD,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;AACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;AACpC,QAAQ,OAAO,OAAO;AACtB;AACA,IAAI,MAAM,WAAW,CAAC,OAAO,EAAE;AAC/B,QAAQ,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC;AAC3C,QAAQ,OAAO,OAAO;AACtB;AACA,IAAI,MAAM,MAAM,GAAG;AACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC;AACxE;AACA,IAAI,MAAM,aAAa,GAAG;AAC1B,QAAQ,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC;AAC/E;AACA,IAAI,MAAM,iBAAiB,GAAG;AAC9B,QAAQ,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC;AACnF;AACA,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,OAAO,EAAE,KAAK,EAAE,qCAAqC,EAAE;AAC/D;AACA;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -10,6 +10,10 @@ var capacitorCapacitorEventBird = (function (exports, core) {
10
10
  console.log('ECHO', options);
11
11
  return options;
12
12
  }
13
+ async getFCMToken(options) {
14
+ console.log('getFCMToken', options);
15
+ return options;
16
+ }
13
17
  async logout() {
14
18
  console.log('logout in web isnt really needed it already works');
15
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorEventBird = registerPlugin('CapacitorEventBird', {\n web: () => import('./web').then((m) => new m.CapacitorEventBirdWeb()),\n});\nexport * from './definitions';\nexport { CapacitorEventBird };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorEventBirdWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async logout() {\n console.log('logout in web isnt really needed it already works');\n }\n async openHelpModal() {\n console.log('openHelpModal in web isnt really needed it already works');\n }\n async waitlistAfterInit() {\n console.log('waitlistAfterInit in web isnt really needed it already works');\n }\n async getDeviceId() {\n return { value: 'ios device id is not needed for web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,kBAAkB,GAAGA,mBAAc,CAAC,oBAAoB,EAAE;IAChE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,qBAAqB,EAAE,CAAC;IACzE,CAAC;;ICFM,MAAM,qBAAqB,SAASC,cAAS,CAAC;IACrD,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IACpC,QAAQ,OAAO,OAAO;IACtB;IACA,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC;IACxE;IACA,IAAI,MAAM,aAAa,GAAG;IAC1B,QAAQ,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC;IAC/E;IACA,IAAI,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC;IACnF;IACA,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,OAAO,EAAE,KAAK,EAAE,qCAAqC,EAAE;IAC/D;IACA;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorEventBird = registerPlugin('CapacitorEventBird', {\n web: () => import('./web').then((m) => new m.CapacitorEventBirdWeb()),\n});\nexport * from './definitions';\nexport { CapacitorEventBird };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorEventBirdWeb extends WebPlugin {\n async echo(options) {\n console.log('ECHO', options);\n return options;\n }\n async getFCMToken(options) {\n console.log('getFCMToken', options);\n return options;\n }\n async logout() {\n console.log('logout in web isnt really needed it already works');\n }\n async openHelpModal() {\n console.log('openHelpModal in web isnt really needed it already works');\n }\n async waitlistAfterInit() {\n console.log('waitlistAfterInit in web isnt really needed it already works');\n }\n async getDeviceId() {\n return { value: 'ios device id is not needed for web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,kBAAkB,GAAGA,mBAAc,CAAC,oBAAoB,EAAE;IAChE,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,qBAAqB,EAAE,CAAC;IACzE,CAAC;;ICFM,MAAM,qBAAqB,SAASC,cAAS,CAAC;IACrD,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE;IACxB,QAAQ,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IACpC,QAAQ,OAAO,OAAO;IACtB;IACA,IAAI,MAAM,WAAW,CAAC,OAAO,EAAE;IAC/B,QAAQ,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC;IAC3C,QAAQ,OAAO,OAAO;IACtB;IACA,IAAI,MAAM,MAAM,GAAG;IACnB,QAAQ,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC;IACxE;IACA,IAAI,MAAM,aAAa,GAAG;IAC1B,QAAQ,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC;IAC/E;IACA,IAAI,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC;IACnF;IACA,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,OAAO,EAAE,KAAK,EAAE,qCAAqC,EAAE;IAC/D;IACA;;;;;;;;;;;;;;;"}
@@ -8,6 +8,7 @@ public class CapacitorEventBirdPlugin: CAPPlugin, CAPBridgedPlugin {
8
8
 
9
9
  public let pluginMethods: [CAPPluginMethod] = [
10
10
  CAPPluginMethod(name: "echo", returnType: CAPPluginReturnPromise),
11
+ CAPPluginMethod(name: "getFCMToken", returnType: CAPPluginReturnPromise),
11
12
  CAPPluginMethod(name: "logout", returnType: CAPPluginReturnPromise),
12
13
  CAPPluginMethod(name: "waitlistAfterInit", returnType: CAPPluginReturnPromise),
13
14
  CAPPluginMethod(name: "openHelpModal", returnType: CAPPluginReturnPromise),
@@ -15,7 +16,11 @@ public class CapacitorEventBirdPlugin: CAPPlugin, CAPBridgedPlugin {
15
16
  ]
16
17
 
17
18
  private var pendingEchoCalls: [CAPPluginCall] = []
19
+ private var pendingFCMCalls: [CAPPluginCall] = []
20
+
18
21
  private var savedToken: String?
22
+ private var savedFCMToken: String?
23
+
19
24
  private let implementation = CapacitorEventBird()
20
25
 
21
26
  @objc func echo(_ call: CAPPluginCall) {
@@ -28,16 +33,35 @@ public class CapacitorEventBirdPlugin: CAPPlugin, CAPBridgedPlugin {
28
33
  }
29
34
  }
30
35
 
36
+ @objc func getFCMToken(_ call: CAPPluginCall) {
37
+ if let token = savedFCMToken {
38
+ print("[Native] JS called getFCMToken, passing the token.")
39
+ call.resolve(["value": token])
40
+ } else {
41
+ print("[Native] JS called getFCMToken, but token not ready. Queuing callback.")
42
+ pendingFCMCalls.append(call)
43
+ }
44
+ }
45
+
31
46
  @objc func getDeviceId(_ call: CAPPluginCall) {
32
47
  call.resolve(["value": UIDevice.current.identifierForVendor?.uuidString])
33
48
  return
34
49
  }
35
50
 
51
+ @objc public func setFCMToken(_ token: String) {
52
+ print("[Native] Setting FCM token in plugin")
53
+ self.savedFCMToken = token
54
+
55
+ for call in pendingFCMCalls {
56
+ call.resolve(["value": token])
57
+ }
58
+ pendingFCMCalls.removeAll()
59
+ }
60
+
36
61
  @objc public func setAuthToken(_ token: String) {
37
62
  print("[Native] Setting auth token in plugin")
38
63
  self.savedToken = token
39
64
 
40
- // Resolve all pending echo calls
41
65
  for call in pendingEchoCalls {
42
66
  call.resolve(["value": token])
43
67
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-event-bird",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "returns events back to native env",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",